Expand description
Rules store with immune-system lifecycle and TTL decay.
Rules are learned from post-mortem analysis and enforced via hooks. Each rule follows an immune-system lifecycle:
Proposed -> Active -> Dormant -> Settled -> Dead | Superseded –+
Three decay mechanisms:
- Time decay: TTL (default 30 days), reset on each trigger hit
- Anchor decay: Rule anchored to file; file changes -> stale
- Contradiction detection: Same trigger, different action -> supersede
Structs§
- Rule
- A learned rule with TTL decay.
- Rules
Store - The rules store: manages rules.json persistence and lifecycle.
- Store
Stats - Summary statistics for the rules store.
Enums§
- Rule
Category - What kind of rule this is — determines enforcement mechanism.
- Rule
Status - Rule lifecycle status (immune system model).
Constants§
- DISALLOWED_
TRIGGER_ WORDS - Shell builtins, keywords, and ubiquitous utilities whose failures are environmental noise rather than a missing-tool signal. They must never become learned-rule command triggers (GH-813: echo 1789 / cd 1618 hits).
Functions§
- command_
word - Quote-aware command word of a command segment.
- is_
disallowed_ trigger - True when a stored rule trigger is disallowed and should be reclaimed by
the decay cycle. ONLY
command_failure:triggers can be disallowed command triggers:file_churn:<path>(paths may contain=),multi_agent_start, and free-text triggers are never revoked by the decay cycle (GH-813). - is_
trackable_ command - True when a command may become a learned-rule command trigger.
- is_
var_ assignment - True when a bare token is a variable assignment:
NAME=valueor the bash append formNAME+=value. The name before=/+=must be a valid shell identifier (ASCII alpha/underscore, then ASCII alphanum or underscore). - split_
command_ segments - Split a shell command into segments on
;,&,|, and newline.