Society · Protocols

InvariantFilter

Rule-based message filtering

Definition

Mechanism

A strict communication firewall that intercepts Messages (incoming or outgoing) and evaluates them against an explicit set of RuleSet (Invariants). If a Message satisfies all predicates, it is permitted to pass. If it fails even one, it is blocked, dropped, or flagged for review. This enforces 'Contractual Safety' on the communication channel. It inspects every Message via a rigorous Check against defined predicates before allowing transit.

Preconditions

  1. A defined Invariant Set (Predicates)
  2. A Message or Stream to evaluate

Postconditions

  1. Only compliant messages reach the destination
  2. Blocked messages are logged (optional)

Invariants

  1. Atomic Blocking: If Predicate(M) is False, M is NOT forwarded.
  2. Fail-Closed: If evaluation errors (e.g. timeout), default to BLOCK.
  3. Isolation: The protected agent state is not mutated by evaluation.

Risks

Failure modes

  1. Incomplete Invariants

    If the filter does not catch a specific edge case, bad data leaks through.

  2. False Positives

    Overly strict invariants blocking legitimate messages.

  3. Latency

    Complex predicate evaluation slowing down high-throughput streams.

Relationships

Builds on

Accepts

Infrastructure

Message

Structured signal container

Infrastructure

RuleSet

Immutable collection of constraints

References

Infrastructure

Check

Side-effect-free observational verification yielding Verified/Falsified/Unknown

Infrastructure

Stream

Continuous data flow

Nothing in this library builds on this pattern yet.

Reference

Parameters

action_on_fail Enum, [DROP, REJECT, FLAG]
What happens when a message violates a predicate

Identity

Ref
InvariantFilter#212b
Sema ID
sema:InvariantFilter#mh:SHA-256:212b8b7a75ea69b22561e19191aa5cb630aaf75f4e4229e03db798338ab00a8e
Ring
1
Tier
1
Updated
2026-11-11
Supersedes
  • sema:InvariantFilter#mh:SHA-256:a541049098acbba01ebe35ee9c23ebbdaf9d34e252b1b69f97daa87b3e96eea2
  • sema:InvariantFilter#mh:SHA-256:cc3794d06d91be2bd2371c18fcdddc379e5001aa4864f6f3fea1fb3b037bd2b2
  • sema:InvariantFilter#mh:SHA-256:5e4da90216dd412c9acc3258da818ffe31965d54ba79cbd966a193563e9c2329