Claude Code keeps working when you close your laptop.
A routine is a saved Claude Code configuration: a prompt, one or more repositories, and a set of connectors. It runs on Anthropic-managed cloud infrastructure — no machine, no open session. Define it once, then let it handle recurring work: PR reviews, nightly triage, deploy verification, docs drift checks.
Routines are in research preview and available on Pro, Max, Team, and Enterprise plans with Claude Code on the web enabled. Create and manage them at claude.ai/code/routines or from the CLI with `/schedule`.
A routine is a cloud-hosted Claude agent with a saved prompt, repos, and connectors — triggered automatically, without you.
Think of a routine like a standing order to a night-shift engineer. You write the brief once. They clock in every night, do the work, and leave you a report. You read the results in the morning.
Available on Pro, Max, Team, and Enterprise
Requires Claude Code on the web to be enabled. Create and manage routines at claude.ai/code/routines or from the CLI with /schedule.
The building blocks
A routine has two parts — what Claude should do, and what makes it run. Separate these and the system becomes clear.
Why cloud matters
Local Claude Code stops when you close your laptop. Routines run on Anthropic's infrastructure — they keep going at 3am, on weekends, during your holiday. The session log is always there when you come back.
Commits, PRs, Slack messages, and Linear tickets created by a routine appear under your GitHub identity. Runs count against your account's daily allowance — not a shared pool.
Three trigger types
Every routine needs at least one trigger. Mix and match — the same routine can react to all three simultaneously.
Hourly, daily, weekdays, or weekly. Times set in your local timezone. Custom cron expressions via `/schedule update` in the CLI.
Each routine gets a dedicated endpoint and bearer token. Pass extra context in the `text` field — Claude receives it alongside the saved prompt.
PR events (opened, closed, labeled) or release events. Filter by author, branch, label, draft state, or regex on the title.
By default Claude can only push to branches prefixed with `claude/`. To allow unrestricted pushes, enable it explicitly per repository when creating the routine.
Create a cloud routine
All three surfaces — web, CLI, Desktop app — write to the same cloud account. A routine created in the CLI shows up on the web instantly.
Run `/schedule daily PR review at 9am` in any session. Claude walks through setup conversationally and saves the routine to your account.
The routine runs fully autonomously. No approval prompts during the run — be explicit about what to do and what success looks like.
Each repo is cloned fresh from the default branch on every run. Set environment variables, network access, and a setup script (result is cached).
Schedule, API endpoint, and GitHub event triggers can be combined. Add or remove them anytime from the edit form at claude.ai/code/routines.
Each run is a full session — review changes, create a PR, or continue the conversation. Use Run now, pause, or edit from the routine's detail page.
Minimum schedule interval is 1 hour. Routine runs count against your daily cap and subscription usage. Check consumption at claude.ai/settings/usage.
End-to-end: Alert Triage
Your monitoring tool fires at 2am. You want Claude to pull the stack trace, correlate it with recent commits, and open a draft PR with a proposed fix — without waking anyone up.
The prompt is self-contained — Claude knows exactly what to do with no human in the loop.
Save it. Claude generates a unique endpoint URL and you create a bearer token (shown once — store it immediately).
Your monitoring tool (Sentry, Datadog, PagerDuty) POSTs to the routine endpoint. The alert body reaches Claude alongside the saved prompt.
All of this happens while you sleep — no approval prompts, no human in the loop.
A Slack message in #on-call links to draft PR #312. Claude's reasoning is in the PR description. You review, approve, and merge — instead of starting from a blank terminal at 2am.
The same routine handles every future alert. Combine it with a schedule trigger (nightly log scan) and a GitHub trigger (every new release) — one routine, three ways to fire, zero manual intervention.
Code Examples
Three ways to work with routines in code. CLI is fastest for creating them; curl and Python are for triggering from external systems.
The /fire endpoint receives your POST and authenticates the bearer token
Anthropic spins up a fresh Claude Code cloud session for this routine
Claude clones the configured repos and runs the saved prompt (plus any `text` you passed)
The response returns a session URL — open it to watch Claude work in real time