Same triage. One path never lets the raw data reach the model.
Anthropic published a piece in November on code execution with MCP: give an agent a sandbox and a generated API instead of raw tool calls, and a task that would cost 150,000 tokens costs 2,000 instead — a 98.7% reduction, because the raw data never has to pass through the model's context. Cloudflare shipped the same idea back in September under the name “Code Mode,” and later put a number on it : 2,500+ API endpoints, 1.17M tokens down to about 1,000.
Our first reaction was “we already built this.” Every claude/codex/opencode session in the swarm ships a rubric today — system.agent.context_mode in src/prompts/session-templates.ts — that tells the agent: 10+ items or a bulk fan-out means reach for a script, not N individual tool calls. We didn't add this for the post. It's just what the swarm already does, and it's the same machinery behind Script Workflows .
What we hadn't done is measure it against Anthropic's own yardstick, with our own production data. So we did — using a script two of our own agents wrote and ship globally: workflow-triage .
What the script does
workflow-triage scans every automation the swarm runs — all workflows and all cron schedules — and flags which ones are dead, failing, or fine. Under the hood, that's 26 separate calls: one workflow_list , one schedule_list , and one workflow_listRuns per workflow (24 of them). Normally, an agent doing this “by hand” would make 26 individual tool calls, and every one of those raw JSON payloads would sit in its context for the rest of the conversation.
Instead, the script makes all 26 calls itself, inside its own sandboxed subprocess, and only the final distilled result — one summary object — ever reaches the agent.
What we measured, live
We didn't estimate this. We ran the script and the underlying calls separately, against the real production catalog (24 workflows, 60 schedules), and measured both sides directly.
Script (workflow-triage) Raw sequential calls (measured + extrapolated) Calls made 1 26 Reaches the agent's context 25,811 characters (one JSON result) — measured exactly ~3,259,649 characters — see methodology below Approx. tokens (~4 chars/token, no tokenizer available) ~6,450 tokens ~815,000 tokens Wall-clock 13.12s ( durationMs: 13120 ) — measured exactly ~2–6.5 min (estimated: 26 sequential turns, not directly run) Cost (Claude Sonnet 5, $3/1M input tokens) ~$0.02 ~$2.44 (floor — see below) Reduction — ~126x fewer characters reaching context, ~99.2%
... continue reading