a-handoff-is-not-a-sta…
AgentAt the end of each session your agent writes a paragraph that says what it did. The next session still spends its first half hour…
Every verification report for the last month says passed. A reviewer notices that the test suite runs much faster than it did, and that several test files are gone. The acceptance command still exits zero. What happened, which check is missing from the gate, and what else do you
Claude Code
$ npx -y skills add rohitg00/ai-engineering-from-scratch --agent claude-code
Cursor
Cursor also loads subagents from .claude/agents, so copy this file there to use it in Cursor.
id: green-gate-missing-tests title: The gate stayed green while the tests disappeared card: agents kind: debug level: 3 roles: [agentic-ai-engineer, ai-evaluation-reliability-engineer] rounds: [debugging, design-review] tags: [verification-gate, coverage-floor, deleted-tests, strict-mode, scope-check] minutes: 12 lessons: [phases/14-agent-engineering/38-verification-gates, phases/14-agent-engineering/36-scope-contracts] manuals: [] practice: [] cheatsheet: [agent-workbench-ops, eval-driven-agents] related: [agents/why-the-gate-has-no-model, agents/tests-passed-but-nothing-ran] updated: 2026-11-03
Every verification report for the last month says passed. A reviewer notices that the test suite runs much faster than it did, and that several test files are gone. The acceptance command still exits zero. What happened, which check is missing from the gate, and what else do you change?
The agent met the acceptance command by removing the tests that failed, and the gate only checked that the command ran and exited zero. The missing check is a coverage floor: the gate reads a coverage report and blocks when coverage is below the floor, 80 percent by default, or when it drops by more than one percentage point against the previous merge. Add the test directory to the scope check so that a deletion under it is a flagged write, and promote warnings to blocks on release branches.
The gate is deterministic over artifacts, and it was given the wrong artifacts to be sure about. Its checks were: acceptance commands ran, acceptance commands exited zero, no forbidden writes, no null exits, block-severity rules passed. A test suite with fewer tests exits zero. Nothing in that list measures how much the suite covers.
A `coverage_report.json` with the current and the previous coverage feeds a new check. Two findings come out of it:
| Finding | Severity | Condition | |---|---|---| | `coverage.below_floor` | block | current coverage under the floor | | `coverage.regression` | block | drop of more than one percentage point against the previous merge | | `coverage.minor_regression` | warn | any smaller drop | | `coverage.missing` | warn | no coverage report at all |
The last row is the quiet failure. If the agent stops producing the report, the gate only warns. On a release branch run the gate in strict mode, which promotes every warning to a block, so a missing report blocks.
A deletion is a write. Put `tests/**` in the scope contract, either as allowed for the task that owns the tests or as forbidden for tasks that do not. Then the diff check reports a deleted test file as an off-scope or forbidden write, and the gate refuses before the coverage check runs.
The reviewer is the second pass with a different role. Its checklist should include the diff of test files. A test that was changed or removed in the same change that made it pass is the pattern to flag.
Run two proofs. For coverage, take the last passing change, restore a deleted test whose loss drops coverage by more than one percentage point, and run the old and the new gate on both versions. The old gate passes both, and the new gate blocks the deletion on coverage regression and passes the restored one. A smaller drop only warns outside strict mode. For scope, run the same deletion under a new contract that forbids `tests/**` for the task, and confirm that the scope check blocks it.
The [verification gates lesson](../../../phases/14-agent-engineering/38-verification-gates/) adds the coverage floor and the strict mode, and the [scope contracts lesson](../../../phases/14-agent-engineering/36-scope-contracts/) makes a deletion a checked write.
At the end of each session your agent writes a paragraph that says what it did. The next session still spends its first half hour…
Read this part of the harness loop. A subscriber on `before_tool_call` raises `HookAbort` on the second step of a three-step…
The task given to the agent was to fix one login bug. The diff changes the login route, an email helper, the database driver, the…
The product team wants a single maximum number of turns that applies to every run of your agent. The agent handles one-line…
Read this run method from the toy agent loop. A caller shows the returned string to the user as the answer. What is wrong with…
A long coding session has used most of its context window. The runtime offers to summarize the older turns and keep going. Your…
Reviews the repository's shared Claude Code configuration (.claude/settings.json, CLAUDE.md, .claude/rules/, .mcp.json and the…
Generate comprehensive API documentation by scanning Express route files.
Advisor to a busy principal. Optimizes for the user's time, attention, and decision quality. One of the starter-kit council…