handoff-verify 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- handoff_verify-0.1.0/.claude-plugin/marketplace.json +14 -0
- handoff_verify-0.1.0/.claude-plugin/plugin.json +12 -0
- handoff_verify-0.1.0/.github/workflows/ci.yml +29 -0
- handoff_verify-0.1.0/.gitignore +18 -0
- handoff_verify-0.1.0/AGENTS.md +38 -0
- handoff_verify-0.1.0/LICENSE +21 -0
- handoff_verify-0.1.0/PKG-INFO +476 -0
- handoff_verify-0.1.0/PLAN.md +50 -0
- handoff_verify-0.1.0/README.md +432 -0
- handoff_verify-0.1.0/bin/handoff-verify +61 -0
- handoff_verify-0.1.0/evals/cases/clean_01_claude_single_read.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/clean_02_claude_multi_window_read.jsonl +6 -0
- handoff_verify-0.1.0/evals/cases/clean_03_claude_read_edit_reread.jsonl +8 -0
- handoff_verify-0.1.0/evals/cases/clean_04_claude_quotes_normalized.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/clean_05_claude_prose_examples_and_urls.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/clean_06_claude_repo_wide_grep_absence.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/clean_07_claude_subdir_grep_qualified.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/clean_08_claude_paginated_mcp_complete.jsonl +6 -0
- handoff_verify-0.1.0/evals/cases/clean_09_claude_subagent_accurate.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/clean_10_codex_rollout_accurate.jsonl +9 -0
- handoff_verify-0.1.0/evals/cases/clean_11_generic_accurate.jsonl +5 -0
- handoff_verify-0.1.0/evals/cases/clean_12_claude_write_and_command_quote.jsonl +6 -0
- handoff_verify-0.1.0/evals/cases/clean_13_claude_redirected_log_readback.jsonl +6 -0
- handoff_verify-0.1.0/evals/cases/clean_14_claude_grep_context_adjacent.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/clean_15_claude_parent_subagent_relay.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/clean_16_claude_negated_and_noncode_absence.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/fail_01_claude_unread_pointer.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/fail_02_claude_out_of_window.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/fail_03_claude_stale_read_after_edit.jsonl +6 -0
- handoff_verify-0.1.0/evals/cases/fail_04_claude_fabricated_inline_quote.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/fail_05_claude_fabricated_fenced_quote.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/fail_06_claude_truncated_grep.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/fail_07_claude_narrow_search_scope.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/fail_08_claude_unread_pagination_cursor.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/fail_09_claude_no_search_evidence.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/fail_10_codex_unread_and_quote.jsonl +5 -0
- handoff_verify-0.1.0/evals/cases/fail_11_claude_subagent_fabricated.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/fail_12_generic_window_and_truncated_search.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/fail_13_claude_unredirected_unread.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/fail_14_claude_grep_far_extrapolation.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/fail_15_claude_subagent_relay_fabricated.jsonl +4 -0
- handoff_verify-0.1.0/evals/cases/fail_16_claude_mixed_negated_and_narrow_usage.jsonl +4 -0
- handoff_verify-0.1.0/evals/manifest.json +332 -0
- handoff_verify-0.1.0/hooks/hooks.json +25 -0
- handoff_verify-0.1.0/pyproject.toml +66 -0
- handoff_verify-0.1.0/skills/handoff-verify/SKILL.md +91 -0
- handoff_verify-0.1.0/src/handoff_verify/__init__.py +41 -0
- handoff_verify-0.1.0/src/handoff_verify/__main__.py +8 -0
- handoff_verify-0.1.0/src/handoff_verify/cli.py +751 -0
- handoff_verify-0.1.0/src/handoff_verify/doctor.py +503 -0
- handoff_verify-0.1.0/src/handoff_verify/evals.py +599 -0
- handoff_verify-0.1.0/src/handoff_verify/extractors.py +1938 -0
- handoff_verify-0.1.0/src/handoff_verify/formatters.py +498 -0
- handoff_verify-0.1.0/src/handoff_verify/hooks.py +683 -0
- handoff_verify-0.1.0/src/handoff_verify/models.py +207 -0
- handoff_verify-0.1.0/src/handoff_verify/parsers/__init__.py +175 -0
- handoff_verify-0.1.0/src/handoff_verify/parsers/_common.py +2750 -0
- handoff_verify-0.1.0/src/handoff_verify/parsers/claude_code.py +731 -0
- handoff_verify-0.1.0/src/handoff_verify/parsers/codex.py +623 -0
- handoff_verify-0.1.0/src/handoff_verify/parsers/generic.py +422 -0
- handoff_verify-0.1.0/src/handoff_verify/pipeline.py +137 -0
- handoff_verify-0.1.0/src/handoff_verify/verifiers/__init__.py +13 -0
- handoff_verify-0.1.0/src/handoff_verify/verifiers/_paths.py +296 -0
- handoff_verify-0.1.0/src/handoff_verify/verifiers/_redirects.py +575 -0
- handoff_verify-0.1.0/src/handoff_verify/verifiers/pointers.py +1569 -0
- handoff_verify-0.1.0/src/handoff_verify/verifiers/quotes.py +760 -0
- handoff_verify-0.1.0/src/handoff_verify/verifiers/scope.py +767 -0
- handoff_verify-0.1.0/tests/test_adoption_polish.py +775 -0
- handoff_verify-0.1.0/tests/test_adversarial_edge_cases.py +1947 -0
- handoff_verify-0.1.0/tests/test_claude_code_parser.py +469 -0
- handoff_verify-0.1.0/tests/test_cli_ergonomics.py +135 -0
- handoff_verify-0.1.0/tests/test_cli_hooks_init.py +363 -0
- handoff_verify-0.1.0/tests/test_codex_parser.py +224 -0
- handoff_verify-0.1.0/tests/test_dogfood_regressions.py +344 -0
- handoff_verify-0.1.0/tests/test_e2e_cli.py +240 -0
- handoff_verify-0.1.0/tests/test_evals.py +683 -0
- handoff_verify-0.1.0/tests/test_extractors.py +183 -0
- handoff_verify-0.1.0/tests/test_formatters.py +395 -0
- handoff_verify-0.1.0/tests/test_generic_and_auto.py +184 -0
- handoff_verify-0.1.0/tests/test_hooks.py +770 -0
- handoff_verify-0.1.0/tests/test_models.py +151 -0
- handoff_verify-0.1.0/tests/test_pipeline_and_cli.py +191 -0
- handoff_verify-0.1.0/tests/test_pipeline_verification.py +281 -0
- handoff_verify-0.1.0/tests/test_review_regressions.py +1424 -0
- handoff_verify-0.1.0/tests/test_verifiers_pointers.py +331 -0
- handoff_verify-0.1.0/tests/test_verifiers_quotes.py +219 -0
- handoff_verify-0.1.0/tests/test_verifiers_scope.py +340 -0
- handoff_verify-0.1.0/uv.lock +108 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "handoff-verify",
|
|
3
|
+
"description": "handoff-verify: deterministic claim and scope verification for Claude Code agents and subagents.",
|
|
4
|
+
"owner": {
|
|
5
|
+
"name": "Solomon Wakhungu"
|
|
6
|
+
},
|
|
7
|
+
"plugins": [
|
|
8
|
+
{
|
|
9
|
+
"name": "handoff-verify",
|
|
10
|
+
"source": "./",
|
|
11
|
+
"description": "Deterministic, zero-LLM verification of agent file pointers, verbatim code quotes, and search/pagination scope receipts."
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "handoff-verify",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Deterministic, zero-LLM claim and scope verification for AI coding agents and subagents. Verifies file pointers, verbatim code quotes, and search/pagination scope receipts on Stop and SubagentStop.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Solomon Wakhungu"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://github.com/1solomonwakhungu/handoff-verify",
|
|
9
|
+
"repository": "https://github.com/1solomonwakhungu/handoff-verify",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"keywords": ["verification", "transcripts", "subagents", "hooks", "claims", "hallucination"]
|
|
12
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.11", "3.13"]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: astral-sh/setup-uv@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: ${{ matrix.python-version }}
|
|
20
|
+
- name: Run checks
|
|
21
|
+
run: |
|
|
22
|
+
if [ ! -f pyproject.toml ]; then
|
|
23
|
+
echo "Bootstrap commit (no pyproject.toml yet); skipping."
|
|
24
|
+
exit 0
|
|
25
|
+
fi
|
|
26
|
+
uv sync --dev
|
|
27
|
+
uv run ruff check .
|
|
28
|
+
uv run ruff format --check .
|
|
29
|
+
uv run pytest -v
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# AGENTS.md — handoff-verify
|
|
2
|
+
|
|
3
|
+
## Mission
|
|
4
|
+
Build **handoff-verify**, a deterministic, zero-LLM CLI and hook tool that verifies claims made by AI coding agents and subagents against their actual tool-call transcripts (file pointers, verbatim code quotes, and search/pagination scope receipts).
|
|
5
|
+
|
|
6
|
+
## Tech Stack & Constraints
|
|
7
|
+
- **Language:** Python `>=3.11` managed with `uv`.
|
|
8
|
+
- **Runtime dependencies:** **Zero** third-party runtime dependencies (Python standard library only) so startup is <50ms and installs work cleanly across Python 3.11–3.15.
|
|
9
|
+
- **Dev dependencies:** `pytest`, `ruff`.
|
|
10
|
+
- **Package layout:** `src/handoff_verify/` with console entry point `handoff-verify = "handoff_verify.cli:main"`.
|
|
11
|
+
- **No LLM calls anywhere** in the runtime verification path. Everything is deterministic, local, and fast.
|
|
12
|
+
|
|
13
|
+
## Quality Bar
|
|
14
|
+
- `uv run pytest` passes 100% with zero skipped tests.
|
|
15
|
+
- `uv run ruff check .` and `uv run ruff format --check .` pass cleanly.
|
|
16
|
+
- Quiet when clean, loud on anomalies (never spam noisy warnings when all claims are verified).
|
|
17
|
+
- Fail-open option on hook integration so a hook crash never bricks a user's coding session.
|
|
18
|
+
|
|
19
|
+
## Mandatory Worker PR, Review & Merge Workflow
|
|
20
|
+
Every implementation worker thread owns its PR end-to-end (the orchestrator does NOT review or merge PRs):
|
|
21
|
+
1. Work in your assigned git worktree branched from `origin/main`.
|
|
22
|
+
2. Implement your milestone cleanly with thorough unit + integration tests.
|
|
23
|
+
3. Run `uv run pytest && uv run ruff check . && uv run ruff format --check .`.
|
|
24
|
+
4. Commit with clear commit messages, push to `origin`, open a PR targeting `main` via `gh pr create`, and call `link_pull_request` with the full PR URL.
|
|
25
|
+
5. **Mandatory Fable 5.2 Review:**
|
|
26
|
+
- Call `orchestrator_capabilities` once in your thread before your first `delegate_task`.
|
|
27
|
+
- Start a review delegate using `delegate_task` with:
|
|
28
|
+
- `role: "review"`
|
|
29
|
+
- `mode: "wait"` (or `"async"` and wait for wakeup)
|
|
30
|
+
- `target: { "providerInstanceId": "claudeAgent_claude_proxy", "model": "claude-fable-5-2", "options": { "effort": "high" } }`
|
|
31
|
+
- Pass the PR URL/number, `git diff origin/main...HEAD` (or instructions to inspect it), and test output. Ask Fable 5.2 for an adversarial review covering correctness, edge cases, false positives/negatives, CLI ergonomics, and test gaps.
|
|
32
|
+
- Fix all valid findings, re-run tests & ruff, and push updates. If changes were non-trivial, run a fresh `delegate_task` re-check with Fable 5.2 (`claudeAgent_claude_proxy` / `claude-fable-5-2`) until approved with no blocking issues.
|
|
33
|
+
6. **CI & Self-Merge:**
|
|
34
|
+
- Check PR checks (`gh pr view <num> --json statusCheckRollup`). If GitHub Actions CI is still running, call `watch_pull_request` and end your turn to wake on completion (do NOT use `sleep` or `gh --watch`).
|
|
35
|
+
- If `origin/main` moved while you worked and there are conflicts, `git fetch origin && git rebase origin/main`, resolve conflicts, re-run tests, and push.
|
|
36
|
+
- Once Fable 5.2 approves and CI is green, merge your PR yourself:
|
|
37
|
+
`gh pr merge <num> --squash --delete-branch`
|
|
38
|
+
- Report the merged PR URL, Fable 5.2 review summary, and final test results in your final message.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Solomon Wakhungu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: handoff-verify
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Deterministic, zero-LLM claim and scope verification for AI coding agents and subagents.
|
|
5
|
+
Project-URL: Homepage, https://github.com/1solomonwakhungu/handoff-verify
|
|
6
|
+
Project-URL: Repository, https://github.com/1solomonwakhungu/handoff-verify
|
|
7
|
+
Project-URL: Issues, https://github.com/1solomonwakhungu/handoff-verify/issues
|
|
8
|
+
Author: Solomon Wakhungu
|
|
9
|
+
License: MIT License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2026 Solomon Wakhungu
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
SOFTWARE.
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Keywords: ai-agents,claude-code,codex,hooks,subagents,transcripts,verification
|
|
32
|
+
Classifier: Development Status :: 4 - Beta
|
|
33
|
+
Classifier: Environment :: Console
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
40
|
+
Classifier: Topic :: Software Development
|
|
41
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
42
|
+
Requires-Python: >=3.11
|
|
43
|
+
Description-Content-Type: text/markdown
|
|
44
|
+
|
|
45
|
+
# handoff-verify
|
|
46
|
+
|
|
47
|
+
**Deterministic, zero-LLM claim & scope verification for AI coding agents and subagents.**
|
|
48
|
+
|
|
49
|
+
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.
|
|
50
|
+
|
|
51
|
+
`handoff-verify` parses an agent's tool-call transcript and deterministically checks every claim in its final handoff against what the agent actually observed:
|
|
52
|
+
|
|
53
|
+
- **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 `--repo` is supplied)?
|
|
54
|
+
- **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)?
|
|
55
|
+
- **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?
|
|
56
|
+
|
|
57
|
+
**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.**
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
Requires Python `>=3.11`. No runtime dependencies.
|
|
64
|
+
|
|
65
|
+
### As a Claude Code plugin (bundled hooks + skill)
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
claude plugin marketplace add 1solomonwakhungu/handoff-verify
|
|
69
|
+
claude plugin install handoff-verify@handoff-verify
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Or test locally from a clone without installing:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
claude --plugin-dir /path/to/handoff-verify
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
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`.
|
|
79
|
+
|
|
80
|
+
### From source (works today)
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
git clone https://github.com/1solomonwakhungu/handoff-verify.git
|
|
84
|
+
cd handoff-verify
|
|
85
|
+
uv tool install . # puts `handoff-verify` on your PATH
|
|
86
|
+
handoff-verify --version
|
|
87
|
+
handoff-verify doctor # verify PATH, Python >= 3.11, and Claude hook config
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
To try it without installing, run `uvx --from . handoff-verify --version` inside the clone.
|
|
91
|
+
|
|
92
|
+
### From PyPI (after the first release)
|
|
93
|
+
|
|
94
|
+
`handoff-verify` is not on PyPI yet, so these fail until it is published:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
uvx handoff-verify --version
|
|
98
|
+
uv tool install handoff-verify
|
|
99
|
+
pip install handoff-verify
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 60-Second Quickstart
|
|
105
|
+
|
|
106
|
+
Check the Claude Code session you just ran, from the project directory:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
handoff-verify check --latest
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`--latest` picks the newest transcript for the current directory. To check a specific one,
|
|
113
|
+
pass its path. Transcripts live here:
|
|
114
|
+
|
|
115
|
+
| Harness | Transcript location |
|
|
116
|
+
| --- | --- |
|
|
117
|
+
| Claude Code | `~/.claude/projects/<cwd-with-dashes>/<session-id>.jsonl` |
|
|
118
|
+
| Claude Code subagent | `~/.claude/projects/<cwd-with-dashes>/<session-id>/subagents/agent-<id>.jsonl` |
|
|
119
|
+
| Codex CLI | `~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl` |
|
|
120
|
+
|
|
121
|
+
Inspect what a transcript actually read, edited, searched, truncated, or left unread:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
handoff-verify inspect session.jsonl
|
|
125
|
+
handoff-verify inspect session.jsonl --json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Verify claims in a transcript (pass `-` to read from stdin):
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Compact plain-text receipt (exit 0 on pass, exit 1 on findings, exit 2 on usage/parse error)
|
|
132
|
+
handoff-verify check session.jsonl
|
|
133
|
+
|
|
134
|
+
# Stay completely silent when clean
|
|
135
|
+
handoff-verify check session.jsonl --quiet-on-pass
|
|
136
|
+
|
|
137
|
+
# Also cross-check cited files and line counts against the live repository on disk
|
|
138
|
+
handoff-verify check session.jsonl --repo /path/to/repo
|
|
139
|
+
|
|
140
|
+
# Treat warnings (e.g. non-trivial excluded search dirs) as failures
|
|
141
|
+
handoff-verify check session.jsonl --strict
|
|
142
|
+
|
|
143
|
+
# Render actionable Markdown (great for parent agents / PR comments) or machine-readable JSON
|
|
144
|
+
handoff-verify check session.jsonl --format markdown
|
|
145
|
+
handoff-verify check session.jsonl --json # same as --format json
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Every subcommand's `--help` ends with examples and the exit codes.
|
|
149
|
+
|
|
150
|
+
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):
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Exit 0 when all targets pass, exit 1 if targets are missed, exit 2 on missing/invalid manifest
|
|
154
|
+
handoff-verify eval
|
|
155
|
+
handoff-verify eval --verbose
|
|
156
|
+
handoff-verify eval --strict
|
|
157
|
+
handoff-verify eval --format markdown
|
|
158
|
+
handoff-verify eval --format json
|
|
159
|
+
handoff-verify eval --cases-dir ./custom-evals
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Verify your local setup (PATH, Python version, and `.claude/settings.json` hook config):
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
handoff-verify doctor
|
|
166
|
+
handoff-verify doctor --json
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Claude Code Hook Integration
|
|
172
|
+
|
|
173
|
+
Wire `handoff-verify` into Claude Code's `SubagentStop` and `Stop` lifecycle hooks so ungrounded subagent or main-agent handoffs are caught automatically.
|
|
174
|
+
|
|
175
|
+
### Print or install `.claude/settings.json`
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# Preview the hook configuration JSON
|
|
179
|
+
handoff-verify init
|
|
180
|
+
|
|
181
|
+
# Safely create or merge into .claude/settings.json (preserves existing hooks and keys)
|
|
182
|
+
handoff-verify init --write
|
|
183
|
+
|
|
184
|
+
# Use block mode (exit 2 on findings) or a custom wrapper command (e.g. uvx)
|
|
185
|
+
handoff-verify init --write --mode block
|
|
186
|
+
handoff-verify init --write --command "uvx handoff-verify"
|
|
187
|
+
|
|
188
|
+
# Install for every project instead of this one
|
|
189
|
+
handoff-verify init --write --settings ~/.claude/settings.json
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
`init --write` warns if the hook command is not on your PATH, because Claude Code would then
|
|
193
|
+
report "command not found" on every stop. Start with the default `advise` mode; see
|
|
194
|
+
[How it behaves on real sessions](#how-it-behaves-on-real-sessions) before choosing `block`.
|
|
195
|
+
|
|
196
|
+
Generated configuration (`handoff-verify init`):
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"hooks": {
|
|
201
|
+
"SubagentStop": [
|
|
202
|
+
{
|
|
203
|
+
"hooks": [
|
|
204
|
+
{
|
|
205
|
+
"type": "command",
|
|
206
|
+
"command": "handoff-verify hook claude-code --mode advise"
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
],
|
|
211
|
+
"Stop": [
|
|
212
|
+
{
|
|
213
|
+
"hooks": [
|
|
214
|
+
{
|
|
215
|
+
"type": "command",
|
|
216
|
+
"command": "handoff-verify hook claude-code --mode advise"
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Hook modes & safety guarantees
|
|
226
|
+
|
|
227
|
+
- **`SubagentStop` vs `Stop` isolation:** On `SubagentStop`, `handoff-verify` strictly reads `agent_transcript_path` (never falling back to the parent session's `transcript_path`). On `Stop`, it reads `transcript_path`.
|
|
228
|
+
- **Verifies the message Claude Code is about to hand back:** Claude Code can fire `Stop` / `SubagentStop` before the final assistant message is written to the transcript file. The hook compares the transcript with the payload's `last_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.
|
|
229
|
+
- **Quiet when clean and on warning-only reports:** When verification passes with zero findings — or with warning-only findings (unless `--include-warnings` or `--strict` is passed) — the hook exits `0` with empty stdout and stderr.
|
|
230
|
+
- **`--mode advise` (default):** On error-level findings (or warnings with `--strict`), exits `0` and emits structured Claude Code JSON (`systemMessage` + `hookSpecificOutput.additionalContext`) with concise, bounded Markdown feedback.
|
|
231
|
+
- **`--mode block`:** On failing claims, writes the concise actionable receipt to stderr and exits `2` so the agent fixes the ungrounded claim before stopping.
|
|
232
|
+
- **Infinite-loop guard (`stop_hook_active`):** When Claude Code sets `stop_hook_active: true`, the hook **never** exits `2` and **never** emits `hookSpecificOutput.additionalContext` — it emits `systemMessage` only and exits `0`, guaranteeing the agent can always stop after at most one verification retry.
|
|
233
|
+
- **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 exit `0`). Pass `--fail-closed` to exit `2` (blocking) on errors instead.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Using it from an agent
|
|
238
|
+
|
|
239
|
+
[`skills/handoff-verify/SKILL.md`](skills/handoff-verify/SKILL.md) is a ready-made skill that
|
|
240
|
+
tells an agent when to run the check, how to read a finding, and what to do about each code.
|
|
241
|
+
Copy the folder into `.claude/skills/` (project) or `~/.claude/skills/` (every project):
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
mkdir -p .claude/skills && cp -R skills/handoff-verify .claude/skills/
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
An agent that only has a shell can self-check before reporting back:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
handoff-verify check --latest --json --quiet-on-pass
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Exit `0` with no output means every pointer, quote and absence claim was backed by a tool
|
|
254
|
+
call. On exit `1`, each entry in `findings` has a `code`, the `claim` text, and a `suggestion`
|
|
255
|
+
naming the read or search that would ground it.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## How it behaves on real sessions
|
|
260
|
+
|
|
261
|
+
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):
|
|
262
|
+
|
|
263
|
+
| Stage | Transcripts with an error-level finding |
|
|
264
|
+
| --- | ---: |
|
|
265
|
+
| As first tagged `0.1.0` | 512 / 1,571 (32.6%) |
|
|
266
|
+
| After shell-read & scratch-copy fixes | 343 / 1,571 (21.8%) |
|
|
267
|
+
|
|
268
|
+
Follow-up fixes addressed the top remaining false-alarm classes observed in that corpus:
|
|
269
|
+
|
|
270
|
+
- shell output redirected to a temp/log file (`> /tmp/x.log`, `| tee ...`) and subsequently read back
|
|
271
|
+
- `grep -n` / `rg -n` context lines (`-C`/`-A`/`-B` `file-line-content`) and lines immediately adjacent to matched hits
|
|
272
|
+
- parent agents relaying `Agent`/`Task` subagent `path:line` ranges under alternate path spellings or unambiguous basenames
|
|
273
|
+
- negated existence mentions (*"`src/app.py:99` does not exist"*, *"there is no `foo.py:42`"*, *"`bar.py` wasn't found"*)
|
|
274
|
+
- non-code absence phrases (*"no usage limit"*, *"no open issue"*, *"no open PRs"*, *"no errors"*, *"no warnings"*, *"no changes"*)
|
|
275
|
+
|
|
276
|
+
Remaining caveats to keep in mind:
|
|
277
|
+
|
|
278
|
+
- Reads through arbitrary scripts (`python - <<EOF` generating 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.
|
|
279
|
+
- `--latest` currently discovers Claude Code session directories; for Codex CLI rollouts pass the transcript path explicitly.
|
|
280
|
+
- Treat any finding as *"the transcript does not show this"*, not *"this is false"*. Start with the default `advise` mode before opting into `block` mode.
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## Real CLI Output Examples
|
|
285
|
+
|
|
286
|
+
### Clean session (`exit 0`)
|
|
287
|
+
|
|
288
|
+
```console
|
|
289
|
+
$ handoff-verify check evals/cases/clean_01_claude_single_read.jsonl
|
|
290
|
+
PASS: 0 findings (6 claims checked, 1 file read, 1.0ms)
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Truncated search claimed as *"no other matches"* (`exit 1`, text format)
|
|
294
|
+
|
|
295
|
+
```console
|
|
296
|
+
$ handoff-verify check evals/cases/fail_06_claude_truncated_grep.jsonl
|
|
297
|
+
FAIL: 1 finding (1 error; 4 claims checked, 0 files read, 0.7ms)
|
|
298
|
+
[ERROR] TRUNCATED_SEARCH_OUTPUT: Claimed `no other matches`, but search output was truncated: Grep#0 (result limit (5) reached).
|
|
299
|
+
Claim (absence): no other matches
|
|
300
|
+
Evidence: truncated_searches=[{event_index=0, tool_name=Grep, query=deprecated_v1_client, reason=result limit (5) reached}]
|
|
301
|
+
Next step: Re-run the search without head_limit/truncation before claiming absence or completeness.
|
|
302
|
+
Scope receipt:
|
|
303
|
+
Searched roots: .
|
|
304
|
+
Truncated outputs (1): [0] Grep (result limit (5) reached)
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Subagent with unread pointer + fabricated quote (`exit 1`, Markdown format)
|
|
308
|
+
|
|
309
|
+
```console
|
|
310
|
+
$ handoff-verify check evals/cases/fail_11_claude_subagent_fabricated.jsonl --format markdown
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
```markdown
|
|
314
|
+
### handoff-verify: FAIL
|
|
315
|
+
|
|
316
|
+
**Summary:** 2 findings (2 errors) · 3 claims checked · 1 file read · 0.6ms
|
|
317
|
+
|
|
318
|
+
#### Findings
|
|
319
|
+
|
|
320
|
+
- **[ERROR] `UNREAD_FILE`** — Cited `src/security/cors.py` (line 34), but the file was never read in transcript.
|
|
321
|
+
- **Claim (`pointer`):** `` `src/security/cors.py:34` ``
|
|
322
|
+
- **Evidence:** file_path=src/security/cors.py; claimed_range=[34, 34]; observed_in_search=false; reason=never read in transcript
|
|
323
|
+
- **Next step:** Read line 34 of src/security/cors.py
|
|
324
|
+
- **[ERROR] `QUOTE_NOT_FOUND`** — Quoted snippet `if origin not in ALLOWED_WILDCARD_ORIGINS:` was not found in observed content of `src/security/csrf.py`.
|
|
325
|
+
- **Claim (`quote`):** `` `if origin not in ALLOWED_WILDCARD_ORIGINS:` `` (`src/security/csrf.py:6-9`)
|
|
326
|
+
- **Evidence:** claimed_file=src/security/csrf.py; checked_events=[file_read#0]; snippet_preview=if origin not in ALLOWED_WILDCARD_ORIGINS:
|
|
327
|
+
- **Next step:** Re-read `src/security/csrf.py` and verify the exact code before quoting it.
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## JSON Output Schema (`schema_version: "1.0"`)
|
|
333
|
+
|
|
334
|
+
`handoff-verify check <transcript> --format json` emits a stable machine-readable report:
|
|
335
|
+
|
|
336
|
+
```json
|
|
337
|
+
{
|
|
338
|
+
"schema_version": "1.0",
|
|
339
|
+
"passed": false,
|
|
340
|
+
"transcript_path": "evals/cases/fail_01_claude_unread_pointer.jsonl",
|
|
341
|
+
"source_format": "claude_code",
|
|
342
|
+
"duration_ms": 0.65,
|
|
343
|
+
"summary": {
|
|
344
|
+
"errors": 1,
|
|
345
|
+
"warnings": 0,
|
|
346
|
+
"infos": 0,
|
|
347
|
+
"claims": 2,
|
|
348
|
+
"findings": 1
|
|
349
|
+
},
|
|
350
|
+
"claims": [
|
|
351
|
+
{
|
|
352
|
+
"kind": "pointer",
|
|
353
|
+
"text": "`src/auth/tokens.py:3-6`",
|
|
354
|
+
"file_path": "src/auth/tokens.py",
|
|
355
|
+
"start_line": 3,
|
|
356
|
+
"end_line": 6,
|
|
357
|
+
"snippet": null,
|
|
358
|
+
"context": "Bearer headers are parsed in `src/auth/tokens.py:3-6`.",
|
|
359
|
+
"message_index": 0
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
"kind": "pointer",
|
|
363
|
+
"text": "`src/auth/session_store.py:48-55`",
|
|
364
|
+
"file_path": "src/auth/session_store.py",
|
|
365
|
+
"start_line": 48,
|
|
366
|
+
"end_line": 55,
|
|
367
|
+
"snippet": null,
|
|
368
|
+
"context": "Revoked session IDs are then checked against Redis in `src/auth/session_store.py:48-55` before granting access.",
|
|
369
|
+
"message_index": 0
|
|
370
|
+
}
|
|
371
|
+
],
|
|
372
|
+
"findings": [
|
|
373
|
+
{
|
|
374
|
+
"severity": "error",
|
|
375
|
+
"code": "UNREAD_FILE",
|
|
376
|
+
"claim": { "...": "..." },
|
|
377
|
+
"evidence": {
|
|
378
|
+
"file_path": "src/auth/session_store.py",
|
|
379
|
+
"claimed_range": [48, 55],
|
|
380
|
+
"observed_in_search": false,
|
|
381
|
+
"reason": "never read in transcript"
|
|
382
|
+
},
|
|
383
|
+
"message": "Cited `src/auth/session_store.py` (lines 48-55), but the file was never read in transcript.",
|
|
384
|
+
"suggestion": "Read lines 48-55 of src/auth/session_store.py"
|
|
385
|
+
}
|
|
386
|
+
],
|
|
387
|
+
"scope_receipt": {
|
|
388
|
+
"searched_roots": [],
|
|
389
|
+
"excluded_dirs": [],
|
|
390
|
+
"truncated_outputs": [],
|
|
391
|
+
"unread_cursors": [],
|
|
392
|
+
"files_read": ["/workspace/payments/src/auth/tokens.py"],
|
|
393
|
+
"files_edited": []
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### Finding codes
|
|
399
|
+
|
|
400
|
+
| Code | Severity | Meaning |
|
|
401
|
+
| --- | --- | --- |
|
|
402
|
+
| `UNREAD_FILE` | `error` | Cited file or `path:line` was never read/observed in the transcript |
|
|
403
|
+
| `LINE_OUT_OF_READ_WINDOW` | `error` | Cited line range falls outside the transcript's observed `Read` line windows |
|
|
404
|
+
| `STALE_FILE_READ` | `error` / `warning` | File was edited or deleted after the last read (or changed on disk with `--repo`) without re-reading |
|
|
405
|
+
| `FILE_NOT_FOUND` | `error` | Cited file does not exist on disk in `--repo` |
|
|
406
|
+
| `LINE_OUT_OF_BOUNDS` | `error` | Cited line number exceeds the live file's line count in `--repo` |
|
|
407
|
+
| `QUOTE_NOT_FOUND` | `error` | Quoted code or command output snippet does not appear in observed evidence |
|
|
408
|
+
| `QUOTE_MISMATCH` | `error` | Quoted snippet was attributed to file A, but was only observed in file B |
|
|
409
|
+
| `NO_SEARCH_EVIDENCE` | `error` | Absence/completeness claim made with no matching repository search |
|
|
410
|
+
| `TRUNCATED_SEARCH_OUTPUT` | `error` | Absence/completeness claim backed only by truncated search or partial read output |
|
|
411
|
+
| `NARROW_SEARCH_SCOPE` | `error` | Repo-wide (or wider) absence claim backed only by a subdirectory search |
|
|
412
|
+
| `UNREAD_PAGINATION_CURSOR` | `error` | Completeness/absence claim made while a tool returned `has_more` / `nextCursor` that was never followed |
|
|
413
|
+
| `EXCLUDED_SEARCH_DIRS` | `warning` | Search explicitly excluded non-trivial directories not acknowledged in the claim |
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## 32-Case Seeded Eval Results
|
|
418
|
+
|
|
419
|
+
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.
|
|
420
|
+
|
|
421
|
+
| Metric | Measured (macOS / Python 3.13) | Target |
|
|
422
|
+
| --- | ---: | ---: |
|
|
423
|
+
| Cases | 32 (16 clean / 16 failures) | — |
|
|
424
|
+
| Precision | **100.0%** (16 TP, 0 FP) | 100.0% |
|
|
425
|
+
| Recall | **100.0%** (16/16) | >= 90.0% |
|
|
426
|
+
| False Positive Rate | **0.0%** (0/16) | 0.0% |
|
|
427
|
+
| Expected Code Match | **100.0%** | 100.0% |
|
|
428
|
+
| Median Latency | **~0.4–0.6 ms** | < 50.0 ms |
|
|
429
|
+
| P95 / Max Latency | **~0.8–1.2 ms / ~1.2–4.3 ms** | — |
|
|
430
|
+
|
|
431
|
+
| Category | Total | Clean | Failures | TP | TN | FP | FN |
|
|
432
|
+
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
|
|
433
|
+
| `cross_harness` | 4 | 2 | 2 | 2 | 2 | 0 | 0 |
|
|
434
|
+
| `false_positive_guard` | 1 | 1 | 0 | 0 | 1 | 0 | 0 |
|
|
435
|
+
| `pagination` | 2 | 1 | 1 | 1 | 1 | 0 | 0 |
|
|
436
|
+
| `pointers` | 6 | 3 | 3 | 3 | 3 | 0 | 0 |
|
|
437
|
+
| `quotes` | 4 | 2 | 2 | 2 | 2 | 0 | 0 |
|
|
438
|
+
| `real_session` | 8 | 4 | 4 | 4 | 4 | 0 | 0 |
|
|
439
|
+
| `scope` | 5 | 2 | 3 | 3 | 2 | 0 | 0 |
|
|
440
|
+
| `subagent` | 2 | 1 | 1 | 1 | 1 | 0 | 0 |
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
## Supported Transcript Formats
|
|
445
|
+
|
|
446
|
+
`handoff-verify` auto-detects the transcript format by default (override with `--parser claude_code|codex|generic`):
|
|
447
|
+
|
|
448
|
+
1. **Claude Code JSONL (`claude_code`)** — Main session and sidechain subagent logs (`assistant` / `user` records with `tool_use` / `tool_result` blocks for `Read`, `Grep`, `Glob`, `LS`, `Bash`, `Edit`, `MultiEdit`, `Write`, `NotebookEdit`, `WebFetch`, and `mcp__*` paginated tools).
|
|
449
|
+
2. **Codex CLI JSONL (`codex`)** — Modern rollout logs (`session_meta`, `turn_context`, `response_item` with `function_call` / `function_call_output`, `custom_tool_call` / `apply_patch`, `local_shell_call`, `event_msg`) as well as legacy flat logs.
|
|
450
|
+
3. **Generic JSONL (`generic`)** — A simple, documented line-delimited JSON schema for integrating any custom agent harness:
|
|
451
|
+
|
|
452
|
+
```jsonl
|
|
453
|
+
{"type": "meta", "cwd": "/workspace/app"}
|
|
454
|
+
{"type": "file_read", "file_path": "src/auth.py", "start_line": 1, "end_line": 20, "content": "def verify(tok):\n return bool(tok)"}
|
|
455
|
+
{"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}
|
|
456
|
+
{"type": "command", "command": "pytest", "stdout": "4 passed in 0.12s\n", "exit_code": 0}
|
|
457
|
+
{"type": "assistant", "text": "Verified `src/auth.py:1-2` (`return bool(tok)`). No other callers of `verify` in the repository."}
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
Supported generic record types: `meta`, `file_read`, `file_edit`, `search`, `command`, `pagination`, `tool_call` / `tool_result`, and `assistant`.
|
|
461
|
+
|
|
462
|
+
---
|
|
463
|
+
|
|
464
|
+
## Development
|
|
465
|
+
|
|
466
|
+
```bash
|
|
467
|
+
uv sync --dev
|
|
468
|
+
uv run ruff check .
|
|
469
|
+
uv run ruff format --check .
|
|
470
|
+
uv run pytest -v
|
|
471
|
+
uv run handoff-verify eval --verbose
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
## License
|
|
475
|
+
|
|
476
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# MVP Plan — handoff-verify
|
|
2
|
+
|
|
3
|
+
Build a production-quality, user-ready MVP across 4 sequenced/parallel PRs.
|
|
4
|
+
|
|
5
|
+
## PR 1 (Foundation — land first on `main`)
|
|
6
|
+
**Branch:** `feat/foundation-parsers`
|
|
7
|
+
- Create `pyproject.toml` (`handoff-verify`, Python `>=3.11`, pure stdlib runtime, `pytest` + `ruff` dev deps, `src/` layout).
|
|
8
|
+
- Define core data models in `src/handoff_verify/models.py`:
|
|
9
|
+
- `ToolEvent`, `FileReadEvent`, `FileEditEvent`, `SearchEvent`, `CommandEvent`, `PaginationEvent`
|
|
10
|
+
- `Claim` (`pointer`, `quote`, `absence`, `completeness`), `Finding` (`severity`, `code`, `claim`, `evidence`, `message`), `VerificationReport`
|
|
11
|
+
- Implement transcript parsers in `src/handoff_verify/parsers/`:
|
|
12
|
+
- `claude_code.py`: parses real Claude Code JSONL transcripts (handles `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write`, `WebFetch`, MCP tool calls, assistant text blocks, tool results, line ranges, truncation markers).
|
|
13
|
+
- `codex.py`: parses Codex CLI JSONL session logs (function/tool calls & outputs, assistant messages).
|
|
14
|
+
- `generic.py`: simple documented JSONL schema + auto-detection (`auto_parse(path)`).
|
|
15
|
+
- Implement CLI skeleton (`src/handoff_verify/cli.py`): `handoff-verify check <transcript>`, `handoff-verify inspect <transcript>`, `handoff-verify --version`.
|
|
16
|
+
- Unit tests covering all 3 parsers + auto-detection + malformed-line resilience.
|
|
17
|
+
|
|
18
|
+
## PR 2 (Deterministic Claim Extractors & Verifiers — parallel after PR 1)
|
|
19
|
+
**Branch:** `feat/verifiers`
|
|
20
|
+
- Implement claim extraction in `src/handoff_verify/extractors.py`:
|
|
21
|
+
- File pointers: `path/to/file.py:42`, `path/to/file.py:10-25`, `file.py#L10-L20`, `file.py (line 42)`, backticked repo paths.
|
|
22
|
+
- Quoted code snippets: inline backticked multi-token code snippets tied to a file/output and fenced code blocks claimed to come from a file or command.
|
|
23
|
+
- Absence & completeness phrases: *"no other callers"*, *"no matches"*, *"not used anywhere"*, *"checked all"*, *"every file"*, *"reviewed all pages"*, *"all results"*.
|
|
24
|
+
- Implement verifiers in `src/handoff_verify/verifiers/`:
|
|
25
|
+
- `pointers.py`: checks whether the cited file was actually read in the transcript, whether the cited line range was within the read window (`offset`/`limit`), and whether the file was subsequently modified (stale read detection via transcript edit events + optional live repo git hash/file line count check).
|
|
26
|
+
- `quotes.py`: verifies quoted snippets against logged file reads and command stdout (exact + whitespace-normalized matching; flags fabricated or mismatched quotes).
|
|
27
|
+
- `scope.py`: on absence/completeness claims, builds a factual scope receipt from the transcript's search/read/pagination events: searched roots vs repo root, excluded/ignored dirs, truncated search/command outputs (`truncated`, `limit reached`, capped results), and unread pagination cursors (`nextCursor`, `has_more`, `page 1 of N`).
|
|
28
|
+
- Wire verifiers into `handoff-verify check` with `--repo <path>`, `--strict`, `--format text|markdown|json`.
|
|
29
|
+
- Comprehensive unit & edge-case tests (avoiding false positives on prose examples, hypothetical code, or non-repo URLs).
|
|
30
|
+
|
|
31
|
+
## PR 3 (Hook Adapters, Formatters & Setup UX — parallel after PR 1)
|
|
32
|
+
**Branch:** `feat/hooks-and-ux`
|
|
33
|
+
- Implement clean formatters in `src/handoff_verify/formatters.py`:
|
|
34
|
+
- Quiet-when-clean compact receipt (1 line or silent with `--quiet-on-pass`).
|
|
35
|
+
- Loud, scannable Markdown anomaly receipt designed for both human readers AND parent agents (actionable next steps: exact unread lines or unsearched roots).
|
|
36
|
+
- Machine-readable JSON output with stable schema version.
|
|
37
|
+
- Implement harness hook adapter in `src/handoff_verify/hooks.py`:
|
|
38
|
+
- `handoff-verify hook claude-code`: reads Claude Code `SubagentStop` / `Stop` JSON payload from stdin, resolves `transcript_path` (or `agent_transcript_path` for subagents), runs verification, respects `stop_hook_active` to prevent infinite loops.
|
|
39
|
+
- Supports `--mode advise` (exit 0, outputs structured feedback JSON `additionalContext` / `systemMessage`) and `--mode block` (exit 2 with concise stderr receipt on unverified claims, max 1 block via `stop_hook_active`).
|
|
40
|
+
- Fail-open wrapper: internal errors log to stderr and exit 0 unless `--fail-closed` is passed.
|
|
41
|
+
- Implement `handoff-verify init --claude-code [--write]` to output or safely merge the hook snippet into `.claude/settings.json`.
|
|
42
|
+
- Integration tests simulating real Claude Code `Stop` and `SubagentStop` stdin JSON payloads.
|
|
43
|
+
|
|
44
|
+
## PR 4 (24-Case Seeded Eval Suite, E2E Polish & User Docs — final PR after PR 2 & PR 3)
|
|
45
|
+
**Branch:** `feat/evals-and-docs`
|
|
46
|
+
- Create `evals/cases/` with 24 realistic synthetic transcripts (12 clean sessions, 12 planted failure modes: unread `path:line`, out-of-window line number, stale read after edit, fabricated snippet quote, truncated grep claimed as "no matches", subdir-only grep claimed as repo-wide "no callers", unread page-2 cursor claimed as "reviewed all", Codex transcript failure, subagent fabricated claim, etc.).
|
|
47
|
+
- Add `handoff-verify eval` command (and pytest integration) that runs all 24 cases and reports precision, recall, false-positive rate, per-category breakdown, and median runtime in ms.
|
|
48
|
+
- Target metrics: **100% precision on clean cases (0 false positives)**, **>=90% recall on planted failures**, **<50ms median latency**.
|
|
49
|
+
- Finalize `README.md` with clear installation (`uvx`, `pip`), 60-second quickstart, Claude Code hook installation, real CLI output examples, JSON schema overview, and measured eval numbers.
|
|
50
|
+
- Ensure end-to-end smoke test via `uv run handoff-verify` passes cleanly.
|