What an AI coding agent audit log should record, and how to trust it

· 5 min read · By the Sidefleet team

An AI coding agent audit log should let someone answer, months later, what an agent tried, who owned it, which rule decided, who approved it and what happened. It also has to show that nobody edited it since. Sidefleet keeps an append-only log in which each record carries the hash of the one before it, and it can check the whole chain on request.

Why do coding agents need their own audit trail?

Git already records what changed in the code. It doesn't record the psql an agent ran against a database, the push it was refused, or the person who said yes to a deploy at 11pm from their phone. Once agents run commands without someone watching, those decisions are the part an auditor or an incident review asks about, and shell history on a laptop doesn't survive that.

Auditors for frameworks such as SOC 2 and ISO 27001 usually ask for evidence that changes were approved by someone allowed to approve them. An agent that runs commands on its own is one more actor that evidence has to cover.

What should an AI agent audit log record?

Every record should answer the questions an investigation starts with. Sidefleet stores these on each record, as short sentences rather than codes:

The questions an audit record answers, and the field that holds each answer.
QuestionFieldExample
When, in what order?at, seqA timestamp to the microsecond, and a sequence number
Who acted?actor, actor_kindriley, admin. The kind is admin, member, agent, API key or system
What happened?event, whatpolicy.denied: the agent tried a push to main and was refused
Which agent, and whose?agent, ownerClaude Code on a build machine, owned by a named person
What was it allowed to do?permissions, policyThe policy that decided, such as Push to protected branches
Who approved it?approval, decided_byApproved once, by the agent's owner
How did it end?outcomeDenied, approved, expired, cancelled

The log covers the decisions, not every keystroke. That means agents registered, suspended and reactivated, policy and permission changes, a change of safety level, approval requests and their answers, denied actions, cancelled tasks, and agent keys issued or revoked. Allowed tool calls go to a separate Activity feed, with the policy that allowed each one.

How do you make an audit log tamper-evident?

A log anyone can quietly edit isn't evidence. Sidefleet uses two layers.

  • The database refuses changes. Triggers on the table reject every UPDATE, DELETE and TRUNCATE, so the application can only add records.
  • Each record is chained to the last. A record's hash is SHA-256 over its fields and the previous record's hash. Edit or delete one and every hash after it stops matching.

The Audit page checks the chain when it opens and shows Chain intact, or the sequence number of the first record that doesn't fit. The same check is GET /v1/audit/verify, which walks every record in your org from the first one and recomputes each hash.

Records also have no foreign keys, so deleting an agent or a policy leaves its history in place.

What can a hash chain not prove?

Tamper-evident is not tamper-proof. Someone with full control of the database could drop the triggers and rewrite the chain from the first record, and it would verify. The defence is to keep a copy of the chain's latest hash somewhere they can't reach. The verify call returns it as head. Write it to a ticket or a separate store each week, and a rewritten history no longer matches what you wrote down.

The log is also only as complete as what Sidefleet sees. Claude Code's tool calls are checked one by one through a PreToolUse hook. Codex and opencode are governed per task, so the log records their tasks being cancelled or their agent suspended, not each command. For what each safety level blocks or holds, see Sidefleet's guardrails. A command hidden inside a script can get past a policy, as the guide to unattended runs explains.

Does the log store secrets or code?

It stores a short summary of the command, after redaction. Anything that looks like a credential is replaced with [REDACTED] before it is stored. That covers API keys in the sk- style, GitHub and Slack tokens, AWS access key ids, Google API keys, JWTs, private key blocks, bearer tokens and password= or --token style arguments. The target is cut to 300 characters and the detail to 1,000.

Approvals work the same way. Each one stores a SHA-256 digest of the tool name and its redacted input, and only the call with that digest goes through. If the agent changes the command after you approved it, it has to ask again, and the log shows both requests.

How do you hand the log to an auditor?

Export it. The Audit page has Export CSV and Export JSONL buttons, and the API has GET /v1/audit/export?format=csv or jsonl, oldest first. Filter by text, event, agent and date range first if they only need one quarter or one incident.

Each exported row keeps prev_hash and hash, so a reviewer can recompute the chain without access to Sidefleet. Every member of an org can read the log. Only org owners change policies or suspend agents, and those changes land in the log under their name.

Where the log lives can matter as much as what's in it. On a self-hosted control plane it sits in your own Postgres, under your own backups and retention rules.

How do you start recording?

  1. Pick a safety level. Watch only records every Claude Code tool call and blocks nothing, so you get a trail from day one without slowing anyone down.
  2. Give each agent an owner, so every record names a person who answers for it.
  3. Turn on Balanced when the Watch only report looks right. Held commands then wait for an approval, and each answer is logged.
  4. Turn on phone notifications, so a held command gets an answer instead of expiring.
  5. Note the chain's head hash somewhere else on a schedule.

Questions

Does Sidefleet make us SOC 2 or ISO 27001 compliant?

No. Compliance covers far more than one tool. Sidefleet gives you records of what agents did and who approved it, in a form you can export and check, which is the evidence those audits ask for about agents.

Is Watch only enough for an audit trail?

It records every checked Claude Code call with what Balanced would have done, but nothing waits for approval, so there are no approvals to show. Use it to start, and turn on Balanced when you need sign-off on risky commands.

Can an agent write to its own audit log?

Only through Sidefleet. When the gateway refuses a call, the record names the agent as the actor. Neither the agent nor anyone using Sidefleet can edit or remove a record.

Put your machines to work

Sign in with GitHub and connect a machine. Free for 2 machines, and the agents and your repos stay on your machines.