Claude Code scheduled tasks are the answer to “what happens when no human started the agent.” Before they existed, every nightly triage or “when the alert fires, open a branch” workflow lived outside Claude Code as a CI cron job shelling out to claude -p. Scheduled tasks move that into Anthropic’s cloud: you save a prompt, the repositories it works in, and the connectors it may use, then attach triggers. Anthropic launched the feature as Routines on April 14, 2026 (The Register, SiliconANGLE); the official docs now call them “scheduled tasks, formerly routines,” and the feature is still a research preview whose behavior, limits, and API “may change.”

This post covers what the product actually does, how it compares with the other ways to schedule Claude Code, and the engineering decisions that matter when a run has no one watching. It extends our map of the interactive extension points in Claude Code in production.


What Is a Claude Code Scheduled Task?

A scheduled task is a saved Claude Code configuration: a prompt, one or more GitHub repositories, and a set of connectors, packaged once and run automatically. Each run is a full Claude Code cloud session that executes shell commands, uses skills committed to the cloned repo, and calls the included connectors. Tasks run on Anthropic-managed infrastructure by default, or on your organization’s self-hosted environment.

The practical facts, all from Anthropic’s documentation:

  • Plans: Pro, Max, Ultra, Team, and Enterprise. Team and Enterprise Owners can turn the feature off org-wide.
  • Where you create them: the web at claude.ai/code/routines, the Desktop app, or the CLI with /schedule (alias /routines). All three write to the same account. /schedule list, /schedule update, and /schedule run manage existing tasks.
  • Ownership: tasks belong to your individual claude.ai account and are not shared with teammates.
  • Each run is fresh: every repository is cloned at the start of every run, and every trigger event starts a new, independent session. Claude pushes to claude/-prefixed branches unless the prompt says otherwise.
  • Model and effort: you pick the model (and effort level, where the model supports it) once, and every run uses it.

The prompt is the whole program. The docs put it plainly: because the task runs autonomously, “the prompt must be self-contained and explicit about what to do and what success looks like.”

The Three Triggers

A task can have any combination of the three trigger types. A task doesn’t need a schedule at all: one with only an API or GitHub trigger runs only when called.

Schedule

Pick a preset (hourly, daily, weekly) or enter a custom cron expression. The rules that trip people up:

  • Minimum interval is one hour. Expressions that run more often are rejected.
  • Bare cron is UTC. 0 9 * * 1-5 runs at 9:00 AM UTC on weekdays. Prefix the expression with CRON_TZ= to write hours in another zone. (Presets take your local time.)
  • Avoid the top of the hour. Runs scheduled exactly on the hour “can start several minutes late”; the docs suggest a time like 9:07.
  • One-off runs are supported, such as /schedule in 2 weeks, open a cleanup PR that removes the feature flag. The task turns itself off after it fires.

API (/fire)

An API trigger gives the task its own endpoint and a bearer token scoped to triggering that one task. The token is shown once. Here is the call shape from the docs, with placeholder values:

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."}'

The response returns type: "routine_fire", a claude_code_session_id, and a claude_code_session_url you can open to watch the run.

Three details matter for anyone wiring this into alerting or deploy pipelines:

  1. text is the only input, and it’s not parsed. Send JSON and the task receives a literal string. There is no input schema.
  2. Fire text arrives labeled as untrusted. It’s wrapped in a <routine-fire-payload> block that tells Claude not to follow instructions inside it unless the saved prompt says to. Your prompt must opt in explicitly, for example: “Investigate the alert described in the routine-fire-payload block.” This is the right default: anyone holding a leaked token can send text, and the wrapper keeps that text from becoming a command, the failure mode we dissected in Prompts as Shells.
  3. It’s a claude.ai feature, not a Platform API. The endpoint is available to claude.ai users only and ships behind a dated beta header. Breaking changes ship under new header versions, with the two previous versions kept working during migration.

GitHub events

A GitHub trigger starts a session when a matching event occurs on a repository where the Claude GitHub App is installed. Supported categories are pull request, release, and issue events, either a specific action (pull_request.opened) or all actions in a category. Pull request filters cover author, title, body, base branch, head branch, labels, draft state, and merged state, with operators from “equals” to “matches regex.” (The regex must match the whole field: use .*hotfix.*, not hotfix.)

When a PR event triggers the run and that PR’s repository is the task’s first repository, the clone starts from the PR’s head commit rather than the default branch.

Scheduled Tasks vs /loop vs Desktop Tasks vs GitHub Actions

Claude Code now has four ways to run work on a timer or an event. Pick by where the work must run and what it must touch:

