Without a verification gate, Claude Code quits at 'looks done'

Verification gates, /compact flags, terse CLAUDE.md, and fan-out subagents — Claude Code practices most developers skip.

Without a verification gate, Claude Code quits at 'looks done'
Share

Claude Code will happily tell you a task is finished the moment the output looks right — and stop there. That default, plus a year of near-daily releases, is why most of the useful workflow now lives in features you have to opt into.

What formalized since GA: compaction, background nesting, and fan-out subagents

Between v2.1.147 (May 21) and v2.1.200 (Jul 3, 2026), Claude Code shipped roughly one release per day, promoting behaviors that were undocumented in 2025 into named, first-class features with stable flags . The most important thing to internalize first is a documented default, not a bug: without a runnable check in the prompt, Claude Code terminates when its output "looks done" . Everything below is about closing that gap.

Three recent changes matter for how you configure a session:

  • Rewind now restores context, not just files. As of v2.1.191 (Jun 24, 2026), /rewind can resume context from before a /clear, rather than only reverting file changes .
  • Background subagents are the default. Since v2.1.198, subagents run in isolated context by default and send completion notifications, keeping your main session clean .
  • Auto-permission mode gates scope. Introduced in v2.1.183, --permission-mode auto uses an ML classifier to skip routine approvals while blocking scope escalation and dangerous git/terraform commands — one of seven permission modes .

Because the surface changes weekly, treat specific flags as version-bound and check the changelog before relying on one .

What to have in place before relying on these practices

Without a verification gate, Claude Code quits at 'looks done'

Before you lean on gates, checkpoints, and subagents, confirm four things: a plan tier, a current binary, a clean git repo, and a lean CLAUDE.md. Claude Code ships in Pro at $17/month billed annually (or $20 monthly), with Max starting at $100/month for 5× or 20× the usage headroom . Web-based isolated runs that open PRs require a Team premium seat at $100/seat/month annually .

  • Binary: run claude --version. You need ≥ 2.1.152 for Stop hooks and the /code-review skill, and ≥ 2.1.183 for auto-permission mode .
  • Git history: /rewind snapshots only Claude's file edits, not external process writes, so it is not a git replacement — run git status before any autonomous invocation .
  • CLAUDE.md: run /init to generate a baseline if absent, and keep it under 200 lines before instruction adherence degrades .

Four practices to configure today

Without a verification gate, Claude Code quits at 'looks done'

Four changes pay off within a single session: a verification gate, a trimmed CLAUDE.md, targeted compaction, and a routed subagent. None require plugins or a marketplace install — they are files and commands you already have. Configure them in order, because each one reduces the noise that makes the next one hard to evaluate.

1. Add a verification gate. Anthropic states plainly that Claude stops when work "looks done" unless you give it a check it can run . The cheapest gate is inline: append a runnable check to every non-trivial prompt.

After editing, run: pytest -q
Confirm the process exits 0 before you report the task complete.

For hard enforcement, write a Stop hook in .claude/hooks/ that exits non-zero until the check passes. Treat it as a guardrail, not an absolute — Claude overrides a Stop hook after 8 consecutive blocks .

2. Trim CLAUDE.md. Keep it under 200 lines before instruction adherence degrades, and prefix must-follow rules with "IMPORTANT" or "YOU MUST" — Anthropic confirms emphasis words measurably boost adherence . Put personal overrides in a gitignored CLAUDE.local.md, and import a shared AGENTS.md via @path rather than duplicating content that costs context twice .

3. Replace /clear with /compact. Between large refactors, run /compact Focus on the API surface changes to summarize with intent instead of wiping context. Add a directive in CLAUDE.md such as "always preserve the full list of modified files and test commands" so critical state survives auto-summarization . Use /btw for throwaway questions whose answers must never enter conversation history .

CommandEffect on historyUse when
/clearWipes context entirelySwitching to an unrelated task
/compact <focus>Summarizes, keeps focus threadContinuing a long refactor
/btwAnswer never enters historyThrowaway side question

4. Route broad subtasks to a subagent. Create .claude/agents/reviewer.md with model: haiku in the YAML frontmatter for cheap, fast read-only passes; switch to model: opus for deep analysis. The built-in Explore and Plan subagents deny Write and Edit by default, so they are safe against any codebase . As Anthropic frames it, subagents "run in isolated context with their own tools and model," keeping the main thread clean (source: Claude Code best practices).

Where these practices go sideways

Without a verification gate, Claude Code quits at 'looks done'

