Blog
4 min read

Claude Code /goal: Keep Claude Working Until the Job Is Actually Done

/goal sets a completion condition and Claude keeps taking turns until a separate model confirms it's met — no prompting each step. How to write conditions the evaluator can verify, how evaluation and check-ins work, combining it with auto mode, running it headless, and when to use /loop or a Stop hook instead.

Normally Claude Code stops when it thinks it's finished, and hands control back to you. /goal changes that: you state a completion condition, and after every turn a separate model checks whether it holds. If not, Claude starts another turn — no "continue" needed from you.

Details as of October 2026, from Anthropic's /goal docs.

The basics

/goal all tests in test/auth pass and the lint step is clean

That sets the goal and immediately starts working on it. A ◎ /goal active indicator shows how long it's been running.

/goal          show status: condition, time, turns, tokens, last verdict
/goal clear    remove the goal (also: stop, off, cancel)

One goal per session. Setting a new one replaces the old.

How evaluation works

After each turn, Claude Code sends your condition and the conversation to the small fast model (Haiku by default). It returns one of:

  • Not yet met — Claude keeps going, using the reason as guidance.
  • Met — the goal clears and is recorded as achieved.
  • Impossible — the goal clears with the reason why.

The evaluator doesn't run commands or read files. It only judges what Claude has shown in the conversation. That shapes how you write conditions.

Writing a condition that works

Good conditions have:

  • One measurable end state — a test result, an exit code, a count, an empty queue.
  • A stated check — how Claude proves it: "npm test exits 0", "git status is clean".
  • Constraints — what must not change on the way: "without modifying any test files".
/goal every call site of the old fetchUser() is migrated to getUser(),
`npx tsc --noEmit` reports 0 errors, and `npm test` exits 0.
Don't change any files under test/. Stop after 30 turns.

The "stop after 30 turns" clause is a useful budget — the evaluator judges it from Claude's progress reports. Conditions can be up to 4,000 characters.

Weak conditions: "make the code better", "fix the bugs". There's nothing for the evaluator to verify.

Pair it with a permission mode

/goal removes the prompts between turns, not the permission prompts within them. In Manual mode, Claude still stops to ask before running tests. To let it run unattended, use auto mode, which approves safe tool calls on its own. (Claude Code Permission Modes)

When things go wrong

  • Errors you must fix — an auth failure, an exhausted credit balance, a context overflow compaction can't clear, or an unavailable model — clear the goal with a warning. Fix it, then set the goal again.
  • Transient errors (overloaded servers, dropped connections) retry automatically; rate and usage limits pause the goal until you prompt or the limit resets.
  • No progress — if Claude stops using tools for several turns in a row, the loop stops and hands back to you, with the goal still set.

Background work and check-ins

If a subagent or background command is still running when a turn ends, evaluation waits. After 30 minutes of waiting, Claude Code checks in on the running tasks, then backs off (1 hour, then every 2 hours). Change the first interval with CLAUDE_CODE_GOAL_CHECKIN_MINUTES; 0 turns check-ins and automatic retries off.

Running it headless

claude -p "/goal CHANGELOG.md has an entry for every PR merged this week" \
  --output-format stream-json --verbose

Without streaming output, nothing prints until the end, so a long goal can look stuck. (Running Claude Code Headless)

/goal vs /loop vs a Stop hook

Next turn starts when Stops when
/goal The previous turn ends A model confirms the condition (or judges it impossible)
/loop A time interval passes You stop it or the work is done
Stop hook The previous turn ends Your own script or prompt decides

/goal is actually a session-scoped prompt-based Stop hook. If you want the same check on every session, or a deterministic script instead of a model, write a Stop hook in settings. (Claude Code Hooks, Claude Code /loop)

Cost

Evaluation runs on the small model and is usually negligible. The real cost is the extra turns — a long goal can use a lot of your plan. Budget turns in the condition.

The summary

  • /goal <condition> keeps Claude working until a separate model confirms the condition.
  • Write verifiable conditions: a check, an end state, constraints, a turn budget.
  • Combine with auto mode for unattended work; use /goal clear to stop.

EasySpawn runs Claude Code on a persistent server, so a /goal that takes an hour of tests and fixes can finish while you're away — and the results are waiting when you reconnect. See how it works or join the waitlist.

Related: Test-Driven Development With Claude Code · Spec-Driven Development · Evals for Coding Agents · Claude Code Best Practices

Keep reading