Cloud scheduled taskDesktop scheduled task/loopGitHub Actions + claude-code-action
Runs onAnthropic cloud (or self-hosted env)Your machineYour machine, in an open sessionGitHub runners
Needs your machine onNoYesYesNo
Local filesNo (fresh clone)YesYesChecked-out repo only
Minimum interval1 hour1 minute (set by Claude); 1 hour in forms1 minuteWhatever GitHub cron allows
PermissionsAuto mode by defaultConfigurable per taskInherits from session--allowedTools / settings you pass
BillingYour subscription usageYour Claude Code loginSame as the sessionAPI tokens (or a subscription OAuth token) plus Actions minutes

The first three columns come from Anthropic’s scheduling comparison; the last from the GitHub Actions docs.

Our rule of thumb:

  • Cloud scheduled task for unattended work tied to a repo and SaaS tools (triage, docs drift, deploy verification), especially when an alerting system or a GitHub event should start it.
  • GitHub Actions when the run must sit inside your CI security model: org-level secrets, workload identity federation, Bedrock/Agent Platform/Foundry routing, required checks, or GitHub’s own concurrency controls. It’s also the only option here that bills against an API key rather than one person’s subscription.
  • /loop for polling inside a session you’re actively running, such as babysitting a deploy for an hour. Recurring /loop tasks expire after seven days by design.
  • Hooks stay what they were: deterministic guardrails that fire during a session. Scheduling decides when a session starts; hooks decide what it may do once running. If you rely on project hooks as a guardrail for scheduled runs, test that they fire in the cloud environment before trusting them.

What a Run Can Reach: The Security Model

A scheduled task’s reach is the union of three things the docs list explicitly: the repositories you select, the environment’s network access and variables, and the connectors you include. Everything else follows from that.

It acts as you

This is the most important fact and the easiest to miss. Tasks belong to your account, and “anything a scheduled task does through your connected GitHub identity or connectors appears as you.” Commits and PRs carry your GitHub user; Slack messages and Linear tickets use your linked accounts. There is no per-task service account. Treat a scheduled task as a standing delegation of your identity, with the governance that implies. Our AI agent governance framework calls this the registry and ownership layer.

Two controls compensate:

  • Branch protection. Use GitHub branch protection rules or rulesets to limit where runs can push. For Anthropic-hosted runs, GitHub applies them to the access you connected, so a rule that access can bypass won’t block a run.
  • Org kill switch. Team and Enterprise Owners can disable scheduled tasks for everyone with the “Scheduled tasks (Was Routines)” toggle. Existing tasks stop running immediately.

Connectors: all on by default, so trim them

When you create a task, every connector on your account is included by default, and Claude “can use an included connector during a run, including writes.” Remove each connector the task doesn’t need. Connector traffic routes through Anthropic’s servers, so it bypasses the environment’s network allowlist. Removing the connector is the only way to keep a run from reaching that service. Tool descriptions from connected servers are also an injection surface, as our MCP tool poisoning exploit showed.

Network: Trusted by default

The Default environment uses Trusted network access: package registries, cloud provider APIs, container registries, and common development domains. Requests to other hosts fail with 403 and x-deny-reason: host_not_allowed. Widen it per environment with Custom (your domains, optionally plus the defaults) or Full. Store API keys as network secrets rather than environment variables, which are visible to anyone who uses the environment.

Permissions: auto mode, not a human

There’s no permission mode to choose. Anthropic-hosted runs start in auto mode, where a classifier allows or blocks actions that would otherwise wait for approval. A run still pauses for a human when an action matches an ask rule, or when blocks pile up past auto mode’s repeated-block thresholds. In that case the prompt waits in the run’s session until someone answers it. One more subtlety: the docs state that a fired prompt “is not live user input and can’t act as approval or consent for actions during the run.” Don’t write prompts that try to pre-authorize destructive steps. Gate those with ask rules instead, and make sure the approval binds to the exact action, the gap we covered in Loopjacking.

Scoping Tools: allowed-tools Pre-Approves, It Doesn’t Restrict

A common mistake, which an earlier version of this post repeated, is to treat a skill’s allowed-tools frontmatter as an allowlist. It isn’t. Per the skills docs, allowed-tools pre-approves the listed tools for the turn that invokes the skill, and “it does not restrict which tools are available: every tool remains callable.”

To actually narrow what a scheduled run can do:

  • Skill-level: list tools in disallowed-tools, which removes them from Claude’s pool while the skill is active.
  • Repo-level: commit deny rules to the repository’s .claude/settings.json. For a single-repo cloud session outside a project, those permission rules apply, unless managed settings set allowManagedPermissionRulesOnly.
  • Task-level: drop connectors and repositories the task doesn’t need, and keep network access at Trusted.

An illustrative skill for a read-mostly nightly triage task, using only documented frontmatter fields:

<!-- .claude/skills/triage/SKILL.md — illustrative example -->
---
name: triage
description: Draft a dated triage report from open issues and recent PRs
allowed-tools: Read Grep Glob
disallowed-tools: WebFetch
---

