A scheduled task tells Claude Code: “Run this prompt later or run it repeatedly.”
The current Claude Code documentation describes two closely related ways to do this inside a session:
/loop — the quickest way to repeat a prompt while the session stays open.| Option | Runs on | Machine must be on? | Open session? | Local files? | Minimum interval |
|---|---|---|---|---|---|
| Cloud | Cloud / Anthropic-managed by default | No | No | No — fresh clone | 1 hour |
| Desktop | Your machine | Yes | No | Yes | 1 minute |
| /loop | Your machine | Yes | Yes | Yes | 1 minute |
/loop for quick polling during an active session.
/loop is a bundled skill designed for repeated work.
/loop 5m check if the deployment finished and tell me what happened
This asks Claude to run the prompt repeatedly on a fixed cadence.
/loop check the deploy
When no interval is supplied, Claude dynamically chooses the delay between iterations.
/loop
A bare /loop uses the built-in maintenance prompt, or your custom loop.md if one exists.
/loop 20m /review-pr 1234
A scheduled fire can invoke skills only when Claude is allowed to invoke them on its own.
You can write the interval before the prompt or as a natural-language clause.
| Example | Meaning |
|---|---|
/loop 5m check the deploy | Run every 5 minutes. |
/loop 30m check CI | Run every 30 minutes. |
/loop 2h check the PR | Run every 2 hours. |
/loop check CI every 2 hours | Interval can also appear as a clause. |
Supported interval units are:
7m or 90m, are rounded to a suitable interval and Claude tells you what it selected.
If you omit the interval, Claude chooses a delay dynamically after each iteration.
The delay is between 1 minute and 1 hour, based on what Claude observes.
/loop check whether CI passed and address any review comments
After each iteration Claude reports the chosen delay and why it selected it.
When you run:
/loop
Claude uses a built-in maintenance prompt unless you provide a custom loop.md.
The maintenance behavior works roughly in this order:
You can replace the default maintenance prompt with your own instructions.
Claude Code checks these locations:
| File | Scope |
|---|---|
.claude/loop.md | Project-level. Takes precedence. |
~/.claude/loop.md | User-level. Applies to projects without a project-level file. |
Example:
Check the release/next PR. If CI is red, pull the failing job log, diagnose, and push a minimal fix. If new review comments have arrived, address each one and resolve the thread. If everything is green and quiet, say so in one line.
The file is plain Markdown. You write it as if you were typing the /loop prompt directly.
loop.md take effect on the next iteration. Keep the file concise; content beyond 25,000 bytes is truncated.
For a self-paced /loop waiting for its next iteration, press Esc.
There is an important distinction:
| Task type | Esc | Cancellation behavior |
|---|---|---|
Self-paced /loop | Stops the pending wakeup. | Claude can also stop itself when complete. |
| Task created by asking Claude directly | Not affected. | Cancel/delete the scheduled task. |
If an iteration finishes without rescheduling or stopping, Claude Code schedules a fallback wakeup of about 20 minutes and ends the loop if the next iteration also does not reschedule.
For a one-shot reminder, use natural language instead of /loop.
remind me at 3pm to push the release branch
in 45 minutes, check whether the integration tests passed
Claude schedules a single-fire task that deletes itself after running.
You can manage tasks using natural language.
what scheduled tasks do I have?
cancel the deploy check job
Under the hood, Claude Code uses three cron tools:
| Tool | Purpose |
|---|---|
CronCreate | Create a scheduled task. It accepts a 5-field cron expression, prompt, and recurrence/one-shot behavior. |
CronList | List scheduled tasks with IDs, schedules, and prompts. |
CronDelete | Cancel a task by ID. |
Each scheduled task has an 8-character ID. A session can contain up to 50 scheduled tasks at once.
0 9 * * * means 9:00 AM in the local timezone where Claude Code is running — not UTC.
Claude Code adds deterministic timing offsets to reduce many sessions hitting the API at exactly the same wall-clock moment.
| Task | Jitter behavior |
|---|---|
| Recurring task | May fire up to 30 minutes after the scheduled time, or up to half the interval for jobs more frequent than hourly. |
| One-shot at :00 or :30 | May fire up to 90 seconds early. |
The offset is derived from the task ID, so the same task gets the same offset.
:00 or :30. For example, use 3 9 * * * instead of 0 9 * * *.
Recurring session-scoped tasks automatically expire 7 days after creation.
The task fires one final time and then deletes itself.
CronCreate accepts a standard five-field cron expression:
minute hour day-of-month month day-of-week
| Expression | Meaning |
|---|---|
*/5 * * * * | Every 5 minutes |
0 * * * * | Every hour on the hour |
7 * * * * | Every hour at 7 minutes past |
0 9 * * * | Every day at 9 AM local time |
0 9 * * 1-5 | Weekdays at 9 AM local time |
30 14 15 3 * | March 15 at 2:30 PM local time |
* — wildcard5 — single value*/15 — step1-5 — range1,15,30 — listDay-of-week uses 0 or 7 for Sunday through 6 for Saturday.
L, W, ?, and aliases such as MON or JAN are not supported.
When both the day-of-month and day-of-week fields are constrained, a date matches if either field matches. This follows standard vixie-cron semantics.
Scheduled tasks belong to the current Claude Code session/conversation.
Tasks can be restored when you resume a session with --resume or --continue, subject to the documented exceptions.
| Situation | What happens |
|---|---|
| Claude Code is running and idle | Tasks can fire. |
| Terminal/session closes | Session-scoped tasks stop firing. |
| Claude is busy | Due task waits until the current turn ends. |
| Missed multiple intervals | No catch-up for every missed fire; it fires once when Claude becomes idle. |
--resume / --continue | Some CronCreate tasks are restored if still valid. |
Self-paced /loop | Not restored; start it again. |
Suppose you schedule a task every 10 minutes, but Claude is busy for 35 minutes.
| Feature | /loop | Scheduled task via CronCreate |
|---|---|---|
| Quick interactive setup | Excellent | Usually indirect / via Claude |
| Repeat prompt | Yes | Yes |
| One-time reminder | Not the primary method | Yes |
| Natural-language management | Yes | Yes |
| Task ID | Managed as loop/task | 8-character ID |
| Long-term persistence | No; seven-day session scheduling limits apply | Same session-scoped constraints |
/goal rather than repeatedly running a fixed prompt.| Feature | Scheduled Tasks | Channels | Goals |
|---|---|---|---|
| Trigger | Time interval / clock | External event | Progress toward a condition |
| Typical use | Poll CI, PR, deployment | Receive Telegram/Discord/etc. event | Keep working until condition is reached |
| Polling | Yes | No — event-driven | Not the main idea |
| Best mental model | “Check again later.” | “Tell me when something happens.” | “Keep going until this is true.” |
/loop 10m check whether the staging deployment finished. If it failed, inspect the failure and summarize the likely cause.
/loop 15m check the current PR for new review comments, failed CI, or merge conflicts. Tell me only if something changed.
in 45 minutes, check whether the integration tests passed
/loop 1d inspect the current branch for unfinished work and summarize anything that still needs attention
/loop 10m check the staging frontend deployment. If the build failed, inspect the build output and identify the first actionable error.
This can be useful when you are actively working on a frontend deployment and want Claude Code to periodically check progress.
/loop 10m check whether the Spring Boot deployment is healthy. Inspect the available logs and report startup failures, database connection errors, or failing health checks.
You can disable the scheduler entirely with:
CLAUDE_CODE_DISABLE_CRON=1
When disabled:
/loop becomes unavailable.| Mistake | Why it is a problem | Better approach |
|---|---|---|
| Assuming tasks run after closing the terminal | Session-scoped tasks need Claude Code running. | Use Desktop/Cloud/Routines/GitHub Actions for durable work. |
| Expecting exact :00 timing | Scheduler jitter can shift execution. | Use a non-:00/:30 minute when timing matters. |
| Expecting missed runs to catch up | Missed intervals are not replayed individually. | Design the prompt to check current state. |
| Creating an endless loop | Recurring tasks expire after seven days. | Recreate or use durable scheduling. |
| Using polling for an event | Repeated prompts can waste tokens. | Prefer Channels when an external event can be pushed. |
Using /loop for a condition | Fixed polling is not always the best model. | Consider /goal. |
/loop.
/goal.
/loop and a one-time reminder?/loop?loop.md?loop.md be located?CronCreate, CronList, and CronDelete?loop.md for monitoring a release PR.| Need | Use |
|---|---|
| Repeat every 5 minutes | /loop 5m <prompt> |
| Let Claude choose the interval | /loop <prompt> |
| Default maintenance loop | /loop |
| Custom default loop | .claude/loop.md or ~/.claude/loop.md |
| One-time reminder | Natural language: “remind me …” |
| List tasks | “what scheduled tasks do I have?” |
| Cancel a task | “cancel the … job” |
| Disable scheduler | CLAUDE_CODE_DISABLE_CRON=1 |
| Durable cloud schedule | Cloud Routines |
| Durable local schedule | Desktop scheduled tasks |
| CI schedule | GitHub Actions |
| External event trigger | Channels |
| Work toward a condition | /goal |
/loop = the fastest active-session polling mechanism.