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.

Abstract Claude Code loop and goal workflow with hooks schedules and verifier checkpoint

Answer-first comparison

PrimitiveNext turn starts whenStops whenBest for
/goalThe previous turn finishesA model confirms the condition is met, or you clear/stop itSubstantial work with a verifiable end state
/loopA time interval elapsesYou stop it, or Claude decides the work is donePolling, recurring checks, periodic maintenance
Stop hookThe previous turn finishesYour script or prompt decidesCustom deterministic or model-evaluated checks
Scheduled taskA schedule fires outside the sessionThe scheduled run finishes or is disabledWork that should run after your laptop/session closes

Safe examples

Use casePreferWhy
Fix auth tests until `npm test -- auth` passes/goalThe end condition is verifiable.
Check an issue queue every 30 minutes/loop or scheduled taskThe trigger is cadence, not completion.
Run nightly docs freshness checksScheduled taskIt should run without an open session.
Keep refactoring until a file is under 300 lines/goalThe condition is measurable and bounded.

Do not skip the wrapper

Questions

FAQ

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.