# What does the /loop command do in Claude Code? Explain its syntax, behavior, and use cases in det... ## Retrieval Notes - Session id: `09226888-3945-4f9c-9e89-c7f0e7a408d6` - Last activity: `2026-03-24T20:25:42.969Z` ## My Notes <!-- Add your notes here. This section is preserved across syncs. --> ## Conversation ### User What does the /loop command do in Claude Code? Explain its syntax, behavior, and use cases in detail. ### Assistant ## The /loop Command `/loop` schedules a recurring prompt to fire automatically at a set interval within your current Claude Code session. It's a session-scoped scheduler — tasks live only as long as your terminal is open. ### Syntax ``` /loop 5m check if the deployment finished /loop check the build every 2 hours /loop 20m /review-pr 1234 /loop check the build # defaults to every 10 minutes ``` Supported units: `s` (seconds, rounded up to nearest minute), `m` (minutes), `h` (hours), `d` (days). The interval can go before or after the prompt (with `every`). Omit it entirely and it defaults to 10 minutes. ### How it works Under the hood, `/loop` converts your interval into a cron expression and schedules it. Each tick: - Runs between your turns (never mid-response) - If Claude is busy, the prompt queues and fires when the current turn finishes - Uses your local timezone - Adds a small deterministic jitter (up to 10% of period, capped at 15 min) to prevent sync issues Tasks auto-expire after 3 days to prevent forgotten loops. ### Managing tasks - Ask "what scheduled tasks do I have?" or use CronList - Cancel by ID: "cancel the deploy check job" - Up to 50 tasks per session ### One-shot reminders You can also schedule single-fire reminders: ``` remind me at 3pm to push the release branch in 45 minutes, check whether the tests passed ``` ### Use cases - Polling deployments, builds, or CI pipelines - Babysitting PRs (re-running status checks) - Monitoring long-running migrations or background jobs - Session reminders ### Limitations - Tasks only fire while Claude Code is running and idle — no catch-up for missed intervals - No persistence across restarts (closing terminal cancels everything) - For unattended automation, use `/schedule` (cloud triggers), Desktop scheduled tasks, or GitHub Actions instead - Disable entirely with `export CLAUDE_CODE_DISABLE_CRON=1` *Il `loop` è uno strumento di sorveglianza passiva — delega l'attenzione alla macchina perché la tua si possa rivolgere altrove.*