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
What routines are good for
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.
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.
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.
Browse Claude Code MCP configs and other automation-ready setups on ConfigDeck.
Browse the marketplace →