Claude Code Routines: cloud automation on a schedule

A routine is a saved Claude Code configuration — a prompt, one or more repositories, and a set of MCP connectors — packaged once and run automatically. Routines execute on Anthropic-managed cloud infrastructure, so they keep working when your laptop is closed. Each routine can combine several triggers: scheduled, API, and GitHub events.

Routines are in research preview — behavior, limits and the API surface may change.

The three trigger types

Scheduled
Run hourly, nightly, weekly, or once at a specific future time. Times are entered in your local zone and converted automatically.
API
Trigger on demand with an HTTP POST to a per-routine endpoint and bearer token — wire it into alerting systems, deploy pipelines or internal tools.
GitHub
React automatically to pull request or release events on a connected repository, with filters on author, branch, labels, draft state and more.

What routines are good for

Backlog maintenance
A nightly schedule reads issues via a connector, applies labels, assigns owners, and posts a summary to Slack.
Alert triage
A monitoring tool calls the API endpoint on an alert; the routine pulls the stack trace, correlates recent commits, and opens a draft PR.
Bespoke code review
A GitHub trigger on pull_request.opened applies your team's own checklist and leaves inline comments.
Deploy verification
A CD pipeline calls the API endpoint after each deploy; the routine runs smoke checks and posts a go/no-go before the release window closes.
Docs drift
A weekly schedule scans merged PRs, flags documentation referencing changed APIs, and opens update PRs.

Create a routine

Create from claude.ai/code/routines, the Desktop app, or the CLI — all three write to the same cloud account, so a routine created anywhere shows up everywhere. From the CLI, run /schedule in any session; it also accepts a description directly, like "/schedule daily PR review at 9am" or a one-off like "/schedule clean up feature flag in one week." In the Desktop app, choosing Cloud when creating a routine gives you this cloud-hosted behavior — choosing Local instead creates a Desktop scheduled task that runs on your own machine rather than Anthropic's infrastructure, which matters if the task needs access to local files a cloud session can't see. The CLI also manages existing routines: /schedule list shows everything on your account, /schedule update changes one, and /schedule run triggers it immediately without waiting for the next scheduled time.

1. Name it and write the prompt
The prompt is the most important part — the routine runs unattended, so it must be self-contained and explicit about what to do and what success looks like.
2. Select repositories
Each repository is cloned fresh at the start of a run, starting from the default branch. Claude pushes changes to claude/-prefixed branches, which are always accepted.
3. Select an environment
Controls network access, environment variables, and a cached setup script. The Default environment allows only a Trusted allowlist of package registries and common dev domains.
4. Choose triggers
Pick one or combine several — for example nightly plus a manual API call from a deploy script.
5. Review connectors
All connected MCP connectors are included by default. Remove any the routine doesn't need — Claude can use every tool from an included connector, including writes, without asking.

Firing a routine via API

Add an API trigger from the web UI, copy the generated URL, and generate a bearer token (shown once — store it securely). POST to the /fire endpoint with the token in the Authorization header; an optional text field passes run-specific context such as an alert body. That text arrives wrapped in a labeled untrusted-data block, so a routine's prompt must explicitly opt in to acting on it.

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

GitHub event triggers

A GitHub trigger fires a new session on matching pull request or release events — for example pull_request.opened, filtered to a specific base branch or label. The Claude GitHub App must be installed on the repository; running /web-setup grants clone access but does not enable webhook delivery on its own. During the research preview, webhook events are subject to per-routine and per-account hourly caps.

Custom cron and one-off runs

Pick the closest preset frequency (hourly, daily, weekdays, weekly) in the form, then run /schedule update in the CLI to set a specific cron expression — the minimum interval is one hour. A one-off run fires once at a specific timestamp and then auto-disables; one-off runs don't count against the daily routine run cap, unlike recurring runs.

Usage and limits
Routines draw down subscription usage the same way interactive sessions do, plus a daily cap on how many runs can start per account. One-off runs are exempt from that daily cap. Organizations with usage credits turned on can keep running routines on metered overage once the cap or subscription limit is hit; without credits, additional runs are rejected until the window resets.

Security: scope connectors and repos tightly

A routine runs with no approval prompts during execution, so what it can reach is entirely determined by the repositories, environment network access, and connectors you attach. Remove connectors it doesn't need — an included connector's tools, including writes, are all available without asking. A green run status only means the session exited without an infrastructure error, not that the task succeeded — open the run transcript to confirm what actually happened.

Managing existing routines

Open a routine's detail page to see its repositories, connectors, prompt, schedule, API tokens, GitHub triggers and a list of past runs. From there: click Run now to start a run immediately (optionally with run-specific text), use the Repeats toggle to pause or resume a schedule without losing its configuration, click the pencil icon to edit the name, prompt, repositories, environment, connectors or triggers, or click delete to remove the routine — past sessions it created stay in your session list. Each run opens as a normal session, so you can review changes, open a pull request, or keep the conversation going manually.

Repository and branch permissions

Claude clones each selected repository fresh on every run and pushes changes to claude/-prefixed branches, which are always accepted. If your prompt directs it to push elsewhere, Claude Code checks first and rejects the push if the branch is protected on GitHub, someone else already has an open PR from that branch, or the branch carries commits authored by someone other than you.

Connectors: which external services it can touch

Routines use the MCP connectors on your claude.ai account — the same integrations available under claude.ai/customize/connectors — to read from and write to services like Slack, Linear or Google Drive during a run. Local servers added with claude mcp add in the CLI live on your machine, not your account, so they don't show up in a routine's connector list unless you add them as an account-level connector or declare them in a committed .mcp.json inside the cloned repository. Everything a routine does through a connector or your GitHub identity is attributed to you: commits and PRs carry your GitHub username, and Slack messages or Linear tickets use your linked accounts.

Troubleshooting: "/schedule returns Unknown command"
This usually means one of three things: you're authenticated with a Console API key or a cloud provider (Bedrock, Vertex, Foundry) rather than a claude.ai subscription login, which /schedule requires; a variable like DISABLE_TELEMETRY, DO_NOT_TRACK or DISABLE_GROWTHBOOK is set and blocks the feature-flag fetch /schedule depends on; or you're inside a Claude Code on the web session, where routines are managed from the web UI instead. You can always create and manage routines directly at claude.ai/code/routines regardless of how the CLI is configured.
Related from the Academy
For the full Japanese-language walkthrough with more example prompts, see the ConfigDeck Academy article on Routines. Read the Routines guide →
Pair routines with the right connectors

Browse Claude Code MCP configs and other automation-ready setups on ConfigDeck.

Browse the marketplace →

FAQ

Is this the same as a hook or a scheduled task?
No. Hooks fire on lifecycle events inside a running session on your machine; local scheduled tasks (/loop, Desktop scheduled tasks) run on your machine too. Routines execute as full cloud sessions on Anthropic's infrastructure, so they keep running with your laptop closed.
Are routines out of beta?
No — routines are in research preview. Behavior, limits and the API surface may change.
Which plans include routines?
Pro, Max, Team and Enterprise, with Claude Code on the web enabled. Team/Enterprise Owners can disable them org-wide from the admin settings.
Does a routine ask for permission before running commands?
No — a routine runs autonomously as a full session with no permission-mode picker and no approval prompts. Scope its repositories, environment and connectors to only what it actually needs.
Can I trigger a routine from my own alerting tool?
Yes, via the API trigger — POST to the routine's /fire endpoint with its bearer token and optional free-text context.