TokenMix Research Lab · 2026-04-22
Claude Code Routines: Run AI Agents on Schedule, No Mac Online
Anthropic shipped Claude Code Routines on April 14, 2026 — scheduled, repeatable AI coding tasks that run on Anthropic's web infrastructure. Your Mac can be closed, asleep, or halfway around the world; routines execute. Each routine bundles a prompt, a repo, and connectors into one config that fires on a schedule, via API call, or on GitHub events. This is Anthropic's answer to Cursor 3's background cloud agents and pushes Claude Code toward the "autonomous coding agent" category. This guide covers what routines can do today, how to write one in 10 minutes, the cost model, and three production use cases. TokenMix.ai tracks model usage across scheduled agent workflows — if you're running routines at scale, our dashboard shows per-routine cost attribution.
Table of Contents
- Confirmed vs Speculation: Routines Facts
- What Routines Can Do
- Your First Routine in 10 Minutes
- Three Production Use Cases
- Cost Model: What Each Run Actually Costs
- Routines vs Cursor 3 Cloud Agents vs GitHub Actions
- FAQ
Confirmed vs Speculation: Routines Facts
| Claim | Status | Source |
|---|---|---|
| Claude Code Routines released April 14, 2026 | Confirmed | 9to5Mac |
| Runs on Anthropic web infrastructure | Confirmed | Anthropic docs |
| Schedule, API, GitHub event triggers | Confirmed | Documentation |
| Requires Claude Code Pro or Max | Confirmed | Pricing docs |
| Default model: Opus 4.7 | Confirmed | Anthropic release notes |
| Per-routine cost tracking available | Partial — Max tier only | Community reports |
| Unlimited routines | No — rate-limited | Documentation |
| Cross-repo routines supported | Yes | Recently added |
Bottom line: production-ready with clear limits. Best fit for teams already on Claude Code Pro/Max.
What Routines Can Do
A routine combines four elements:
- Prompt — the instruction Claude executes (e.g., "Check for dependency vulnerabilities and create a PR")
- Repo — which codebase to operate on
- Connectors — tools Claude can use (GitHub, Linear, Slack, custom MCP servers)
- Trigger — when to run (cron schedule, API call, GitHub webhook)
Trigger types
| Trigger | Example use | Setup difficulty |
|---|---|---|
| Cron schedule | "Every Monday at 9am, review dependabot PRs" | Easy |
| GitHub event | "On new PR, run linting + summarize diff" | Medium |
| API call | Your app triggers via POST | Medium |
| Manual | Click "run" in dashboard | Trivial |
What Claude can do inside a routine
- Read/write files in the target repo
- Create/update PRs via GitHub connector
- Post to Slack/Linear/Notion
- Run custom MCP servers (subject to MCP security considerations)
- Call external APIs (if connector configured)
- Chain multiple tool calls autonomously
Your First Routine in 10 Minutes
Example: Weekly dependency audit that creates a PR if vulnerabilities found.
Step 1: Open Claude Code Routines dashboard
In Claude Code (Pro/Max), click "Routines" sidebar → "New Routine".
Step 2: Configure the routine
name: weekly-dependency-audit
description: Scan dependencies for CVEs, open PR with fixes
trigger:
type: cron
schedule: "0 9 * * MON" # Every Monday 9am
repo:
url: github.com/yourorg/yourrepo
branch: main
connectors:
- github
- slack
prompt: |
Run npm audit --json on the repo.
Parse results for high/critical severity.
For each fixable vulnerability:
- Create a branch "security/fix-{package-name}"
- Update the affected dependency
- Run the test suite
- If tests pass, open a PR with a summary
- Post to #security-alerts Slack channel
If no vulnerabilities, post "clean" to Slack.
model: claude-opus-4-7
max_runtime_minutes: 30
Step 3: Test once manually
Click "Run now". Review output in dashboard. Adjust prompt if needed.
Step 4: Activate schedule
Toggle "Active". Routine now runs every Monday at 9am without your Mac being online.
Estimated cost per run: $0.50-$2.00 depending on repo size and vulnerability count.
Three Production Use Cases
1. Nightly Test Flakiness Analysis
Run at 2am. Claude reviews last 24 hours of CI test failures, groups by likely root cause, files a Linear ticket for each pattern with suggested fixes. Teams report 30-50% reduction in test flake triage time.
2. PR Description Generation & Review Prep
Trigger on pull_request.opened GitHub event. Claude reads the diff, generates a structured PR description with context, risk assessment, and suggested reviewers. Optionally flags high-risk changes for senior review.
3. Customer Support Codebase Q&A
Trigger via API from your support tool. When a customer asks "How do I integrate feature X?", support agent hits your endpoint, which triggers a routine that searches your docs repo and returns an authoritative answer with source links.
Cost Model: What Each Run Actually Costs
Anthropic charges routines at standard API rates for the model used. Default is Opus 4.7 at $5/$25 per MTok, with the new tokenizer cost considerations.
Typical costs per run:
| Routine type | Tokens in | Tokens out | Cost/run |
|---|---|---|---|
| Small audit (one check) | ~5K | ~1K | $0.05 |
| Dependency audit + PR | ~30K | ~5K | $0.28 |
| Codebase-wide refactor | ~200K | ~50K | $2.25 |
| Long-form doc generation | ~50K | ~20K | $0.75 |
| Cross-repo analysis | ~500K | ~100K | $5.00 |
Hidden cost: runtime caps
Routines have a default 30-minute timeout. Tasks exceeding this fail. Extending to 60 minutes is $0.10/minute premium on Max tier. This caps worst-case cost per run at about