skip to content

Schedules & Routines

/loop polls inside an open session, Desktop tasks run on your machine, and routines run in the cloud on a schedule, API call or GitHub event. Asked because each fails differently when a laptop sleeps.

part ofClaude Coderead it →
on this pageshow

explore

questions

5

In Claude Code, how do /loop, Desktop scheduled tasks and cloud routines differ, and which one survives a closed laptop?

level: seniorimportance: must knowfreq 20%

answer

  1. where the work physically runs
  2. open session versus machine awake
  3. lid shut means cloud
  4. fresh clone, no local files
  5. one-minute versus one-hour minimum

basics

~20 s

/loop fires only inside an open CLI session; a Desktop scheduled task starts local sessions while the app runs and the computer is awake; a routine runs in the cloud, so only a routine survives a closed laptop.

solid answer

~50 s

All three re-run a prompt, but they live in different places. `/loop` (with `CronCreate` underneath) fires only while that CLI session is running and idle. A **Desktop scheduled task** starts a fresh local session per run with your files and tools, but only while the Desktop app runs and the computer is awake — a slept-through time is skipped and one catch-up runs on wake. A **routine** (research preview) is a cloud session started by a schedule, an API call or a GitHub event, so it keeps running with the lid shut, but it works on a fresh clone rather than your local files, runs without permission prompts, and its schedule cannot go below one hour. So: a five-minute deploy poll is `/loop 5m`, a morning check needing local state is a Desktop task, and a weekly report while you are away is a routine.

go deeper

for a junior

Recall the three names and the one-line rule: /loop lives in an open session, Desktop tasks need the app and an awake machine, routines run in the cloud.

for a middle

Explain the comparison table: local files versus a fresh clone, the one-minute against one-hour minimum, and how each handles permission prompts.

for a senior

Show you can predict each failure: a closed terminal ends /loop, a sleeping laptop skips a Desktop run and catches up once, a routine keeps going but cannot see local state.

for a principal

Weigh reach against reliability: local schedulers see your environment but depend on your hardware, routines are reliable but act autonomously as your account, so scope repositories, network and connectors deliberately.

