Detailed Analysis
A recurring pattern in autonomous coding agents surfaces in this account: a user running a Hermes-based agent workflow against a Shopify theme codebase reports that a large reasoning model's per-step input token count climbed steadily and predictably across a single task—from roughly 51,000 tokens at the outset to over 168,000 tokens by the final step—while output tokens per step stayed under 1,000. That growth curve (51k → 52.5k → 53.8k → 55.2k, and so on) is a textbook signature of an agent loop that re-sends its entire accumulated conversation history, tool outputs, and file context on every single turn rather than summarizing, truncating, or caching that context. Because the model itself was producing compact outputs, the ballooning cost wasn't coming from verbose reasoning; it was coming from the orchestration layer repeatedly re-feeding a growing transcript back into the model as input. Across just three modest development tasks, this pattern generated roughly $130 in API spend, which is a meaningful red flag for anyone running agentic coding workflows at scale.
This matters because input-token accumulation is one of the most under-discussed cost drivers in production agent systems, and it's largely an architectural problem rather than a model-quality problem. Modern coding agents typically operate in a loop: read files, call tools, receive results, reason, act again—and if the orchestrator naively appends every prior turn's context to the next prompt without pruning, the transcript grows linearly or worse with each step, and the model ends up paying to re-read its own history over and over. This is compounded when the agent's "vault" or working set includes full file contents, diffs, or theme assets, since even a modest ~700KB Shopify theme can translate into tens of thousands of tokens once serialized as text in a prompt, especially if it's re-included on every call instead of being fetched selectively. The user's decision to rule out an oversized vault and to upgrade Hermes by roughly 1,700 commits is a reasonable diagnostic step, but the underlying fix is more likely to be found in how the agent framework manages context windows—via truncation, rolling summarization, prompt caching, or selective re-inclusion of only the files relevant to the current step—rather than in the choice of reasoning model.
The planner/executor/reviewer architecture suggested as a workaround reflects a broader trend that has been gaining traction across the agentic AI ecosystem throughout 2025 and into 2026: decomposing agent responsibilities across tiers of models with different cost-to-capability ratios. Using an expensive, high-reasoning model only for upfront planning and final review, while delegating the bulk of repetitive file-editing, test-running, and iteration work to a cheaper, faster coding-specialized model, is a pattern increasingly recommended by both AI labs and third-party tooling vendors because it directly targets the token-volume problem rather than trying to make every step "smarter." This mirrors design choices seen in production agent frameworks that split work into sub-agents with isolated, smaller context windows, and it aligns with guidance from model providers—including Anthropic's own documentation on Claude Code—that emphasizes context compaction, scoped sub-agents, and prompt caching as primary levers for controlling cost in long-running autonomous coding sessions.
More broadly, this incident is a useful case study in the economics of agentic AI adoption. As developers move from single-shot prompting toward multi-step, tool-using agents that operate with minimal supervision, the cost model shifts from "price per response" to "price per session," and that session cost is disproportionately sensitive to how context is managed rather than which frontier model is chosen. The fact that a user could rack up $130 across three modest tasks—and trace it to a mechanical growth pattern in input tokens rather than model behavior—underscores why context-window discipline, caching strategies, and tiered model architectures are becoming as central to agentic coding tool design as raw model capability. Expect scrutiny of this kind of cost transparency to intensify as more developers run reasoning-heavy models inside long-lived autonomous loops, and as agent frameworks compete not just on task success rate but on how efficiently they manage the token economics of sustained, multi-step work.
Read original article →