Skip to content

Instantly share code, notes, and snippets.

@mgreenly
Created July 1, 2026 16:21
Show Gist options
  • Select an option

  • Save mgreenly/5fb6e8abff200fc5c6505bc65b78bf77 to your computer and use it in GitHub Desktop.

Select an option

Save mgreenly/5fb6e8abff200fc5c6505bc65b78bf77 to your computer and use it in GitHub Desktop.
A continue, next, done ralph loop in claude code with the /loop command
/loop Advance the gather → build → verify prompt cycle by one step (verify wraps back to
gather), using ./project/prompts/cursor.md as the durable current-step marker. Each
iteration: read cursor.md for the current step; if it is missing or empty, the current step
is gather. Dispatch a subagent to read and execute that step's prompt file
(./project/prompts/{gather,build,verify}.md); it ends by emitting a single JSON object of the
form {"status": ..., "message": ...}. Parse its "status" and relay its "message" so progress
stays visible, then act: CONTINUE — leave cursor.md unchanged and loop again. NEXT — write
the next step in the cycle to cursor.md and loop again. DONE — delete cursor.md and stop; do
not schedule another iteration. If a subagent fails, or its final output is not a JSON object
carrying a "status" of exactly CONTINUE, NEXT, or DONE, stop and surface the raw output —
never guess a status, and leave cursor.md unchanged. You are only the orchestrator: you read
and write cursor.md for bookkeeping, but never read the prompt files themselves — subagents
read and execute those.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment