Cost engineering

What a Scheduled Claude Code Agent Actually Costs (and Why It Re-Reasons Every Run)

The token bill of a recurring Claude Code job, priced per model from a real benchmark, and how to replay the deterministic core at 0 tokens straight from Claude Code's own history.

The short version
  • 01A scheduled Claude Code job re-reads its instructions and re-derives the same tool sequence every run — a full model session each time.
  • 02On our benchmark the agent arm carried 18,390 input tokens per run; at hourly cadence that's roughly $66/mo on Opus 4.8, before the job's real context is counted.
  • 03Claude Code writes a scannable history, so `reelier scan` reads it directly, compiles the deterministic core to a skill, and replays it at 0 tokens.

A scheduled Claude Code agent — a Routine, or claude-code-action on a cron — was chosen for the schedule precisely because the task repeats. That repetition is the whole problem: the agent doesn't know the task is the same as yesterday's, so it re-reads its instructions, re-derives the same tool calls, and pays full price to regenerate a sequence that hasn't changed.

This post prices that bill per model from a real benchmark, then replays the deterministic half of it at 0 tokens — with a receipt at the end, not a projection. The durable mental model behind all of it lives in the cost-series pillar.

1. The bill is calls × tokens × price

The monthly bill is arithmetic: runs per month × tokens per run × price per token. Runs per month is the schedule you set. Price per token is published, from the Anthropic pricing page (retrieved 2026-07-21): Claude Opus 4.8 at $5.00 per million input tokens, Claude Sonnet 5 at $2.00 (introductory, through 2026-08-31; $3.00 thereafter), Claude Haiku 4.5 at $1.00.

Tokens per run is the factor people misread. In the published benchmark, a live agent doing a small two-step npm-metadata lookup carried 18,390 input tokens per run — the task never changed between runs. Hold that fixed context and vary only the price and the schedule (Routines cap out at an hourly interval):

Model tier Cost/run (input, 18,390 tok) Monthly, daily Monthly, hourly
Opus 4.8 ($5.00/MTok) $0.0920 $2.76 $66.20
Sonnet 5 ($2.00/MTok) $0.0368 $1.10 $26.48
Haiku 4.5 ($1.00/MTok) $0.0184 $0.55 $13.24
✓ Reelier replay · Level 0 $0.0000 $0 $0

Two honest notes. The Sonnet row uses the introductory $2.00 rate; it becomes $3.00 after 2026-08-31, which raises the hourly column to ~$39.72. And 18,390 tokens is a tiny measured context — a real Claude Code job also drags along CLAUDE.md, the tool definitions, repo context, and any MCP servers, so treat this table as a floor. The takeaway is the shape: the bill scales with the schedule while the work stays the same size.

Fig. 1Cumulative cost over one month of a scheduled agent, re-run vs. replayed. Source: table above.
$0$864$1,728LLM re-reasoningReelier replay · $01 self-heal ≈ $0.001, then $002,880 heartbeats / month

Cost is calls × 120k tokens × price on Opus 4.8 at a 15-minute cadence. Level-0 replay re-executes the recorded tool calls: 0 tokens by construction. Source: the tables above and the reelier benchmark.

2. A scheduled Claude Code agent re-reasons every run

Claude Code Routines (research preview as of July 2026) are saved configurations — a prompt, repositories, connectors — that run on Anthropic-managed cloud infrastructure on a schedule, down to an hourly minimum via /schedule update (code.claude.com/docs/en/routines). Per the docs, a routine draws down subscription usage the same way an interactive session does, plus a daily cap on runs per account. GitHub Actions crons around anthropics/claude-code-action are the other common shape — a full agent session on a cron trigger.

Either way, the schedule fires, a model session spins up, tool definitions load, the agent re-reads its instructions, re-derives its plan, re-executes its tool calls, and exits. Tomorrow: the same trip. On a subscription that spend shows up as usage against your cap rather than a line-item invoice, but the tokens are real either way — and on a BYOK or API key it is the invoice.

3. Claude Code keeps a scannable history — reelier reads it directly

Here is the part that makes Claude Code the easy case. Claude Code writes every session as a tool-call transcript in JSONL under ~/.claude/projects/<project-slug>/<uuid>.jsonl. That is exactly the format reelier scan reads — it's the native transcript schema, parsed directly, no proxy in the loop:

sh
npx -y reelier scan          # reads ~/.claude/projects, ranks read-only sessions first

You don't re-run the job to capture it; the run that already worked is on disk. scan lists the replayable sessions and offers to compile one, or point from-session at a specific transcript. (For contrast, an IDE that keeps its history in a SQLite database gets no history scan and needs the recording proxy instead — that's the Cursor case; Codex keeps file-based session logs of its own under the home directory.)

