Original Reddit post

Hi everyone, sharing some notes from running hundreds of automated agent sessions across Claude Code, Codex, and Cursor. We started logging raw API request payloads over a local proxy to see where the token budget actually vanishes during long refactoring runs. Here are 18 specific token drains that quietly bloat your context window and bill: Unfiltered test runner outputs : Passing a full pytest or jest run that outputs 400 lines of passing dot-logs injects thousands of tokens that stay in the history for every future turn. (Fix: pipe with --quiet or filter for failures only). Multiple idle MCP servers : Every active MCP tool registers its complete JSON parameter schema on every single turn. Five unused servers can burn 15k input tokens per request before the model reads your prompt. Mid-session rule tweaks : Editing your root project instructions mid-session invalidates the prefix prompt cache, causing you to lose the 90% input token discount on the next turn. Redundant directory tree traversals : Asking an agent to “find the file where X is defined” often triggers 4 separate glob and grep tool calls that get preserved in the message log. (Fix: pass the exact file path). Compaction overhead : When the agent hits a context limit, the summarization turn sends the entire bloated history at full input pricing. Git diff re-reading : Requesting git status or git diff repeatedly without committing leaves duplicate diff snapshots stacked across turns. Verbose typecheck traces : TypeScript errors that output giant generic instantiation traces take up massive prompt space. Extended reasoning output tax : For hard tasks, thinking blocks can be 3x to 5x longer than the final code edit. Because output tokens cost more than input tokens, thinking often drives most of the dollar cost. Subagent sprawl: Spawning autonomous explore or plan subagents multiplies your tool calls Unconstrained subagents can spend 30k tokens just mapping directories. Unpruned rule sprawl in instructions : Stuffing 400 lines of static guidelines into a single instruction file dilutes reasoning and bloats every baseline turn. (You can use tigerless-autoharness on GitHub to distill skills dynamically from real sessions and prune stale ones automatically instead of maintaining giant static prompts). Repetitive system prompts across tools : Multiple custom skills that duplicate foundational build commands rather than sharing a root config. Lingering stack traces : Leaving 5 previous debugging attempts in the active conversation while working on an unrelated bug. Formatting/Lint runs inside the LLM: Asking the model to format code instead of letting a pre-commit hook or local linter do it deterministically. Log outputs with ANSI color codes: Raw terminal color codes and escape characters add significant token bloat without aiding reasoning. Invisible payload bloat: Most developers only look at the final token bill, which hides the split between prompt cache, MCP blocks, and tool outputs. (You can use open-sourced cost-xray to capture local proxy traffic and attribute exact tokens and costs back to individual request sources). 16. Unpinned tool definitions: Tools that return dynamic schema metadata invalidate prompt caches across turns. Premature multi-file refactoring: Asking for wide architectural updates in one turn forces the model to load dozens of file buffers simultaneously. Zombie sessions: Continuing a debugging session after a feature is already merged, which carries obsolete context into new tasks. Which of these have caused the biggest surprise in your own agent bills, and what habits do you use to keep context tight? submitted by /u/EmployerNegative5653

Originally posted by u/EmployerNegative5653 on r/ClaudeCode