Claude Code
Claude Code /loop vs /goal
Use /goal for outcome-based completion. Use /loop for cadence-based repetition. Wrap both with budget, evidence, and approval gates.

Answer-first comparison
| Primitive | Next turn starts when | Stops when | Best for |
|---|---|---|---|
| /goal | The previous turn finishes | A model confirms the condition is met, or you clear/stop it | Substantial work with a verifiable end state |
| /loop | A time interval elapses | You stop it, or Claude decides the work is done | Polling, recurring checks, periodic maintenance |
| Stop hook | The previous turn finishes | Your script or prompt decides | Custom deterministic or model-evaluated checks |
| Scheduled task | A schedule fires outside the session | The scheduled run finishes or is disabled | Work that should run after your laptop/session closes |
Safe examples
| Use case | Prefer | Why |
|---|---|---|
| Fix auth tests until `npm test -- auth` passes | /goal | The end condition is verifiable. |
| Check an issue queue every 30 minutes | /loop or scheduled task | The trigger is cadence, not completion. |
| Run nightly docs freshness checks | Scheduled task | It should run without an open session. |
| Keep refactoring until a file is under 300 lines | /goal | The condition is measurable and bounded. |
Do not skip the wrapper
- State the verifier in the condition or prompt.
- Add a turn/time/token budget.
- Make the approval boundary explicit before merge, deploy, publish, send, delete, or spend.
- Use a worktree or branch for repo-changing loops.
- Write progress to files or PR comments so the next turn has durable state.
QuestionsFAQ
What is the difference between /loop and /goal in Claude Code?
In Claude Code docs, /goal keeps the current session working toward a verifiable condition after each turn, while /loop reruns a prompt on a time interval.
When should I use /goal?
Use /goal when there is a measurable end state such as tests passing, a queue emptying, or acceptance criteria being proven.
When should I use /loop?
Use /loop when the next turn should start on cadence: polling, checking, triage, or periodic maintenance.