loop — Recurring Execution
- Trigger:
/loop [interval] [command]or keywords "loop", "recurring", "poll", "watch", "every X minutes" - Best for: Periodic status checks, CI/CD polling, log monitoring, workflow automation
- Not for: One-shot tasks, operations needing immediate feedback
Overview
loop runs a prompt or slash command on a recurring interval. When the interval is omitted, Claude Code determines the optimal check frequency.
Trigger Conditions
loop auto-triggers when you:
- Mention "check every X", "poll", "watch"
- Need to monitor something for state changes
- Use the
/loopcommand
Examples
Example 1: Monitor CI
/loop 5m Check the CI status of the current branch and report failuresChecks CI every 5 minutes; notifies on failure.
Example 2: Self-Paced Loop
/loop Run the test suite, continue to next step when all passNo interval specified — Claude picks the right cadence.
Example 3: PR Monitoring
/loop 3m /babysit-prsExample 4: Log Monitoring
/loop 1m Check dev.log for new ERROR linesExample 5: Workflow Automation
/loop Run lint check before ending each conversationHow It Works
- You specify a prompt and (optionally) an interval
- Claude Code enqueues it for background execution
- Results appear when the conversation is idle
- Loop terminates when the session ends or you stop it
Notes
- Too-frequent loops (< 1 min) create noise and execution cost
- Recurring tasks auto-expire after 7 days
- Don't run destructive operations in loops (deploy, migrate)
- Use
CronCreate/CronDeletetools for fine-grained scheduling - Combine with
cavemanto reduce loop output token costs