Appearance
Text size
Typeface
Line spacing
4
Chapter 4 · 3 min

Work that runs on a clock

Claude Code has three places to run something repeatedly: cloud routines, Desktop scheduled tasks and the in-session /loop. They differ in where they run, how often they can fire and what survives.


Three places, three trade-offs

The first question is not how to schedule something. It is where it will run, because that decides everything else.

  • Cloud routines, set up with /schedule, run without your machine. The minimum interval is 1 hour.
  • Desktop scheduled tasks run on your machine. When Claude sets one, the minimum is 1 minute.
  • /loop runs inside an open session.
Need it when your laptop is closed?
Yes: a cloud routine, hourly at most
No, my machine can stay on: a Desktop task
Only while you are working: /loop

The rule is plain. If the job must happen when you are not there, it cannot depend on your machine being awake, and that costs you a coarser clock.

Check yourself

What is the shortest interval a cloud routine can use?

/loop in practice

/loop has three forms.

  • /loop 5m prompt runs on a fixed interval.
  • /loop prompt lets Claude pick the interval each time, which suits work where the right gap depends on what it sees.
  • A bare /loop runs a built-in maintenance prompt, or your own.

Your own lives in .claude/loop.md in the project, which wins, or ~/.claude/loop.md for the user. It replaces the default bare-loop prompt, and edits apply on the next iteration, so you can tune a running loop by editing a file.

$ claude> /loop 5m check whether the deploy finished and tell me if it failed✻ Schedules the check every 5 minutes✻ Runs it, reports "still building"# Esc and Ctrl+C will not stop it. Ask Claude to cancel the loop.

That last point surprises people. To stop a fixed-interval loop, ask Claude to cancel it. Esc and Ctrl+C do not.

What a scheduled fire cannot do

A scheduled run has no one to answer it, so it is restricted. It cannot run built-in commands, skills marked disable-model-invocation, or MCP prompts. If your loop prompt depends on a slash command, it will not work the way it does when you type it.

Limits to know:

  • A session holds at most 50 scheduled tasks.
  • Each has an 8-character ID that CronDelete takes, and CronList shows the next run times.
  • Session tasks are restored on --resume unless they expired. The expiry is seven days.

Background work

Scheduling is not the only way to keep work going without you watching. claude --bg starts a background agent. claude --bg --exec 'pytest -x' runs a shell job in the background as a PTY job.

Two neighbours are worth knowing. For reacting to events instead of polling, use Channels. To keep working toward a condition, use /goal. A loop asks "is it time yet?" on a clock. These ask "did something happen?" or "are we there?", which is often what you actually meant.

Check yourself

How do you stop a fixed-interval /loop?

Read further