Event format
One JSON line per event, in .mission/events/YYYY-MM-DD.jsonl, one file per local day. audit.js reads it.
Read the audit
Real output of the commands from the other pages (rule, cap, kill switch) on a scratch project:
shell
node .leashr/bin/audit.js --dir .output
time type decision rule tool target session agent mission
2026-11-23T22:44:42Z guard.denied deny deny-git-force-push Bash git push --force origin main s1 main
2026-11-23T22:44:42Z guard.asked ask ask-sudo Bash sudo ls s1 main
2026-11-23T22:44:43Z guard.allowed allow allow-read-only-shell Bash ls s1 main
2026-11-23T22:44:43Z cap.set main checkout-refactor
2026-11-23T22:44:43Z cap.kill_on main checkout-refactor
2026-11-23T22:44:43Z cap.denied deny kill_switch Bash ls s1 main checkout-refactorshell
node .leashr/bin/audit.js --dir . --summary
node .leashr/bin/audit.js --dir . --decision deny --since 24h --format jsonl
node .leashr/bin/audit.js --dir . --mission checkout-refactor --format csv > audit.csv- Filters:
--since/--until(ISO date,today,30m,24h,7d),--type guard,cap,--decision allow|defer|ask|deny,--rule,--mission,--session,--tool,--agent main|<name>,--limit N,--all. --summarycounts by type, decision, rule, mission, session and agent, joins the two hooks of each call ontool_use_id(strongest vote wins), and adds the estimated cost in scope, equal to thelsh-costreport.- Formats:
table,json,jsonl,csv(cells starting with=,+,-,@are prefixed so a spreadsheet does not run them). Read-only: it writes nothing. Exit 0 even with no match, 1 on a bad option.
Fields
Every event carries the common fields below. A decision event adds the second table.
| Field | Content |
|---|---|
ts | Time of the event (UTC). |
mission, slug | Mission the event belongs to (null if none). |
type | Event type, see below. |
model, effort, tier | Model fields, null on decision events. |
tokens_in, tokens_out, cost_usd_est | Tokens and estimated cost in USD, set by cost.request. |
source | What wrote the event: lsh-rules, lsh-cap, lsh-mission, otel... |
| Decision field | Content |
|---|---|
session, agent, agent_id, tool_use_id | Session, agent name (main in the main session, lsh:review in a sub-agent), sub-agent id, call id. |
tool, target | Tool name and command or path, secrets masked, cut at 300 characters. |
rule, decision, decided_by, reason | Rule id, allow, defer, ask or deny, what decided (rule, default, kill_switch, signal_missing...), reason text. |
hook, scope, mission_spent_usd, day_spent_usd | lsh-cap only: hook, cap scope, spend seen. |
duration_ms | Time taken by the hook. |
Types
| Type | Written by |
|---|---|
guard.allowed, guard.deferred, guard.asked, guard.denied | lsh-rules, before each tool call |
cap.deferred, cap.warned, cap.reached, cap.denied | lsh-cap, before each tool call and prompt |
cap.set, cap.kill_on, cap.kill_off | cap.js commands |
tool.failed | lsh-learn, after a failed tool call |
mission.started, mission.ended, mission.session | lsh-mission |
cost.request, cost.metric | lsh-cost collector (OpenTelemetry) |
Real example
A line written by the kill switch above (shortened, not invented):
jsonl
{"ts":"2026-11-23T22:44:43.636Z","type":"cap.denied","decision":"deny","rule":"kill_switch","decided_by":"kill_switch","tool":"Bash","target":"ls","session":"s1","agent":"main","mission":"checkout-refactor","hook":"PreToolUse","source":"lsh-cap","cost_usd_est":null}What is kept out
- Only a fixed list of fields is printed by
audit.js; any other field an event may carry stays out of every format. target,reasonanderrorgo through secret masking (bearer tokens,AuthorizationandCookieheaders,*TOKEN*=,*SECRET*=,sk-,ghp_,AKIA, URL credentials and similar). It is a pattern list: an unknown secret format can get through.- The prompt text is never written.
Limits
- The journal is written by the hooks: an agent without Leashr hooks writes nothing. See Limits by agent.
- A request that appears on two different days with the same request id is counted twice.
- The format is for local use. It has no version field and may still change before launch.
Status
| Function | Status | Proof |
|---|---|---|
| Journal, filters, summary, exports | Tested | skills/lsh-audit/test/audit.test.js |
| One event per decision | Tested | rules.js test (320) |
| Secret masking | Tested | skills/lsh-audit/test/audit.test.js |
Planned fields (branch, pr, cache_read, limit) | Planned | no code |