✦ Research Preview · April 2026

Claude Code Routines
× BACON-AI Engine

How Anthropic's new cloud automation platform integrates with the Process Classification Framework, Workflow Orchestrator, and self-annealing agent architecture to create truly autonomous AI pipelines.

Schedule Triggers API Triggers GitHub Triggers PCF v2 Integration
Scroll to explore

Autopilot for AI Workflows

A Routine is a saved Claude Code configuration — prompt + repositories + connectors + triggers — that executes on Anthropic-managed cloud infrastructure. Your laptop can be closed. The work keeps running.

🕐

Schedule Trigger

Define a recurring cadence — hourly, nightly, weekly, or a custom cron expression. Runs start a few minutes after scheduled time due to stagger. Minimum interval is one hour.

"Every night at 2am: pull the top bug from Linear, attempt a fix, and open a draft PR."

API Trigger

Each routine gets its own HTTPS endpoint and bearer token. POST a message, receive a session URL. Integrates with alerting tools, deployment hooks, and internal dashboards.

"Read the alert payload, find the owning service, and post a triage summary to #oncall with a proposed first step."
🔀

GitHub Trigger

React to repository events — PR opened, release published, labels applied. Rich filter system: author, branch, labels, draft state, fork status, regex. Each event starts a fresh session.

"Flag PRs touching /auth-provider, summarize changes, and post to #auth-changes with security notes."
3
Trigger Types
Cloud Infrastructure
25/day
Team/Enterprise runs
5/day
Pro plan runs

How Routines Run

Routines execute as full Claude Code cloud sessions — with no permission prompts, full shell access, MCP connectors, and the ability to push to claude/-prefixed branches.

graph LR subgraph Triggers["⚡ Triggers"] T1["🕐 Schedule\nCron / Preset"] T2["🌐 API POST\n/fire endpoint"] T3["🔀 GitHub Event\nPR · Release"] end subgraph Cloud["☁️ Anthropic Cloud Infrastructure"] Q["Queue & Stagger"] S["Claude Code\nCloud Session"] R["Repo Clone\n(default branch)"] E["Environment\nEnv vars · Scripts"] end subgraph Connectors["🔌 MCP Connectors"] C1["Linear"] C2["Slack"] C3["GitHub API"] C4["Custom MCPs"] end subgraph Output["📤 Output"] O1["Push Branch\nclaude/*"] O2["Open Draft PR"] O3["Post Message"] O4["Session URL"] end T1 --> Q T2 --> Q T3 --> Q Q --> S S --> R S --> E S <--> C1 S <--> C2 S <--> C3 S <--> C4 S --> O1 S --> O2 S --> O3 S --> O4 style T1 fill:#1e3a5f,color:#93c5fd,stroke:#3b82f6 style T2 fill:#064e3b,color:#6ee7b7,stroke:#10b981 style T3 fill:#2e1065,color:#c4b5fd,stroke:#8b5cf6 style S fill:#1e293b,color:#f1f5f9,stroke:#475569,stroke-width:2px

Routines in the PCF Hierarchy

The BACON-AI PCF organises all work into a 5-level hierarchy. A Claude Code Routine maps cleanly onto this structure — it is a workflow run triggered externally rather than manually.

PCF × Routine Mapping

