← Claude Code Hub
May 6, 2026 · 7 min read ✦ Tip #062

Scheduled tasks in Claude Code (formerly Routines): your agent keeps working with the laptop closed

Close the laptop and your Claude Code agent keeps running. Cron, GitHub events, external webhooks: any of the three can fire a full session that does its work, opens PRs, posts to Slack — all without you being there.

Diagram of scheduled tasks (formerly Routines) in Claude Code: 3 triggers (Schedule, GitHub event, API webhook) fire a cloud session that runs the prompt and returns outcomes (PR comments, Slack post, draft PR fix) — all with the laptop closed

TL;DR A scheduled task (formerly a Routine) is a saved Claude Code config (prompt + repos + MCP connectors) with one or more triggers: cron, GitHub event, or an HTTP endpoint any system can hit. Anthropic runs it in its cloud, so it keeps working with your Mac closed. Available on Pro / Max / Ultra / Team / Enterprise plans with Claude Code on the web enabled. It's one of the four ways to send Claude Code to background — alongside Agent View, headless, and /loop — and the only one that survives turning off the machine; the full map lays out all four in a decision table.

Update, November 1, 2026: Anthropic renamed Routines to scheduled tasks, now also on the Ultra plan, and you can add a GitHub trigger from the CLI (v2.1.225+). Claude pushes to a claude/ branch unless your prompt names another, and which branches a run can push to is up to your GitHub branch protection rules or rulesets.

Update, October 31, 2026: Routines no longer have a separate daily limit of included runs: every run counts against your regular subscription usage limits, and the included-runs indicator is gone.

/loop makes Claude watch something inside your active session, but it dies when you close the terminal. Monitor reacts to stdout events, but it also lives and dies with the session. Scheduled tasks are the next floor up: they take the same "Claude works for me" pattern to Anthropic's cloud, where it doesn't depend on your laptop being on or your terminal being open. To see where they fit next to /loop, Monitor and Channels, there's a map that puts it all in a 2×3 matrix.

Anthropic shipped them as Routines in v2.1.105+ (Week 16, April 2026) and they're still in research preview — the API endpoint ships under beta header experimental-cc-routine-2026-04-01.

What a scheduled task actually is

Anthropic used to call them Routines, and the old name still shows in several places: the URL claude.ai/code/routines, the /routines alias for /schedule, Claude's replies while it sets one up, the /fire endpoint and its beta header, and in some accounts the sidebar itself. It's all the same feature.

Three pieces + one or more triggers:

  1. Prompt: instructions Claude runs every time the task fires (autonomously — no permission prompts mid-run)
  2. Repos: one or more GitHub repositories Claude clones on each run; it pushes to a claude/-prefixed branch unless your prompt names another
  3. Connectors: your connected MCPs (Slack, Linear, Sentry, etc.) — Claude can use any tool from included connectors without asking
  4. Triggers: when the task fires. A single task can combine multiple.

Each fire creates a full Claude Code session on Anthropic-managed VMs. It shows up in your session list (web, Desktop, CLI) like any other. You can open it after the fact, review what it did, see diffs, open a PR. If you need it to run on your machine, with your files, that is a Local Desktop task, and it has failure modes of its own.

Each scheduled task runs in a cloud environment, the same kind you create from Claude Code Desktop.

The 3 trigger types

1. Schedule trigger — cron in the cloud

# From the CLI:
> /schedule daily PR review at 9am

# Or from web/Desktop: presets (hourly, daily, weekdays, weekly)
# or custom cron expression (minimum: every 1 hour)

Times are interpreted in your local timezone. There's an automatic stagger of a few minutes to avoid hammering the API. There's no daily run cap anymore: recurring and one-off runs ("remind me in 2 weeks") alike count against your regular usage limits, and share a ceiling of 100 scheduled runs per hour on your account.

2. GitHub event trigger — react to PRs and releases

Configured from the web, or by asking Claude in the CLI, which takes Claude Code v2.1.225 or later (for example, /schedule add a GitHub trigger to my nightly review for pull requests opened in acme/webapp). Supported events: pull_request.* and release.*. Available filters: author, base/head branch, labels, title, regex.

# Example: only ready-for-review PRs touching the auth module
event: pull_request.opened
filter: is_draft = false AND head_branch contains "auth-"

