Why should an agent's audit trail resist retroactive edits?
Why should an agent’s audit trail resist retroactive edits?
When an agent acts on a company’s behalf, is a list of yesterday’s actions enough to settle a disagreement today? A log can tell a story, but the person investigating also needs to know whether someone changed that story after the fact. Having records and having a defensible sequence of events are different things. The difference becomes particularly important when both employees and agents can affect the same work.
Imagine a procurement agent comparing offer documents. Later someone suspects a document went to the wrong place. This is a hypothetical workflow, not a customer incident or a claim that the product performs this task end to end. The team would want to find the identity behind the call, any policy decision at the time, and whether the evidence was altered later. A conventional database table might answer the first two questions if the right events were recorded. Merely querying that table cannot answer the last question.
Records need a way to contradict their own history
ADR-0006 in agentic-organization chooses a hash-linked audit trail. Each event refers to the preceding event’s hash, while its own hash covers its contents, sequence number and chain identity. The current code keeps a separate chain for each company, with a global chain for events not associated with a company. Verification recomputes the hashes in order. Change a recorded event or remove one from the middle, and that internal check can flag the break. It does not prevent a person with database access from attempting the edit. It provides a way to detect a class of edits.
Why not simply keep the ordinary application audit table? The decision record explains that its rows could be changed or removed and that the earlier logging covered too few of the actions under discussion. Restricting access still matters, but a privileged operator or a mistaken maintenance operation can alter data. A chain makes the resulting inconsistency observable. That choice has an operational price: writes have an order, so concurrent append operations must be coordinated. The implementation uses a transaction-scoped advisory lock for a chain on PostgreSQL; on SQLite it relies on an in-process lock and the database’s writer serialization for the single-process case. It would be unwise to assume the same behavior for every deployment topology.
There is a subtler problem. A chain can be internally consistent even after its last several events have been discarded and the remaining history rebuilt. A verifier looking only at the rewritten database has no earlier reference to compare against. audit_anchor.py addresses this by periodically recording the last sequence number and hash of each chain in a local append log. If a backup bucket has been configured, it also attempts to send that log to object storage. An anchor check can flag a live chain that is shorter than the saved reference or one whose hash at the anchored sequence changed. Anchoring does not make every possible rewrite detectable; it depends on the reference remaining independent and intact.
Those storage conditions are not fine print. The code puts the local anchor log under the application’s data directory; it is not automatically a protected off-site copy. Sending it to object storage is optional. If the bucket does not support Object Lock, the code falls back to an unlocked upload. Failures to write locally or upload are warnings rather than a universal halt. A team claiming immutable external evidence should therefore inspect the actual storage configuration and failure monitoring, not just the feature name. The distinction between an architectural mechanism and a verified operational guarantee matters most during an investigation.
Integrity cannot tell you which event matters
Even a perfectly checked sequence could hold too many events for someone to read. ADR-0013 tackles triage as a separate problem. When enabled, a scheduled scoring job selects events, asks a model to assess their significance and stores scores in a separate table. The original event chain is not rewritten to attach a later opinion. Higher scores can produce inbox and messaging alerts according to configuration. Scoring is delayed and may be wrong. It is neither proof of wrongdoing nor a real-time guardrail. A sound audit design should not conflate “was this event changed?” with “should an investigator look at it?”
Another distinction is whether the event accurately describes what happened at all. The chain attests to the integrity of events it has received. A workstation may report an action, and the server records that report, but a missing report is not reconstructed by hashing. The ingestion code attaches a client-origin marker to submitted events so a reader can distinguish client reports from server-observed activity. ADR-0006 explicitly warns that the intended fail-closed behavior is not yet a guarantee: the recording helper can swallow append failures, and checking that a gateway is reachable does not establish that every intervening event reached durable storage. It would be inaccurate to tell a team that unlogged execution is impossible today.
Each department has a different reason to care. Production may need a reliable sequence when diagnosing an interrupted workflow. Procurement needs to connect a document action to a responsible actor and an approval. Finance might review usage and cost events while keeping their integrity separate from the accuracy of the bill. HR has to ask whether an audit payload contains personal information: the decision record leaves retention and redaction as open questions. IT has to check whether anchor storage is independent, whether writes succeeded and what verification actually compares. A shared audit mechanism gives these questions a common reference; it does not resolve each team’s obligations automatically.
A practical start is to trace one workflow rather than promise that every event in the company is captured. Identify which observations the server produces and which the workstation reports. Check who can request chain verification, where the most recent anchor resides, how recently it was written and what a failed append does to the work in progress. Test internal verification and anchor comparison separately: they detect different kinds of loss. The earlier model gateway article asks which requests pass through a shared route. An audit design asks what can later be established about those requests.
An audit trail becomes useful when an organization can say precisely what its history supports and what it cannot prove. ADR-0006 and ADR-0013 in agentic-organization separate the integrity of the record from the later task of deciding what deserves attention. If your team asks who caused an action, it is worth asking how you know the record you are reading still reflects the one that was written.
Verification note: This article was checked against ADR-0006, ADR-0013, backend/services/audit_chain.py, backend/services/audit_anchor.py and the verification endpoint code in the agentic-organization repository. The limits on durability and storage are included rather than treated as completed guarantees.