What an AI-Built User Story Really Costs: A Token-Level Audit
A token-level cost audit of an autonomous Claude Code pipeline reveals cache economics, hidden failure rates, and a ledger bug that hid real spend.
An autonomous SDLC framework running on Claude Code wrote an 861,601-line production application over four months with zero human coding, but the first generation of the pipeline kept no usage records and the transcripts expired — so that bill is gone forever. A rebuilt, self-instrumented version fixed this by logging every stage attempt's tokens, cost, model, and failure category to a persistent ledger.
Analyzing 193 story-builds across three weeks of real runs, the factory consumed 595.7 million tokens to ship 77 stories: $837.53 at list prices, averaging $10.88 per story with a $9.56 median. The more useful finding is structural: cache reads make up 95.4% of all tokens, yet cache writes and reads together account for 77% of total cost, while fresh input is a rounding error. In agentic pipelines, the lever that actually moves cost is cache management and context discipline, not shorter prompts.
Counting retries, bugfix loops, and crashed sessions, the 'honest' rework rate is about 13%, with only 34 of 76 stories passing clean on the first try. The measurement system itself had a bug: failed-validation re-asks silently overwrote original usage rows and crashed sessions never logged at all, undercounting real spend by roughly a sixth — a defect the factory diagnosed and patched through its own pipeline.
None of this cost the operator anything marginal, since the work ran on a flat $200/month subscription plan. But the measured API-equivalent spend for one month across all codebases came to roughly $1,088 — more than five times the fee — with quota, not dollars, as the real constraint: overnight runs stalled for hours against rate-limit windows. That leaves an open question of whether professional or commercial use of such flat plans is a financial bargain or simply an unenforced loophole.
This synthesis was produced from its source by AI; there is no human editor or manual review step. How we work