Tamper-evident audit logs for AI agents
A tamper-evident audit log for AI agents chains each record to the last by hash, so edits show. How it works, where it stops, and how Oxagen locks a run.
An agent ran a schema migration on staging at two in the morning. By nine, two records disagree. The transcript on the engineer's laptop says the agent ran the dry run first. The shell history says it went straight to the real one. Both are plain files, and any process running as that user can rewrite them, the agent included.
A tamper-evident audit log for AI agents gives each entry the hash of the entry before it. A hash is a short code made from the content, and any change to the content gives a different code. So a later edit, insert, or deletion breaks the chain from that point on, and the break shows when anyone checks. The log does not stop the edit, and it cannot add an action it never held.
A coding agent writes files all day as the same user that owns its logs. That changes what a log has to prove.
#Why agent logs need a hash chain
The problem is older than agents. In 1999, Schneier and Kelsey described a log kept on a machine an attacker might control. They aimed for detection, not prevention: "this is a system to detect such manipulations after the fact."1 NIST's control catalog asks for protection and, at its high baseline, for cryptographic integrity. Control AU-9 protects audit information from unauthorized modification and deletion. Enhancement AU-9(3) adds cryptographic mechanisms to protect its integrity.2
Coding agents make the old problem routine. Claude Code, Codex, Cursor, and Stella run shell commands and edit files as the user who started them. That user owns the transcript, the shell history, and most logs on the machine. An agent needs no bad intent to damage its own record. A cleanup step that deletes *.log is enough.
An individual Internet-Draft on agent audit trails, which the IETF has not adopted, names this gap in its first section. Current agent logs have "no tamper-evidence, allowing post-hoc modification of logs without detection."3
#How a hash chain makes an edit show
Each entry is a JSON object. Before hashing, the writer puts the JSON in one standard form, defined by RFC 8785. Two programs that read the same entry then produce the same bytes.4 The writer hashes those bytes with SHA-256 and stores the previous entry's hash inside the new entry. The first entry points at a fixed starting value.
To check the log, a reader recomputes every hash from the first entry forward. Change entry 411, and its hash no longer matches the one entry 412 carries. The check reports the position of each entry that stopped matching. Oxagen also locks its chains at set points. Locked means any change after this point shows.
How one frame reaches a locked run record in Oxagen
- HookClaude Code fires a hook when a tool call ends.
- HashThe recorder hashes the frame with the hash of frame 411 inside it.
- TagThe recorder writes a keyed tag beside the hash.
- Machine lockOnce a minute the computer locks the chain with its own key.
- ArrivalOxagen checks that the frame links to frame 411.
- Run lockThe run ends and Oxagen locks its record.
| Stage | Frame 412 after the stage |
|---|---|
| Hook | reported |
| Hash | hashed |
| Tag | tagged |
| Machine lock | locked on the machine |
| Arrival | checked |
| Run lock | locked |
A plain chain has a cost. To show that one entry is in a log, a reader may need every entry before it. Crosby and Wallach worked this out for a log of 80 million events. They estimated that a classic hash chain might need 800 MB to prove that one event is present. Their prototype, a tree-shaped log, returned a proof of about 3 KB.5 Certificate Transparency uses the same shape, a Merkle tree, where each node is the hash of the two nodes below it.6 Oxagen's run export carries both: the chain, and a Merkle root over every frame hash.
#What a hash chain leaves open
A hash uses no secret. Anyone who can rewrite entry 411 can also work out the hashes of 412 onward again, and the new chain checks out. The draft names two more holes. A bare chain "cannot, by itself, prove that records were not removed from the tail." And "tamper-evidence over records that were never emitted is indistinguishable from tamper-evidence over a complete trail."3
So designs add something outside the chain:
- A key the editor does not hold. A chain someone rebuilt then fails a keyed check.
- A copy kept somewhere else. A rewrite on one machine no longer matches the other copy.
- A close record and regular locks. A cut tail or a long silence shows.
- An outside timestamp. A reader learns when the chain's head existed, from a party other than the writer.
For consequential actions, such as payments, deletions, and production deploys, the draft sets a default trust level of L2 or above. At L2 and above, records "MUST be written by a component independent of the agent." That component locks records with its own key, distinct from the agent's, and runs under a different operating-system security principal.3 The draft treats a close record, regular heartbeats, and an outside anchor as recommended or optional.
#What an AI coding agent audit trail needs
The draft is an individual submission, revision 11 of November 2026, and the IETF has not adopted it. It still gives a detailed public checklist for an AI agent audit trail. The table sets its main requirements beside Oxagen's run record today.
| The draft asks for | Oxagen's run record today |
|---|---|
| Each record holds the SHA-256 hash of the previous record in RFC 8785 form | A matching rule: each frame holds the hash of the frame before it, taken in RFC 8785 form. The first frame holds the hash of empty text, where the draft uses null. |
| A recorder that is not the agent, under its own key and its own operating-system user, at L2 and above | The recorder and its local gateway run beside the harness, not inside it, and add a keyed tag to each hash. On a laptop they run as the same user as the agent. |
| A close record, so a cut tail shows | agent_stop closes a session. After 12 hours with no frame, Oxagen closes the run as unknown and marks its tail unobserved. |
| A heartbeat or lock schedule that limits silent gaps | The agent's computer locks each chain that has new frames every 60 seconds. |
| A chain head anchored to an RFC 3161 time authority, write-once storage, or a transparency log | A run export carries Oxagen's Ed25519 lock and no outside timestamp. Oxagen's time-window format with RFC 3161 tokens is a draft. |
| Known gaps stated in the record | The recorder writes a gap frame for what it knew it missed. The computer can add a gap and cannot remove one. |
Read the second row twice. On a laptop, the recorder's key files belong to the same user as the agent. An agent that set out to forge its record could reach them. The protection is the copy Oxagen holds. Oxagen checks that every frame it receives links to the one before it, so a later rewrite on the laptop no longer matches. A change made before a frame leaves the machine is the window that remains.
#EU AI Act logging for coding agents
Article 12 of the EU AI Act is short: "High-risk AI systems shall technically allow for the automatic recording of events (logs) over the lifetime of the system."7 Article 19 asks providers to keep those logs for at least six months, unless other law says otherwise.8 Regulation (EU) 2026/1744 moved the dates. The high-risk rules apply from 2 December 2027 for systems listed in Annex III, and from 2 August 2028 for AI in products under Annex I.9
The Act asks for logs. It does not name a format or a hash chain. It also applies to high-risk systems. Annex III lists uses such as hiring, credit scoring, and critical infrastructure.10 A coding agent is rarely one of those by itself, and whether a deployment counts is a question for counsel. The draft maps its fields to Article 12 as an informative guide, and says the mapping is not a compliance assessment.3
#How Oxagen locks a coding agent run
Oxagen records from beside the agent. The recorder receives the hooks that Claude Code, Codex, Cursor, and Stella fire, and records each step as a frame. A local gateway inside the recorder records model calls for Claude Code, Codex, and Stella. Cursor sends its model calls to its own servers, so they do not pass through the gateway.11
Each frame's hash is SHA-256 over the frame in RFC 8785 form, and each frame holds the hash of the frame before it. Beside each hash, the recorder writes a keyed tag. An edit that works the hash out again still fails the tag check, because only the recorder's key makes a matching tag. The export records whether the tags held. Every 60 seconds, the agent's computer locks each chain that has new frames, with an Ed25519 key that stays on that computer.
The run's record locks when the run ends, which happens when the agent stops or an operator ends the run from the app. A run silent for 12 hours closes as unknown with an unobserved tail. The next frame reopens it, and it cannot be exported until the agent's computer ends it. Only an organization Owner can export a locked run. The auditor checks the file with oxagen verify on a machine with no network, and reads HELD or BROKEN.12 The offline check is covered in Evidence an auditor can check. What a turn record should hold is in Deterministic coding agents.
A live run cannot be exported. The Runs page lists finished runs on its Ended tab.
The Runs page's Ended tab with illustrative data. 12,904 runs ended in 30 days, and each row shows the run's final cost, its work item, and the pull request it opened when it opened one.
#Coding agent run history and replay
The record also serves the people who work with the agent. The Run page plays a run back from its first step. The timeline splits it into turns, one for each prompt or steer a person sent. Reading a long agent run walks through the page.
A run's page with illustrative data, printed the way Cursor prints it. An agent credits a paid invoice once per Stripe webhook event, and the transcript shows each read, edit, and test run.
The diff view answers a second question: what did the run change? It lists each file with its added and removed lines, under the pull request's CI jobs.
The Run page's diff drawer with illustrative data, open on pull request #7188. Each changed file is folded open with its hunks, and a line counts the unchanged lines left out between them.
Read the coverage statement before you rely on a record. Then export one run and check it yourself. Runs lists every run and its record, Oxagen for security teams shows who allowed each routed request, and the MCP allowlist post covers the rules that allow, deny, or route a tool call to a person.
#References
-
Schneier, B., & Kelsey, J. (1999). Secure Audit Logs to Support Computer Forensics. ACM Transactions on Information and System Security, 2(2). https://www.schneier.com/wp-content/uploads/2016/02/paper-auditlogs.pdf ↩
-
Joint Task Force (2020). Security and Privacy Controls for Information Systems and Organizations. NIST Special Publication 800-53, Revision 5, control AU-9. https://csrc.nist.gov/pubs/sp/800/53/r5/upd1/final ↩
-
Sharif, R. (2026). Agent Audit Trail: A Standard Logging Format for Autonomous AI Systems. IETF Internet-Draft draft-sharif-agent-audit-trail-11, sections 1, 5.2, 5.3, 6.3, and 11. https://datatracker.ietf.org/doc/html/draft-sharif-agent-audit-trail-11 ↩ ↩2 ↩3 ↩4
-
Rundgren, A., Jordan, B., & Erdtman, S. (2020). JSON Canonicalization Scheme (JCS). IETF RFC 8785. https://www.rfc-editor.org/rfc/rfc8785 ↩
-
Crosby, S. A., & Wallach, D. S. (2009). Efficient Data Structures for Tamper-Evident Logging. 18th USENIX Security Symposium. https://www.usenix.org/legacy/event/sec09/tech/full_papers/crosby.pdf ↩
-
Laurie, B., Messeri, E., & Stradling, R. (2021). Certificate Transparency Version 2.0. IETF RFC 9162. https://www.rfc-editor.org/rfc/rfc9162 ↩
-
European Parliament and Council (2024). Regulation (EU) 2024/1689 (Artificial Intelligence Act), Article 12: Record-keeping. https://artificialintelligenceact.eu/article/12/ ↩
-
European Parliament and Council (2024). Regulation (EU) 2024/1689 (Artificial Intelligence Act), Article 19: Automatically generated logs. https://artificialintelligenceact.eu/article/19/ ↩
-
European Parliament and Council (2026). Regulation (EU) 2026/1744 amending Regulations (EU) 2024/1689, (EU) 2018/1139 and (EU) 2023/1230 as regards the simplification of the implementation of harmonised rules on artificial intelligence. Official Journal of the European Union, 24 July 2026. https://eur-lex.europa.eu/eli/reg/2026/1744/oj ↩
-
European Parliament and Council (2024). Regulation (EU) 2024/1689 (Artificial Intelligence Act), Annex III: High-risk AI systems referred to in Article 6(2). https://artificialintelligenceact.eu/annex/3/ ↩
-
Oxagen (2026). Coverage statement. Oxagen documentation. https://docs.oxagen.sh/docs/security/record-coverage ↩
-
Oxagen (2026). Export and verify a run. Oxagen documentation. https://docs.oxagen.sh/docs/security/export-and-verify ↩

