Normally Claude Code works until it judges the job done, then hands control back to you. On a big job that means you keep coming back to type “keep going”. /goal changes who decides when to stop. You state a condition, and Claude keeps starting new turns until it holds:
/goal all tests in test/auth pass and the lint step is cleanSetting a goal starts work immediately, with the condition itself as the instruction. There’s one goal per session; setting a new one replaces it. It suits substantial work with a checkable end state: a migration until every call site compiles, a backlog until the queue is empty.
Who decides it’s done
Not the model doing the work. After every turn, Claude Code sends your condition and the conversation so far to a small fast model (Haiku by default on the Claude API). It returns one of three verdicts, each with a short reason:
- Not yet met: Claude takes another turn, using the reason as guidance.
- Met: the goal clears and is recorded as achieved.
- Impossible: the goal clears and is recorded as failed, with the reason.
Under the hood, /goal is a session-scoped, prompt-based Stop hook. A Stop hook in your settings file does the same job for every session; /goal is the one-line version for this session only.
Write a condition it can check
The evaluator doesn’t run commands or read files. It judges only what has already appeared in the conversation. So write a condition Claude’s own output can prove: one measurable end state, the check that proves it (“npm test exits 0”), and anything that must not change on the way there. To bound the run, add a clause like “or stop after 20 turns”.
/goal on its own shows the status: the condition, how long it has run, turns evaluated, token spend and the latest reason. /goal clear stops it early. It also works headless: claude -p "/goal …" runs the loop to completion in one invocation.
The catch
A goal doesn’t change your permission mode. In Manual mode, Claude still asks before tool calls your settings don’t allow, so a goal you want to run unattended needs auto mode. Every extra turn also re-sends a growing context, so a long goal spends real tokens. If a subagent or background command is still running when a turn ends, evaluation waits for it. And errors you have to fix yourself, such as failed authentication or an exhausted credit balance, clear the goal with a warning rather than retrying forever.