David WalshSubscribe
Claude Code · v2.1.139 · 11 May 2026

/goalKeep going until the
condition is actually met.

A per-turn condition check built into Claude Code's CLI. You write the completion criterion; a separate small fast model reads each turn and decides whether you're done — closing the gap between “Claude says it's finished” and “the tests actually pass.”

Shipped
May 11 · 18:43 UTC
Surfaces
3 TUI · -p · Remote
Condition cap
4,000 chars
Native spend cap
None — bound it yourself
Anatomy of the loop

A second model, judging from the transcript.

A normal prompt stops when Claude judges its own work done. /goaladds a fresh judge after every turn, so completion isn't decided by the model with skin in the game.

01 · You
Write the condition
Up to 4,000 chars. One measurable end-state, the proof method, and any constraints.
02 · Claude
Takes a turn
Calls tools, edits files, runs commands. The condition itself is the directive.
03 · Stop hook
Session-scoped wrapper
Intercepts the turn end. Forwards the transcript + condition to the evaluator.
04 · Haiku
Reads, judges, replies
Returns yes/no + a one-line reason. Cannot call tools — only text in the transcript.
05 · Outcome
Continue or clear
Yes clears the goal and logs the achievement. No is fed back as guidance for the next turn.
on "no" → loop
Try it

The loop, simulated.

Pick a scenario, set the goal, and watch each turn get judged by Haiku. The status overlay tracks elapsed time, turns, and tokens — exactly as the real overlay does.

claude · ~/repo · zsh
/goal idle
$ claude
Claude Code 2.1.139 · accepted trust dialog · ready.
 
› Pick a scenario from the panel and press Set goal to start the loop.
 
› After each Claude turn, the small fast model (Haiku) reads the transcript
  and answers yes/noagainst your condition. “no” forces another turn.

Status overlay

◎ /goal (none)
— no goal set —
00:00
Elapsed
0
Turns
0
Tokens

Try a goal

When it fits — and when it doesn't

Forward motion to a verifiable state.

Use it for

Mechanical, long-horizon, verifiable

  • Migrating a module to a new API until every call site compiles and tests pass.
  • Splitting a large file into focused modules until each is under a size budget.
  • Working through a labeled issue backlog until the queue is empty.
  • Implementing a design doc until all acceptance criteria hold.
  • Backfilling docs, changelogs, or test coverage to a measurable target.
Don't use it for

Vague quality goals

  • "The code is clean and idiomatic." — no objective signal in the transcript.
  • "The architecture is well-designed." — Haiku can't judge taste.
  • Anything where Claude could fool the judge by summarising rather than showing.
  • Open-ended exploration — you want plan mode, not goal mode.
  • Production deploys with no spend cap and no human in the loop.
In the autonomy stack

One layer in a larger control plane.

/goal is the missing per-turn check. Compose it with auto mode for fully unattended runs; reach for the others when you need scheduling, isolation, or rubrics.

FeatureWhat starts the next turnWhat stops the loopScope
/goalPrevious turn finishesHaiku confirms condition met (or /goal clear)Per-turn
/loopA time interval elapsesYou stop it, self-declared done, or 7-day expirySchedule
Stop hookPrevious turn finishesYour script decidesSettings file
Auto modeTool call requestedClaude judges work doneWithin a turn
Routines / Desktop tasksA cron scheduleEach invocation is one-shotSchedule
CoworkUser promptUser stops; runs in isolated VMDesktop session
Managed Agents OutcomesManaged-agent session startRubric-based grader returns satisfiedPer-agent
Provenance

The pattern is older than the command.

Anthropic productised something the community had bolted on for the better part of a year. The novelty is the chrome — first-class slash command, status overlay, headless support — not the loop itself.

Jul 14, 2025
Ralph Wiggum.Geoffrey Huntley's essay coins the canonical bash form of the pattern: re-feed a prompt to Claude until a done-token appears.
Late 2025
Community skills. jthack/claude-goal and chrischabot/claude-code-goal ship as Claude Agent skills with pause/resume and token caps.
Mar 23, 2026
Long-running Claude. Anthropic research post on scientific computing describes the same idea in formal terms.
Apr 30, 2026
Codex CLI 0.128.0. OpenAI ships its own /goal — durable runtime state, pause/resume across process restarts.
May 6, 2026
Code w/ Claude conf. Dreaming, Outcomes, multi-agent orchestration, Claude Design. /goal is not announced.
May 11, 2026
v2.1.139 ships. Commit fdfbc06 by ashwin-ant. One-line changelog, no blog post.
Caveats & limits

What it doesn't do — yet.

The feature is days old. Treat the first week as a public beta, even though it isn't labelled as one.

01

No native spend cap

Misjudged conditions can run for hours. Bound it in the condition ("…or stop after 20 turns") or rely on plan-level rate limits.

02

Evaluator can be fooled

Haiku reads text only. If Claude summarises results instead of showing exit codes, the judge may green-light an unmet goal.

03

Trust dialog required

Built on the hooks system. If your enterprise policy sets disableAllHooks, /goal tells you why instead of silently no-op'ing.

04

One goal per session

Setting a new one replaces the old. No native parallel goals; subagent-with-verifier fanout is manual orchestration.

05

Resume resets counters

Condition survives --resume and --continue. Elapsed time, turn count, and token baseline all restart at zero.

06

Bedrock / Vertex / Foundry

Evaluator runs on your configured provider. Tokens billed there. Anthropic notes the cost is typically negligible — but not free.

Recommendation

Start small. Bound the loop. Always.

Try it first on a goal you know has two or three small failures — calibrate how Haiku reads your conditions before you trust it overnight. Pair with auto mode only inside a worktree, and always include a bounding clause until your phrasing is dialed in.

/goal all tests in test/auth pass and lint is clean,
or stop after 15 turns
↑ the bounding clause is the only thing standing between you and an overnight credit burn.