Drives a /loop through a handoff-style task queue, executing one task per tick and judging idempotently whether each is already done before acting. State lives in the conversation itself (no sidecar file). Use when running recurring task execution, processing a handoff checklist, or resuming work from a previous session. Keywords loop handoff task queue idempotent resume next steps
Drives a loop that iterates through a handoff-style task list, one task per tick, skipping completed work via LLM judgment rather than marker files or a sidecar accumulator.
Typical invocation:
/loop /loop-handoff-prompt # dynamic pacing
/loop 10m /loop-handoff-prompt # fixed interval
State lives in the conversation itself. Each tick appends its result so the next tick sees what's already done. No files on disk.
Copy this checklist at the top of each response and tick items as you complete them:
- [ ] 1. Locate or generate the handoff prompt
- [ ] 2. Select the next pending task
- [ ] 3. Verify idempotently (is it already done?)
- [ ] 4. Skip or execute
- [ ] 5. Report the delta
- [ ] 6. Decide continuation
Scan the current conversation for a prior block fenced with / .
=== HANDOFF ====== END HANDOFF ===Next Steps section MUST be a numbered list of concrete, verifiable tasks — this is the queue.Each Next Steps item is either:
- [ ] <task> — pending- [x] <task> — done (executed or skipped in a prior tick)Pick the first - [ ] item. If every item is - [x], jump to step 6.
Before executing, check whether the task's stated outcome is already present. Use whichever signals fit the task:
jj log / git log for a commit that already landed itDefault to skepticism. Only mark done when the evidence is concrete. "Probably done" is pending. "File exists but contents differ from the task description" is pending.
- [x] <task> — already present (<one-line evidence>) in the handoff block. Do not re-do the work.One or two sentences. What was executed, what was skipped, what changed. Do not re-print the full handoff — only the tick's delta.
/loop mode, simply return without scheduling another wake-up. In fixed-interval mode, tell the user to cancel the loop.When generating the handoff on the first tick, use this structure. Keep it short — long handoffs eat the context budget the actual work needs.
=== HANDOFF ===
## Context Summary
- Goal: <original request>
- Phase: <planning|implementation|testing|review>
## Next Steps
1. - [ ] <concrete task with verifiable outcome>
2. - [ ] <concrete task with verifiable outcome>
3. - [ ] <concrete task with verifiable outcome>
## Important context
- <key decision, constraint, or pattern>
- <key decision, constraint, or pattern>
=== END HANDOFF ===
Writing good Next Steps: each task should name the file, symbol, or observable outcome so the idempotency check has something to grep for. Vague tasks ("clean up auth") break the whole pattern — rewrite them into concrete slices ("remove unused legacyAuthMiddleware from src/auth/index.ts") before committing to the queue.
[x] or append new ones.~/.claude/commands/handoff.md — the non-loop handoff command this skill is modeled onloop-work skill — sidecar-file alternative: JSON state via state.py, initialized by /loop-plan, strict scope caps, no LLM-judgment idempotency. Use it when you need cross-session durability or survivable state across compaction; use loop-handoff-prompt when you want zero setup and judgment-based skippingclaude-code-best-practices/references/loop-patterns.md — accumulator pattern deep-dive