Claude Code Routines: Automate AI Workflows on Autopilot in 2026
TL;DR Summary
- Claude Code Routines run on Anthropic's cloud infrastructure — your laptop can be closed, routines keep executing
- Three trigger types: schedule (cron, recurring or one-off), API (HTTP POST from any system), and GitHub events (PRs, releases)
- Routines run autonomously as full Claude Code sessions — they clone repos, use MCP connectors, run shell commands, and create PRs
- Use cases include PR review, alert triage, deploy verification, docs drift detection, backport automation, and library sync
- Available on Pro/Max/Team/Enterprise plans with Claude Code on the web enabled. Create via web dashboard or
/schedulein CLI
Direct Answer Block
A Claude Code Routine is a saved configuration — a prompt, repositories, and MCP connectors — that executes automatically on Anthropic's managed cloud infrastructure. You define it once, then it runs on schedule, when called via API, or when a GitHub event fires. Unlike CI/CD pipelines that run deterministic scripts, routines run full AI-powered coding sessions autonomously: they reason about your codebase, use tools, and produce PRs.
Introduction
Most automation tools force a tradeoff: either you write deterministic scripts that can't think, or you run AI agents that need constant supervision. Claude Code Routines split the difference. They run unattended on cloud infrastructure — scheduled, API-triggered, or GitHub-event-driven — but each run is a full Claude Code session with access to your repos, MCP connectors, and shell. The routine's prompt defines what to do; the infrastructure handles when and how. No laptop, no open terminal, no approval prompts.
What are Claude Code Routines and how do they differ from CI/CD pipelines?
Routines are not CI/CD. They are not GitHub Actions. They are autonomous AI coding sessions that run on Anthropic-managed cloud infrastructure when triggered.
The distinction matters because it changes what you automate:
- CI/CD runs a deterministic script. It can't inspect a PR and decide whether the changes introduce a subtle security issue. It can lint, test, and build — but it can't reason.
- Routines run a Claude Code session. It reads your codebase, applies judgment, uses tools, and produces a PR with inline comments explaining why something should change.
"A routine stores a prompt, repositories, and connectors as one configuration and runs it automatically. The system executes routines on managed cloud infrastructure, so your workflows run without a local machine." — AlphaSignal summary of Anthropic's announcement
According to Anthropic's documentation, each routine can have one or more triggers attached:
| Trigger | What fires it | Example |
|---|---|---|
| Schedule | Cron-based recurring or one-off time | Nightly PR review at 9am |
| API | HTTP POST with bearer token | Alerting system fires routine on error threshold |
| GitHub | Repository events (PR opened, release created) | Auto-review every new PR |
A single routine can combine triggers. A PR review routine can run nightly, trigger from a deploy script via API, and also react to every new PR opened.
Anthropic's documentation explicitly distinguishes routines from /loop (session-scoped, stops when terminal closes), Desktop scheduled tasks (runs on your machine), and GitHub Actions (deterministic CI). Routines are the "runs on Anthropic cloud, survives independently" tier.
How do you create a routine from the web dashboard, the CLI, and the Desktop app?
Method 1: Web dashboard (claude.ai/code/routines)
This is the most complete creation surface. All three trigger types (schedule, API, GitHub) are configurable here. The creation form walks through:
Name and prompt — the prompt is the most important part. Since routines run autonomously, the prompt must be self-contained and explicit about what success looks like. Anthropic's docs note: "The prompt is the most important part: the routine runs autonomously, so the prompt must be self-contained and explicit about what to do and what success looks like."
Repositories — add GitHub repos for Claude to work in. Each is cloned at run start from the default branch. Claude creates
claude/-prefixed branches for changes.Environment — pick a cloud environment controlling network access (Trusted, Custom, Full), environment variables (API keys, tokens), and a setup script (dependencies install). The setup script result is cached across runs.
Trigger — schedule (preset or custom cron via
/schedule update), API (URL + token generated after save), or GitHub event (PR/release with filters).Connectors and permissions — all connected MCP connectors (Slack, Linear, Google Drive) are included by default. Remove unused ones. Enable "Allow unrestricted branch pushes" if the routine should push to existing branches.
Method 2: CLI (/schedule)
Run /schedule to create a scheduled routine conversationally. You can pass a description:
/schedule daily PR review at 9am
/schedule clean up feature flag in one week
Claude walks through the same info the web form collects. The CLI creates scheduled routines only — to add API or GitHub triggers, edit on the web.
Manage existing routines from CLI:
/schedule list # see all routines
/schedule update # change one
/schedule run # trigger immediately
Method 3: Desktop app
Click Routines in the sidebar, then New routine, and choose Remote (vs Local for Desktop scheduled tasks). All three surfaces write to the same cloud account — a routine created in one appears everywhere immediately.
How do you configure schedule triggers, API triggers, and GitHub event triggers?
Schedule triggers
Pick a preset (hourly, daily, weekdays, weekly) or a custom cron via /schedule update. Minimum interval is 1 hour. Times are entered in your local timezone and converted automatically.
For one-off runs, describe the time naturally:
/schedule tomorrow at 9am, summarize yesterday's merged PRs
/schedule in 2 weeks, open a cleanup PR that removes the feature flag
One-off runs don't count against the daily routine run cap. After firing, they auto-disable.
API triggers
API triggers give a routine a dedicated HTTP endpoint. POST to the endpoint with a bearer token to start a new session.
Setup (web only):
- Edit routine → Add another trigger → API
- Copy the URL
- Click Generate token — shown once, store securely
Call:
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 "Content-Type: application/json" \
-d '{"text": "Sentry alert SEN-4521 fired in prod. Stack trace attached."}'
Response returns a session ID and URL for live monitoring. Note the beta header — this is research preview.
GitHub triggers
Configure from web UI only. Requires the Claude GitHub App installed on the target repo.
Supported events: Pull request (opened, closed, assigned, labeled, synchronized) and Release (created, published, edited, deleted).
Filters (all must match):
- Author, Title, Body, Base branch, Head branch, Labels, Is draft, Is merged
Example: Base branch main + Head branch contains auth-provider → focused auth module review.
Each matching event starts a new session — no session reuse across events.
SOCIAL SHARE CARD GENERATOR