Anatomy of 58.2M Tokens: Where Autonomous Coding Agents Actually Spend Money
A 14-day empirical audit of 850 model invocations across 32 workflow nodes — why unmerged retries dominate gross spend, and the four architectural changes that cut token waste by 38%.
While merged pull requests consumed only 586,759 net tokens on their own task rows (7.6M total), gross server spend reached 4.48M tokens per merge because post-slice developer checks resumed full CLI conversation transcripts up to 4 times per build (35M tokens) and critique loops regenerated PRDs from scratch (8.4M tokens).
1) Run all deterministic static checks (completeness, test coverage, typecheck, targeted suites) before a single resumed developer session with the union of findings; 2) Cache PRD/UX/Architecture artifacts by SHA-256 brief digest; 3) Route incremental replans on diff-only critiques; 4) Enforce strict per-role token budgets.
35–40% reduction in gross server spend (58.2M → ~35M/14d) and ~400k net tokens per merged PR.
1. Net Task Tokens vs. Gross Server Spend
Most industry benchmarks only report the happy-path tokens of tasks that succeeded. Over 14 days in production (850 model calls, 40.6M input tokens, 17.6M output tokens), we measure both metrics transparently: 586,759 net tokens on merged task rows versus 4,476,923 gross tokens when unmerged retries, background daemons, and planning revisions are included.
Metric | 14d Baseline | Post-Optimization Target ----------------------------------------+----------------------+--------------------------- Net tokens on merged task rows / PR | 586,759 | ~400,000 Gross server tokens / merged PR | 4,476,923 | <= 2,800,000 (-38%) Developer CLI turns / merged PR | 9.5 calls (35.0M) | < 6.0 calls (< 2.0M/merge) Planning tokens / merged PR (5 roles) | 650,000 (8.4M total) | < 300,000 (SHA-256 cache)
2. Eliminating Transcript Replay in Resumed CLI Sessions
When a coding agent completes a vertical slice and spawns sequential follow-up processes for completeness, test coverage, typechecking, and linting, each resumed turn re-ingest the entire conversation transcript. Executing all deterministic static gates upfront and batching the union of failures into a single resumed turn eliminates three redundant context replays per slice.