4. Record once, replay the part that never changes

The loop is scan → compile → replay → diff.

Fig. 2Record once, replay the part that never changes.
recordtool calls capturedcompileSKILL.md + assertionsreplayLevel 0 · 0 tokensdiffSAME / DRIFTED0 tokens✓ SAMEelse DRIFTED → exit 1

Record captures the real tool calls once. Every subsequent run replays them at Level 0 (0 tokens), emits a receipt, and diffs the result. Drift fails loudly. Source: the reelier benchmark.

Compiling a scanned session produces a SKILL.md — typed JSON in, typed JSON out. The compiler writes a minimal set of assertions: a step whose recorded result was clean gets an assertion; a step that failed or returned nothing stays assertion-less and replays as unchecked, surfaced as an open question rather than silently marked passed. It's reviewed like code, because it is code you commit to git. Three boundaries, stated before you ask:

Replay covers the deterministic core, not the judgment. Status checks, metrics pulls, and feed diffs replay for free; triage, synthesis, and prose need a model every run and replay is the wrong tool for them. Level-0 replay never constructs an LLM client — 0 tokens by construction, not by optimization. Escalation to a model (--max-level 1|2) is opt-in and BYOK; a destructive step is never auto-escalated.

Replay is read-only by default. An idempotent-write step re-fires only when you pass --allow-writes; a destructive step is stricter and never re-fires without an explicit --yes. A scheduled replay can't accidentally re-send a message or re-create a record.

Drift fails loudly. reelier diff <job> reports SAME or DRIFTED per step and exits 1 on drift, with the failing assertion printed. Wire that nonzero exit to wake your Claude Code agent: the runs where nothing changed cost nothing, and the one run where the API shifted gets the model's full attention.

5. The measured numbers

From the head-to-head benchmark — same task, same live data, full method and raw tables:

Agent re-run Reelier replay
Tokens per run 18,390 in / 136 out (avg) 0 / 0 — verified from the run record
Cost per run $0.019068 (avg) $0.000000
Latency per run (Task 1, N=9) 2,842 ms (avg) 48 ms (avg)
✓ Output stability no structural guarantee 1,000 / 1,000 byte-identical (N=1000)

The 0-token claim is asserted from each replay's run record (llmInputTokens === 0 && llmOutputTokens === 0) on every one of the 1,000 replays, checked programmatically. In that N=1000 sample the agent arm produced no wrong outputs on this task — the claim here is cost, speed, and a byte-identical guarantee by construction, not an observed drift rate. Replay latency varies with your network, because Level-0 replay re-executes the real tool calls; what doesn't vary is 0 tokens, the same steps, and a receipt each run. The pattern is independently corroborated — arXiv 2605.14237 reports 93.3–99.98% monthly token reduction for the same record-and-replay approach.

6. Run your own numbers

Reelier's install demo closes with this, reproduced verbatim from the project README:

Reelier · replay receipt
Your receipt:
  skill:        reelier-init-demo
  steps:        2 total, 2 passed, 0 unchecked, 0 failed
  replay time:  44ms  [measured]
  LLM tokens:   0     [measured]

  An agent doing a comparable task re-reasons every run (~2.8s, ~18k tokens on
  our benchmark). Your replay: 44ms, 0 tokens.
* * * end of receipt * * *

Plug your own schedule, context size, and model into the agent cost calculator — the table from section 1 at your numbers, next to the replay column pinned at $0. For the cron-first workflow (Routines, Actions, and a copy-paste gate on drift), see scheduled agents at zero tokens; if you're weighing this against Claude Code's own Agent Skills, that page draws the line between an instruction file and a compiled replay.

Scan the run that worked. Replay it on the schedule. Pay for judgment, not re-derivation.

Sources

  1. Anthropic — pricing (retrieved 2026-07-21) — Opus 4.8 $5.00, Sonnet 5 $2.00 (introductory, through 2026-08-31; $3.00 thereafter), Haiku 4.5 $1.00 per million input tokens.
  2. Reelier benchmark results (run 2026-07-18) — 18,390 input tokens/run (agent arm) vs. 0/0 verified on every one of 1,000 replays; $0.019068 vs. $0.000000; 2,842 ms vs. 48 ms (Task 1, N=9); 1,000/1,000 byte-identical (Task 3, N=1000).
  3. Claude Code Routines — scheduled Claude Code configs on Anthropic-managed infrastructure; hourly minimum interval; draws down subscription usage plus a daily run cap.
  4. anthropics/claude-code-action — the GitHub Actions cron path for scheduled Claude Code sessions.
  5. seldonframe/reelier — the open-source implementation; the Claude Code history scan (~/.claude/projects), the Level-0 rule, and the write gates live in src/scan.ts, src/runner.ts, and src/cli.ts.