Someone on r/AskNetsec asked how teams in regulated industries prove what an AI agent did, and noted that "IAM sees direct API calls, not what flows through orchestration." One reply put the problem in a line, "most audit infrastructure generates logs, not evidence."
I have been working on that gap, and this is where I landed.
Append-only storage and signed logs already exist, and they help. What I wanted was narrower, a record an outside auditor can check on their own machine, with code they can read before they run it.
So each step an agent takes becomes a receipt. The claim and each step are hashed with SHA3-256 as they are recorded, each hash links to the one before it, and the last one is signed with Ed25519. Change one byte of the claim or of any step and the check fails. Fields outside the seal, like the issue time, are not covered, and the checker does not pretend they are. The sealed time is the one inside each step.
The checker is a single Python file whose only outside dependency is the cryptography package. After that one install it runs offline.
pip install cryptography
curl -L -o verify_counterfoil.py https://www.matrixcr.ai/counterfoil/verify_counterfoil.py.txt
curl -L -o sample-receipt.json https://www.matrixcr.ai/counterfoil/sample-receipt.json
python3 verify_counterfoil.py sample-receipt.json
When this was written, the checker's SHA-256 was fb3ca325b7da3ceb3f8ef952f5a221c34d564a97996ba2fea6bb5acd1dea2a41, so you can confirm you ran the same file.
What a PASS shows is narrow, and I would rather say so. It means the claim and its steps have not changed since they were sealed, and were signed by our published key. By default the checker compares the full key, not only its short fingerprint, and you can point it at a different key with --expect-key. It does not mean the agent was right, or that the signer is honest.
The key is where this gets hard. If the signing key sits on the same machine as the agent, whoever controls that machine can sign a false record that checks out perfectly. Keeping the key somewhere the agent's operator cannot reach is the real work. The same goes for whatever records the steps, because a receipt seals what it was given, not what really happened. You still judge the key itself, by its full public key rather than its short fingerprint, through a channel you trust.
Two more things I have not solved. A trail has to be readable by a person, and a chain of hashes is not. And proving that privileged data did not shape another agent's output is harder than proving what was recorded. I am designing for that now, by tracing where each action's target came from.
If you run agents somewhere regulated, I would like to know one thing. When your auditor asks what the agent did, what do they accept today?
If this ground is already covered for you, that is a good answer too.