Write reports/triage-<today's date>.md summarizing issues opened since the
last report in reports/, PRs awaiting review, and the top three risks.
If today's report already exists, update it instead of creating a second one.
Do not merge, close, or label anything.

Designing Prompts for Unattended Runs

The docs describe no concurrency, retry, or timeout settings for scheduled tasks, so the safety properties have to come from the prompt and the repository. Design for these realities:

Every event is a separate session. “Two PR updates produce two independent sessions.” A burst of synchronize events can start several runs on the same PR. Make the work idempotent: check whether the comment, branch, or ticket already exists before creating it, and write date-stamped outputs instead of overwriting a shared file.

Runs start from a clean clone. Nothing persists between runs except what’s in the repo, the connected services, and the session history. If the task needs to know “since the last run,” derive it from durable state: the newest report file, a label, a timestamp in a tracking issue.

“Succeeded” means the session ended cleanly, not that the work got done. The run history marks Failed, Cancelled, or neither. A blocked network request or a missing connector tool shows up only in the transcript. Have the prompt end with an explicit result: a summary comment, a Slack post, or a file. Silence then means something went wrong.

The cloned repo is input, too. A run executes in whatever the repository contains, including committed config. Repository-borne attacks on coding agents, such as GitSpawn, apply to scheduled runs on untrusted branches. Be deliberate about triggering on PRs from authors you don’t control.

Be explicit about destinations. State the branch, the output path, and what the task must never do (merge, force-push, close issues). The same specificity principle we found in Claude Code’s own system prompt applies here.

Limits and Cost

Scheduled tasks draw down subscription usage exactly like interactive sessions. There’s no per-run API bill. Separately, each way of starting a run has an hourly cap, per the docs:

ActionLimitCounted for
Scheduled runs (including one-off)100 per hourYour account (over-limit runs wait)
Run now + API fires + re-arming a one-off30 per hourEach task (over-limit actions fail)
Run now + re-arming a one-off100 per hourYour account
API fires100 per hourYour account
GitHub eventsPer-task and per-account hourly capsExcess events are dropped

None of the hourly limits has overage. When a task hits your subscription usage limit, organizations with usage credits turned on can keep running on metered overage; otherwise runs are rejected until the window resets. (At launch, The Register reported daily run allowances of 5 on Pro, 15 on Max, and 25 on Team and Enterprise. Current docs describe the hourly limits above.)

If the work runs in GitHub Actions on an API key instead, you pay per token plus Actions minutes. Cap each run with --max-turns and --max-budget-usd (both print-mode flags) and a workflow timeout-minutes. At current list prices, Claude Fable 5.1 costs $10 per million input tokens and $50 per million output tokens, and Claude Sonnet 5.5 costs $2 and $10. For a routine that runs every night, that model choice usually matters more than any prompt tweak. We cover the levers in effort and task budgets.

An illustrative scheduled workflow using the documented anthropics/claude-code-action@v1 inputs:

# .github/workflows/nightly-triage.yml — illustrative example
name: Nightly triage
on:
  schedule:
    - cron: "7 2 * * *"   # GitHub cron is UTC
jobs:
  triage:
    runs-on: ubuntu-latest
    timeout-minutes: 20
    permissions:
      contents: read
      issues: read
      id-token: write
    steps:
      - uses: anthropics/claude-code-action@v1
        with:
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
          prompt: "Summarize yesterday's commits and open issues"
          claude_args: |
            --model claude-sonnet-5-5
            --max-turns 15
            --allowedTools "mcp__github__list_commits,mcp__github__list_issues"

GitHub runs scheduled workflows only from the default branch. In public repositories it also disables the schedule after 60 days without repository activity, which is an easy way to lose a “nightly” job without noticing.

Where to Start

  1. Move one existing cron job. Pick a read-mostly workflow, such as a nightly report, and recreate it with /schedule. Off-the-hour time, explicit output path, and an explicit “done” message.
  2. Trim before the first run. Remove every connector and repository the task doesn’t need, keep Trusted network access, and add branch protection on anything it can push to.
  3. Add an API trigger for one alert. Write the prompt to reference the routine-fire-payload block explicitly, store the token in your alerting tool’s secret store, and start with a task that opens a draft PR or a comment, not a merge.
  4. Read transcripts, not status badges, for the first two weeks. “Succeeded” only means the session ended.
  5. Put prompt and skill changes through evals. A scheduled prompt is production code that runs as you; treat edits like any other change, with the gates from agent evals in CI/CD.

Scheduled tasks close the gap between “useful when a human drives it” and “useful when no human is there.” What they don’t do is add a service identity, a concurrency guard, or an input schema. Those properties still come from how you scope the task and write the prompt.


We wire Claude Code for production, from skills and hooks to MCP connectors and scheduled cloud tasks, with the scoping and evals to prove it holds when no one is watching. If you’re moving cron hacks to scheduled agents and want identity, reach, and cost handled before anything runs unattended, let’s talk.