← Blog

Software Audit Trail: What It Has to Contain When an Agent Made the Change

Marco Masut

A software audit trail is a tamper-resistant record that lets someone who was not there reconstruct how a change reached production: what was asked, what was changed, what was checked, and who approved it. When an AI agent writes the change, the trail has to answer the same questions without relying on the agent's own account. In practice that means six elements: the original intent, the contract of the task, the diff, a verification run by the system rather than claimed by the model, the outcome, and a named person with a timestamp. The agent's session log is not on that list, because it is a narrative the agent produced about itself. A trail is judged by whether it still holds up when someone asks about the change six months later, from a different team, with no access to the people involved.

What is an audit trail for, and who asks for it?

Three readers ask for it, and they ask at different moments.

  • The client, when a delivered feature behaves differently from what was agreed and the question becomes who decided what.
  • The responsible person inside the software house, a delivery lead or a CTO, who has to answer for a change they did not write and did not read line by line.
  • A reviewer from outside: a customer's security team, an auditor, an insurer, a due diligence team during an acquisition.

None of them wants the story of the session. They want a record they can check against something they trust. The moment this matters is rarely the day of the change. It is the day after an incident, or the day a client disputes an invoice, when the people who remember the details are busy, gone, or were never involved.

This is also why the record has to be cheap to produce. A trail that depends on someone remembering to write it up will have holes exactly where the interesting changes are.

Why are session logs not an audit trail?

The session log of an agent, the transcript of prompts, tool calls and replies, looks like a record. It is useful for debugging. It fails as evidence for three reasons.

| Property | Session log | Audit trail | | --- | --- | --- | | Who wrote it | The agent, about itself | A system independent of the agent | | Can it be edited afterwards | Usually yes, it is a file or a chat | Not without leaving a visible break | | Does it contain a human decision | Only if someone typed one in | A named signature is part of the record | | Does it survive the session | Depends on the tool and its retention | Stored with the project, outside the session | | Does it say what was verified | It says what the agent said it verified | It stores the output of a check the agent did not run |

The practical test is simple: could the agent, or anyone with access to the machine, have rewritten this record after the fact without anyone noticing? If yes, it is a log, not a trail. Logs are valuable. They simply answer a different question.

What are the six things the record has to contain?

  1. The intent. The request in the words of whoever asked, linked to the ticket, the brief or the approved plan. Without it, a diff has no yardstick: you can see what changed but not whether it should have.
  2. The task contract. What the agent was allowed to touch, what it was forbidden to touch, and what evidence was required before the task could count as done. This is written before the work, and it is what makes the later checks mechanical.
  3. The diff. The exact change, tied to a commit, with the task it belongs to. One task, one commit makes the link readable by a person who was not there.
  4. The verification, with its output. Tests, linters, build, scope check. Stored with the result, the command that produced it and the time.
  5. The outcome. Passed, failed, retried, blocked, and why. Failures belong in the record too: a trail with only successes is a marketing document, and reviewers notice.
  6. The signature. Who approved the release, when, and on which version of the plan and the product. The name has to be a person, not a service account or the agent.

Notice what is absent: nothing in the list requires reading the agent's reasoning. The record is built from facts that exist independently of the model.

What is the difference between verification run by the system and verification claimed by the model?

An agent that says "all tests pass" is reporting. A runner that executes the test command itself and stores the exit code and the output is measuring. The two look identical in a chat window and are worth very different amounts in front of an auditor.

The mechanics are not exotic:

  • The verification command is declared in the task before the agent starts.
  • After the agent stops, the system runs that command, with its own timeout, in its own process.
  • The result is written to the record whatever the agent said.
  • A scope check compares the diff against the paths the task allowed, so a change outside the declared perimeter is caught by comparison and not by reading.

Hooks can help here: Claude Code hooks let a team run deterministic commands at defined moments instead of hoping the model remembers to. They are one way to produce evidence at the point of action, as long as what they write ends up somewhere the agent cannot rewrite. The same logic applies to supply chain records: an SBOM for AI-generated code describes what is inside, while the trail describes how it got there.

The METR randomised trial published on 10 July 2025 found experienced developers took 19% longer with AI tools while believing they were faster. Self-assessment, human or machine, is the weakest evidence available, which is the whole argument for measuring instead of asking.

How do you keep the trail cheap enough that the team keeps it?

A trail dies when it costs a person an hour per change. Three rules keep it alive.

First, generate it, do not write it. Every element above is a by-product of the flow: the contract is written at planning time, the diff and the verification come out of execution, the signature is one action at the end. If a person has to assemble the record by hand, they will skip it under deadline.

Second, store it with the project, in versioned files, not in a vendor's dashboard. A record that lives in the same repository as the code travels with the code, survives a change of tool and can be read years later with nothing but git.

Third, put the human step where it counts. A person who signs a release having seen the diff, the checks and the scope result is exercising judgement. A person who clicks approve on forty unread items is generating a signature, not a control. The design question is how to make the thing in front of the signer small enough to read, and the answer is usually smaller tasks with narrower contracts. The same reasoning is behind auto mode and the human signature: automation can prepare everything, but the signature has to stay a decision.

That is the principle Detent, the end-to-end delivery system, is built around: the system prepares the record, a person signs it, and nothing is released without that signature. For how tools compare on what they leave behind after the session ends, see the benchmark.