# Tamper-evident audit logs for AI agents · Oxagen Research

Source: https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents

[Research](https://oxagen.sh/blog) · [AI agents](https://oxagen.sh/blog/pillars/ai-agents)

# 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.

Oxagen Research · November 30, 2026 · 8 min read

*   [AI agents](https://oxagen.sh/blog/pillars/ai-agents)
*   [Coding agents](https://oxagen.sh/blog/pillars/coding-agents)

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](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fn-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](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fn-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](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fn-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](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fn-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

1.  HookClaude Code fires a hook when a tool call ends.
2.  HashThe recorder hashes the frame with the hash of frame 411 inside it.
3.  TagThe recorder writes a keyed tag beside the hash.
4.  Machine lockOnce a minute the computer locks the chain with its own key.
5.  ArrivalOxagen checks that the frame links to frame 411.
6.  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 |

Each step after the hook adds a check that a later edit to frame 412 would fail.

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](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fn-5) Certificate Transparency uses the same shape, a Merkle tree, where each node is the hash of the two nodes below it.[6](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fn-6) Oxagen's run export carries both: the chain, and a Merkle root over every frame hash.

Proof that one event is in a log of 80 million events

|  | Value |
| --- | --- |
| Classic hash chain | 800 MB |
| Tree-shaped log | 3 KB |

Source: Crosby and Wallach (2009). The 800 MB chain figure is the authors' estimate. The 3 KB tree proof comes from their prototype on an 80 million event syslog trace.

## 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](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fn-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](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fn-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](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fn-7) Article 19 asks providers to keep those logs for at least six months, unless other law says otherwise.[8](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fn-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](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fn-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](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fn-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](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fn-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](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fn-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](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fn-12) The offline check is covered in [Evidence an auditor can check](https://oxagen.sh/blog/evidence-an-auditor-can-check). What a turn record should hold is in [Deterministic coding agents](https://oxagen.sh/blog/deterministic-coding-agents-every-turn-on-the-record).

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.

Ended runs with their final cost and pull request

## 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](https://oxagen.sh/blog/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.

A recorded run printed the way Cursor prints it

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.

Each file a run changed with its added and removed lines

What a passing check covers

A passing check shows that nothing changed after a lock. It does not show that every action was recorded, or that the work was right. A command typed in another terminal is not in the record. Steps taken while the recorder was down can be missing, and the record carries a `daemon_down` gap for each session that was running then.

Read the [coverage statement](https://docs.oxagen.sh/docs/security/record-coverage) before you rely on a record. Then export one run and check it yourself. [Runs](https://oxagen.sh/product/runs) lists every run and its record, [Oxagen for security teams](https://oxagen.sh/roles/security) shows who allowed each routed request, and the [MCP allowlist post](https://oxagen.sh/blog/mcp-allowlist-for-claude-code-codex-and-cursor) covers the rules that allow, deny, or route a tool call to a person.

## References

1.  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](https://www.schneier.com/wp-content/uploads/2016/02/paper-auditlogs.pdf) [↩](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fnref-1)
    
2.  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](https://csrc.nist.gov/pubs/sp/800/53/r5/upd1/final) [↩](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fnref-2)
    
3.  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](https://datatracker.ietf.org/doc/html/draft-sharif-agent-audit-trail-11) [↩](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fnref-3) [↩2](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fnref-3-2) [↩3](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fnref-3-3) [↩4](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fnref-3-4)
    
4.  Rundgren, A., Jordan, B., & Erdtman, S. (2020). _JSON Canonicalization Scheme (JCS)_. IETF RFC 8785. [https://www.rfc-editor.org/rfc/rfc8785](https://www.rfc-editor.org/rfc/rfc8785) [↩](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fnref-4)
    
5.  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](https://www.usenix.org/legacy/event/sec09/tech/full_papers/crosby.pdf) [↩](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fnref-5)
    
6.  Laurie, B., Messeri, E., & Stradling, R. (2021). _Certificate Transparency Version 2.0_. IETF RFC 9162. [https://www.rfc-editor.org/rfc/rfc9162](https://www.rfc-editor.org/rfc/rfc9162) [↩](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fnref-6)
    
7.  European Parliament and Council (2024). _Regulation (EU) 2024/1689 (Artificial Intelligence Act), Article 12: Record-keeping_. [https://artificialintelligenceact.eu/article/12/](https://artificialintelligenceact.eu/article/12/) [↩](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fnref-7)
    
8.  European Parliament and Council (2024). _Regulation (EU) 2024/1689 (Artificial Intelligence Act), Article 19: Automatically generated logs_. [https://artificialintelligenceact.eu/article/19/](https://artificialintelligenceact.eu/article/19/) [↩](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fnref-8)
    
9.  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](https://eur-lex.europa.eu/eli/reg/2026/1744/oj) [↩](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fnref-9)
    
10.  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/](https://artificialintelligenceact.eu/annex/3/) [↩](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fnref-10)
     
11.  Oxagen (2026). _Coverage statement_. Oxagen documentation. [https://docs.oxagen.sh/docs/security/record-coverage](https://docs.oxagen.sh/docs/security/record-coverage) [↩](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fnref-11)
     
12.  Oxagen (2026). _Export and verify a run_. Oxagen documentation. [https://docs.oxagen.sh/docs/security/export-and-verify](https://docs.oxagen.sh/docs/security/export-and-verify) [↩](https://oxagen.sh/blog/tamper-evident-audit-log-for-ai-agents#user-content-fnref-12)
