An audit journal for what your coding agent was allowed to do
Record every allow, ask and deny decision of a coding agent in a local file, then read it back as a table. Real output, and the honest limit: the file is not tamper-proof.
Thomas Devulder · Published · Updated
When an agent works for an hour, you want to know afterwards what it tried and what it was allowed to do. Not a summary written by the agent, but a record written by the program that decided. That is an audit journal.
Leashr writes one line per decision into a local journal, inside the project. Each line has the time, the type of event, the decision, the rule that fired, the tool and its target, and the session, agent and mission it belongs to. This article shows the real journal of a short throwaway session, and says plainly what the journal cannot prove.
How a decision becomes a line
agent
proposes a call
hook
applies the rules
journal
one line per decision
audit
reads the lines back
A real session, read back
The session below ran a mix of calls through the real rules: a force push, a test run, a package publish and a few reads of secret files. The command that follows lists the most recent decisions as a table.
Read it from the left. The decision column says deny, allow, ask or defer. A deferred decision means no rule had an opinion and Claude Code's own permissions applied. The rule column names the rule that fired, so a surprise refusal can be traced to one line of one file.
deny
git push --force origin mainRule
deny-git-force-pushallow
npm testRule
allow-read-only-shellask
npm publishRule
ask-publishdeny
Read .envRule
deny-secret-files-toolsno opinion
Read .env.exampleNo rule matched
Why record deferred calls too
It is tempting to log only the refusals. The deferred lines matter just as much. The call that read an example environment file was deferred because no rule objects to it, and the journal shows that this was a choice of the rules and not a gap in the logging. When you tighten a rule later, the old journal tells you what it would have changed.
Filtering, summarising, exporting
The audit command reads the journal and can filter by mission, session, decision or rule, summarise, or export as JSON, JSONL or CSV. Secrets are masked in every output. The journal is a set of plain files, one per day, so you can also read it with the tools you already have.
node .leashr/bin/audit.js --limit 20What this journal cannot prove
The journal is a plain file without a hash chain. Anyone who can write to the project can edit it, so it is a record for you and your team, not evidence against a determined person. It also records calls that reached the hook. A call that the hook never saw leaves no line, which is why the next article, on what a hook cannot catch, matters.
Questions the journal answers in a minute
- Which rule refused the call that stopped my agent, and what did the rule say?
- Did the agent try anything I would have refused, even once, during the night?
- Which calls were left to Claude Code's own permissions because no rule had an opinion?
- Which mission did a session belong to, so that the decisions can be grouped with its cost?
The last question is why the mission appears on every line. A mission is a name you give to a piece of work before you start the agent. The decisions, the cost and the journal all carry it, so the same name joins the three views of one task. Without it you would be matching timestamps by eye.
A journal also changes how you write rules. A rule that fires too often shows up as a column of identical lines, and you can see at once whether to loosen it or to explain it to the team. A rule that never fires may be dead weight or may be waiting for the one day it matters. The file will not decide for you, but it gives you the evidence.
Keep it as what it is. A local, honest log of decisions beats a memory of what the agent probably did, and it costs nothing to read.
Try the rules on your own project
The code is public. Install from a clone, or as a Claude Code plugin, and read each skill with a replayed example.