## Three schedulers, three places to run Claude Code can re-run a prompt on a schedule in three different ways, and the difference between them is not the syntax but **where the work physically runs** and what has to stay alive for it to fire: - **`/loop`** — a bundled skill in the CLI that schedules a prompt inside the session you are typing in. Under it sit the `CronCreate`, `CronList` and `CronDelete` tools. The tasks are **session-scoped**: they fire only while that Claude Code process is running and idle. - **Desktop scheduled tasks** — created in the Desktop app's **Routines** page by choosing **Local**. Each run starts a **fresh local session** on your machine, with your files, your tools and your MCP configuration, but only while the app is open and the computer is awake. - **Routines** — saved cloud configurations (a prompt, one or more repositories, an environment and a set of connectors). They are in **research preview**. A run is a full cloud session on Anthropic-managed infrastructure, or on your organisation's self-hosted environment when routed there, started by a **schedule**, an **API call** or a **GitHub event**. You create them on the web, in the Desktop app (choosing **Cloud**), or from the CLI with `/schedule`. ## The comparison that decides it | | `/loop` | Desktop scheduled task | Routine | | :- | :- | :- | :- | | Runs on | Your machine | Your machine | Cloud | | Machine must be on | Yes | Yes | No | | Open session needed | Yes | No (app must be open) | No | | Local files | Yes | Yes | No — fresh clone | | Permission prompts | Inherits from the session | Mode set per task | None — runs autonomously | | Minimum interval | 1 minute | 1 minute | 1 hour | | Survives restarts | Restored on `--resume`, with exceptions | Yes | Yes | The row people forget is the last-but-one: a routine **cannot run more often than hourly**. Expressions that fire more frequently are rejected. ## What a sleeping laptop does to each This is why the question gets asked: each option fails differently when the laptop sleeps or the lid shuts. 1. **`/loop`** stops firing when the session exits. Closing the terminal ends it. Backgrounding the session carries `/loop` tasks into a background session that keeps running without a terminal, but that is still a process on your machine. There is no catch-up: a fire missed while Claude was busy runs once when it becomes idle, not once per missed interval. 2. **A Desktop task** whose time passes while the computer sleeps is **skipped**. On wake, Desktop starts exactly **one catch-up run** for the most recent missed time within the last seven days and discards older misses. **Keep computer awake** prevents idle sleep, but closing the lid still sleeps the machine. 3. **A routine** keeps running with the lid shut, because nothing about it lives on your laptop. Its trade-off is reach: it sees a fresh clone of the selected repositories, not your working directory, and only the connectors included in that routine. ## Matching the three jobs - **A deploy poll every five minutes** while you work: `/loop 5m check whether the deploy finished`. Five minutes is below a routine's floor, and the poll only matters while you are at the session anyway. - **A dependency check every morning** that needs your local checkout or tools: a Desktop task on the **Daily** preset, accepting that a slept-through morning becomes one catch-up run later. - **A weekly report while the laptop is shut**: a routine with a weekly schedule trigger, created with `/schedule` or at the routines page. It will run from a fresh clone and act through your connected accounts. ## Permissions and identity Each scheduler handles approval differently. `/loop` inherits the session's permission mode and rules, so a scheduled prompt can stop on a prompt nobody is there to answer. A Desktop task has its own permission mode, and allow rules from `~/.claude/settings.json` also apply; in Manual mode a run waits for approval in the sidebar. A routine has **no permission-mode picker** at all: it runs shell commands and calls included connectors, including writes, without stopping for approval (apart from some artifact actions), so you bound it by choosing repositories, the environment's network access and the connectors. Routines belong to your individual claude.ai account, and what they do through GitHub or connectors appears as you. ## Common mistakes - Treating a Desktop task as "always on" because it lives outside the CLI — it still needs the app running and the machine awake. - Expecting a routine to reach a file that exists only on the laptop. - Building a sub-hourly poll as a routine and finding the schedule rejected. - Leaving a `/loop` running in a terminal and assuming it fires after the session is closed.

  • Why can't the five-minute deploy poll be a Claude Code routine?
    A routine's schedule has a one-hour minimum, and expressions that fire more often are rejected. Five-minute polling belongs to `/loop 5m` in an open session or to a Desktop task, both of which go down to one minute. If the pipeline can call out when it finishes, the routine's API trigger replaces polling with a single fire instead.
  • Does backgrounding a CLI session let /loop keep running after you close the terminal?
    Yes, in part: backgrounding carries `/loop` tasks into a background session that keeps running without a terminal. It is still a process on your machine, though, so a sleeping or powered-off machine stops it. Only a routine runs independently of your hardware.
  • How do permission prompts differ across the three schedulers?
    `/loop` inherits the session's mode and rules, so a fire can stop on a prompt. A Desktop task has its own permission mode, plus allow rules from `~/.claude/settings.json`; in Manual mode a run waits for approval. A routine has no permission-mode picker and runs autonomously, so you limit it through its repositories, environment network access and connectors.

  • A Desktop task with Keep computer awake still runs after you close the lid.
  • /loop tasks keep firing after the CLI session exits.
  • A cloud routine can read files that exist only on your laptop.
  • A routine can poll every five minutes just like /loop.
  • All three schedulers stop for permission prompts in the same way.
open as a page

In Claude Code, what do `/loop 5m check the deploy`, `/loop check the deploy` and a bare `/loop` each do?

level: juniorimportance: should knowfreq 16%

basics

~20 s

/loop 5m check the deploy runs on a fixed cron schedule; /loop check the deploy lets Claude choose a one-minute-to-one-hour delay after each run; a bare /loop self-paces through loop.md or the built-in maintenance prompt.

open as a page

A Claude Code session schedules `0 9 * * *` with CronCreate; it fires around 9:20 daily and is gone a week later — why?

level: seniorimportance: should knowfreq 8%

basics

~10 s

Recurring CronCreate tasks get a deterministic jitter of up to 30 minutes after the scheduled time, and they expire seven days after creation, firing one final time before deleting themselves.

open as a page

Why does a Claude Code Desktop scheduled task sometimes run hours late or not at all, and why can an unattended run stall?

level: middleimportance: nice to knowfreq 6%

basics

~20 s

Desktop tasks fire only while the app runs and the computer is awake; a slept-through time is skipped and one catch-up runs on wake for the latest miss. A Manual-mode run stalls on any unapproved tool until someone answers.

open as a page

How do a Claude Code routine's schedule, API and GitHub triggers start a run, and what bounds what that run can do?

level: seniorimportance: nice to knowfreq 5%

basics

~20 s

Each trigger starts a fresh cloud session: a schedule (hourly minimum), a bearer-token POST to /fire, or a GitHub pull request or release event. Runs have no permission-mode picker, so repositories, environment and connectors bound them.

open as a page