Routines, explained by monkey
(plus the night shift setup)
A routine is a saved prompt that Claude Code runs on a schedule in Anthropic's cloud, so it keeps working with your laptop closed. Here's the night shift setup, the three ways to put Claude on a timer, and the limits.
A routine is a saved prompt, plus one or more of your GitHub repos, plus your connectors, that runs by itself on Anthropic's servers. Set one for every morning and it runs every morning, whether your laptop is open or shut. You make one by typing /schedule and saying what you want and when.
The night shift setup
A routine works on a fresh copy of your repo from GitHub, not the files on your laptop, so push your work first. Then type this into any Claude Code session:
/schedule every night at 2:07am, run the test suite on main. If anything fails, fix it and open a pull request that explains what broke and how you fixed it. If everything passes, don't change anything.
Claude asks a few follow-up questions, then saves it. Then:
- 1. Trim the connectors. Every connector you have is included by default, and the routine can use all of them, writes included, without asking. Remove the ones it doesn't need.
- 2. Test it now. /schedule run starts it straight away, so you don't wait until 2am to find out something's wrong.
- 3. In the morning, open the run and read what Claude did. A green tick only means it didn't crash.
More /schedule examples
/schedule daily PR review at 9:07am
/schedule tomorrow at 9am, summarize yesterday's merged PRs
/schedule clean up feature flag in one week
The first one repeats. The other two run once. /routines is the same command.
Manage your routines
/schedule list # every routine you have
/schedule update # change one, including a custom schedule
/schedule run # run one right now
Or just ask what happened, like /schedule why did my nightly review do nothing this morning? (v2.1.227 or later). You can also make and edit routines on the web at claude.ai/code/routines, or in the Desktop app: Code tab, Routines, New routine, Cloud.
Three ways to put Claude on a timer
- Routine: runs in Anthropic's cloud. Your computer can be off and no session needs to be open. Works on a fresh copy of your repo from GitHub. Never asks permission. At most once an hour.
- Desktop scheduled task: runs on your own computer, while the Claude Desktop app is open and the computer is awake. Sees your local files. Asks permission based on the mode you pick for it. As often as every minute.
- /loop: repeats a prompt inside the Claude Code session you have open. Sees your local files. Asks permission just like that session. As often as every minute, and only while the session is running.
Short version: laptop closed, use a routine. Need your local files, use a Desktop task. Just watching something while you work, use /loop.
Other ways to start a routine
One routine can have several triggers:
- A schedule: hourly, daily, weekdays, weekly, or once at a set time. For anything else, like every two hours or the first of the month, pick the closest preset, then run /schedule update to set your own cron expression. Nothing more often than once an hour.
- An API call: send a POST to the routine's /fire URL with its token. You can only make the token on the web. Text you send arrives labelled as untrusted, so your saved prompt has to tell Claude to act on it, for example "investigate the alert in the routine-fire-payload block".
- GitHub: pull requests or releases, with filters like author, branch and labels. The Claude GitHub App has to be installed on the repo.
Desktop scheduled tasks: the local option
- In the Desktop app: Code tab, Routines, New routine, Local. Pick a folder, a permission mode, a model and a schedule: Manual, Hourly, Daily, Weekdays or Weekly.
- Need a different interval? Ask in a Desktop session, like "schedule a task to run all the tests every 6 hours."
- Each run opens a new session under Scheduled in the sidebar and sends you a desktop notification.
- The prompt is saved at ~/.claude/scheduled-tasks/<task-name>/SKILL.md.
- Needs Claude Desktop 1.1.5368 or later, and a paid plan for Claude Code.
/loop: repeat something in the session you have open
/loop 5m check if the deployment finished
/loop check whether CI passed and address any review comments
/loop 20m /review-pr 1234
/loop
- The first runs every 5 minutes.
- The second has no interval, so Claude picks the wait each time, between 1 minute and 1 hour, and tells you why.
- The third re-runs a skill every 20 minutes.
- A bare /loop runs the built-in maintenance prompt: finish open work, tend the branch's pull request, then clean up. If you've written a .claude/loop.md, it runs that instead.
Intervals use s, m, h or d, at the start (30m) or the end ("every 2 hours"). Seconds round up to a whole minute, and odd ones like 7m or 90m round to the nearest clean interval, which Claude tells you. To stop a loop that picks its own timing, press Esc. A fixed one keeps going until you say something like "cancel the deploy check job", or for 7 days. For a one-off reminder, skip /loop and just say "remind me at 3pm to push the release branch".
Tips most people don't know
- Loop, then /bg, then close the terminal. Moving the session to the background carries its /loop over to a background session that keeps firing with no terminal open. The computer still has to be on. In claude agents it shows as a ✢ row with a run count and a countdown.
- Timing isn't exact. A recurring /loop task can start up to half its interval late, 30 minutes at most. A one-off reminder set for :00 or :30 can fire up to 90 seconds early. /loop 5m is the exception: it runs every 4 minutes 45 seconds.
- Spot a runaway loop. /usage has a Loops breakdown (v2.1.243 or later) with each loop's runs, tokens and tokens per run.
Careful: what a routine can do
- It never asks permission. There's no permission mode to pick, and it can use every tool from the connectors it has, writes included. Give it only the ones it needs.
- It acts as you. Commits and pull requests carry your GitHub user. It pushes to branches that start with claude/ unless your prompt says otherwise.
- It can't see your laptop. It works on a fresh copy of the repo from GitHub, so anything you haven't pushed isn't there.
What you need
- A Pro, Max, Team or Enterprise plan, signed in with your claude.ai account.
- /schedule is hidden if you're signed in with an API key, through Bedrock, Vertex or Foundry, or if ANTHROPIC_API_KEY is set in your shell. Typing it then gives Unknown command, or a message that it needs a claude.ai subscription.
- On Team and Enterprise, an Owner can turn routines off for everyone.
Limits
- Routines use your normal subscription usage, the same as a chat.
- 100 scheduled runs an hour per account. Extra runs wait.
- 30 Run now or API runs an hour per routine.
- GitHub events have their own hourly limits, and events over the limit are dropped.
- Routines are yours alone, not shared with teammates, and they pause while your subscription is paused.
- If GitHub gets disconnected, a routine skips runs for up to 72 hours, then turns itself off.
- /loop only fires while Claude Code is running and idle, never in the middle of a reply. Missed runs don't catch up. A session holds up to 50 tasks, recurring ones expire after 7 days, and a loop that picks its own timing isn't brought back by --resume.
Monkey believe in you. Now go build.
follow @nocodemonkey



