Offline Sigma single-event replay with a sealed detection-quality receipt.
keryn detection replay <input.json> | --rule <rule.yml> --observations <batch.json>... [--labels <file>] [--save-input <file>] [--receipt <file|->] [--export <file>] [--timeout <seconds>]Options
Section titled “Options”Usage: keryn detection replay <input.json> [--receipt <file|->] [--export <file>] [--timeout <seconds>] keryn detection replay --rule <rule.yml> --observations <batch.json>... [--labels <file>] [--save-input <file>] [...] keryn detection validate <input.json> <receipt.json | export.json> Offline replay of one Sigma single-event rule against supplied events (keryn-detection, profile sigma-replay-spike/0). The input is {rule, mapping: {id, observed}, events: [{id, event, label?}], source_complete?, cohort?}. The receipt records every event's verdict (match, no match, incomplete, refused; a no-match over an incomplete source is provisional) and precision and recall over the labelled events, each with its denominator, sealed by its own sha256. Aggregation, correlation and time windows are refused. --receipt <file|-> write the receipt (- prints it to stdout and the summary to stderr) --export <file> write the receipt as evidence: one item of a keryn-export/1 file, whose id is the sha256 of the receipt; validate takes that file in place of the receipt and refuses one changed since export --rule, --observations replay AI observation batches (keryn.dev/ai-observations/v1, what keryn ai-test saves) under the ai-observations-sigma/0 mapping: contract field names, application nested; a field the contract lacks (command lines, payloads, time) is incomplete; a batch not complete or with dropped events makes every no-match provisional. Event ids are run/case/trial/sequence. --labels <file> {"<event id>": "match" | "no_match"} for precision and recall --save-input <file> keep the composed replay input, which validate needs --timeout <s> stop the replay after this many seconds (default 60, at most 3600); it runs in a worker that is terminated validate re-runs the replay and compares: exit 0 valid, 1 not the receipt these inputs give, 2 unreadable. replay exits 0 when every event was decided, 3 when the rule was refused, an event was incomplete or refused, the source is declared incomplete, or the run was stopped (no receipt then). Nothing is collected or sent; a fixture cohort supports no production detection claim.Examples
Section titled “Examples”# Replay a labelled cohort and keep its receipt.keryn detection replay replay-input.json --receipt receipt.json
# Replay a rule over the AI observation batches keryn ai-test saved.keryn detection replay --rule outbound.yml --observations observations-0001.json --save-input input.json --receipt receipt.jsonExit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
| 0 | every event decided; receipt written |
| 2 | bad usage or an input the engine refuses to read |
| 3 | rule refused, an event incomplete or refused, the source declared incomplete, or the run stopped at –timeout (no receipt) |