Requires installing the Claude GitHub App on the repo, whichever surface you configure it from (/web-setup alone isn't enough — that only grants clone permissions). The web prompts you to install it when it's missing; from the CLI, install it first from its GitHub page.

3. API trigger — unique webhook per task

Every task has its own /fire endpoint with a unique bearer token. Any external system can fire it:

curl -X POST https://api.anthropic.com/v1/claude_code/routines/trig_01ABC.../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 optional text reaches the task as literal run-specific context. The response returns the claude_code_session_id and URL to follow the run in real time in the browser.

The 6 templates Anthropic ships in docs

Use case Trigger What it does
Backlog maintenance Schedule (weeknights) Reads new issues, labels, assigns owners, posts a Slack summary
Alert triage API Sentry/Datadog hits with a stack trace → Claude correlates with recent commits and opens a draft PR with a proposed fix
Bespoke code review GitHub pull_request.opened Applies your team's checklist, leaves inline comments for security/perf/style
Deploy verification API (from your CD) Smoke checks after each deploy, scans logs, posts go/no-go to release channel
Docs drift Weekly schedule Scans merged PRs, flags docs referencing changed APIs, opens update PRs
Library port GitHub pull_request.closed (merged) When a change merges in SDK-A, ports it to SDK-B and opens a matching PR

Result preview

> /schedule daily PR review at 9am

⏺ Routine created: pr-review-daily
  Trigger: schedule, daily 09:00 (local)
  Repo: juanwmedia/ai-infra
  Connectors: GitHub, Slack
  Push: claude/* branch (unless the prompt names another)

[The next day, with your Mac off]

⏺ Routine running in cloud session_01HJK...
  ✓ Cloned juanwmedia/ai-infra
  ✓ Analyzed 4 open PRs
  ✓ Left 7 inline comments on PR #421
  ✓ Posted summary to Slack #releases

Done in 4m 22s.

Caveats you must know first

  • Research preview: the /fire endpoint and shapes may change; two versions of the beta header coexist to give callers time to migrate
  • Scheduled tasks are personal, not team-shared: anything they do appears as you (commits, comments, Slack messages)
  • No separate daily cap: runs count against your regular usage limits, like an interactive session; check consumption at claude.ai/settings/usage. Separately, each way of starting a run has an hourly limit
  • GitHub triggers have hourly caps per task and per account during preview
  • Branches: Claude pushes to a claude/* branch unless your prompt names another. What limits which branches it can push to is your GitHub branch protection rules or rulesets, applied to the GitHub access you connected: a rule that access can bypass doesn't block the push
  • The /fire body is opaque text: if you POST JSON, it reaches the prompt as a literal string
  • Min recurring interval: 1 hour. Faster cron expressions are rejected
  • Pro / Max / Ultra / Team / Enterprise plans only, with Claude Code on the web enabled

Reference

Aspect Detail
Minimum version Claude Code v2.1.105 (v2.1.225 to add a GitHub trigger from the CLI)
Create from claude.ai/code/routines, Desktop app, or /schedule (alias /routines) in CLI
Triggers Schedule (cron), GitHub event, API HTTP
Beta header experimental-cc-routine-2026-04-01 (only for /fire)
Min interval 1 hour (recurring); unlimited for one-off
Branches claude/* unless the prompt names another; the limit comes from your GitHub branch protection rules or rulesets
Connectors Your connected MCPs, per-task config
Pricing Counts against your normal subscription usage
Pairs with /loop (the intra-session cousin), Monitor (events inside the session). 6-primitives map: autonomous map. 4-mechanisms background map (incl. Agent View + headless): background agents map

Official docs: Automate work with scheduled tasks

Found this useful? See more of wmedia.es in your Google results.

Add wmedia.es as a preferred source on Google
FREE GUIDE

Approve less, but better.

Ten minutes in, you're hitting yes without reading. That's not review, that's prayer. A 10-page guide with the five levers in order of risk.

  • 1. Rules the first match wins
  • 2. Mode a dial, not a switch
  • 3. Auto mode a classifier approves for you
  • 4. Sandbox a fence the OS puts up
  • 5. Bypass only inside a container
Are you a professional Web developer?

It arrives by email · You join the Gravitas newsletter · Unsubscribe anytime

Claude Code permissions cheat sheet: approve less, keep control
FREE GUIDE

Approve less, but better.

Are you a professional Web developer? · Unsubscribe anytime
Workshop for teams

Multiply your team's output without sacrificing quality: a 6 to 8 hour AI First workshop, online, on the Claude platform.

See the workshop

Tired of approving permissions without reading?