Run Claude Code on a schedule with /loop
Sometimes you want Claude to check something again in five minutes, or every hour: is the deploy done, did CI pass, are there new review comments. /loop does that inside the session you already have open. This page covers how it works, how to stop it and where it stops working.
First, decide where it should run
As we read the docs, there are three options with different trade-offs:
- Cloud: runs in the cloud, so your machine and your session can be off; no local files (it works on a fresh clone); shortest interval 1 hour.
- Desktop: runs on your machine, which must be on, but no open session is needed; local files yes; shortest interval 1 minute when Claude sets it.
/loop: runs on your machine and needs the session open; local files yes; shortest interval 1 minute.
Cloud for work that must run without your computer, desktop for local files and tools, /loop for quick polling while you work. The rest of this page is about /loop.
The three ways to start one
/loop 5m check the deploy: an interval and a prompt, on a fixed schedule./loop check the deploy: a prompt only. Claude picks the interval each time./loopalone (or with only an interval): runs a built-in maintenance prompt, or your ownloop.md.
You can also loop a skill: /loop 20m /review-pr 1234. A scheduled run only executes skills Claude is allowed to call on its own; built-in commands such as /clear or /model, skills marked disable-model-invocation and MCP prompts reach Claude as plain text instead.
Fixed interval
Write the interval as a leading token (30m) or a trailing clause (every 2 hours). Units are s, m, h and d. Cron works in whole minutes, so seconds are rounded up, and intervals that don't fit a clean step (7m, 90m) are rounded to the nearest one that does; Claude tells you what it picked.
Let Claude choose
With no interval, Claude waits between one minute and one hour after each pass, depending on what it saw: short while a build finishes or a PR is busy, longer when nothing is pending. It prints the delay and the reason at the end of every iteration. If the Monitor tool is available, Claude may use it instead of polling at all: it runs a background script and streams each output line back, which can be cheaper and quicker than re-running a prompt.
The default prompt and loop.md
A bare /loop works through, in order: unfinished work from the conversation, the current branch's pull request (review comments, failed CI, merge conflicts), then cleanup passes when nothing else is pending. It does not start new projects, and irreversible actions such as pushing or deleting only go ahead when they continue something the transcript already authorized.
To replace that with your own default, create a plain Markdown file at .claude/loop.md (project) or ~/.claude/loop.md (all projects; the project one wins). Write it as if you were typing the /loop prompt. Edits apply on the next iteration, and anything past 25,000 bytes is cut. It is one default prompt, not a list of tasks, and it is ignored whenever you give a prompt on the command line.
Check the release/next PR. If CI is red, read the failing log,
diagnose and push a minimal fix. If new review comments arrived,
address each one. If everything is green and quiet, say so in one line.
Stopping a loop
- Self-paced loop: while it waits for its next pass, press Esc. Claude can also end it itself when the task is done.
- Fixed-interval loop: ask Claude to cancel it ("cancel the deploy check loop"). Esc and Ctrl+C don't stop it.
- Otherwise it expires: recurring tasks delete themselves after seven days, firing once more first. For longer, recreate the task before then, or use a cloud or desktop task.
A loop that never ends is the usual way to burn quota; how to stop agents from looping covers the habits that prevent it.
One-time reminders and managing tasks
For a one-off, just say it: remind me at 3pm to push the release branch or in 45 minutes, check whether the integration tests passed. Claude schedules a single run that deletes itself. To see or remove tasks, ask: what scheduled tasks do I have?, cancel the deploy check job. Behind that are three tools, CronCreate, CronList and CronDelete, and a session holds up to 50 tasks.
How the runs behave
- Runs fire between your turns, never mid-answer. If Claude is busy, the prompt waits.
- Times are your local timezone:
0 9 * * *is 9am where you are, not UTC. - Jitter: to avoid everyone hitting the API at once, a recurring task can start late, by up to half the gap to the next run and at most 30 minutes. The exception is every five minutes, which starts about 15 seconds sooner each time.
- A one-time task set for :00 or :30 can run up to 90 seconds early. If timing matters, pick an odd minute:
3 9 * * *rather than0 9 * * *.
Limits to know
- Tasks fire only while Claude Code is running and idle. Close the terminal and they stop (backgrounding the session keeps
/looptasks alive). - No catch-up: if a run comes due while Claude is busy, it fires once when Claude is free, not once per missed interval.
- With
--resumeor--continue, tasks created withCronCreateare restored unless expired; a self-paced/loopis not, so run/loopagain. Background commands that were running are not restarted. - To switch the whole scheduler off, set
CLAUDE_CODE_DISABLE_CRON=1.
Cron cheat sheet
Five fields: minute, hour, day of month, month, day of week (0 or 7 is Sunday). Wildcards, steps, ranges and lists work; L, W, ? and names like MON don't.
- Nube: se ejecuta en la nube, así que tu máquina y tu sesión pueden estar apagadas; sin archivos locales (trabaja sobre una copia nueva); intervalo mínimo de 1 hora.
- Escritorio: se ejecuta en tu máquina, que debe estar encendida, pero no hace falta sesión abierta; archivos locales, sí; intervalo mínimo de 1 minuto cuando lo fija Claude.
/loop: se ejecuta en tu máquina y necesita la sesión abierta; archivos locales, sí; intervalo mínimo de 1 minuto.
If both day of month and day of week are set, a date matches when either one matches.
All the guides are in the guides index; for scheduling outside a session, see everyday workflows and running Claude Code from a script. This follows Anthropic's scheduled tasks documentation as we read it in October 2026. We are not affiliated with Anthropic. We wrote this from the documentation and have not tested every case. Intervals, limits and some features depend on your version, and where this page and the documentation disagree, the documentation wins.
See also: Work toward a goal with /goal.
The free loop-stop skill gives long tasks a limit and a stop rule. If you want a second pair of eyes on your CLAUDE.md and settings, the Tune-Up Kit is a checklist for exactly that.