You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
backtest: run a rule over your own recent trail before you enable it #230
A rule turned on blind either floods triage or stays quiet for the wrong reason. Before enabling a YAML rule, or changing a threshold, an operator should be able to see what it would have fired on in their own recent history.
agentmetry benchmark already replays a recorded corpus through the real engine (core/audit/detection/benchmark.py, run_detections). Running the same engine over the operator's own trail, for a window they choose, is a small step from that.
Read the trail (all segments, as verify --trail does) for the last N days.
Group by session and run run_detections over each session, with the built-in rules plus any rules from --rules-dir.
Report per rule: sessions it would fire on, the count by severity, and the three most recent example sessions with their ids, so agentmetry replay <id> can show each one.
Mark which of those findings the live trail already holds, so the output separates "new under this rule" from "already fired".
Read-only. It writes nothing to the trail, the live store or the disposition store.
Constraints
No frozen file changes. It calls the engine. It does not modify rules.py, traits.py, engine.py, mitre.py or the detection manifest, so the ruleset fingerprint does not move.
Large trails: stream the file rather than load it. The maintainer's own trail is over 56,000 lines.
Done when
agentmetry backtest --days 30 runs against a real trail and prints the per-rule report.
Tests cover a rule that fires, a rule that does not, and a window that excludes an older session.
Activity
ci: run the suite on macOS, and put master back to green