Mastering Claude Code · ~7 min
Stop babysitting a terminal at 9am. Recurring work belongs on a schedule — and the only real decision is which machine runs it.
Claude Code gives you two scheduling surfaces with one clean dividing line: where the run executes. Local scheduling stays inside your session; cloud routines run on Anthropic infrastructure. Everything else — cadence, file access, permission gates — follows from that one choice.
/loop and the cron toolsSession scheduling re-runs a prompt automatically inside an active session. The interactive entry point is
the /loop bundled skill — pass an optional interval and a prompt, and Claude converts it to a cron
expression:
Units are s, m, h, d; seconds round up to the nearest minute.
Under the hood, agents and skills drive the same machinery with three tools: CronCreate (schedule a task),
CronList (list tasks with IDs), and CronDelete (cancel by 8-character ID). Expressions are
standard 5-field cron — wildcards, steps (*/15), ranges, comma lists — with a 50-task-per-session cap.
/loop runs a built-in maintenance prompt; override it with a plain-Markdown
.claude/loop.md (project-level wins over ~/.claude/loop.md). Edits take effect on the next
iteration — no restart.For a deferred one-off, just describe it: remind me at 3pm to push the release branch schedules a
single-fire task that auto-deletes after running. A few execution facts worth holding: tasks fire between
turns (never mid-response), in your local timezone, with deterministic jitter, and no
catch-up — a fire missed while Claude is busy runs once when idle, not once per missed interval.
Local scheduling is session-scoped only. Closing the terminal or restarting Claude Code cancels everything. Recurring tasks also expire 7 days after creation. This is a convenience layer, not durable infrastructure — which is exactly the gap cloud routines fill.
A Routine is a saved Claude Code configuration — prompt, repos, connectors, environment — that runs
on Anthropic-managed cloud infrastructure on a schedule, an API call, or a GitHub event. Create one from the CLI with
/schedule. It is the cloud counterpart to /loop and CronCreate, and the deployment
choice is a clean trade: cloud fixes host-uptime and env-drift failures but breaks working-tree fidelity, the
permission gate, and sub-hour cadence.
| Dimension | Cloud Routine | /loop |
|---|---|---|
| Runs on | Anthropic cloud | Your machine |
| Machine on? | No | Yes |
| Open session? | No | Yes |
| Local files | No — fresh clone of default branch | Yes — working tree |
| Permission prompts | None — runs autonomously | Inherits from session |
| Minimum interval | 1 hour | 1 minute |
Choose cloud when all hold: cadence is hourly or slower (sub-hour cron is rejected), work runs against the default branch (each run clones fresh from it — in-flight feature work is invisible), no mid-run human approval is needed, and every required resource is reachable from the cloud environment. Move scheduled work to the cloud when the local box is the failure point — laptops that sleep, reboots that drop cron, dev-env drift, rotated secrets.
The same "always on, no prompts, acts as creator" posture that makes routines durable is what opens their failure surfaces. Three are worth memorizing:
STANDARDS.md from main never sees
your unmerged feature-branch edit. The cloud snapshot is the default branch at clone time.claude/-prefixed branch-push restriction, trim the connector list (every connected
connector is included by default and callable with no per-tool prompt), and keep the network policy at Trusted
— widen only when a run fails on a 403.The rule of thumb writes itself. A weekly dependency audit against main fits cloud cleanly — autonomous
PR posture is the point. A hotfix loop watching CI on your current feature branch does not: it needs the live branch,
5-minute granularity, and the in-session prompt on git push.
/loop / CronCreate give sub-hour cadence, the working tree, and session permission prompts, but die with the terminal and expire in 7 days.Retrieval practice — recall, don't peek
Question 1Local /loop scheduling stops working the moment you…
Question 2A cloud routine sees your repo as…
Question 3The minimum interval a cloud routine accepts is…
Question 4"Identity collapse" in a cloud routine means…
Question 5 · spaced recall from an earlier lessonTo run isolated parallel work in a monorepo without agents colliding, you reach for…
/loop
or a cloud routine, or how to trim a routine's connector list to close the trifecta? Next, the capstone:
The Claude Code Decision Table — symptom to move, picking the right Claude Code surface for the job.