Routines & Scheduling
Automate recurring work without keeping your computer on. Routines run on Anthropic-managed cloud infrastructure.
What Is a Routine?
Section titled “What Is a Routine?”A routine is a saved Claude Code configuration that runs automatically:
- A prompt (what Claude should do each run)
- One or more repositories (code to clone and work in)
- Connectors (MCP tools like Slack, Linear, Jira)
- One or more triggers (when to run)
Routines execute in the cloud — your laptop can be closed and they still run.
Routines are available on Pro, Max, Team, and Enterprise plans.
Trigger Types
Section titled “Trigger Types”1. Schedule Trigger
Section titled “1. Schedule Trigger”Run on a recurring cadence or once at a specific time.
Presets: hourly, daily, weekdays, weekly
Custom intervals: use /schedule update in CLI to set a cron expression. Minimum interval: 1 hour.
2. API Trigger
Section titled “2. API Trigger”A dedicated HTTP endpoint. POST to it with a bearer token to start a run.
curl -X POST https://api.anthropic.com/v1/claude_code/routines/trig_01XXXXX/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."}'Response:
{ "type": "routine_fire", "claude_code_session_id": "session_01HJKLMNOPQRSTUVWXYZ", "claude_code_session_url": "https://claude.ai/code/session_01HJKLMNOPQRSTUVWXYZ"}3. GitHub Event Trigger
Section titled “3. GitHub Event Trigger”React to repository events: pull requests, releases.
Supported events:
| Event | Triggers when |
|---|---|
| Pull request | PR opened, closed, assigned, labeled, synchronized |
| Release | Release created, published, edited, deleted |
Filter PRs by: author, title, body, base branch, head branch, labels, is draft, is merged.
Real-World Examples
Section titled “Real-World Examples”Backlog Maintenance (Schedule)
Section titled “Backlog Maintenance (Schedule)”Every weeknight: read issues opened since last run, apply labels, assign owners, post summary to Slack.- Trigger: schedule (daily, weeknights)
- Connectors: issue tracker, Slack
- Result: team starts the day with a groomed queue
Alert Triage (API)
Section titled “Alert Triage (API)”When monitoring fires → call routine API endpoint with alert body.Routine pulls stack trace, correlates with recent commits, opens draft PR with proposed fix.- Trigger: API (called by your alerting system)
- Result: on-call gets a PR instead of a blank terminal
Automated Code Review (GitHub)
Section titled “Automated Code Review (GitHub)”On every new PR: apply your team checklist, leave inline comments, add summary.- Trigger: GitHub (
pull_request.opened) - Result: human reviewers focus on design, not mechanics
Deploy Verification (API)
Section titled “Deploy Verification (API)”After every prod deploy → call routine API.Run smoke checks, scan error logs, post go/no-go to release channel.- Trigger: API (called by your CD pipeline)
- Result: deploy window closes only after verification
Docs Drift Detection (Schedule)
Section titled “Docs Drift Detection (Schedule)”Weekly: scan merged PRs, flag docs that reference changed APIs, open update PRs.- Trigger: schedule (weekly)
- Result: docs stay in sync automatically
Library Port (GitHub)
Section titled “Library Port (GitHub)”On every merged PR in SDK A → port the change to SDK B, open matching PR.- Trigger: GitHub (
pull_request.closed, filtered to merged) - Result: two parallel SDKs stay in sync
Creating a Routine
Section titled “Creating a Routine”From the Web
Section titled “From the Web”Visit claude.ai/code/routines → New routine.
Steps:
- Name + prompt — write a self-contained, explicit prompt (runs autonomously, no approval prompts)
- Select repositories — cloned at the start of each run from the default branch
- Select environment — controls network access, env vars, setup scripts
- Select trigger(s) — schedule, API, GitHub event, or any combination
- Review connectors — all your connected MCP connectors are included by default (remove unused ones)
- Create — click Run now to start immediately
From the CLI
Section titled “From the CLI”/schedule # Create conversationally/schedule daily PR review at 9am # Create recurring/schedule clean up feature flag in one week # Create one-off/schedule list # See all routines/schedule update # Change an existing routine/schedule run # Trigger immediately
/schedulerequires a claude.ai subscription login (not a Console API key).
Branch Permissions
Section titled “Branch Permissions”By default, routines can only push to claude/-prefixed branches (safety measure).
To allow pushing to any branch: enable Allow unrestricted branch pushes when creating/editing the routine.
One-Off Runs
Section titled “One-Off Runs”Schedule a routine to fire once at a specific time:
/schedule tomorrow at 9am, summarize yesterday's merged PRs/schedule in 2 weeks, open a cleanup PR that removes the feature flagAfter firing, the routine auto-disables and is marked Ran in the UI.
One-off runs do not count against the daily routine run cap.
Connectors in Routines
Section titled “Connectors in Routines”Routines use your claude.ai integrations as connectors.
Local MCP servers (added via
claude mcp add) are not available in routines — they live on your machine. To use them in a routine: add them as connectors on claude.ai, or declare them in a committed.mcp.jsonfile.
Usage & Limits
Section titled “Usage & Limits”- Routines draw down your subscription usage like interactive sessions
- There is a daily cap on routine runs per account
- See usage at claude.ai/settings/usage
- Organizations with usage credits can continue on metered overage
Other Scheduling Options
Section titled “Other Scheduling Options”| Option | Runs where | Best for |
|---|---|---|
| Routines | Anthropic cloud | Unattended, recurring, multi-repo |
| Desktop scheduled tasks | Your machine | Local files, local tools |
/loop | CLI session | Quick polling within an open session |
Troubleshooting
Section titled “Troubleshooting”/schedule shows “Unknown command”: You’re using a Console API key or cloud provider (Bedrock/Vertex). Use a claude.ai login instead. Or DISABLE_TELEMETRY / DO_NOT_TRACK is set.
“Routines are disabled by your organization”: An Owner disabled them at claude.ai/admin-settings/claude-code. Ask an Owner to enable them.
🧠 Quick Recall
Section titled “🧠 Quick Recall”- Trick: scheduling ladder — “
/loopin the session → desktop task on your machine → routine in the cloud (machine off).”
👨🏫 Teach It
Section titled “👨🏫 Teach It”- Show: create one nightly routine with
/schedule, live. - They’ll trip on: expecting cloud routines to see local files — they run on Anthropic VMs.
Learning path: ⬅ 33-headless-and-scripting.md · Index · ➡ 35-github-actions.md
Written by Fenil Patel