[{"data":1,"prerenderedAt":50},["ShallowReactive",2],{"blog-scheduled-claude-code-routines":3,"blog-related-scheduled-claude-code-routines":33},{"slug":4,"title":5,"description":6,"category":7,"categoryId":8,"keyword":9,"date":10,"minutes":11,"body":12,"html":13,"headings":14},"scheduled-claude-code-routines","Scheduled Claude Code tasks: recurring routines on autopilot","Four ways to run Claude Code on a schedule: \u002Floop, cloud scheduled tasks (routines), Desktop tasks and plain cron. What each needs, and which to pick.","Agents & automation","agents-automation","scheduled claude code tasks","2026-11-17",5,"You can make Claude Code run on a schedule in four ways: `\u002Floop` inside an open session, cloud scheduled tasks (called routines until recently) that run on Anthropic's infrastructure, Desktop scheduled tasks that run on your machine, or your own cron job calling `claude -p`. They differ in one question that decides everything: does the job need your computer, your files, or a session left open?\n\n## Which scheduling option should you choose?\n\nAnthropic's own comparison, condensed:\n\n| | Cloud | Desktop | `\u002Floop` |\n| --- | --- | --- | --- |\n| Runs on | Anthropic's cloud | Your machine | Your machine |\n| Needs your machine on | No | Yes | Yes |\n| Needs an open session | No | No | Yes |\n| Local files | No, a fresh clone of your repo | Yes | Yes |\n| Shortest interval | 1 hour | 1 minute when Claude sets it, 1 hour in the forms | 1 minute |\n\nRule of thumb: cloud for work that must run reliably while your laptop is shut, Desktop or cron when the job needs local files, and `\u002Floop` for quick polling while you work. Reach for [headless mode with cron](\u002Fblog\u002Fclaude-code-headless-mode) if you want the least moving parts.\n\n## How does \u002Floop work?\n\n`\u002Floop` re-runs a prompt on an interval while the session stays open. You can give it an interval, a prompt, both or neither.\n\n```text\n\u002Floop 5m check if the deployment finished and tell me what happened\n\u002Floop check whether CI passed and address any review comments\n\u002Floop 20m \u002Freview-pr 1234\n```\n\nWith an interval (`s`, `m`, `h` or `d`), Claude turns it into a cron expression and schedules it. Intervals that do not map to a clean cron step, such as `7m` or `90m`, are rounded and Claude tells you what it picked. Without an interval, Claude picks a delay between one minute and one hour after each iteration, shorter while something is changing, longer when nothing is pending. A bare `\u002Floop` runs a built-in maintenance prompt: continue unfinished work, tend to the branch's pull request, then do cleanup passes. Put your own default in `.claude\u002Floop.md` (or `~\u002F.claude\u002Floop.md`) to replace it.\n\nLimits to know before you rely on it:\n\n- Tasks fire only while Claude Code is running and idle. A prompt that comes due mid-response waits for the turn to end.\n- Recurring tasks expire seven days after creation. They fire once more and delete themselves.\n- A session holds up to 50 scheduled tasks.\n- Runs are not exact: a recurring task can start late by up to half the gap to its next run, capped at 30 minutes. Missed runs are not replayed; one fires when Claude is idle again.\n- To stop a fixed-interval loop, ask Claude: \"cancel the deploy check loop\". A self-paced one stops with `Esc`.\n\nOne-off reminders work in plain language: `remind me at 3pm to push the release branch`. Claude pins a cron time and the task deletes itself after running.\n\n## What are cloud scheduled tasks (routines)?\n\nA cloud scheduled task is a saved configuration: a prompt, one or more repositories and a set of connectors. It runs as a full Claude Code session in the cloud, with no need for your laptop. Each can have one or more triggers: a schedule (hourly, nightly, weekly, or once), an API call to its own endpoint with a bearer token, or a GitHub event such as a pull request opening. They are in research preview and available on paid Claude plans.\n\nCreate one at claude.ai\u002Fcode\u002Froutines, from the Desktop app, or in a session:\n\n```text\n\u002Fschedule daily PR review at 9am\n```\n\n`\u002Froutines` is an alias. Good fits from the docs: backlog grooming each weeknight, triaging an alert sent to the API trigger, a custom review checklist on every new pull request, a weekly check for documentation that has drifted from the code.\n\nKeep in mind:\n\n- The run starts from a fresh clone of the repository you pick, so it cannot see uncommitted local files. It works on `claude\u002F`-prefixed branches.\n- The prompt must be self-contained: the task runs autonomously, so say what to do and what success looks like.\n- Connectors you add can write, and everything is done as you (your GitHub identity, your Slack). Remove the ones the task does not need.\n- Runs count against your plan's usage limits; see [Claude Code usage limits](\u002Fblog\u002Fclaude-code-usage-limits).\n\n## How do you schedule with plain cron?\n\nWhen you want a local run with full control, combine cron with `claude -p`:\n\n```sh\n# crontab -e   (weekdays at 08:00)\n0 8 * * 1-5 cd ~\u002Fcode\u002Fapp && claude -p \"Run the test suite and summarize any failure in 5 lines\" --allowedTools \"Bash(npm test *),Read\" >> ~\u002Ftest-report.md 2>&1\n```\n\nDecide permissions explicitly, because nobody is there to approve. `--permission-prompts none` denies anything that would prompt, and `--max-budget-usd` caps spend. Cron starts with a bare environment, so use absolute paths and set up authentication for that user. The details are in the [headless mode article](\u002Fblog\u002Fclaude-code-headless-mode). If the machine is asleep at the time, the run simply does not happen: cron does not catch up.\n\n## How do you write a prompt that is safe to run unattended?\n\nA scheduled run has no one to ask. A few habits:\n\n1. **Make it read-only first.** Start with \"report, don't change\", read the output for a week, then grant edits.\n2. **Give it a definition of done and an output place.** \"Write the summary to `reports\u002F2026-W47.md`\" beats \"look into it\".\n3. **Bound it.** One repository, one branch, a turn or budget cap.\n4. **Make it idempotent.** If a run is missed or doubled, nothing should break.\n5. **Ask for evidence**, such as the command and its output, so the report is verifiable.\n\nTreat anything the job fetches (web pages, issue text) as untrusted input, and [hooks](\u002Fblog\u002Fclaude-code-hooks) as the place for rules that cannot have exceptions.\n\n## In Relais\n\nRelais has scheduling built in. \"Repeat…\" resends a prompt at set times, or every so many minutes, hours or days, in the same session or in a fresh one each time. A session that repeats shows \"next in 3h 12m\" in the sidebar, and the Daily dashboard lists coming runs. It runs while Relais is open: a run waits if Claude is busy, and one missed while the computer slept runs once when it is back, or is offered to you. Agents get routines of their own too, each run a fresh session (reply to mentions every hour, say), and with Keep awake on, Relais holds off idle sleep while an agent has a routine due within the hour. See [features](\u002Ffeatures) and [agents](\u002Fagents).","\u003Cp>You can make Claude Code run on a schedule in four ways: \u003Ccode>\u002Floop\u003C\u002Fcode> inside an open session, cloud scheduled tasks (called routines until recently) that run on Anthropic&#39;s infrastructure, Desktop scheduled tasks that run on your machine, or your own cron job calling \u003Ccode>claude -p\u003C\u002Fcode>. They differ in one question that decides everything: does the job need your computer, your files, or a session left open?\u003C\u002Fp>\n\u003Ch2 id=\"which-scheduling-option-should-you-choose\">\u003Ca class=\"anchor\" href=\"#which-scheduling-option-should-you-choose\" aria-label=\"Link to this section\">#\u003C\u002Fa>Which scheduling option should you choose?\u003C\u002Fh2>\n\u003Cp>Anthropic&#39;s own comparison, condensed:\u003C\u002Fp>\n\u003Cdiv class=\"table-wrap\">\u003Ctable>\u003Cthead>\u003Ctr>\u003Cth>\u003C\u002Fth>\u003Cth>Cloud\u003C\u002Fth>\u003Cth>Desktop\u003C\u002Fth>\u003Cth>\u003Ccode>\u002Floop\u003C\u002Fcode>\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\u003Ctbody>\u003Ctr>\u003Ctd>Runs on\u003C\u002Ftd>\u003Ctd>Anthropic&#39;s cloud\u003C\u002Ftd>\u003Ctd>Your machine\u003C\u002Ftd>\u003Ctd>Your machine\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Needs your machine on\u003C\u002Ftd>\u003Ctd>No\u003C\u002Ftd>\u003Ctd>Yes\u003C\u002Ftd>\u003Ctd>Yes\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Needs an open session\u003C\u002Ftd>\u003Ctd>No\u003C\u002Ftd>\u003Ctd>No\u003C\u002Ftd>\u003Ctd>Yes\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Local files\u003C\u002Ftd>\u003Ctd>No, a fresh clone of your repo\u003C\u002Ftd>\u003Ctd>Yes\u003C\u002Ftd>\u003Ctd>Yes\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Shortest interval\u003C\u002Ftd>\u003Ctd>1 hour\u003C\u002Ftd>\u003Ctd>1 minute when Claude sets it, 1 hour in the forms\u003C\u002Ftd>\u003Ctd>1 minute\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003C\u002Fdiv>\n\u003Cp>Rule of thumb: cloud for work that must run reliably while your laptop is shut, Desktop or cron when the job needs local files, and \u003Ccode>\u002Floop\u003C\u002Fcode> for quick polling while you work. Reach for \u003Ca href=\"\u002Fblog\u002Fclaude-code-headless-mode\">headless mode with cron\u003C\u002Fa> if you want the least moving parts.\u003C\u002Fp>\n\u003Ch2 id=\"how-does-loop-work\">\u003Ca class=\"anchor\" href=\"#how-does-loop-work\" aria-label=\"Link to this section\">#\u003C\u002Fa>How does \u002Floop work?\u003C\u002Fh2>\n\u003Cp>\u003Ccode>\u002Floop\u003C\u002Fcode> re-runs a prompt on an interval while the session stays open. You can give it an interval, a prompt, both or neither.\u003C\u002Fp>\n\u003Cpre class=\"code\" data-lang=\"text\">\u003Ccode>\u002Floop 5m check if the deployment finished and tell me what happened\n\u002Floop check whether CI passed and address any review comments\n\u002Floop 20m \u002Freview-pr 1234\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>With an interval (\u003Ccode>s\u003C\u002Fcode>, \u003Ccode>m\u003C\u002Fcode>, \u003Ccode>h\u003C\u002Fcode> or \u003Ccode>d\u003C\u002Fcode>), Claude turns it into a cron expression and schedules it. Intervals that do not map to a clean cron step, such as \u003Ccode>7m\u003C\u002Fcode> or \u003Ccode>90m\u003C\u002Fcode>, are rounded and Claude tells you what it picked. Without an interval, Claude picks a delay between one minute and one hour after each iteration, shorter while something is changing, longer when nothing is pending. A bare \u003Ccode>\u002Floop\u003C\u002Fcode> runs a built-in maintenance prompt: continue unfinished work, tend to the branch&#39;s pull request, then do cleanup passes. Put your own default in \u003Ccode>.claude\u002Floop.md\u003C\u002Fcode> (or \u003Ccode>~\u002F.claude\u002Floop.md\u003C\u002Fcode>) to replace it.\u003C\u002Fp>\n\u003Cp>Limits to know before you rely on it:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>Tasks fire only while Claude Code is running and idle. A prompt that comes due mid-response waits for the turn to end.\u003C\u002Fli>\n\u003Cli>Recurring tasks expire seven days after creation. They fire once more and delete themselves.\u003C\u002Fli>\n\u003Cli>A session holds up to 50 scheduled tasks.\u003C\u002Fli>\n\u003Cli>Runs are not exact: a recurring task can start late by up to half the gap to its next run, capped at 30 minutes. Missed runs are not replayed; one fires when Claude is idle again.\u003C\u002Fli>\n\u003Cli>To stop a fixed-interval loop, ask Claude: &quot;cancel the deploy check loop&quot;. A self-paced one stops with \u003Ccode>Esc\u003C\u002Fcode>.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>One-off reminders work in plain language: \u003Ccode>remind me at 3pm to push the release branch\u003C\u002Fcode>. Claude pins a cron time and the task deletes itself after running.\u003C\u002Fp>\n\u003Ch2 id=\"what-are-cloud-scheduled-tasks-routines\">\u003Ca class=\"anchor\" href=\"#what-are-cloud-scheduled-tasks-routines\" aria-label=\"Link to this section\">#\u003C\u002Fa>What are cloud scheduled tasks (routines)?\u003C\u002Fh2>\n\u003Cp>A cloud scheduled task is a saved configuration: a prompt, one or more repositories and a set of connectors. It runs as a full Claude Code session in the cloud, with no need for your laptop. Each can have one or more triggers: a schedule (hourly, nightly, weekly, or once), an API call to its own endpoint with a bearer token, or a GitHub event such as a pull request opening. They are in research preview and available on paid Claude plans.\u003C\u002Fp>\n\u003Cp>Create one at claude.ai\u002Fcode\u002Froutines, from the Desktop app, or in a session:\u003C\u002Fp>\n\u003Cpre class=\"code\" data-lang=\"text\">\u003Ccode>\u002Fschedule daily PR review at 9am\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>\u003Ccode>\u002Froutines\u003C\u002Fcode> is an alias. Good fits from the docs: backlog grooming each weeknight, triaging an alert sent to the API trigger, a custom review checklist on every new pull request, a weekly check for documentation that has drifted from the code.\u003C\u002Fp>\n\u003Cp>Keep in mind:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>The run starts from a fresh clone of the repository you pick, so it cannot see uncommitted local files. It works on \u003Ccode>claude\u002F\u003C\u002Fcode>-prefixed branches.\u003C\u002Fli>\n\u003Cli>The prompt must be self-contained: the task runs autonomously, so say what to do and what success looks like.\u003C\u002Fli>\n\u003Cli>Connectors you add can write, and everything is done as you (your GitHub identity, your Slack). Remove the ones the task does not need.\u003C\u002Fli>\n\u003Cli>Runs count against your plan&#39;s usage limits; see \u003Ca href=\"\u002Fblog\u002Fclaude-code-usage-limits\">Claude Code usage limits\u003C\u002Fa>.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch2 id=\"how-do-you-schedule-with-plain-cron\">\u003Ca class=\"anchor\" href=\"#how-do-you-schedule-with-plain-cron\" aria-label=\"Link to this section\">#\u003C\u002Fa>How do you schedule with plain cron?\u003C\u002Fh2>\n\u003Cp>When you want a local run with full control, combine cron with \u003Ccode>claude -p\u003C\u002Fcode>:\u003C\u002Fp>\n\u003Cpre class=\"code\" data-lang=\"sh\">\u003Ccode># crontab -e   (weekdays at 08:00)\n0 8 * * 1-5 cd ~\u002Fcode\u002Fapp &amp;&amp; claude -p &quot;Run the test suite and summarize any failure in 5 lines&quot; --allowedTools &quot;Bash(npm test *),Read&quot; &gt;&gt; ~\u002Ftest-report.md 2&gt;&amp;1\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Decide permissions explicitly, because nobody is there to approve. \u003Ccode>--permission-prompts none\u003C\u002Fcode> denies anything that would prompt, and \u003Ccode>--max-budget-usd\u003C\u002Fcode> caps spend. Cron starts with a bare environment, so use absolute paths and set up authentication for that user. The details are in the \u003Ca href=\"\u002Fblog\u002Fclaude-code-headless-mode\">headless mode article\u003C\u002Fa>. If the machine is asleep at the time, the run simply does not happen: cron does not catch up.\u003C\u002Fp>\n\u003Ch2 id=\"how-do-you-write-a-prompt-that-is-safe-to-run-unattended\">\u003Ca class=\"anchor\" href=\"#how-do-you-write-a-prompt-that-is-safe-to-run-unattended\" aria-label=\"Link to this section\">#\u003C\u002Fa>How do you write a prompt that is safe to run unattended?\u003C\u002Fh2>\n\u003Cp>A scheduled run has no one to ask. A few habits:\u003C\u002Fp>\n\u003Col>\n\u003Cli>\u003Cstrong>Make it read-only first.\u003C\u002Fstrong> Start with &quot;report, don&#39;t change&quot;, read the output for a week, then grant edits.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Give it a definition of done and an output place.\u003C\u002Fstrong> &quot;Write the summary to \u003Ccode>reports\u002F2026-W47.md\u003C\u002Fcode>&quot; beats &quot;look into it&quot;.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Bound it.\u003C\u002Fstrong> One repository, one branch, a turn or budget cap.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Make it idempotent.\u003C\u002Fstrong> If a run is missed or doubled, nothing should break.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Ask for evidence\u003C\u002Fstrong>, such as the command and its output, so the report is verifiable.\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cp>Treat anything the job fetches (web pages, issue text) as untrusted input, and \u003Ca href=\"\u002Fblog\u002Fclaude-code-hooks\">hooks\u003C\u002Fa> as the place for rules that cannot have exceptions.\u003C\u002Fp>\n\u003Ch2 id=\"in-relais\">\u003Ca class=\"anchor\" href=\"#in-relais\" aria-label=\"Link to this section\">#\u003C\u002Fa>In Relais\u003C\u002Fh2>\n\u003Cp>Relais has scheduling built in. &quot;Repeat…&quot; resends a prompt at set times, or every so many minutes, hours or days, in the same session or in a fresh one each time. A session that repeats shows &quot;next in 3h 12m&quot; in the sidebar, and the Daily dashboard lists coming runs. It runs while Relais is open: a run waits if Claude is busy, and one missed while the computer slept runs once when it is back, or is offered to you. Agents get routines of their own too, each run a fresh session (reply to mentions every hour, say), and with Keep awake on, Relais holds off idle sleep while an agent has a routine due within the hour. See \u003Ca href=\"\u002Ffeatures\">features\u003C\u002Fa> and \u003Ca href=\"\u002Fagents\">agents\u003C\u002Fa>.\u003C\u002Fp>\n",[15,18,21,24,27,30],{"id":16,"text":17},"which-scheduling-option-should-you-choose","Which scheduling option should you choose?",{"id":19,"text":20},"how-does-loop-work","How does \u002Floop work?",{"id":22,"text":23},"what-are-cloud-scheduled-tasks-routines","What are cloud scheduled tasks (routines)?",{"id":25,"text":26},"how-do-you-schedule-with-plain-cron","How do you schedule with plain cron?",{"id":28,"text":29},"how-do-you-write-a-prompt-that-is-safe-to-run-unattended","How do you write a prompt that is safe to run unattended?",{"id":31,"text":32},"in-relais","In Relais",[34,40,45],{"slug":35,"title":36,"description":37,"category":7,"categoryId":8,"keyword":38,"date":10,"minutes":39},"ai-agents-with-a-browser","AI agents that use a browser: what works and what breaks","What AI agents with a browser do well (testing, reading, forms), where they fail (logins, CAPTCHAs, dialogs), and how to give one a browser safely.","ai agents with a browser",6,{"slug":41,"title":42,"description":43,"category":7,"categoryId":8,"keyword":44,"date":10,"minutes":11},"claude-code-headless-mode","Claude Code in headless mode: scripts, cron and CI","Run Claude Code without the interface using claude -p: pipe input, get JSON, pre-approve tools safely, resume sessions, and wire it into cron or CI.","claude code headless mode",{"slug":46,"title":47,"description":48,"category":7,"categoryId":8,"keyword":49,"date":10,"minutes":11},"ai-agents-as-a-company","Running a group of AI agents like a small company","How to organize AI agents like a small company: roles, a manager, a shared task board, approvals and routines, and the mistakes that make teams drift.","ai agents as a company",1794931098789]