from line 2
22
33> Use /loop and the cron scheduling tools to run prompts repeatedly, poll for status, or set one-time reminders within a Claude Code session.
44
5Scheduled tasks let Claude re-run a prompt automatically on an interval. Use them to poll a deployment, babysit a PR, check back on a long-running build, or remind yourself to do something later in the session. To react to events as they happen instead of polling, see [Channels](/docs/en/channels): your CI can push the failure into the session directly. To keep the session working turn after turn toward a condition rather than on an interval, see [`/goal`](/docs/en/goal).
5Session-scoped scheduled tasks let Claude re-run a prompt automatically on an interval within a Claude Code session. Use them to poll a deployment, babysit a PR, check back on a long-running build, or remind yourself to do something later in the session.
66
7Tasks are session-scoped. When you resume with `--resume` or `--continue`, Claude Code restores tasks that haven't [expired](#seven-day-expiry), except those listed under [Limitations](#limitations). For scheduling that survives independently of any session, use [Routines](/docs/en/routines) to create a routine on the cloud, set up a [Desktop scheduled task](/docs/en/desktop-scheduled-tasks), or use [GitHub Actions](/docs/en/github-actions).
7<Note>
8 These cases are covered on other pages:
89
10 * **Reacting to events as they happen instead of polling**: see [Channels](/docs/en/channels). Your CI can push the failure into the session directly.
11 * **Keeping the session working turn after turn toward a condition rather than on an interval**: see [`/goal`](/docs/en/goal).
12</Note>
13
14Tasks are session-scoped. When you resume with `--resume` or `--continue`, Claude Code restores tasks that haven't [expired](#seven-day-expiry), except those listed under [Limitations](#limitations). For scheduling that survives independently of any session, create a [cloud scheduled task](/docs/en/routines), set up a [Desktop scheduled task](/docs/en/desktop-scheduled-tasks), or use [GitHub Actions](/docs/en/github-actions).
15
916## Compare scheduling options
1017
1118Claude Code offers three ways to schedule recurring or one-off work:
from line 142
135142
136143Claude pins the fire time to a specific minute and hour using a cron expression and confirms when it will fire.
137144
138## Manage scheduled tasks
145<span id="manage-scheduled-tasks" />
139146
147## Manage session-scoped scheduled tasks
148
140149Ask Claude in natural language to list or cancel tasks, or reference the underlying tools directly.
141150
142151```text theme={null}
from line 166
157166
158167Each scheduled task has an 8-character ID you can pass to `CronDelete`. A session can hold up to 50 scheduled tasks at once.
159168
160## How scheduled tasks run
169<span id="how-scheduled-tasks-run" />
161170
171## How session-scoped scheduled tasks run
172
162173The scheduler checks every second for due tasks and enqueues them at low priority. A scheduled prompt fires between your turns, not while Claude is mid-response. If Claude is busy when a task comes due, the prompt waits until the current turn ends.
163174
164175All times are interpreted in your local timezone. A cron expression like `0 9 * * *` means 9am wherever you're running Claude Code, not UTC.
from line 205
194205
195206### Seven-day expiry
196207
197Recurring tasks automatically expire 7 days after creation. The task fires one final time, then deletes itself. This bounds how long a forgotten loop can run. If you need a recurring task to last longer, cancel and recreate it before it expires, or use [Routines](/docs/en/routines) or [Desktop scheduled tasks](/docs/en/desktop-scheduled-tasks) for durable scheduling.
208Recurring tasks automatically expire 7 days after creation. The task fires one final time, then deletes itself. This bounds how long a forgotten loop can run. If you need a recurring task to last longer, cancel and recreate it before it expires, or use [cloud scheduled tasks](/docs/en/routines) or [Desktop scheduled tasks](/docs/en/desktop-scheduled-tasks) for durable scheduling.
198209
199210## Cron expression reference
200211
from line 224
213224
214225When both day-of-month and day-of-week are constrained, a date matches if either field matches. This follows standard vixie-cron semantics.
215226
216## Disable scheduled tasks
227<span id="disable-scheduled-tasks" />
217228
229## Disable session-scoped scheduled tasks
230
218231Set `CLAUDE_CODE_DISABLE_CRON=1` in your environment to disable the scheduler entirely. The cron tools and `/loop` become unavailable, and any already-scheduled tasks stop firing. See [Environment variables](/docs/en/env-vars) for the full list of disable flags.
219232
220233## Limitations
from line 241
228241
229242For cron-driven automation that needs to run unattended:
230243
231* [Routines](/docs/en/routines): run in the cloud on a schedule, via API call, or on GitHub events
244* [Cloud scheduled tasks](/docs/en/routines): run in the cloud on a schedule, via API call, or on GitHub events
232245* [GitHub Actions](/docs/en/github-actions): use a `schedule` trigger in CI
233246* [Desktop scheduled tasks](/docs/en/desktop-scheduled-tasks): run locally on your machine
234247
No line in this hunk matches that.