Keep Claude Code working toward a goal with /goal

/goal sets a finish line. After every turn, a second model checks whether the condition is true; if not, Claude starts another turn instead of handing control back to you. The goal clears when the condition is met, when the checker judges it impossible, or when an error you have to fix stops the turn. Here is how to use it without losing control of the clock or the bill.

When it fits

Substantial work with an end state you can verify: migrating a module until every call site compiles and the tests pass, implementing a design doc until each acceptance criterion holds, splitting a big file until each part is under a size limit, or working through a labeled backlog until the queue is empty. For vague or open-ended work, use a normal conversation.

/goal, /loop or a Stop hook?

As we read the docs, /goal is a shortcut for a session-scoped, prompt-based Stop hook. It also pairs with auto mode: auto mode removes the per-tool prompts, /goal removes the per-turn prompts. A goal does not change your permission mode, so in manual mode Claude still asks before anything your settings don't already allow.

Set one

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

Setting a goal starts a turn right away, with the condition as the instruction. One goal can be active per session; a new one replaces the old. A /goal active indicator shows how long it has been running, and you can press Ctrl+O to see the reason behind each verdict.

Write a condition the checker can verify

The checker only judges what Claude has put in the conversation. It does not run commands or open files itself. So write the condition as something Claude's own output can demonstrate: "all tests in test/auth pass" works because Claude runs the tests and the result appears in the transcript. A good condition usually has:

It can be up to 4,000 characters. To bound how long it runs, put a limit in the condition itself, such as or stop after 20 turns; Claude reports progress against it each turn.

Status, clear, resume

Without a screen

claude -p "/goal CHANGELOG.md has an entry for every PR merged this week"

With -p the whole loop runs in one call. With the default text output you only see the final answer, so a long goal can look stuck; add --output-format stream-json --verbose to see each message as it happens. Ctrl+C stops it. More on non-interactive runs in running Claude Code from a script.

How the check works, and what it costs

When Claude finishes a turn, Claude Code sends the condition and the conversation so far to your small, fast model, which answers not yet met (Claude continues, using the reason as guidance), met (the goal clears) or impossible (it clears with the reason recorded). If Claude keeps answering the checker without using any tool for several turns, Claude Code stops the loop and gives control back with the goal still set. The docs say the checker's tokens are billed on the small model and are typically small next to the main turns, so the real cost is the turns themselves; that is why a turn limit in the condition matters. One warning from the docs: ANTHROPIC_DEFAULT_HAIKU_MODEL, which changes the checker's model, also changes the model used for the haiku alias, session titles and some other background tasks.

What clears or pauses a goal

Requirements

/goal is part of the hooks system, so it follows the same workspace-trust rule as hooks in settings files. It is unavailable when disableAllHooks is true or when managed settings allow only managed hooks; the command says why instead of doing nothing.

All the guides are in the guides index. For the hooks behind it, see the hooks guide. This follows Anthropic's /goal documentation as we read it in October 2026. We are not affiliated with Anthropic. We wrote this from the documentation and have not tested every case. Details such as retries, check-ins and requirements depend on your version, and where this page and the documentation disagree, the documentation wins.

The free loop-stop skill gives long tasks a limit and a stop rule, which is the same idea as the turn limit above. If you want a second pair of eyes on your CLAUDE.md and settings, the Tune-Up Kit is a checklist for exactly that.