L0
Domain
040AOP — Agent Operations
L1
Sub
040.001AOP-SESS Routine
040.002AOP-HLTH
L2
E2E
WF-ROUTINE-EXECRoutine Execution New
WF-ROUTINE-EXEC.V01Schedule variant
WF-ROUTINE-EXEC.V02API trigger variant
L3
Block
040.001.01Trigger Validation rigid
040.001.02Repo Clone & Env Setup rigid
040.001.03Prompt Execution elastic
040.001.04Output & Branch Push rigid
L4
Step
TSK-VALIDATE-TRIGGERValidate auth token
SCR-CLONE-REPOGit clone default branch
LLM-EXECUTE-PROMPTRun prompt + tools
SCR-PUSH-BRANCHPush to claude/* branch

Elasticity in Routine Blocks

rigid Trigger Validation & Output Push

Authentication, repo cloning, and branch push are deterministic safety layers. Claude cannot skip or reorder these — they are the safety envelope from Baby AI wake-up instruction #3.

elastic Prompt Execution Block

The core execution block where Claude reasons, calls tools, reads files. Step order is elastic — Claude decides which tools to call and in what order based on the prompt and observed state.

routine Variant Dimensions

Each trigger type maps to a variant: .V01 schedule (high-autonomy, no human feedback), .V02 API (context-driven, fast SLO), .V03 GitHub (event-scoped, PR-aware).

Routines as First-Class Workflow Runs

In the BACON-AI engine, a Routine execution maps directly to a workflow.run — with blocks, steps, logs, and topology fingerprints. This makes Routines auditable, self-annealing, and governance-aware.

TRIGGER
Routine Fires
Schedule, API POST, or GitHub event received by Anthropic infrastructure
VALIDATE
workflow.run created
New run record in state draft → validated. Variant selected from trigger type.
EXECUTE
Block Runs spawned
workflow.block.run records created per PCF block. Steps assigned to the session agent.
LOG
Step Logs + Events
Every tool call, LLM response, and decision appended to workflow.step.log (append-only).
FINGERPRINT
Topology Hash
Realized DAG hashed to T:xxxxxxxx. Drift from canonical flags variant candidacy.
COMPLETE
PR / Message / Gap
Output pushed. Gap records created for any missing capabilities discovered during run.
graph TD subgraph RoutineTrigger["Routine Trigger (External)"] RT["🕐 Schedule / ⚡ API / 🔀 GitHub"] end subgraph OrchestratorRun["workflow.run (BACON-AI Engine)"] WR["workflow.run\nstate: validated → running"] WBR1["workflow.block.run\n040.001.01 Trigger Validation\n🔴 rigid"] WBR2["workflow.block.run\n040.001.02 Repo Clone\n🔴 rigid"] WBR3["workflow.block.run\n040.001.03 Prompt Execution\n🟡 elastic"] WBR4["workflow.block.run\n040.001.04 Output Push\n🔴 rigid"] TF["Topology Fingerprint\nT:xxxxxxxx"] end subgraph AuditLayer["Audit & Learning"] SL["workflow.step.log\n(append-only)"] EV["workflow.event stream"] GR["workflow.gap.record\n(if capability missing)"] VA["Variant Candidacy\n(if topology drifts 3×)"] end RT --> WR WR --> WBR1 WBR1 --> WBR2 WBR2 --> WBR3 WBR3 --> WBR4 WBR4 --> TF WBR3 --> SL WBR3 --> EV WBR3 --> GR TF --> VA style WR fill:#1e3a5f,color:#93c5fd,stroke:#3b82f6,stroke-width:2px style WBR3 fill:#1a3a2a,color:#6ee7b7,stroke:#10b981 style GR fill:#2d1b69,color:#c4b5fd,stroke:#8b5cf6 style VA fill:#3b1f00,color:#fcd34d,stroke:#f59e0b

Process Flow Diagrams

Formal BPMN 2.0 models of the Routine Execution lifecycle and the PCF integration pattern — rendered live in your browser.

Routine Execution — Full BPMN Process

WF-ROUTINE-EXEC · BPMN 2.0

PCF Gap Record → Self-Annealing — BPMN Subprocess

WF-GAP-ANNEAL · BPMN 2.0

Routines Drive PCF Evolution

Every Routine run produces a topology fingerprint. When routines consistently deviate from the canonical flow — skipping steps, adding tool calls — the engine automatically proposes new variants and fills capability gaps.

graph LR A["Routine Executes\n(any trigger type)"] -->|"step sequence\nrecorded"| B["Topology Hash\nT:xxxxxxxx"] B -->|"compare to\ncanonical"| C{Drift?} C -->|"No drift"| D["Log metrics\nUpdate confidence"] C -->|"Drift detected"| E["Flag topology\nas candidate"] E -->|"3+ identical\ndrifts"| F["Propose new variant\nWF-ROUTINE-EXEC.V04"] F -->|"human approves"| G["Variant promoted\nto default"] G -->|"next routine\nuses new variant"| A A -->|"missing\ncapability"| H["Gap Recorded\nworkflow.gap.record"] H -->|"freq ≥ 3"| I["Auto-prioritised\nMedium priority"] I -->|"freq ≥ 5"| J["High priority\nResearch triggered"] J -->|"new block/step\ncreated"| K["Gap Resolved\nCapability available"] K -->|"next run\nhas capability"| A style A fill:#1e3a5f,color:#93c5fd,stroke:#3b82f6 style F fill:#3b1f00,color:#fcd34d,stroke:#f59e0b style G fill:#064e3b,color:#6ee7b7,stroke:#10b981 style H fill:#2d1b69,color:#c4b5fd,stroke:#8b5cf6 style K fill:#064e3b,color:#6ee7b7,stroke:#10b981

🔬 Topology Fingerprint

Every execution hashes its realized step sequence: T:a3f2c91e. When this diverges from canonical, the engine knows the workflow is self-annealing in practice.

📡 Gap Records as Demand Signals

When a Routine encounters a missing capability (a tool, block, or skill), it creates a workflow.gap.record. Three identical gaps auto-escalate to Medium priority — the system tells you what to build next.

🧬 Variant Promotion

Three identical topology drifts trigger variant candidacy. A human approves, and the new pattern becomes .V04 — a permanent, named execution context learned from real Routine behaviour.

🛡️ Safety Envelope Preserved

Self-annealing only affects elastic blocks. The rigid trigger validation and output push blocks never drift — the safety layer is structurally separate.

Routines in Practice

Creating routines from the CLI, triggering via API, and integrating with the BACON-AI workflow orchestrator.

# Create a nightly routine from the Claude Code CLI
/schedule "Every night at 2am: pull the top-priority issue from Linear,
attempt a fix, open a draft PR, and post a summary to #dev-updates"

# Claude checks GitHub connection, confirms repositories, sets trigger
# Result: routine appears at claude.ai/code/routines

# List all routines
/schedule list

# Trigger immediately (without waiting for schedule)
/schedule run nightly-issue-fix

# Update to custom cron (e.g. every 2 hours on weekdays)
/schedule update nightly-issue-fix "0 */2 * * 1-5"

