Skip to content
Guides/Tools

Claude Code: /goal vs /loop vs Stop Hook

Short answer

All three keep a Claude Code session running between prompts. /goal starts the next turn when the previous finishes and stops when a fast model confirms your condition is met. /loop re-runs on a time interval. A Stop hook fires after every turn and stops when your own script or prompt decides.

Why it matters

Picking the wrong one wastes turns or never stops. Use /goal for a verifiable end state, /loop for periodic polling, and a Stop hook when you need custom, deterministic checks across every session.

/goal vs /loop vs Stop hook (from the official docs)

/goal vs /loop vs Stop hook (from the official docs)
ApproachNext turn starts whenStops when
/goalThe previous turn finishesA model confirms the condition is met
/loopA time interval elapsesYou stop it, or Claude decides the work is done
Stop hookThe previous turn finishesYour own script or prompt decides
3 of 3 rows

Which to use

  1. 01Have a single verifiable end state?/goal
  2. 02Want to re-run on a schedule or interval?/loop
  3. 03Need custom deterministic checks across sessions?Stop hook

Practical checklist

  • Use /goal for a single verifiable completion condition
  • Use /loop for time-interval polling
  • Use a Stop hook for reusable, scriptable checks
  • Bound /goal by adding “or stop after N turns” to the condition
  • Remember the /goal evaluator only sees what Claude surfaces in the conversation

Example

/goal all tests in test/auth pass and the lint step is clean — Claude works until a fast model (Haiku by default) confirms it. Add “or stop after 20 turns” to bound how long it runs.

Common failure modes

Using /loop when you have a clear end state (use /goal)
A /goal condition the evaluator cannot see in the transcript
No turn or time bound on a long /goal
A Stop hook with no stop decision

Related templates

FAQ

No. Per the official docs, the evaluator does not run commands or read files — it judges what Claude has surfaced in the conversation. So make sure validation results (like a test run) land in the transcript.

Sources & further reading