Harness Engineering 6 months ahead, in a few hours.

Claude Code scheduled tasks: automate work with /schedule

Thomas Poulain Ā·

A Claude Code scheduled task is a saved configuration, made of a prompt, one or more GitHub repositories and a set of connectors, that Claude runs on its own in Anthropic’s cloud, even when your laptop is closed. You create one from the terminal with /schedule or on claude.ai/code. The feature reached Claude Code on the web in the week of April 13, 2026, during releases 2.1.105 to 2.1.113, under the name routines. It’s available on Pro, Max, Team and Enterprise plans and is still a research preview, so its behavior and limits may change.

Each run is a cloud session that starts in auto mode. To keep an open session working until a condition is met, see the /goal command instead.

How do I create a scheduled task with /schedule?

Run /schedule in any session, alone or followed by a description. Claude asks about the schedule, the repositories and the prompt, then saves the task to your account. /routines is an alias for the same command.

/schedule every weekday at 9:07am, review open PRs and summarize the risks
/schedule in 2 weeks, open a cleanup PR that removes the feature flag

For a one-off run, Claude confirms the exact timestamp with you before saving. After that, three subcommands manage your tasks.

/schedule list     # show your scheduled tasks
/schedule update   # change one
/schedule run      # start one right now

Write the prompt as a complete brief that says what to do and what a good result looks like, since nobody will be around to clarify. /schedule needs a claude.ai subscription login. An ANTHROPIC_API_KEY set in your shell takes precedence over that login and hides the command.

Which triggers can a task have?

A task takes one or more triggers, and a schedule is optional.

TriggerWhen the task startsWhere you set it up
ScheduleOn a recurring cadence, or once at a given time/schedule or the web
APIOn each POST to the task’s URL with its tokenThe web only
GitHubOn a pull request or release eventThe web, or the CLI since v2.1.225

The shortest interval is one hour. For a cadence the presets don’t offer, set a cron expression with /schedule update, such as 0 */2 * * * for every two hours. A run set exactly on the hour, like 9:00, can start several minutes late, so pick something like 9:07 instead.

A GitHub trigger needs the Claude GitHub App on the repository. You can filter pull requests by author, title, branch, labels, draft state or merge state.

How do I start a task from a script or an alert?

Add an API trigger from the task’s page on the web. You get a URL and a token, and the token is shown only once. After that, one POST is enough. This example uses the placeholder values from the docs.

curl -X POST https://api.anthropic.com/v1/claude_code/routines/trig_01ABCDEFGHJKLMNOPQRSTUVW/fire \
  -H "Authorization: Bearer sk-ant-oat01-xxxxx" \
  -H "anthropic-beta: experimental-cc-routine-2026-04-01" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"text": "Sentry alert SEN-4521 fired in prod. Stack trace attached."}'

The response holds the new session’s URL. The text field arrives wrapped in a <routine-fire-payload> block labeled as untrusted data, and Claude doesn’t follow instructions inside it unless the task’s own prompt says to. Write that prompt with this in mind, for example ā€œInvestigate the alert described in the routine-fire-payload blockā€.

What can Claude do during a run?

Each run starts from a fresh clone of your repositories. Claude runs shell commands, uses the repository’s skills and calls the task’s connectors. All your claude.ai connectors are included by default, writes included, so remove the ones the task doesn’t need.

The session starts in auto mode unless auto mode is unavailable. It won’t ask you to approve each action, but it stops and waits for an answer when an action matches an ask rule or when blocks keep repeating. Claude pushes its work to branches prefixed with claude/ unless your prompt names another branch. To limit what a run can push, use branch protection on GitHub.

Whatever is committed comes along, such as CLAUDE.md and .claude/skills/. Hooks and permission rules in .claude/settings.json come along too when the task has a single repository. Your local ~/.claude/ stays on your machine, so commit your guardrails. Commits, pull requests and connector messages show up under your name.

How do I see what a run did?

On the task’s page, the History list keeps every run. Click one to open it as a full session, where you can review the changes or create a pull request. A green status only means the session started and exited without an infrastructure error. Read the transcript to know whether the work got done.

Since v2.1.227 you can also ask from the terminal. Claude lists recent runs, then reads a run’s log to explain what happened, including tool errors and permission denials.

/schedule why did my nightly review do nothing this morning?

What are the limits?

Runs draw down your subscription usage the same way interactive sessions do. On top of that, each way of starting a run has an hourly cap, with no overage.

ActionLimit
Scheduled runs, one-off runs included100 per hour for your account
Run now and API fires, combined30 per hour for each task
Run now, and API fires counted separately100 per hour each for your account

Scheduled tasks belong to your account and aren’t shared with teammates. If your GitHub connection is missing, the task skips runs for up to 72 hours, then turns itself off.

Should I use a cloud task, a Desktop task or /loop?

Claude Code has two other ways to schedule work, and both run on your machine.

Cloud (/schedule)Desktop/loop
Machine must be onNoYesYes
Session must be openNoNoYes
Local filesNo, fresh cloneYesYes
Shortest interval1 hour1 minute when Claude sets it, 1 hour in the forms1 minute

Use the cloud for work that has to run without your machine, like a nightly issue triage. When the task needs your local files, go with Desktop.


Section 7.11 of module 7, Optimization and pro workflow covers scheduled tasks, and section 7.8 wires Claude Code into your CI. To write the committed hooks that also guard your cloud runs, see module 5, Hooks and automation.

To see these articles more often on Google, add Harness Engineering to your preferred sources.

You might also like