Why AI agents need an audit trail for memory
When an agent gets something wrong, the first question is what it knew when it answered. Deterministic handles, replayable disclosures, version history and kept conflicts make that question answerable.

When an AI agent gets something wrong, the first question is simple: what did it know when it answered? With most memory setups nobody can say. The prompt was rebuilt on the fly from a transcript or a summary, and it is gone. StateJar keeps a record of every step after extraction, so that question has an exact answer: which facts, which version, which handle, sent to which model, when.
What is an audit trail for AI memory?
An audit trail for memory is a record you can check later of what an agent remembered and what it was shown. It needs four parts, and StateJar has all four:
- A name for each exact state. You cannot say what a model saw if the memory has no fixed identity.
- A log of every disclosure. Each time memory goes to a model, the log says which state and which fields.
- History that is never overwritten. Yesterday's value has to still exist to answer "what was it before?".
- Contradictions kept, not hidden. If a user said two different things, the record should show both.
Deterministic handles: a name for every state
Each version of a user's state is written out in one canonical form and hashed with SHA-256. The result, a string that starts with `shm_` followed by 64 hex characters, is the state's handle. It is a content address: the same facts give the same bytes and the same handle on any machine.
That makes a handle checkable. Restoring a handle re-derives the hash from the stored facts and refuses if it does not match, so a tampered or corrupted state cannot pass as the real one. Every read that feeds a model re-derives the handle first and answers with an error, writing nothing, if it does not match.
Replay what the model was told
Every disclosure is written to the audit log with the handle that was used and the fields that were sent. Each row carries a kind: a chat turn, a memory query, an audited query, a manual entry, or an extraction call. The audit log records which handle and which fields went out, never the user's message text.
Any audited disclosure can be replayed later. The replay rebuilds what the model was given from the handle and checks it, so "what did the agent know at 14:02 on Tuesday?" becomes a lookup, not a reconstruction.
Version history: what was true, and when
Updates never overwrite. A change writes a new version of the state that points back to the version before it, so history is append-only. If a user lived in Pune and then said they moved to Goa, the current state holds Goa, and the version before it still holds Pune, each with its own handle.
Removing a fact works the same way. "Forget the budget." removes the field from the current state as a new version; earlier versions keep it, so the history of what was known stays complete. Through StateJar's MCP server, the `history` tool lists the versions with what each one changed, and `verify` re-derives a handle from the stored state.
Conflicts kept, values refused with reasons
When two statements contradict each other, StateJar keeps the contradiction as a record instead of silently picking one. And when a value does not fit its field (a word where an amount should be, a fragment instead of an e-mail address), it is declined with a reason you can read, not guessed. A refusal is part of the record too.
Who needs this?
These are the kinds of products an audit trail for memory makes possible. They describe what the design allows, not named customers.
- Fintech and agents that handle money. An assistant that sets up a payment or quotes a limit should be able to show which amount it was given, from which version of the customer's facts, and when that version was written.
- Legal and compliance work. When an answer is questioned, the firm can replay the exact memory behind it instead of relying on a model's description of itself.
- Customer support. A support lead can see whether an agent used the address the customer gave last week or the one they corrected yesterday, and which version the reply came from.
- Multi-step agents. When several tools and models share one memory, the handle tells each step it is working from the same state, and the log shows who read what.
What it does not do
Extraction itself is probabilistic: a model helps read each message. The deterministic part is everything after it, which is why StateJar checks proposed facts strictly before storing them; How StateJar extracts facts with 96% precision explains those checks. For how StateJar's memory compares on a public benchmark, read Exact memory for AI agents.
Quick start
pip install statejar
statejar loginfrom statejar import StateJar
sj = StateJar(session_tag="user-42")
sj.ingest("I'm Meera from Pune and I prefer email.")
hit = sj.recall("How should I contact Meera?", audit=True) # audit=True writes the disclosure
print(hit["handle_used"]) # shm_…, a SHA-256 of the canonical stateThe full walkthrough is Add memory to your agent in 5 minutes; the reference is in the docs, and plans are on the pricing page.
Try free or Talk to us.
Frequently asked questions
What is an audit trail for AI agent memory?
A checkable record of what an agent remembered and what it was shown. In StateJar every state has a SHA-256 handle, every disclosure to a model is logged with that handle and the fields sent, history is append-only, and contradictions are kept.
Can I see exactly what my AI agent was told?
Yes. Every audited disclosure is written with the handle that was used and can be replayed later, which rebuilds what the model was given and checks it against the handle.
Does StateJar overwrite old facts?
No. A change writes a new version that points to the one before it. Removing a fact also writes a new version; earlier versions keep the value.
Does the audit log store my users' messages?
No. The audit log records which handle and which fields were disclosed, not the message text, and StateJar does not store full transcripts.