ReadingResearchRadarInvestment framework
Sign in / Sign up
← Back to reading
NewsMaterial2 min readDisconfirmAI Editorial

TokenEconomizer: How Repository Experience Reduces Token Costs for AI Coding Agents by 20% to 30%

Researchers from Microsoft Research, UC Berkeley, and the Microsoft Security team found that coding agents perform approximately 30% redundant tool calls within the same repository, with 16 out of 23 tool descriptions never used, and 17% of failed tasks consuming 32% of the budget. They open-sourced the TokenEconomizer plugin, which leverages three mechanisms—micro-skills, tool pruning, and failure-loop intervention—to convert repository history into cost savings for subsequent sessions. On 277 SWE-Bench tasks, it reduced token costs by an average of 18.4%–30.9% without modifying the agent or the underlying model.

2026-11-17 01:01 GMT+8

Developers use AI coding agents in the same codebases day after day, yet each session starts from scratch: rediscovering how to run tests, loading tools that are never called, and spinning in circles on the same error. Microsoft Research, UC Berkeley, and the Microsoft Security team profiled Claude Code across 60 real bug-fixing tasks on SWE-Bench to quantify the scale of this waste. They identified three recurring patterns: once a repository had accumulated at least five completed tasks, 30% of tool calls repeated actions from earlier tasks in that repository; in every turn, the agent received 23 tool descriptions, 16 of which were never invoked; and 17% of failed tasks consumed 32% of the total budget.

The core idea behind TokenEconomizer is to turn completed sessions into guidance for subsequent ones, without modifying the agent or the underlying model. It operates through three mechanisms. Micro-skills identify recurring patterns across multiple sessions and generate one-line notes added to the agent’s starting context; these are only added after several sessions confirm the pattern and are retired if later evidence contradicts them. Tool pruning removes tools that the repository history suggests the agent is unlikely to use, while always retaining core tools for running commands and editing files; removed tools can be restored if needed. Failure-loop intervention detects whether an agent is repeatedly hitting the same error, using a judge model to determine if it is truly stuck; if so, the agent receives a short note suggesting a change of direction.

Sign in / Sign up
ReadingResearchRadarInvestment framework

In tests across 277 SWE-Bench tasks, six repositories, and five agent-and-model combinations, TokenEconomizer reduced costs by an average of 18.4%–30.9%, saving resources in all 30 repository-combination pairs with no performance loss. Savings grew as experience accumulated: early tasks might be more expensive, but by the sixth task, cumulative costs per repository fell below the default baseline. Costs dropped by 16.0%–21.2% on continuous web development tasks in Web-Bench, and by 6.4%–19.6% in security auditing (where each task involves a new repository).

Important boundaries to note: these figures come from vendor-reported benchmarks and lack independent replication; savings depend on the accumulation of repository history, offering no benefits during cold-start phases; the 18.4%–30.9% figure is a cross-task average, meaning individual task savings may be higher or lower. Additionally, the reported costs already account for the overhead of TokenEconomizer’s own model calls. The plugin is open-source and available on GitHub, requiring no additional API keys, with learned content retained locally on the developer’s machine.

Sources

  • microsoft.comMicrosoft Research↗
Continue researching →