Sometime in mid-2026, the interesting question about a Claude Code session stopped being "what do I type next" and became "who decides this is done." With /goal, the answer is deliberately not the model doing the work.
Why Haiku becomes the exit referee
Claude can't be trusted to grade its own loop, so /goal hands the exit decision to a separate, faster model — Haiku by default on the Claude API. The reason is empirical: LLM evaluators show a self-preference bias, scoring their own output higher than an independent judge would, and stronger models can exhibit stronger bias . A generator that also acts as its own stop signal is unreliable, so the verifier is separated from the maker.
Mechanically, /goal sets a completion condition and wraps a session-scoped, prompt-based Stop hook . After each turn, the Haiku evaluator checks your condition against the current transcript — not the main working model that just edited code . The two outcomes are simple:
- "No" → the evaluator's reason is injected back to Claude as guidance for the next turn.
- "Yes" → the goal is cleared and an achieved-condition entry is recorded.
This reframes the developer's job. As Boris Cherny, the Anthropic engineer who built Claude Code, put it in July 2026: "I no longer prompt Claude directly; my job is to write loops that prompt Claude and decide what to do next" . The skill shifts from wording instructions to writing a stop condition an independent referee can confirm.
The v2.1.139 prerequisite
Before you can write that stop condition, check your installed version: /goal requires Claude Code v2.1.139 or later, a build the changelog dates to May 11, 2026 . Earlier builds have no /goal command at all, so run claude --version and update first if the number is lower. The feature is available on all paid plans and the Anthropic API, and is also supported on Amazon Bedrock, Google Cloud's Agent Platform, and Microsoft Foundry .
Once a session is running, the /goal overlay reports three live figures — elapsed time, turn count, and token count . Watch the turn count on a first run, then use it to calibrate the safety clause in your criterion, such as "or stop after 20 turns," so a stalled loop never burns tokens indefinitely.
From subjective to verifiable: phrasing a criterion Haiku can confirm
A good /goal condition names one measurable end state, states the evidence Haiku should read, adds any constraints, and bounds runtime — because the evaluator can only pass or fail against something objective. Conditions can run up to 4,000 characters, but length is not the point; a binary signal is. Write the check so a reader with no context could confirm it from the transcript alone.
Objective conditions produce that binary evidence. Each of these gives Haiku a clean yes/no:
-
Tests: "all tests in
test/authpass and lint exits 0." - Performance: "Lighthouse performance score ≥ 90."
-
Working tree: "
git statusreports no untracked files."
Subjective conditions silently fail to terminate. "Make the code cleaner" or "improve readability" hand Haiku no objective signal to grade against, so it never returns a confident "yes" and the session runs straight to your turn cap — which is why the explicit "or stop after 20 turns" clause matters as a floor, not a goal. Anthropic's own guidance frames stop conditions as objective checks rather than aesthetic ones .
For CI or headless runs, invoke the goal non-interactively with claude -p. One gotcha: default output prints nothing until the loop completes, so add streaming flags to watch progress :
claude -p "/goal all tests in test/auth pass and lint exits 0, or stop after 20 turns" \
--output-format stream-json --verbose
Without --output-format stream-json --verbose, a long CI run looks hung even while Haiku is grading each turn. Pair the streaming flags with the objective condition and you get a loop that both reports its work and knows, unambiguously, when to stop.
What the evaluator cannot inspect
The Haiku grader behind /goal reads only the transcript — it has no tool access, so it cannot execute commands, open files, or call APIs on its own . It judges your completion condition against whatever the working model has already surfaced in the conversation, and nothing more. A condition like "all tests pass" is meaningless to the evaluator unless the test output is sitting in the transcript as text.
The practical implication is that the working model must make its evidence visible before the loop can close. Pipe test output inline, print build exit codes, run git status and echo the result, or show an empty queue — the grader confirms the end state from that captured text, not from re-running anything . If the evidence never reaches the transcript, a genuinely finished task can loop indefinitely.
When transcript evidence is not enough, agent-based Stop hooks — still experimental — offer a stronger check. They can spawn a verifier subagent with Read, Grep, and Glob access for up to 50 turns, letting the checker inspect the repository directly rather than trusting surfaced output . That independence costs more tokens, so reserve it for cases where a passive reader of the transcript would miss what actually matters.
From one-shot to recurring: /schedule and proactive routines
Once a single goal reliably reaches a verifiable end state, the next step is recurrence — running the same evaluated cycle on a clock or an event instead of a prompt. Claude Code splits this into two triggers. /loop is session-scoped: it runs a prompt (or a built-in maintenance prompt, or .claude/loop.md) at fixed minute-level intervals or dynamically chosen delays between one minute and one hour, and carries a seven-day expiry so a forgotten session stops on its own rather than running indefinitely . It needs an open session on your local machine. /schedule is the cloud-hosted equivalent: execution continues on Anthropic infrastructure after you close your laptop, which is the right fit for CI polling, PR-review comment monitoring, or nightly maintenance passes .
| Trigger | Runs on | Survives laptop close? | Best for |
|---|---|---|---|
/goal |
Local session | No | Verifiable now |
/loop |
Local session | No (7-day expiry) | Interval polling while you work |
/schedule |
Anthropic cloud | Yes | CI, PR watch, nightly passes |
For multi-agent work, dynamic workflows (v2.1.154+) let Claude write a JavaScript script that a background runtime executes, orchestrating up to 16 concurrent subagents and 1,000 per run while intermediate results live in script variables rather than the main context; a cost warning fires above 25 agents or 1.5 million projected tokens . Boris Cherny's "Steps of AI Adoption" ladder (July 17, 2026) frames why all of this compounds: /goal alone lands you at Step 2, while Step 3 requires routines plus /loop, /goal, and subagents working together . The takeaway: pick the trigger by durability — /goal when done is checkable now, /schedule when the clock or an external system owns the trigger — and let a separate grader keep every recurrence honest.
Frequently asked questions
Why does /goal use Haiku to grade the stop condition instead of the working model?
Because a model grading its own output is unreliable. LLM evaluators exhibit a self-preference bias — they score their own responses higher than an independent judge would, and stronger models can show a stronger bias . To keep the exit check honest, /goal routes verification to a separate fast evaluator — Haiku by default on the Claude API — that reads the transcript and answers whether the condition is met; a "no" returns its reasoning as guidance for the next turn . Separating the maker from the grader stops the working model from declaring itself done prematurely.
What version of Claude Code do I need for /goal?
/goal requires Claude Code v2.1.139 or later; the changelog dates that build to May 11, 2026 . Earlier builds have no /goal command. Check your installed version before writing conditions, since model defaults and command syntax can shift between releases .
What happens if my /goal condition is subjective — like "make the code cleaner"?
The Haiku evaluator has no objective signal to check against, so it can never confidently return "yes." The session typically runs until the turn cap is reached, burning tokens without a clean exit . Write conditions backed by binary evidence instead — "all tests in test/auth pass and lint is clean" or "Lighthouse ≥ 90" — and bound runtime with a clause such as "or stop after 20 turns" .
What is the difference between /goal, /loop, and /schedule?
They solve different halves of a loop. /goal owns the stop condition: keep working across turns until a measurable criterion is confirmed or a turn cap is hit. /loop owns the trigger: repeat at fixed or dynamically chosen intervals in your open session on your machine, with a seven-day expiry so forgotten loops eventually stop . /schedule is like /loop but cloud-hosted on Anthropic infrastructure, so execution continues after you close your laptop .
Can /goal be used in non-interactive CI pipelines?
Yes, via claude -p. By default the run may print nothing until it completes, which looks like a hang in a pipeline log. Pass --output-format stream-json --verbose to stream per-turn output as it happens .
Top comments (0)