The same features that keep context clean can quietly fail if you trust them blindly. Four failure modes account for most surprises, and each has a concrete guard.

First, @path imports in CLAUDE.md recurse up to four hops, and every imported file spends context budget proportionally — a 500-line imported file costs the same as 500 inline lines . Depth-limit failures are silent, so run /context after startup to confirm what actually loaded rather than assuming your imports resolved .

Second, Stop hooks are not hard blocks. Claude overrides a hook after 8 consecutive non-zero exits . For behavior you must prevent, pair the hook with --allowedTools allowlisting at invocation time so the capability is absent, not merely discouraged.

"Hooks are deterministic guarantees rather than advisory context," — Anthropic, Claude Code best practices (source: Claude Code docs).

Third, /rewind restores only edits Claude made during the session. An npm install, a database migration, or any external API call that ran inside a turn is not snapshotted . Always cross-check with git diff after rewinding.

Fourth, side-effecting SKILL.md workflows such as /fix-issue 1234 must set disable-model-invocation: true; omit it and Claude can trigger the skill autonomously, even during summarization .

What to tackle next: fan-out, CI, and adversarial subagents

Once the single-session loop is reliable, scale it outward. For fan-out migrations, scope each worktree with an allowlist and a spend cap, and name the session so it survives interruptions:

claude -p "migrate deprecated API calls" \
  --allowedTools 'Edit,Read' \
  --session my-migration \
  --max-budget-usd 2.00

For CI, run Claude over staged diffs in a pre-commit hook and parse the result; add --json-schema when you need validated structured output from linters or doc generators:

claude -p "$(git diff --cached)" \
  --output-format stream-json --verbose | jq '.result'

For adversarial review, drop a rubric into .claude/agents/critic.md with model: claude-opus-4 so it runs in isolated context, then invoke the bundled /code-review for a fresh read or /code-review --fix to apply findings (v2.1.152–154). To wire external systems, claude mcp add plus claude mcp login connect them without touching CLAUDE.md, and /plugin browses a marketplace that bundles skills, hooks, subagents, and MCP as one shareable unit .

The through-line: none of this is a prompt trick. Get context, verification, and scoped memory right first — then fan-out, CI gates, and critic subagents compound instead of amplifying a shaky loop.

Frequently asked questions

What is a verification gate in Claude Code and why does it matter?

A verification gate is a runnable check — a test command, linter, build exit code, or screenshot diff — that Claude Code must pass before it treats a turn as complete. It matters because, as Anthropic documents, Claude stops when work "looks done" unless you give it a check it can run . Gates escalate in strength: inline in the prompt → a /goal condition re-checked each turn by a separate evaluator → a Stop hook that blocks turn-end until a script exits 0 → an adversarial critic subagent that reviews the diff. Pick the weakest gate that reliably catches the failure you care about.

How long should CLAUDE.md be, and what happens if it's too long?

Keep CLAUDE.md under 200 lines — that is Anthropic's stated recommendation . Auto memory loads at session start, reading the first 200 lines or 25 KB . Beyond that cap the file becomes background noise rather than hard instruction, and adherence to your specific rules degrades silently — no error, no warning. If a rule must always run, encode it as a hook, not a memory line; CLAUDE.md is context, not enforcement .

What is the difference between /clear, /compact, and /btw?

All three manage the context window, which fills fast and degrades performance as it does . /clear wipes conversation history entirely — it frees the most context but loses all working state, so use it only between unrelated tasks. /compact <focus> summarizes with a directional lens (e.g. /compact Focus on the API changes), preserving the context you name while dropping the rest. /btw lets you ask a throwaway side question whose answer is never written into conversation history — ideal for quick orientation questions you don't want polluting the working context .

Can Claude Code subagents use cheaper or faster models?

Yes. Set model: haiku in the YAML frontmatter of .claude/agents/<name>.md to route that subagent to a cheaper, faster model, or model: opus for a deep analysis pass . The main conversation context stays clean regardless of which model the subagent runs, because each subagent executes in isolated context with its own tools. Subagents now run in the background by default with completion notifications, shipped in v2.1.198 .

How do Stop hooks work, and what are their limits?

A Stop hook runs at turn-end and blocks completion until its script exits 0, turning a verification check into a deterministic guarantee rather than advisory context . The key limit: Claude overrides the hook after 8 consecutive non-zero exits , so hooks act as guardrails, not hard walls — pair them with --allowedTools allowlisting for stricter enforcement. Recent releases expanded the hookable lifecycle with SessionStart, MessageDisplay, and post-session events .