Anthropic quietly shipped the feature that kills half of your Zapier account. Claude Code Routines went live at 16:42 UTC on April 14 — saved Claude Code configs that run on Anthropic’s cloud, triggered by a schedule, an API call, or a GitHub event. Your laptop doesn’t need to be open. Your terminal doesn’t need to be running. Claude just… works.
The dominant community framing in the first 24 hours: this isn’t a workflow tool, it’s an AI employee. “The employee that works while you sleep.” “24/7 worker.” “The laptop-closed era of AI has arrived.” That’s the noun shift that matters — not workflow, worker. Anthropic Claude Code PM Noah Zweben (2,700+ likes) confirmed Anthropic uses these internally for backlog, docs, and ops. @FamilyClaw on X led with the now-viral two-character take: “RIP @n8n_io.”
It’s in research preview, which means “this will change and sometimes break.” But the setup is already solid. Here’s the full walkthrough for all three trigger types, the Pro/Max/Team quota math, and what actually works the first 48 hours in.
What a Routine Actually Is
A Routine is a saved Claude Code session that runs autonomously. You configure it once with:
- A prompt — what you want Claude to do
- One or more GitHub repositories — where it works
- A cloud environment — network access, env vars, setup scripts
- A set of MCP connectors — Gmail, Slack, Linear, Drive, etc.
- One or more triggers — schedule, API, GitHub event
Then it runs on Anthropic’s infrastructure whenever a trigger matches. No local terminal. No open laptop. No cron entries you forgot to maintain.
Anthropic’s own framing: “Put Claude Code on autopilot. Define routines that run on a schedule, trigger on API calls, or react to GitHub events from Anthropic-managed cloud infrastructure.”
A single routine can combine all three trigger types. Run your PR review routine nightly, trigger it from a deploy script, and also fire it on every new PR. Same routine, three entry points.
Who Can Use Routines
| Claude plan | Routines? | Daily limit |
|---|---|---|
| Free | No | — |
| Pro ($20/mo) | ✅ Yes | 5 runs/day |
| Max 5x / 20x ($100 / $200/mo) | ✅ Yes | 15 runs/day |
| Team ($25/seat/mo) | ✅ Yes | 25 runs/day |
| Enterprise | ✅ Yes | 25 runs/day |
You also need Claude Code on the web enabled (the cloud session surface). Every plan tier has access to that.
Note: the daily limit counts routine runs, not routines you can create. You can configure 20 routines on Pro, but only 5 of them can trigger each day. Combined with standard plan usage limits, this becomes the real constraint for power users.
If you hit the daily cap and have “extra usage” enabled (Settings → Billing → toggle on), extra runs continue as metered overage. Otherwise, additional triggers fail silently until the window resets at midnight UTC.
How to Create a Routine (3 paths)
Routines write to your account cloud-side, so all three creation paths update the same list.
Path 1: Web UI (easiest, most flexible)
- Go to claude.ai/code/routines
- Click New routine
- Fill in the creation form — name, prompt, repositories, environment, connectors, triggers
- Click Create
The web UI is the only place you can configure API tokens or GitHub event triggers. Use the CLI or Desktop for scheduled-only routines; use the web for anything else.
Path 2: CLI (/schedule)
Inside any Claude Code session, run:
/schedule daily PR review at 9am
Claude walks you through the same fields the web form collects, then saves the routine. Works conversationally — you can describe the routine in plain English and Claude fills in the cron expression and parameters.
Management commands:
/schedule list— show all routines/schedule update— edit an existing routine/schedule run— trigger a routine immediately
The CLI path only creates scheduled routines. For API or GitHub triggers, edit the routine on the web afterward.
Path 3: Desktop app
Open Claude Code Desktop → Schedule page → New task → New remote task.
(If you pick New local task instead, that’s a different feature — a Desktop Scheduled Task that runs on your machine, not a cloud routine.)
Writing a Routine Prompt That Actually Works
The prompt is the most important part. Routines run autonomously — no permission prompts during the run, no approval dialogs. Claude will do what the prompt says, using whatever tools are available.
Three rules from Anthropic’s own examples:
- Be explicit about success. Don’t say “review the PR.” Say “review the PR for security issues, missing tests, and style violations, then leave inline comments and a summary comment.”
- Scope the work. Don’t say “clean up the codebase.” Say “find any TODO comments added in the last 7 days in the src/ directory and open PRs to address them.”
- Define when to stop. Routines have a daily cap. Make each run tight so you don’t burn quota on exploration.
Bad prompt:
Look at my issues and clean them up.
Good prompt:
Read every issue opened in the last 24 hours in the Linear connector. Apply labels based on the file paths referenced. Assign owners based on CODEOWNERS. Post a markdown summary to #team-standup Slack channel listing: new issues, assigned issues, and any that need manual triage. Do not modify issues that already have both a label and an owner.
Scheduled Triggers
Pick a preset frequency from the web form: hourly, daily, weekdays, weekly. Times are entered in your local zone and converted automatically.
Using custom cron expressions
The presets don’t cover every case. For “every 2 hours” or “the first of each month,” do this:
- Create the routine with the closest preset (e.g., hourly or weekly)
- In any Claude Code CLI session, run
/schedule update - Pick the routine from the list
- Enter a standard cron expression
Minimum interval: 1 hour. Cron expressions that fire more frequently than hourly are rejected. This is a rate-limiting decision, not a technical one — routines aren’t for sub-minute polling.
Stagger and timezone handling
Runs may start a few minutes after the scheduled time due to stagger. The offset stays consistent per routine — if your routine is staggered to run at 9:04 instead of 9:00, it’ll keep doing that.
Times are wall-clock time in your zone. If you move timezones, the routine follows.
API Triggers
This is the trigger that makes routines infrastructure for your whole stack. You get a dedicated HTTPS endpoint per routine. POST to it with a bearer token and a JSON body; Claude starts a session and returns a URL.
Setup steps
- Edit an existing routine on the web
- Under Select a trigger, click Add another trigger → API
- The modal shows your routine’s URL (format:
https://api.anthropic.com/v1/claude_code/routines/trig_01XXX/fire) - Click Generate token — copy it immediately. It’s only shown once.
- Store the token somewhere secure (your alerting tool’s secret store, AWS Secrets Manager, etc.)
Calling the endpoint
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."}'
Response:
{
"type": "routine_fire",
"claude_code_session_id": "session_01HJKLMNOPQRSTUVWXYZ",
"claude_code_session_url": "https://claude.ai/code/session_01HJKLMNOPQRSTUVWXYZ"
}
Open the session URL to watch the run in real time.
The text field
The optional text field in the body gets passed to the routine as run-specific context — alongside the saved prompt. It’s freeform text, not parsed. If you send JSON or a structured payload, Claude receives it as a literal string. The routine’s saved prompt should instruct it how to interpret the field.
Example pattern:
- Saved prompt: “You receive an alert via the
textfield. Extract the error ID, find the matching commit in the last 24 hours, and open a draft PR with a proposed fix.” - API caller sends:
{"text": "Alert ID 4521, stack trace: ..."}
Beta header warning
The API is under the experimental-cc-routine-2026-04-01 beta header. Request/response shapes may change. Anthropic commits to keeping the two most recent beta versions working at any time, so you get a migration window when things change. Don’t panic if you see a deprecation notice — just swap the header version.
GitHub Triggers
These are the most powerful. A routine fires automatically on GitHub events — PR opened, commit pushed, issue labeled, workflow completed, and 13+ other categories.
Setup steps
- Edit a routine on the web
- Select a trigger → Add another trigger → GitHub event
- Install the Claude GitHub App when prompted — this is separate from
/web-setupwhich only grants clone access - Pick the repository
- Pick the event (e.g.,
pull_request.opened) - Optionally add filters
Critical gotcha: /web-setup in the CLI grants repository access for cloning, but does not install the GitHub App. If GitHub triggers aren’t firing, this is almost always the problem. The trigger setup on the web prompts you to install the app — complete that step.
Supported event categories
- Pull request — opened, closed, assigned, labeled, synchronized, etc.
- Pull request review — submitted, edited, dismissed
- Pull request review comment — comment on a PR diff
- Push — commits pushed to a branch
- Release — created, published, edited, deleted
- Issues — opened, edited, closed, labeled
- Issue comment — comment on an issue or PR
- Sub-issues — parent/child relationship changes
- Commit comment — comments on a commit or diff
- Discussion and discussion comment
- Check run and check suite
- Merge queue entry — entering or leaving the merge queue
- Workflow run and workflow job
- Workflow dispatch — manual trigger
- Repository dispatch — custom events
Filtering PRs
The filters let you narrow exactly which PRs start a session. All conditions must match.
| Filter | What it matches |
|---|---|
| Author | GitHub username |
| Title | PR title text (contains/equals) |
| Body | PR description text |
| Base branch | Branch the PR targets |
| Head branch | Branch the PR comes from |
| Labels | Labels applied to the PR |
| Is draft | Whether PR is in draft state |
| Is merged | Whether PR has been merged |
| From fork | Whether PR comes from a fork |
Useful filter recipes:
- Auth module review only: base=
main, head-branch containsauth-provider→ routes auth PRs to a dedicated security reviewer routine - External contributors only: from-fork=true → extra triage for fork PRs before a human looks
- Skip drafts: is-draft=false → routine runs only on ready-for-review PRs
- Label-gated backport: labels include
needs-backport→ port PR to another branch only when tagged
Hourly caps during research preview
GitHub triggers have per-routine and per-account hourly caps during research preview. Events beyond the cap are dropped until the next window. Check your current limits at claude.ai/code/routines.
The Environment (Network + Secrets)
Every routine runs in a cloud environment that controls three things:
- Network access — which outbound domains Claude can reach
- Environment variables — API keys, tokens, secrets available in the session
- Setup script — install commands that run before each session (e.g.,
npm install,pip install -r requirements.txt)
Anthropic ships a Default environment. For anything that needs specific dependencies or secrets, create a custom environment at Settings → Environments before creating the routine. You can’t edit environments from within the routine form.
Scope network access and env vars to what the routine actually needs. A docs-drift routine shouldn’t have your production Stripe key.
Branch Push Restrictions
By default, routines can only push to branches prefixed with claude/. This protects main, develop, release/*, and any long-lived branches from being accidentally rewritten.
To allow pushes to any branch for a specific repository, enable Allow unrestricted branch pushes in the routine’s edit form.
Security note: unrestricted branch pushes mean Claude can push to main if your prompt tells it to. Keep the default on for repos you care about.
Real Routines You Can Steal
From Anthropic’s own examples, battle-tested:
These map closely to what the community is already sharing on X. The PR-checklist routine (@LayrKits template), the nightly Linear → bug-fix-PR loop (@bhaidar), and the Spring Boot anomaly-watcher (@TheStackPilot) are all variations on these patterns.
1. Nightly backlog maintenance
Trigger: Schedule — weekdays at 20:00
Prompt:
Read every issue opened in the last 24 hours in Linear (via connector). Apply labels based on files referenced in issue body. Assign owners based on the repository’s CODEOWNERS. Post a markdown summary to Slack #team-standup including new, assigned, and needs-triage issues. Skip issues that already have label and owner.
2. Alert triage
Trigger: API — called by Datadog/Sentry when error threshold crossed
Prompt:
You receive an alert in the
textfield. Pull the stack trace, find the last 20 commits in the repo, and identify the likely cause. Open a draft PR with a proposed fix in aclaude/branch. Comment the original alert link in the PR description.
3. Bespoke code review
Trigger: GitHub event — pull_request.opened, filter is_draft=false
Prompt:
Apply our team’s review checklist (security, performance, style, tests). Leave inline comments for each issue. Post a summary comment listing must-fix vs nice-to-have. Do not approve or merge — a human reviewer needs to sign off.
4. Deploy verification
Trigger: API — called by CI after production deploy
Prompt:
Run smoke checks against the new production build using the
textfield’s deploy URL. Scan error logs for the last 10 minutes. Post go/no-go to Slack #releases within 5 minutes. Include top 3 error signatures if no-go.
5. Docs drift detection
Trigger: Schedule — weekly, Friday at 16:00
Prompt:
Scan PRs merged to main in the last 7 days. For any API changes, check the docs repo for outdated references. Open PRs to the docs repo against
claude/docs-sync-YYYY-MM-DDbranch with proposed updates.
6. Library port
Trigger: GitHub event — pull_request.closed, filter is_merged=true on main SDK repo
Prompt:
Port the closed PR to the parallel SDK repo (Python → TypeScript). Preserve tests, naming conventions, and comments. Open a matching PR on the target repo in a
claude/port-branch.
What Breaks (Being Honest)
This is a research preview. Known issues from the first week:
- GitHub App install confusion —
/web-setupgrants clone access, does NOT install the app. If GitHub triggers aren’t firing, check the app install status at github.com/settings/installations. - Daily quota is shared with regular Claude Code usage — a routine run counts against your same bucket as interactive sessions. Five heavy routines on Pro can burn through your day’s Claude Code capacity.
- API
/fireendpoint may return errors during peak hours. Anthropic has acknowledged rate limiting during research preview. textfield is freeform string only — if you send JSON, you need to parse it in your prompt. This trips up a lot of first-time API callers.- Environments can’t be edited during routine creation — set up the environment first, then create the routine. Reversing this means starting over.
- Sessions don’t reuse — every GitHub event starts a fresh session. Two pushes in a minute = two separate sessions eating two runs from your quota.
- No retry mechanism — if a scheduled run fails, Anthropic doesn’t retry. You need to build retry into your prompt or check session status manually.
- Hourly GitHub event caps during research preview — high-traffic repos (10+ PRs/hour) will see dropped events.
Routines vs Cowork Scheduled Tasks vs /loop
These three features overlap confusingly. The simple decision tree:
| Need | Use |
|---|---|
| Runs even when laptop closed, cloud-based, set-and-forget | Routine (this feature) |
| Needs to touch local files on your machine | Cowork Scheduled Task (local) |
| Run once in your current session and iterate | /loop (in-session) |
- Routines live at
claude.ai/code/routines, run on Anthropic’s cloud, 5-25 runs/day cap. - Cowork Scheduled Tasks live in Claude Desktop’s Schedule page, run on your laptop, need Desktop open.
/loopruns immediately in your current CLI session, no persistence.
Pick Routines for unattended/event-driven work. Pick Cowork Tasks for anything needing local filesystem access. Pick /loop for single-session iteration.
What This Means for You
If you’re a developer running your own side projects: Pro at $20/month gives you 5 routines/day. That’s enough for nightly bug scan + weekly docs update + PR review trigger + deploy verification. Probably the best $20/month you’ll spend this year.
If you’re on a platform team: Set up routines for common flows (PR review, release verification, on-call triage). Team plan at $25/seat gets you 25 runs/day, which covers a small team. But actually check your usage limits — routines draw from the same pool as your interactive sessions.
If you’re replacing Zapier/n8n: Partial replacement. Routines are better for dev workflows (GitHub, code review, CI/CD). Zapier/n8n are still better for non-dev business workflows (CRM, forms, payments). Migration calculus: if the routine involves reading code or PRs, move it. If it’s business data integration without code, stay.
If you’re a DevOps/SRE engineer: The API trigger is your gateway. Wire it into PagerDuty, Datadog, Sentry, or your CI. A routine that triages alerts before paging the human on call is real ROI.
If you’re non-technical: This isn’t for you yet. The CLI is optional, but you need to write prompts that Claude executes autonomously. Wait for the AI design tool Anthropic is reportedly shipping this week — that’s the non-dev automation story.
What It Can’t Do Yet
- No team sharing. Routines belong to your individual account. Can’t share with teammates inside Team/Enterprise yet.
- No per-routine billing breakdown. Anthropic shows total consumption, not per-routine.
- No granular permission scoping. Routines inherit your connector permissions wholesale. You can’t say “this routine can only read from Gmail, not send.”
- No rollback. If a routine opens a bad PR, the PR is real. Treat unrestricted branch pushes with care.
- Sub-hourly scheduling rejected. Anything faster than hourly requires a different architecture.
- No native Slack/Discord trigger yet. MCP connectors can be triggered, but the routine UI only shows schedule/API/GitHub.
The Bottom Line
Claude Code Routines is the “set-and-forget” layer that Claude Code was missing. Scheduled runs work. API triggers are clean. GitHub events work once you install the actual app (not just /web-setup). The daily quotas are tight on Pro but generous on Max.
If you’ve been running cron jobs on a server to automate Claude-assisted workflows, stop. Move them to Routines, delete the server, and check back in a week. The first month of use will tell you whether Pro’s 5/day cap is enough or whether Max is necessary.
For $20/month, set-and-forget cloud automation with Claude’s full toolchain is a genuinely different proposition. Worth flipping it on.
Want to go deeper? Our Claude Code Mastery course walks through the full Claude Code workflow. Automation Workflows covers broader agentic patterns. And AI Agents Deep Dive is for building sophisticated autonomous systems.
Sources:
- Introducing routines in Claude Code — Anthropic
- Automate work with routines — Claude Code Docs
- Claude Code routines let AI fix bugs and review code on autopilot — The Decoder
- Anthropic adds repeatable routines feature to Claude Code — 9to5Mac
- Claude Code routines — The Register
- Anthropic’s Claude Code gets automated routines, desktop makeover — SiliconANGLE
- Claude Code Routines: Anthropic’s New Cloud Automation — Pasquale Pillitteri
- Claude Code Routines: Cloud AI on Autopilot — ClaudeFast
- Hacker News discussion #47768133