Stage 1 of plans/2026-10-01-filter-regex-alternation.md: a new fork-owned
wrapper, PatternMatch.h/.cpp, owns the user-facing pattern language and adds
top-level '|' alternation to sender=/text=:
filter add sender=^Alice$|^Bob$
The vendored TinyRegex engine is untouched — it keeps its three documented
modifications, and syntax is added one layer up, in the wrapper. The pattern
is stored as text exactly as before, so there is no persistence change, no
FILTER_CFG_VERSION bump and no static_assert change.
Wrapper behaviour:
- top-level '|' splits the pattern; each alternative is compiled and matched
in order, first match wins, so anchors bind per alternative (^Alice|Bob$
is "(^Alice)|(Bob$)"). '\|' and '[|]' stay literal pipes;
- empty alternatives ("A|", "|A", "A||B") are rejected — an empty branch
matches everything;
- at most FILTER_PATTERN_MAX_ALTS (8, new build-flag-overridable tunable in
PacketFilterConfig.h) alternatives per pattern;
- evaluation stops at the first alternative that exhausts the engine step
budget, fail-open, counted once in budget_aborts as before.
Groups stay unsupported and parentheses keep today's literal behavior, so
"^(Alice|Bob)$" is accepted and matches a sender literally named "(Alice|Bob)"
— documented as the trap it is, in FILTER.md.
Compatibility: one intentional reinterpretation. A stored pattern containing
an unescaped '|' previously matched a literal pipe and now means OR; write
'\|' for a literal pipe. Noted in FILTER.md and in this subject line, which
is what the release body's filter-changes section lists.
Reply strings: existing ones stay byte-identical ("Err - bad/long sender
regex" / "Err - bad/long text regex" remain the fallback for engine-level
rejections); only newly rejected patterns gain strings — "Err - empty
alternative in regex" and "Err - too many alternatives (max 8)".
Verified: pio test -e native_packet_filter 213 cases pass (196 pre-existing,
unchanged, plus 17 new covering alternation, per-branch anchors, escapes,
structural rejections, budget interaction, CLI round-trip and checkContent
rules); pio test -e native_battery_gate 29 pass. Firmware compile check
pio run -e Xiao_S3_WIO_repeater: +712 B flash, +8 B RAM, no new static RAM
in the filter itself (48 B of stack during evaluation).
FILTER.md documents the syntax, the per-branch anchor footgun, the cap, the
pattern-length pressure and the compat break; AGENTS.md gains the amendments
approved in the plan (fork-owned file set, code map, hard invariant #5,
backwards-compat rule, test counts).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
MeshCore — Repeater Firmware with a Remote-Configurable Packet Filter
This is a feature fork of MeshCore. It tracks upstream automatically (synced weekly) and adds two repeater-focused capabilities on top of stock firmware. Everything else — supported boards, clients, protocols, build system — is identical to upstream; see the upstream README for the general project, hardware support, and getting-started guide.
What this fork adds
📡 Packet filter
A remote-configurable drop-rule engine for the simple_repeater firmware.
Rules match on packet type, route type, region, hop count, channel, and —
on decrypted payloads — channel identity and sender/text patterns. Rules are
managed over the repeater CLI, locally via serial or remotely over the mesh
by an authenticated admin. No rebuild, no physical access.
Independently of the rules, flood-route adverts can be rate-limited per originating node: each node's advert is forwarded at most once per window (up to 30 days), taming advert storms on busy channels while every node stays discoverable.
→ Full guide, including the complete predicate reference and CLI commands: FILTER.md
🔋 Battery gate
A configurable low-battery cut-off: below a set voltage the repeater stops forwarding (but stays reachable and keeps advertising); when the battery recovers it resumes automatically. Debounce + hysteresis keep it from flapping, and the admin can check voltage and tune thresholds over the mesh.
→ Full guide: BATTERY.md
Why run this instead of stock repeater firmware?
Stock repeaters forward everything they hear, until the battery dies. This fork is for operators who want policy and resilience at the node:
- Shared / community nodes — mute noisy senders or channels that eat your airtime, without asking anyone to change their setup.
- OpenHop-style policy, nothing extra to run — the rule engine is modelled after the policy filters in OpenHop and lives entirely in the repeater firmware, so you get about the same functionality with just the node itself — no computer, companion app, or other hardware needed.
- Solar / off-grid sites — the node goes quiet while it can still answer you, instead of disappearing dark, and wakes itself when there's sun again.
Getting the firmware
Prebuilt binaries for all supported boards are on the Releases page. Two channels:
| Channel | Branch | Based on | Tags |
|---|---|---|---|
| dev | repeater-filter |
upstream dev (merged weekly by CI) |
filter-v*-dev.N |
| stable | repeater-filter-stable |
upstream main releases |
filter-v* |
Flash as you would stock firmware, then follow FILTER.md to set your first rules over the CLI.