# From desktop app: Schedule → New task → New remote task
# Fire a routine via API (e.g. from an alerting system)
curl -X POST https://api.anthropic.com/v1/claude_code/routines/trig_01ABC.../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: ..."}'

# Response — session URL returned immediately
{
  "type": "routine_fire",
  "claude_code_session_id": "session_01HJKLMN...",
  "claude_code_session_url": "https://claude.ai/code/session_01HJKLMN..."
}

# The `text` field is freeform — pass alert body, JSON payload,
# log excerpt, deploy manifest — whatever context Claude needs
# When a Routine discovers a missing capability, record a PCF Gap
import xmlrpc.client

uid, models = xmlrpc_connect()  # standard Odoo XML-RPC

# Routine tried to use a step that doesn't exist yet
gap_id = models.execute_kw(db, uid, pwd,
    'workflow.gap.record', 'record_gap', [{
        'gap_type': 'step',
        'requested_code': 'LLM-SUMMARIZE-ALERT',
        'description': 'Routine needs alert summarization step',
        'agent_id': 'routine-oncall-triage',
        'context_samples': [{
            'trigger': 'api',
            'prompt_fragment': 'summarize the Sentry alert'
        }]
    }]
)

# After 3 identical gaps → auto-prioritised to Medium
# After 5 gaps → High priority, research triggered automatically
# The system tells you what to build next
import hashlib

