Claude Code Learning Hub
中文 Mingyu's Library

Hub / Tips / F · End-to-end scenarios

Scheduled tasks: /loop, Desktop, or cloud Routines

Want Claude Code doing work for you every day, automatically? There are three official ways to schedule it — in-session /loop, Desktop scheduled tasks, and cloud Routines — and pick the wrong one and your task may never run at all.

The essential difference between the three comes down to a single question: when the task runs, is your machine (and your session) around? Answer that clearly and the choice makes itself.

One-line answer

Answer Choose by "does the machine need to be on": fully unattended (must run even with your machine off) → cloud Routines; needs to read/write local files, machine usually on → Desktop scheduled tasks; just watching a deployment or polling CI within the current session → /loop. OfficialThe official docs' own guidance: cloud for reliable runs when your machine is away, Desktop for tasks that need local files and tools, /loop for quick in-session polling.

Steps

  1. Pick first. OfficialKey rows from the official comparison table (the same table appears on two doc pages):
    Cloud RoutinesDesktop scheduled tasks/loop (in-session)
    Where it runsAnthropic's cloudYour machineYour machine
    Machine must be onNoYesYes
    Session must be openNoNoYes
    Survives restartYesYesRecoverable with --resume until it expires
    Can read local filesNo (fresh clone each run)YesYes
    Permission promptsNone (runs autonomously)Configurable per taskInherits the session's
    Minimum interval1 hour1 minute1 minute
  2. /loop (in-session): Official/loop 5m check if the deployment finished reruns the prompt at a fixed interval; omit the interval and Claude picks its own wait of 1 minute to 1 hour each round. Tasks are session-scoped: open a new session and they're gone, and recurring tasks auto-expire 7 days after creation. There's anti-crowding jitter: on-the-hour tasks can fire up to 30 minutes late, so if punctuality matters, avoid :00/:30 and write minutes like 3 9 * * *. One-off reminders are just plain language: "remind me at 3pm to push the release branch". Manage them in natural language ("what scheduled tasks do I have?"); under the hood are the three tools CronCreate/CronList/CronDelete.
  3. Desktop scheduled tasks (local, persistent): OfficialIn the Desktop sidebar: Routines → New routine → choose Local; fill in the name, description, instructions, and schedule (Manual/Hourly/Daily/Weekdays/Weekly presets; for finer granularity, have Claude set it for you); at the scheduled time it automatically opens a new session and runs. It only runs while the app is open and the computer is awake; if it sleeps through a run, it makes up the most recently missed run after waking (once only) — so write a time guardrail into the prompt (see the example below). Permissions are per task: after creating one, click Run now and set each permission prompt to "always allow" so it never gets stuck later. The task prompt lives at ~/.claude/scheduled-tasks/<task-name>/SKILL.md; edit the file and it takes effect on the next run.
  4. Cloud Routines (unattended): OfficialIn research preview. Create one at claude.ai/code/routines or with /schedule in the CLI: prompt + repo + connectors get packaged into a routine that runs on Anthropic's cloud — a fresh clone of the repo each run, no permission prompts, fully autonomous. Beyond schedules, it can also be triggered by an API POST or GitHub events (PR/release). Minimum interval is 1 hour; there's a daily run cap, and runs consume subscription usage. Requires claude.ai subscription login (/schedule doesn't work with API key login).
  5. Prompt-writing essentials shared by all three: OfficialScheduled tasks run autonomously with no way to ask follow-ups, so the prompt must be self-contained: exactly what to do, what success looks like, where results go. Our takeTwo more: make the task leave auditable artifacts (files/PRs/reports), not just words in a session; and a green status on a cloud routine only means the session exited cleanly, not that the task succeeded — open the transcript and check. CI-side schedules can also run on GitHub Actions cron, see Hooking Claude Code into GitHub Actions; for watching background work from your phone, see Background runs and mobile monitoring.

Copy-paste prompt

Complete daily-task example A — cloud version, in the CLI (requires claude.ai subscription login):

/schedule Every day at 9am: summarize the PRs merged and issues opened in this repo over the past 24 hours,
grouped by module, flagging high-risk changes; write the digest to reports/daily-<date>.md,
commit it to a claude/-prefixed branch, and open a PR.
Success criteria: the PR adds exactly this one file, and every conclusion in the digest cites a PR/issue number.

Complete daily-task example B — local version; just say this in any Desktop session:

Create a local scheduled task for me: runs weekdays at 09:10, working directory ~/work/my-app.
The task: pull the latest code and run the full test suite; if anything fails, track down the cause
and write the analysis and suggested fixes to notes/test-failures-<date>.md.
Time guardrail: if this is a make-up run after the computer wakes and it's already past 5pm,
only write a "what did I miss today" summary — no fixing.
After creating it, Run now immediately so I can set each permission prompt to always allow.

Sources & last verified

  • OfficialRun prompts on a schedule (/loop, 7-day expiry, jitter, cron tools), fetched 2026-08-05.
  • OfficialSchedule recurring tasks in Claude Code Desktop (creation flow, make-up runs, permissions, SKILL.md path), fetched 2026-08-05.
  • OfficialAutomate work with routines (cloud routines, the three trigger types, /schedule, limits), fetched 2026-08-05.
  • Last verified: 2026-08-05 · volatility: high (Routines is in research preview — behavior and limits may change; /loop details evolve with releases).