# Filter policy playground Build a forwarding policy, see its readable definition, and simulate how a repeater handles a packet. Rules match received packet facts, then apply actions such as dropping, scoping, rate-limiting, or retrying a flood. Everything runs locally in this browser. Channel keys, packet facts, and policy drafts are not uploaded anywhere.
Engine design preview

This page targets the new policy-engine idea, not today's FPF7 file or existing set flood.* commands. Its readable policy language, JSON, and Base64 bundle are a prototype for design testing. Current firmware cannot install these policies yet.

## Build a policy Start with an example or build a rule, then test the draft against packet facts in the simulator below. The examples draw from [Flood Filtering and Moderation](flood_filtering.md).
Remote login and direct routes

This policy only decides whether a relay retransmits a flood. Direct packets and local delivery are unaffected. Rules matching the login/admin family can still reduce multi-hop remote-login reach, so the analyzer flags them.

Example policies Choose one to load its full rules into the builder and draft.

Read each summary as when all conditions match, do the actions. A match alone does not stop forwarding. hops=3+ means the rule applies at a received hop count of three or more.

type=grp_data matches one payload type. type=any matches every payload. type=class:group matches group text and data; type=class:login matches REQ, RESPONSE, TXT_MSG, ANON_REQ, and PATH; type=class:other matches everything else.

channel=, rx.scope=, path=, and tempradio= further narrow a match. After do, drop prevents retransmission, scope= sets the outgoing transport scope, rate= limits matches per minute, and timing= selects the schedule.

Rule builder

Create a policy rule

Common match settings

Common actions

Choosing a phase-specific action automatically selects a compatible phase and ACL owner. Open the advanced section to inspect or override those choices.

Advanced execution, ownership, and flood route

Direct packets already carry a supplied path and are intentionally outside this engine. The route condition below only distinguishes unscoped floods from transport-scoped floods.

Readable policy definition

Policy draft

Rules in execution order

Rules match the same immutable packet facts. Ordering is phase, then descending priority, then stable rule ID. Drop decisions are sticky.

Add a rule or load an example to start exploring.

    Immutable packet simulator

    Explain an evaluation

    Read a raw MeshCore packet

    Paste an on-air packet as hexadecimal. The decoder follows the MeshCore wire format, displays its header, route, pbyte path, and clear payload envelope, then loads only facts actually present on the wire into the simulator.

    Runs locally

    Import and explain

    Paste readable policy or a saved draft

    Accepts one-line policy set ... when ... do ... definitions, playground JSON, or a playground Base64 bundle.

    Export

    Move or save this design

    Proposed human-readable definition. Current firmware does not accept it yet.

    ## Proposed evaluation contract The simulator uses these rules: 1. Only flood retransmission enters the policy. Direct routing and local packet delivery remain outside it. 2. Every matcher reads the same immutable receive-time packet facts. 3. Rules run by phase, descending priority, then stable rule ID. 4. A drop decision is sticky and cannot be undone by a later rule. 5. The first matching scope, timing, queue, and retry action in execution order wins. 6. All matching token-bucket rate constraints remain attached to the decision. 7. `stop=phase` skips later rules in that phase. `stop=policy` skips later configurable rules, but never mandatory packet validation or radio safety. 8. Shadow rules report what they would do without changing the decision or stopping other rules. 9. Expensive facts such as channel-key matching, decryption, and path-table lookup are resolved once per packet and reused by every matching rule. The byte-budget display is deliberately approximate until the packed firmware codec exists. It demonstrates why simple mappings should not reserve a maximum- sized structure for every possible condition and action.