Confident handoffs hide small grounding bugs
A subagent finishes researching your repository and hands back a clean bulleted report citing line 48 of a file, quoting a function signature, and concluding there are no other callers anywhere in the codebase. Then you open the file and realize the agent never read it, or its search stopped after five matches inside one subfolder.
Those mistakes slip past a quick skim because the prose looks methodical. When a subagent passes an ungrounded summary back to a parent agent, the parent treats it as fact and starts editing code on top of a false premise.
I built handoff-verify to check every handoff claim against what the agent actually observed, using only Python's standard library and no extra model calls.
Why I did not use an LLM judge
My first instinct was to run a fast model as a reviewer on every subagent summary. I dropped that idea quickly because it burns extra tokens on every turn, adds seconds of wait time to stop hooks (callbacks that run when an agent finishes a turn), and still guesses when checking whether line 48 fell inside a partial read window.
All the ground truth is already sitting on disk. Claude Code and Codex CLI write every tool call and tool result into a local JSONL transcript, a plain text file with one JSON record per line, as the session runs.
Checking whether a final summary matches a local log is a parsing and lookup problem, not a reasoning problem. Plain code solves it in under a millisecond and gives the exact same answer every time.
Three deterministic checks against the transcript
handoff-verify detects Claude Code session logs, Codex CLI rollout logs, and a documented generic JSONL format automatically. It scans the tool history once to build an evidence index, extracts claims from the final assistant message, and runs three checks.
- File and line pointers: Checks whether each cited file was read, whether the cited line numbers fell inside the read window, and whether a later edit shifted those lines without a re-read. When you pass the repository path, it also checks whether the file exists on disk and whether the line number is still in bounds.
- Verbatim code quotes: Checks inline and fenced code snippets against every file read, file edit, search hit, and shell output the agent saw. It normalizes minor whitespace and operator formatting so harmless formatting differences do not trip false alarms, and flags snippets attributed to the wrong file.
- Absence and completeness claims: Whenever the summary says there are no other callers, no remaining references, or that all pages were reviewed, the verifier builds a scope receipt from actual searches and paginated tool calls. It catches missing searches, result-limit truncations, subdirectory-only searches passed off as repo-wide, and unread pagination cursors.
Each failure returns one of twelve finding codes, the exact evidence from the transcript, and a concrete next step telling the agent which lines to read or which search to re-run.
What broke when I tested 1,571 real sessions
On the bundled 32-case seeded regression suite (16 clean sessions and 16 planted failures across Claude Code, Codex CLI, and generic logs), handoff-verify hits 100% precision and 100% recall with a 0.60 ms median runtime. On synthetic scaling tests, it processes a 1.14 MB transcript in 12.7 ms and a 5.76 MB transcript in 60.8 ms, roughly 95 MB/s.
Real developer sessions are much messier than hand-built fixtures, so I ran the verifier over 1,571 actual Claude Code transcripts from my own machine (972 main sessions and 599 subagents). The first pass flagged 512 of them (32.6%), and a lot of those flags were false alarms.
Digging through those false alarms taught me more than writing the initial parser. Agents frequently inspect files through shell commands, redirect command output to a temporary log file and read it back, rely on grep context lines next to a match, or relay a subagent's citations under a shorter path spelling.
They also write normal English sentences that look like absence claims to a naive pattern match, such as saying a file does not exist, or reporting no open pull requests, no warnings, or no changes.
Fixing shell-read tracking and scratch-copy handling cut the flag rate from 32.6% down to 21.8% (343 of 1,571). Follow-up fixes addressed the five remaining false-alarm classes I saw in that set (redirected log readbacks, grep context lines, parent-subagent path relays, negated mentions, and non-code absence phrases), though I have not re-measured the full 1,571-session corpus since those later patches.
Claude Code hook edge cases and known limits
Wiring a verifier into Claude Code's Stop and SubagentStop hooks surfaced three practical details that matter in daily use.
First, SubagentStop reads only the subagent's own transcript path and never falls back to the parent session transcript, so a subagent is never blamed for something the parent wrote.
Second, Claude Code sometimes fires the stop hook before the final assistant message finishes flushing to disk. The hook compares the file against the last assistant message in the hook payload, waits up to one second for disk to catch up, and otherwise checks the payload text directly against the tool evidence already logged.
Third, the hook respects Claude Code's active-stop-hook flag so it can never trap an agent in an infinite retry loop. Clean passes print nothing at all.
handoff-verify checks whether claims are backed by the transcript, not whether the code is right or tests pass. If an agent inspects a file through a custom inline Python script that slices lines dynamically, the verifier cannot always map that back to exact line numbers. Treat a finding as 'the transcript does not show this' and start in advise mode before turning on block mode.
Check your last session in ten seconds
You can audit the most recent Claude Code transcript in your current repository without installing anything globally:
uvx handoff-verify check --latestIf you want automatic checks on every Stop and SubagentStop event in advise mode, install the tool and merge the hook config into your project settings:
uv tool install handoff-verify
handoff-verify init --write
handoff-verify doctorFull documentation, Codex CLI rollout instructions, and the Claude Code plugin setup are in the GitHub repository.