skip to content

How do a Claude Code routine's schedule, API and GitHub triggers start a run, and what bounds what that run can do?

level: seniorimportance: nice to knowfreq 5%

answer

  1. research preview, cloud sessions
  2. schedule, /fire, GitHub event
  3. bearer token shown once
  4. fire text wrapped as untrusted
  5. repositories, environment, connectors

basics

~20 s

Each trigger starts a fresh cloud session: a schedule (hourly minimum), a bearer-token POST to /fire, or a GitHub pull request or release event. Runs have no permission-mode picker, so repositories, environment and connectors bound them.

solid answer

~40 s

A routine (research preview) is a saved prompt, repositories, environment and connectors that runs as a cloud session whenever a trigger matches. A **schedule** trigger runs hourly to weekly or once, with a one-hour minimum; an **API** trigger is a POST to the routine's `/fire` endpoint with a per-routine bearer token generated on the web and shown once; a **GitHub** trigger fires on pull request or release events and needs the Claude GitHub App. Fire `text` arrives wrapped in a `<routine-fire-payload>` block marked untrusted, so the saved prompt must opt in to acting on it. There is no permission-mode picker: the run executes commands and connector writes without stopping for approval, as your account, so you scope it through the repositories, the environment's network access and the connectors you leave attached.

code

bash · 7 lines
bash
# ROUTINE_FIRE_URL and ROUTINE_TOKEN come from the routine's API trigger modal
curl -X POST "$ROUTINE_FIRE_URL" \
  -H "Authorization: Bearer $ROUTINE_TOKEN" \
  -H "anthropic-beta: experimental-cc-routine-2026-04-01" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"text": "Error rate on checkout-api crossed 5% after the 14:10 deploy."}'

go deeper

for a junior

Recall that routines run in the cloud and start from a schedule, an API call or a GitHub event, and that they are a research preview.

for a middle

Explain each trigger's setup: schedule presets and the one-hour floor, the /fire endpoint and its once-shown token, the GitHub App and filters.

for a senior

Show why fire text is wrapped as untrusted, why runs take no approvals, and how repositories, environment network access and connectors bound the blast radius.

for a principal

Weigh giving an autonomous job your identity and connectors against its value, and decide which work earns a routine versus a supervised session.

## What a routine is A **routine** is a saved Claude Code configuration — a **prompt**, one or more **GitHub repositories**, a **cloud environment** and a set of **connectors** — that runs automatically as a full cloud session. Routines are in **research preview**: behaviour, limits and the API surface may change. They are available on Pro, Max, Team and Enterprise plans and belong to your **individual claude.ai account**. You create them at the routines page on the web, in the Desktop app (New routine, then **Cloud**), or from the CLI with **`/schedule`** (alias `/routines`), which walks through the same fields conversationally. ## The three triggers A routine can carry any combination of triggers, and each match starts a **new session**. | Trigger | How it starts a run | Notes | | :- | :- | :- | | **Schedule** | Hourly, daily, weekdays or weekly preset, or a one-off timestamp | Local time converted automatically; minimum interval one hour; custom cron via `/schedule update` | | **API** | HTTP POST to the routine's `/fire` endpoint with a bearer token | Added on the web; the token is shown once; the CLI cannot create or revoke tokens | | **GitHub** | A pull request or release event on a connected repository | Requires the Claude GitHub App on the repository; optional filters | Details that matter in practice: - A schedule set exactly on the hour can start several minutes late; pick a time like 9:07 to start close to it. - The API trigger's token is **scoped to that routine only**; rotate or revoke it with **Regenerate** or **Revoke** in the same modal. A successful fire returns the new session's ID and URL. - GitHub triggers can filter pull requests by author, title, body, base and head branch, labels, draft and merged state; **all conditions must match**, and `matches regex` tests the **whole** field value. Events beyond per-routine and per-account hourly caps are **dropped**. Running `/web-setup` grants clone access but does **not** install the GitHub App or enable webhook delivery. ## How fire text reaches Claude The `/fire` body accepts an optional **`text`** field, freeform and unparsed — JSON you send arrives as a literal string. It is **not** delivered as a bare instruction: it arrives wrapped in a **`<routine-fire-payload>`** block that labels it untrusted data and tells Claude not to follow instructions inside it unless the routine's own prompt says to. So the saved prompt must **opt in**, for example "investigate the alert in the routine-fire-payload block". The same wrapping applies to text supplied with **Run now**. If a token leaks, whatever the holder sends still arrives labelled as data rather than as direct instructions. The routine's saved prompt, by contrast, is delivered as the session's assigned task. ## What bounds a run A routine has **no permission-mode picker**. It runs shell commands, uses skills committed to the cloned repository and calls included connectors — **writes included** — without stopping for approval, apart from some artifact actions. So the boundary is set before the run: 1. **Repositories** — each is cloned fresh from its default branch on every run; Claude pushes to `claude/`-prefixed branches unless the prompt directs otherwise. Use GitHub branch protection or rulesets to control pushes; on Anthropic-managed infrastructure they are checked against the GitHub access you connected, so a rule that access can bypass does not block the push. 2. **Environment** — network access level, environment variables and a cached setup script. The **Default** environment's **Trusted** access allows only a default allowlist; other hosts fail with `403`, while connector traffic is routed through Anthropic's servers instead. 3. **Connectors** — **all of your connected connectors are included by default**; remove the ones the routine doesn't need. Everything it does through GitHub or connectors **appears as you**: commits carry your GitHub user, and connector actions use your linked accounts. ## Operating it - A **green status** means the session started and exited without an infrastructure error — **not** that the task succeeded. Read the run's transcript. - Hourly limits apply per account and per routine, separately from subscription usage. - If your GitHub connection is missing, the routine skips runs for up to 72 hours, then turns off. - `/schedule` needs a **claude.ai subscription login**; with a Console API key or a cloud-provider login it is hidden or answers with an availability message. `/schedule list`, `/schedule update` and `/schedule run` manage existing routines. ## Common mistakes - Expecting `text` to replace or override the saved prompt. - Assuming a routine asks before a connector write. - Leaving every connector attached. - Reading green as success.

  • A routine's API token leaks. What can the holder do, and how do you respond?
    The token is scoped to firing that one routine, so the holder can start runs and send `text`, which arrives wrapped as untrusted data rather than as instructions. Fires also count against the routine's hourly limit. Respond by clicking **Regenerate** or **Revoke** in the API trigger modal on the web; the CLI cannot revoke tokens.
  • Who does a routine act as, and how do you stop it pushing to main?
    It belongs to your individual account: commits and pull requests carry your GitHub user, and connector actions use your linked accounts. Claude pushes to `claude/`-prefixed branches unless the prompt says otherwise, so enforce the limit with GitHub branch protection or rulesets — and remember a rule your own access can bypass won't block the run.
  • A GitHub-triggered routine missed some pull requests. What would you check?
    That every filter condition matches, since all must; that a `matches regex` filter covers the whole value, such as `.*hotfix.*`; that the Claude GitHub App is installed on the repository; and whether events exceeded the per-routine or per-account hourly caps, beyond which they are dropped.

  • The /fire text field replaces the routine's saved prompt for that run.
  • A routine runs in whichever permission mode you pick when creating it.
  • Running /web-setup is enough for a routine's GitHub trigger to fire.
  • A green status in the run list means the routine's task succeeded.
  • You can generate a routine's API token from the CLI with /schedule.
  • Connectors attached to a routine ask before each write.