Claude Code Routines
A Routine is a saved Claude Code configuration (prompt, repositories, environment, connectors) that runs automatically on Anthropic-managed cloud infrastructure. Routines generalize the earlier Claude Code Web Scheduled Tasks concept by adding multiple trigger types to the same saved session. Resear
This is a note from my public notes. View the canonical version: Claude Code Routines.
A Routine is a saved Claude Code configuration (prompt, repositories, environment, connectors) that runs automatically on Anthropic-managed cloud infrastructure. Routines generalize the earlier Claude Code Web Scheduled Tasks concept by adding multiple trigger types to the same saved session. Research preview; requires a Pro, Max, Team, or Enterprise plan with Claude Code Web enabled.
Create and manage them at claude.ai/code/routines, via /schedule in the CLI, or from the Desktop app (New task → New remote task).
Triggers
A routine can attach any combination of these triggers:
- Schedule: hourly, daily, weekdays, weekly, or a custom cron expression. Minimum interval: 1 hour. Runs may start a few minutes after the scheduled time (consistent stagger per routine).
- API: per-routine HTTPS endpoint authenticated with a bearer token. POST to
/firewith an optionaltextfield (freeform string) to kick off a run. Returns a session ID and URL. - GitHub: reacts to repository events (PRs, pushes, issues, workflows, discussions, check runs, merge queue, etc.). Each matching event spawns its own session. PR filters support author, title, body, base/head branch, labels, draft state, merged state, and fork origin.
API triggers ship behind the experimental-cc-routine-2026-04-01 beta header. Tokens are shown once on generation; store them in a secret store or regenerate.
Execution Model
- Runs autonomously as a full Claude Code cloud session; no permission prompts, no approval gates during the run.
- Starts from the default branch of each selected repo; pushes restricted to
claude/-prefixed branches unless Allow unrestricted branch pushes is enabled per repo. - Session is scoped by the selected repositories, the cloud environment (network access, env vars, setup script), and the enabled MCP connectors.
- Runs are visible alongside other sessions; open any run to review, take over, or turn it into a PR.
- Runs execute under the user's identity: commits, PRs, Slack messages, Linear tickets, etc. all appear as you.
Use Cases
- Nightly backlog grooming (triage, label, assign issues).
- Alert triage (monitoring tool POSTs the alert body; routine correlates with recent commits and opens a draft fix PR).
- Bespoke code review on
pull_request.openedwith a team-specific checklist. - Deploy verification called by CD pipeline after each prod release.
- Weekly docs-drift scanner that opens update PRs against the docs repo.
- Library port: merged PR in SDK-A triggers a matching PR in SDK-B.
Routines vs Other Scheduling
| Routines (cloud) | Desktop scheduled tasks | /loop (CLI) |
|
|---|---|---|---|
| Runs on | Anthropic cloud | Your machine | Your machine |
| Machine on? | No | Yes | Yes |
| Open session? | No | No | Yes |
| Local files | No (fresh clone) | Yes | Yes |
| Triggers | Schedule + API + GitHub | Schedule | In-session loop |
| Minimum interval | 1 hour | 1 minute | 1 minute |
Limits
- Per-account daily run cap (in addition to normal subscription limits); visible at
claude.ai/code/routinesandclaude.ai/settings/usage. - Per-routine and per-account hourly caps on GitHub webhook events during the research preview; events beyond the cap are dropped.
- Organizations with extra usage enabled can continue on metered overage once the cap is hit.
- Routines belong to the individual account; they are not shared with teammates.
CLI Surface
/schedule→ guided creation (schedule trigger only; add API/GitHub via web)./schedule list→ list routines./schedule update→ edit a routine (including custom cron)./schedule run→ trigger immediately./web-setupgrants repo cloning access but does NOT install the Claude GitHub App required for GitHub triggers.
Why This Matters
Routines collapse three previously separate workflows (scheduled cloud task, GitHub Action style automation, webhook-triggered agent) into a single reusable session definition. This makes it practical to treat Claude Code as a first-class automation substrate alongside CI/CD, moving from "AI helps me code" toward "AI agents run on infrastructure and act as team members". The tradeoff is loss of local-file access and full autonomy with no human in the loop per run; the prompt must be self-sufficient and the scope of repositories, env, and connectors must be tight.
Alternative to No-Code Automation Platforms
Routines are a serious alternative to n8n, Zapier, and similar workflow platforms. The triggers map directly: cron schedules, webhooks (API), and third-party events (GitHub today, more connectors over time through MCP). The key difference is what sits between trigger and action. In n8n or Zapier, you hand-wire a deterministic graph of nodes and branches. In a Routine, the "node" is a full Claude Code session with reasoning, tool use, code execution, git, and MCP connectors. The cost of expressing a new workflow drops from "design a DAG" to "write a prompt", and the ceiling rises from "map fields between APIs" to "investigate, decide, and ship a PR".
Enabling Always-On Agents (Heartbeat Pattern)
Beyond simple automation, Routines provide the missing substrate for long-running AI agents like OpenClaw and other AI Agents. A scheduled trigger running every hour (or an API trigger fired from a recurring heartbeat) acts as the agent's pulse: each firing is a chance for the agent to wake up, read its own state (vault notes, issues, memory), decide what to do next, act, and go back to sleep. This is the concrete substrate behind Agentic loops, and it depends on AI Agent Memory surviving across firings (via the repo, connectors, or an external store). What was previously a research pattern ("agent with a goal and a loop") becomes a deployable reality: the cloud environment holds state across runs, the heartbeat (cron-scheduled, see cron) gives the agent a sense of time and persistence, and the API trigger lets external systems interrupt or inject context. That combination is what makes an agent "feel alive" instead of being a single-shot chatbot. Routines are arguably the cleanest public implementation of this pattern today, with Claude Managed Agents and its Claude Managed Agents Events surface covering the higher-end, multi-session, fully-managed case. See also Distinction between AI Agents and Automation Workflows for why "a Routine" sits on the agent side of the line even when its trigger looks like a Zap.
References
- Official documentation: https://code.claude.com/docs/en/routines
- API reference: https://platform.claude.com/docs/en/api/claude-code/routines-fire
- Announcement walkthrough: https://youtu.be/j3aXJNu9804
Related
- Claude Code
- Claude Code Web
- Claude Code Web Scheduled Tasks
- Claude Code Tasks
- Claude Code MCP Integration
- Claude Code SDK
- Anthropic
- AI Agent Harness
- AI Agents
- OpenClaw
- Claude Managed Agents
- Claude Managed Agents Events
- Agentic loops
- AI Agent Memory
- Distinction between AI Agents and Automation Workflows
- cron
- n8n
- Zapier
About Sébastien
I'm Sébastien Dubois, and I'm on a mission to help knowledge workers escape information overload. After 20+ years in IT and seeing too many brilliant minds drowning in digital chaos, I've decided to help people build systems that actually work. Through the Knowii Community, my courses, products & services and my Website/Newsletter, I share practical and battle-tested systems.
I write about Knowledge Work, Personal Knowledge Management, Note-taking, Lifelong Learning, Personal Organization, Productivity, and more. I also craft lovely digital products and tools.
If you want to follow my work, then become a member and join our community.
Ready to get to the next level?
If you're tired of information overwhelm and ready to build a reliable knowledge system:
- 📚 KM for Beginners — 10+ hours of structured video lessons
- 🚀 Obsidian Starter Kit — Ready-made vault with 40+ templates
- 💼 Knowledge Worker Kit — Complete guides + lifetime community
- 🦉 1-on-1 Coaching — Personalized guidance
- 🎯 Join Knowii — Community + ALL courses & tools
Found this valuable? Share it with someone who needs it.