handoff-verify
Deterministic, zero-LLM claim & scope verification for AI coding agents and subagents.
AI coding agents and subagents frequently hand back confident reports containing subtle ungrounded claims: citing path:line pointers they never read (or read before a line-shifting edit), altering quoted code snippets, or claiming "no other callers anywhere in the codebase" after a truncated or subdirectory-scoped grep — or "reviewed all pages" while leaving a pagination cursor unread.
handoff-verify parses an agent's tool-call transcript and deterministically checks every claim in its final handoff against what the agent actually observed:
- File pointers (
path:line,path:start-end,#L10-L20): Was the file actually read? Were the cited lines inside the read window (offset/limit)? Was the file edited afterward without re-reading (or changed on disk when--repois supplied)? - Verbatim quotes (inline & fenced): Does the quoted snippet actually appear in what the agent read, wrote, or observed in command output (exact or whitespace/operator-normalized)?
- Absence & completeness scope receipts: When an agent claims "no other callers", "no matches", "not used anywhere", or "reviewed all pages", did it actually run an untruncated search across the claimed scope, and were all pagination cursors followed?
Zero LLM calls. Zero third-party runtime dependencies (Python 3.11+ stdlib only). Fast linear-time verification (sub-millisecond on small transcripts; tens of milliseconds on multi-megabyte transcripts). Quiet when clean, loud on anomalies.
Installation
Requires Python >=3.11. No runtime dependencies.
As a Claude Code plugin (bundled hooks + skill)
claude plugin marketplace add 1solomonwakhungu/handoff-verify
claude plugin install handoff-verify@handoff-verify
Or test locally from a clone without installing:
claude --plugin-dir /path/to/handoff-verify
The plugin bundles Stop and SubagentStop hooks (hooks/hooks.json), a standalone bin/handoff-verify launcher (uses system Python 3.11+ or uv-managed Python against the bundled src/), and skills/handoff-verify/SKILL.md.
From source (works today)
git clone https://github.com/1solomonwakhungu/handoff-verify.git
cd handoff-verify
uv tool install . # puts `handoff-verify` on your PATH
handoff-verify --version
handoff-verify doctor # verify PATH, Python >= 3.11, and Claude hook config
To try it without installing, run uvx --from . handoff-verify --version inside the clone.
From PyPI (after the first release)
handoff-verify is not on PyPI yet, so these fail until it is published:
uvx handoff-verify --version
uv tool install handoff-verify
pip install handoff-verify
60-Second Quickstart
Check the Claude Code session you just ran, from the project directory:
handoff-verify check --latest
--latest picks the newest transcript for the current directory. To check a specific one,
pass its path. Transcripts live here:
| Harness | Transcript location |
|---|---|
| Claude Code | ~/.claude/projects/<cwd-with-dashes>/<session-id>.jsonl |
| Claude Code subagent | ~/.claude/projects/<cwd-with-dashes>/<session-id>/subagents/agent-<id>.jsonl |
| Codex CLI | ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl |
Inspect what a transcript actually read, edited, searched, truncated, or left unread:
handoff-verify inspect session.jsonl
handoff-verify inspect session.jsonl --json
Verify claims in a transcript (pass - to read from stdin):
# Compact plain-text receipt (exit 0 on pass, exit 1 on findings, exit 2 on usage/parse error)
handoff-verify check session.jsonl
# Stay completely silent when clean
handoff-verify check session.jsonl --quiet-on-pass
# Also cross-check cited files and line counts against the live repository on disk
handoff-verify check session.jsonl --repo /path/to/repo
# Treat warnings (e.g. non-trivial excluded search dirs) as failures
handoff-verify check session.jsonl --strict
# Render actionable Markdown (great for parent agents / PR comments) or machine-readable JSON
handoff-verify check session.jsonl --format markdown
handoff-verify check session.jsonl --json # same as --format json
Every subcommand's --help ends with examples and the exit codes.
Run the bundled 32-case evaluation suite (24 seeded cases + 8 realistic messy-session cases, shipped in both source checkouts and built wheels; pass --cases-dir <path> to run a custom local suite):
# Exit 0 when all targets pass, exit 1 if targets are missed, exit 2 on missing/invalid manifest
handoff-verify eval
handoff-verify eval --verbose
handoff-verify eval --strict
handoff-verify eval --format markdown
handoff-verify eval --format json
handoff-verify eval --cases-dir ./custom-evals
Verify your local setup (PATH, Python version, and .claude/settings.json hook config):
handoff-verify doctor
handoff-verify doctor --json
Claude Code Hook Integration
Wire handoff-verify into Claude Code's SubagentStop and Stop lifecycle hooks so ungrounded subagent or main-agent handoffs are caught automatically.
Print or install .claude/settings.json
# Preview the hook configuration JSON
handoff-verify init
# Safely create or merge into .claude/settings.json (preserves existing hooks and keys)
handoff-verify init --write
# Use block mode (exit 2 on findings) or a custom wrapper command (e.g. uvx)
handoff-verify init --write --mode block
handoff-verify init --write --command "uvx handoff-verify"
# Install for every project instead of this one
handoff-verify init --write --settings ~/.claude/settings.json
init --write warns if the hook command is not on your PATH, because Claude Code would then
report "command not found" on every stop. Start with the default advise mode; see
How it behaves on real sessions before choosing block.
Generated configuration (handoff-verify init):
{
"hooks": {
"SubagentStop": [
{
"hooks": [
{
"type": "command",
"command": "handoff-verify hook claude-code --mode advise"
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "handoff-verify hook claude-code --mode advise"
}
]
}
]
}
}
Hook modes & safety guarantees
SubagentStopvsStopisolation: OnSubagentStop,handoff-verifystrictly readsagent_transcript_path(never falling back to the parent session'stranscript_path). OnStop, it readstranscript_path.- Verifies the message Claude Code is about to hand back: Claude Code can fire
Stop/SubagentStopbefore the final assistant message is written to the transcript file. The hook compares the transcript with the payload'slast_assistant_message, waits up to one second for the file to catch up, and otherwise verifies the payload text against the tool evidence already on disk. - Quiet when clean and on warning-only reports: When verification passes with zero findings — or with warning-only findings (unless
--include-warningsor--strictis passed) — the hook exits0with empty stdout and stderr. --mode advise(default): On error-level findings (or warnings with--strict), exits0and emits structured Claude Code JSON (systemMessage+hookSpecificOutput.additionalContext) with concise, bounded Markdown feedback.--mode block: On failing claims, writes the concise actionable receipt to stderr and exits2so the agent fixes the ungrounded claim before stopping.- Infinite-loop guard (
stop_hook_active): When Claude Code setsstop_hook_active: true, the hook never exits2and never emitshookSpecificOutput.additionalContext— it emitssystemMessageonly and exits0, guaranteeing the agent can always stop after at most one verification retry. - Fail-open with visible diagnostics by default: Parse, I/O, missing-file, usage, or internal errors log a single diagnostic line to stderr and exit
1(non-blocking in Claude Code while surfacing stderr, instead of silently hiding errors behind exit0). Pass--fail-closedto exit2(blocking) on errors instead.
Using it from an agent
skills/handoff-verify/SKILL.md is a ready-made skill that
tells an agent when to run the check, how to read a finding, and what to do about each code.
Copy the folder into .claude/skills/ (project) or ~/.claude/skills/ (every project):
mkdir -p .claude/skills && cp -R skills/handoff-verify .claude/skills/
An agent that only has a shell can self-check before reporting back:
handoff-verify check --latest --json --quiet-on-pass
Exit 0 with no output means every pointer, quote and absence claim was backed by a tool
call. On exit 1, each entry in findings has a code, the claim text, and a suggestion
naming the read or search that would ground it.
How it behaves on real sessions
The bundled eval suite below is a deterministic regression benchmark. As a calibration check, the verifier was also run over 1,571 real Claude Code transcripts from one developer's machine (972 main sessions, 599 subagents; mostly code-review and implementation work):
| Stage | Transcripts with an error-level finding |
|---|---|
As first tagged 0.1.0 |
512 / 1,571 (32.6%) |
| After shell-read & scratch-copy fixes | 343 / 1,571 (21.8%) |
Follow-up fixes addressed the top remaining false-alarm classes observed in that corpus:
- shell output redirected to a temp/log file (
> /tmp/x.log,| tee ...) and subsequently read back grep -n/rg -ncontext lines (-C/-A/-Bfile-line-content) and lines immediately adjacent to matched hits- parent agents relaying
Agent/Tasksubagentpath:lineranges under alternate path spellings or unambiguous basenames - negated existence mentions ("
src/app.py:99does not exist", "there is nofoo.py:42", "bar.pywasn't found") - non-code absence phrases ("no usage limit", "no open issue", "no open PRs", "no errors", "no warnings", "no changes")
Remaining caveats to keep in mind:
- Reads through arbitrary scripts (
python - <<EOFgenerating or slicing files) cannot always be mapped back to exact line numbers, and files generated by a script that are linked in prose may still be flagged until read directly. --latestcurrently discovers Claude Code session directories; for Codex CLI rollouts pass the transcript path explicitly.- Treat any finding as "the transcript does not show this", not "this is false". Start with the default
advisemode before opting intoblockmode.
Real CLI Output Examples
Clean session (exit 0)
$ handoff-verify check evals/cases/clean_01_claude_single_read.jsonl
PASS: 0 findings (6 claims checked, 1 file read, 1.0ms)
Truncated search claimed as "no other matches" (exit 1, text format)
$ handoff-verify check evals/cases/fail_06_claude_truncated_grep.jsonl
FAIL: 1 finding (1 error; 4 claims checked, 0 files read, 0.7ms)
[ERROR] TRUNCATED_SEARCH_OUTPUT: Claimed `no other matches`, but search output was truncated: Grep#0 (result limit (5) reached).
Claim (absence): no other matches
Evidence: truncated_searches=[{event_index=0, tool_name=Grep, query=deprecated_v1_client, reason=result limit (5) reached}]
Next step: Re-run the search without head_limit/truncation before claiming absence or completeness.
Scope receipt:
Searched roots: .
Truncated outputs (1): [0] Grep (result limit (5) reached)
Subagent with unread pointer + fabricated quote (exit 1, Markdown format)
$ handoff-verify check evals/cases/fail_11_claude_subagent_fabricated.jsonl --format markdown
### handoff-verify: FAIL
**Summary:** 2 findings (2 errors) · 3 claims checked · 1 file read · 0.6ms
#### Findings
- **[ERROR] `UNREAD_FILE`** — Cited `src/security/cors.py` (line 34), but the file was never read in transcript.
- **Claim (`pointer`):** `` `src/security/cors.py:34` ``
- **Evidence:** file_path=src/security/cors.py; claimed_range=[34, 34]; observed_in_search=false; reason=never read in transcript
- **Next step:** Read line 34 of src/security/cors.py
- **[ERROR] `QUOTE_NOT_FOUND`** — Quoted snippet `if origin not in ALLOWED_WILDCARD_ORIGINS:` was not found in observed content of `src/security/csrf.py`.
- **Claim (`quote`):** `` `if origin not in ALLOWED_WILDCARD_ORIGINS:` `` (`src/security/csrf.py:6-9`)
- **Evidence:** claimed_file=src/security/csrf.py; checked_events=[file_read#0]; snippet_preview=if origin not in ALLOWED_WILDCARD_ORIGINS:
- **Next step:** Re-read `src/security/csrf.py` and verify the exact code before quoting it.
JSON Output Schema (schema_version: "1.0")
handoff-verify check <transcript> --format json emits a stable machine-readable report:
{
"schema_version": "1.0",
"passed": false,
"transcript_path": "evals/cases/fail_01_claude_unread_pointer.jsonl",
"source_format": "claude_code",
"duration_ms": 0.65,
"summary": {
"errors": 1,
"warnings": 0,
"infos": 0,
"claims": 2,
"findings": 1
},
"claims": [
{
"kind": "pointer",
"text": "`src/auth/tokens.py:3-6`",
"file_path": "src/auth/tokens.py",
"start_line": 3,
"end_line": 6,
"snippet": null,
"context": "Bearer headers are parsed in `src/auth/tokens.py:3-6`.",
"message_index": 0
},
{
"kind": "pointer",
"text": "`src/auth/session_store.py:48-55`",
"file_path": "src/auth/session_store.py",
"start_line": 48,
"end_line": 55,
"snippet": null,
"context": "Revoked session IDs are then checked against Redis in `src/auth/session_store.py:48-55` before granting access.",
"message_index": 0
}
],
"findings": [
{
"severity": "error",
"code": "UNREAD_FILE",
"claim": { "...": "..." },
"evidence": {
"file_path": "src/auth/session_store.py",
"claimed_range": [48, 55],
"observed_in_search": false,
"reason": "never read in transcript"
},
"message": "Cited `src/auth/session_store.py` (lines 48-55), but the file was never read in transcript.",
"suggestion": "Read lines 48-55 of src/auth/session_store.py"
}
],
"scope_receipt": {
"searched_roots": [],
"excluded_dirs": [],
"truncated_outputs": [],
"unread_cursors": [],
"files_read": ["/workspace/payments/src/auth/tokens.py"],
"files_edited": []
}
}
Finding codes
| Code | Severity | Meaning |
|---|---|---|
UNREAD_FILE |
error |
Cited file or path:line was never read/observed in the transcript |
LINE_OUT_OF_READ_WINDOW |
error |
Cited line range falls outside the transcript's observed Read line windows |
STALE_FILE_READ |
error / warning |
File was edited or deleted after the last read (or changed on disk with --repo) without re-reading |
FILE_NOT_FOUND |
error |
Cited file does not exist on disk in --repo |
LINE_OUT_OF_BOUNDS |
error |
Cited line number exceeds the live file's line count in --repo |
QUOTE_NOT_FOUND |
error |
Quoted code or command output snippet does not appear in observed evidence |
QUOTE_MISMATCH |
error |
Quoted snippet was attributed to file A, but was only observed in file B |
NO_SEARCH_EVIDENCE |
error |
Absence/completeness claim made with no matching repository search |
TRUNCATED_SEARCH_OUTPUT |
error |
Absence/completeness claim backed only by truncated search or partial read output |
NARROW_SEARCH_SCOPE |
error |
Repo-wide (or wider) absence claim backed only by a subdirectory search |
UNREAD_PAGINATION_CURSOR |
error |
Completeness/absence claim made while a tool returned has_more / nextCursor that was never followed |
EXCLUDED_SEARCH_DIRS |
warning |
Search explicitly excluded non-trivial directories not acknowledged in the claim |
32-Case Seeded Eval Results
Measured via uv run handoff-verify eval --format markdown on the bundled 32-case seeded evaluation suite (evals/manifest.json + evals/cases/: 16 clean sessions and 16 planted failures across Claude Code, Codex CLI, and Generic JSONL, including 8 real-session-shaped real_session regression fixtures covering redirected log readbacks, rg -n -C / adjacent grep lines, parent/subagent path relays, negated mentions, and non-code absence phrases). Because these cases were authored alongside the verifier as a deterministic regression benchmark rather than a held-out production corpus, treat the table below as baseline regression coverage rather than a guarantee on arbitrary real-world phrasings. Latency numbers vary slightly by machine and scale linearly with transcript size.
| Metric | Measured (macOS / Python 3.13) | Target |
|---|---|---|
| Cases | 32 (16 clean / 16 failures) | — |
| Precision | 100.0% (16 TP, 0 FP) | 100.0% |
| Recall | 100.0% (16/16) | >= 90.0% |
| False Positive Rate | 0.0% (0/16) | 0.0% |
| Expected Code Match | 100.0% | 100.0% |
| Median Latency | ~0.4–0.6 ms | < 50.0 ms |
| P95 / Max Latency | ~0.8–1.2 ms / ~1.2–4.3 ms | — |
| Category | Total | Clean | Failures | TP | TN | FP | FN |
|---|---|---|---|---|---|---|---|
cross_harness |
4 | 2 | 2 | 2 | 2 | 0 | 0 |
false_positive_guard |
1 | 1 | 0 | 0 | 1 | 0 | 0 |
pagination |
2 | 1 | 1 | 1 | 1 | 0 | 0 |
pointers |
6 | 3 | 3 | 3 | 3 | 0 | 0 |
quotes |
4 | 2 | 2 | 2 | 2 | 0 | 0 |
real_session |
8 | 4 | 4 | 4 | 4 | 0 | 0 |
scope |
5 | 2 | 3 | 3 | 2 | 0 | 0 |
subagent |
2 | 1 | 1 | 1 | 1 | 0 | 0 |
Supported Transcript Formats
handoff-verify auto-detects the transcript format by default (override with --parser claude_code|codex|generic):
- Claude Code JSONL (
claude_code) — Main session and sidechain subagent logs (assistant/userrecords withtool_use/tool_resultblocks forRead,Grep,Glob,LS,Bash,Edit,MultiEdit,Write,NotebookEdit,WebFetch, andmcp__*paginated tools). - Codex CLI JSONL (
codex) — Modern rollout logs (session_meta,turn_context,response_itemwithfunction_call/function_call_output,custom_tool_call/apply_patch,local_shell_call,event_msg) as well as legacy flat logs. - Generic JSONL (
generic) — A simple, documented line-delimited JSON schema for integrating any custom agent harness:
{"type": "meta", "cwd": "/workspace/app"}
{"type": "file_read", "file_path": "src/auth.py", "start_line": 1, "end_line": 20, "content": "def verify(tok):\n return bool(tok)"}
{"type": "search", "tool_name": "rg", "query": "verify", "search_path": ".", "match_count": 1, "matched_files": ["src/auth.py"], "output": "src/auth.py:1:def verify(tok):", "truncated": false}
{"type": "command", "command": "pytest", "stdout": "4 passed in 0.12s\n", "exit_code": 0}
{"type": "assistant", "text": "Verified `src/auth.py:1-2` (`return bool(tok)`). No other callers of `verify` in the repository."}
Supported generic record types: meta, file_read, file_edit, search, command, pagination, tool_call / tool_result, and assistant.
Development
uv sync --dev
uv run ruff check .
uv run ruff format --check .
uv run pytest -v
uv run handoff-verify eval --verbose
License
MIT — see LICENSE.
Metadata
Release files for handoff-verify 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| handoff_verify-0.1.0.tar.gz | 210.0 kB | Without provenance | Details for handoff_verify-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| handoff_verify-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for handoff_verify-0.1.0-py3-none-any.whl |
Total release size: 381.8 kB
Release files / handoff_verify-0.1.0.tar.gz
| Download URL | handoff_verify-0.1.0.tar.gz |
|---|---|
| Size | 210.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f4e3d3d26f7de8ff62099f6b83fad8a75c55fb38efb3fbbb3b67d4d41002ed4c
|
|
BLAKE2b-256 checksum How to use checksums |
3309ddaad42276579f86e1309b52e27bf9ab26a655592f7af63c94ae1de82546
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / handoff_verify-0.1.0-py3-none-any.whl
| Download URL | handoff_verify-0.1.0-py3-none-any.whl |
|---|---|
| Size | 171.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7172442e5fb020bd7ab167e1e67a246d4f911ba6ea6bfb10c9cff54e81af735a
|
|
BLAKE2b-256 checksum How to use checksums |
7d926c57494004557227257d9214b63f8a710027461c6488f1a599a6b241c602
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for handoff-verify 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.