def topology_fingerprint(executed_steps: list[str]) -> str:
    """Hash the realized step sequence for self-annealing comparison."""
    canonical = '|'.join(executed_steps)
    return 'T:' + hashlib.sha256(canonical.encode()).hexdigest()[:8]

# Canonical Routine execution
canonical = topology_fingerprint([
    'TSK-VALIDATE-TRIGGER', 'SCR-CLONE-REPO',
    'LLM-EXECUTE-PROMPT', 'SCR-PUSH-BRANCH'
])
# → T:a3f2c91e

# Self-annealed execution (Routine added extra LLM call)
annealed = topology_fingerprint([
    'TSK-VALIDATE-TRIGGER', 'SCR-CLONE-REPO',
    'LLM-EXECUTE-PROMPT', 'LLM-VERIFY-OUTPUT',  # extra step!
    'SCR-PUSH-BRANCH'
])
# → T:7b1d4e0f  ← drift detected → variant candidacy after 3× occurrence
# Variant metadata for WF-ROUTINE-EXEC.V02 (API trigger variant)
{
    "variant_id": "V02",
    "description": "API-triggered routine — fast SLO, context-driven",
    "dimensions": {
        "role": "autonomous_responder",
        "model_class": "frontier",
        "risk_tier": 2,
        "autonomy_level": "autonomous",    // no approval prompts
        "data_sensitivity": "internal",
        "slo_class": "fast",             // respond within minutes
        "environment": "production"
    },
    "policy_overrides": {
        "confidence_floor": 0.75,      // lower than schedule variant
        "max_retries": 2,
        "human_approval_gates": []    // fully autonomous
    },
    "curiosity_config": {
        "exploration_budget": 0.05,   // low — prioritise speed
        "novelty_threshold": 0.9,
        "information_gain_weight": 0.1
    }
}

Routine × Orchestrator — Sequence Diagram

sequenceDiagram participant EXT as External System participant ANT as Anthropic Cloud participant CC as Claude Code Session participant GH as GitHub participant ORC as BACON-AI Orchestrator participant MCP as MCP Connectors EXT->>ANT: POST /fire (API trigger) ANT->>ANT: Validate bearer token ANT->>ORC: Create workflow.run (state: validated) ANT->>CC: Spawn cloud session CC->>GH: Clone default branch CC->>ORC: Start block.run 040.001.02 (rigid) ORC-->>CC: Block started CC->>MCP: Tool calls (Linear, Slack, etc.) MCP-->>CC: Tool results CC->>ORC: Log step.log entries (append-only) CC->>ORC: Record topology hash T:xxxxxxxx CC->>GH: Push to claude/fix-SEN-4521 CC->>MCP: Post triage summary to Slack CC->>ORC: Complete workflow.run ORC->>ORC: Compare topology to canonical ORC-->>EXT: Return session URL

What to Build with Routines + BACON-AI

Concrete combinations of Claude Code Routines and PCF workflow patterns that demonstrate the power of autonomous AI pipelines.

mindmap root(("Routines\n× BACON-AI")) Schedule Nightly bug triage PCF 020.003 BAC-BRAIN Linear → PR → Slack Weekly docs drift PCF 010.004 SD-DEPL Scan merged PRs → update docs Daily gap report PCF 050.001 KMG-LESS Summarise gap.records → priority list API Alert triage PCF 040.001 AOP-SESS Sentry → trace → draft fix PR Deploy verification PCF 010.004 SD-DEPL Smoke checks → go/no-go Slack Feedback resolution PCF 020.003 BAC-BRAIN User feedback → change draft GitHub PR code review PCF 010.003 SD-TEST Security + performance + style Cross-SDK port PCF 010.002 SD-IMPL Python merged → Go port PR Backport detection PCF 030.001 GOV-POL Label triggers → backport PR