Claude Code: /goal vs /loop vs Stop Hook
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)
| Approach | Next turn starts when | Stops when |
|---|---|---|
| /goal | The previous turn finishes | A model confirms the condition is met |
| /loop | A time interval elapses | You stop it, or Claude decides the work is done |
| Stop hook | The previous turn finishes | Your own script or prompt decides |
Which to use
- 01Have a single verifiable end state?/goal
- 02Want to re-run on a schedule or interval?/loop
- 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
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.