TokenEconomizer: Learning from Experience to Make AI Coding Agents More Efficient

The AI Signal

The AI Signal

AI and technology, explained in conversation.

TokenEconomizer: Learning from Experience to Make AI Coding Agents More Efficient

Published 21 November 2026 · AI-generated hosts

AI coding agents can waste time and tokens relearning the same lessons. TokenEconomizer is an open-source plugin that builds on past sessions to cut costs while maintaining task success. It’s a path toward coding agents that learn not only how to solve tasks, but also how to spend computation more effectively. The post TokenEconomizer: Learning from Experience to Make AI Coding Agents More Efficient appeared first on Microsoft Research .

Transcript

Mara Microsoft Research published a post on November 16 about TokenEconomizer, an open-source plugin meant to make AI coding agents cheaper to run. The pitch: developers use agents in the same codebase day after day, but agents often start every session from scratch, rediscovering familiar facts, loading tools they never use, and repeating failed approaches.

Jules So the waste is mostly amnesia. How much of it did they actually measure?

Mara They profiled Claude Code on 60 SWE-Bench tasks, run repository by repository in sequence. Three patterns showed up. Once a repository had at least five completed tasks, 30% of tool calls repeated an action from an earlier task in that same repository, versus only 7% matching another repository's history. The agent got 23 tool descriptions every turn, and 16 were never called. And the 17% of tasks that failed accounted for 32% of spending.

Jules Okay, so what does the plugin do about each of those?

Mara Three mechanisms. Micro-skills are one-line, repository-specific notes, added to the agent's starting context only after several sessions confirm a pattern, and retired if later evidence contradicts them. Tool pruning drops tools that history suggests the agent won't use, while always keeping core tools for running commands and editing files, and removed tools can be restored. And failure-loop intervention: a judge model decides whether the agent is truly stuck, and if so the agent gets a short note suggesting a different approach.

Jules What if the agent ignores the note and keeps spinning?

Mara In the open-source plugin, if the agent is still stuck after the note, TokenEconomizer alerts the developer rather than stopping the work itself. It also works without modifying the agent or the underlying model, using only interfaces the agent already provides.

Jules That's the part that makes it practical, I think. Now the headline numbers.

Mara They evaluated on 277 SWE-Bench tasks across six repositories and five agent-and-model combinations, with each repository starting with no prior history. Average cost per task fell by 18.4 to 30.9%. The post says it saved the most in all 30 repository-combination pairs without performance loss, and Pass@1 rose in four of the five combinations. Reported savings also include the cost of TokenEconomizer's own model calls.

Jules Cheaper is easy if you let the agent get worse. Did they compare against that?

Mara They did. Lowering the model's reasoning effort saved similar or larger amounts, but led to substantial performance degradation. They also tested three popular open-source cost-saving plugins built around fixed strategies; each lowered costs in some repositories but not others, which is the argument for adapting to the repository.

Jules And does it pay off right away, or is there a warm-up period?

Mara There's a warm-up. Early tasks can cost more while it learns, but cumulative costs fell below the default in every repository by the sixth task, using Claude Code. Each mechanism saves on its own, and all three combined give the largest reduction. Outside SWE-Bench, costs were 16.0 to 21.2% lower on Web-Bench, and 6.4 to 19.6% lower on security auditing, where every task is in a new repository.

Jules Worth keeping the scope in mind: these are the authors' own results, on benchmark tasks, and the main test is bug fixes in open-source Python projects. Whether the same savings hold in a messy private codebase isn't something this post shows. On privacy, though, it says the plugin needs no API key of its own and keeps what it learns on the developer's machine.

Mara Right. The takeaway is that repeat work in one repository seems to be where the money leaks, and a plugin that remembers can plug some of it. The open question is how well that holds up outside the benchmarks.

Sources