DEV Community

Srinivas Kondepudi
Srinivas Kondepudi

Posted on

Capture That Depends on Model Cooperation Isn't Evidence

Nivaya

AI agents write code, touch production, and make decisions nobody reviews in real time anymore. Most teams running them have started bolting on "audit logging" — a hook script, a webhook, a line appended to a file when the agent does something notable. Almost none of that logging would survive being questioned.

Here's the pattern, and why it's broken.

The common setup

A client (Claude Code, Codex, whatever) exposes lifecycle hooks — UserPromptSubmit, Stop, that kind of thing. You wire a script to one of them. When the hook fires, it writes a line to a log. This feels like an audit trail. It is not one, for a simple reason: the hook is just another thing the agent's runtime has to decide to run.

If the process crashes mid-write, gets SIGKILLed, the hook errors out, or someone just disables it, you get silence. And silence looks exactly like "nothing happened." A logging mechanism that fails the same way it succeeds — by producing nothing — isn't an audit trail. It's a best-effort diary that happens to be right most of the time.

Some clients make this worse by design. Several platforms' Stop hooks fail open: if the hook throws, the turn still completes normally for the user. So a crashed capture hook and a flawless, perfectly quiet turn are indistinguishable from the outside. You cannot tell "nothing worth logging happened" from "the thing that was supposed to log it died" just by looking at the output.

That's the actual problem. Not "we need more logging." We need logging that can't lie about its own gaps.

What evidence actually requires

Three properties, none of which "append a line on success" gives you:

  1. Tamper-evidence. You should be able to prove nothing was rewritten after the fact, not just trust that it wasn't.
  2. Honest absence. A gap in the record has to be visibly a gap — not silently indistinguishable from "all clear."
  3. Capture that doesn't depend on the thing being audited choosing to cooperate. If the subject of the audit controls whether the audit happens, it isn't an audit.

How we're building this in Chron

A few concrete design choices, mapped straight to the three properties above:

  • The journal is fail-stop, not fail-silent. A write that fails stops the writer outright — no silent retry, no dropped record papered over by the next successful one. If something's wrong, the journal stops talking rather than talking selectively.
  • Records are hash-chained, including across file rotations — a journal.continued record links the new segment back to the last record of the old one. You can verify the full chain, including that nothing was spliced out of the middle.
  • Capture sits at the process boundary — wrapping the actual client invocation — rather than trusting the model to self-report through its own tool calls. We just finished testing this against a real launcher (chron codex) that spawns the client as a genuine child process, with stdout/exit code/signal passed through byte-for-byte, while a side channel independently watches for hook receipts.
  • When a hook can't confirm its own write — we tested this directly, inducing a mid-session journal permission failure and then recovering — the system emits a capture-failure warning exactly once, and an explicit "status unknown" rather than defaulting to "recorded." Unknown is a first-class status, not an error we swallow.
  • We're careful with language in the UI and docs too: a delivery receipt says "the collector accepted the bytes," never "the evidence is stored." Those are different claims, and conflating them is exactly the kind of overclaim that gets audit logs disqualified later.

Where this stops being Chron's job

Chron answers "what happened." It deliberately doesn't answer "was that allowed." That second question — policy, authorization, whether an action should have been permitted in the first place — is a different problem with different failure modes, and we keep it out of Chron on purpose (that's where CLAIIM comes in, as the layer that reasons about authorization against a record Chron produced). An audit log that can't say "I don't know" is just vibes with timestamps. A policy engine that can't point to a tamper-evident record of what actually ran is enforcing against a blind spot. Neither substitutes for the other, and gluing them into one system tends to produce something that's bad at both jobs.

The actual point

The honest failure mode — a loud, explicit "unknown" — is more valuable than a confident, silent gap. If your agent's audit trail can't fail loudly, it was never an audit trail. It was a log that's usually right, which is a much weaker thing than anyone writing a postmortem is going to want it to be.

Top comments (0)