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
Postconditions
- Only compliant messages reach the destination
- Blocked messages are logged (optional)
Invariants
- Atomic Blocking: If Predicate(M) is False, M is NOT forwarded.
- Fail-Closed: If evaluation errors (e.g. timeout), default to BLOCK.
- Isolation: The protected agent state is not mutated by evaluation.
Risks
Failure modes
Incomplete Invariants
If the filter does not catch a specific edge case, bad data leaks through.
False Positives
Overly strict invariants blocking legitimate messages.
Latency
Complex predicate evaluation slowing down high-throughput streams.
Relationships
Builds on
Accepts
Nothing in this library builds on this pattern yet.
Reference
Parameters
action_on_failEnum, [DROP, REJECT, FLAG]- What happens when a message violates a predicate
