Skip to content
Leashr
Tested

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-refactor
shell
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.
  • --summary counts by type, decision, rule, mission, session and agent, joins the two hooks of each call on tool_use_id (strongest vote wins), and adds the estimated cost in scope, equal to the lsh-cost report.
  • 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.

FieldContent
tsTime of the event (UTC).
mission, slugMission the event belongs to (null if none).
typeEvent type, see below.
model, effort, tierModel fields, null on decision events.
tokens_in, tokens_out, cost_usd_estTokens and estimated cost in USD, set by cost.request.
sourceWhat wrote the event: lsh-rules, lsh-cap, lsh-mission, otel...
Decision fieldContent
session, agent, agent_id, tool_use_idSession, agent name (main in the main session, lsh:review in a sub-agent), sub-agent id, call id.
tool, targetTool name and command or path, secrets masked, cut at 300 characters.
rule, decision, decided_by, reasonRule id, allow, defer, ask or deny, what decided (rule, default, kill_switch, signal_missing...), reason text.
hook, scope, mission_spent_usd, day_spent_usdlsh-cap only: hook, cap scope, spend seen.
duration_msTime taken by the hook.

Types

TypeWritten by
guard.allowed, guard.deferred, guard.asked, guard.deniedlsh-rules, before each tool call
cap.deferred, cap.warned, cap.reached, cap.deniedlsh-cap, before each tool call and prompt
cap.set, cap.kill_on, cap.kill_offcap.js commands
tool.failedlsh-learn, after a failed tool call
mission.started, mission.ended, mission.sessionlsh-mission
cost.request, cost.metriclsh-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, reason and error go through secret masking (bearer tokens, Authorization and Cookie headers, *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

FunctionStatusProof
Journal, filters, summary, exportsTestedskills/lsh-audit/test/audit.test.js
One event per decisionTestedrules.js test (320)
Secret maskingTestedskills/lsh-audit/test/audit.test.js
Planned fields (branch, pr, cache_read, limit)Plannedno code