The work comes from UC Berkeley, Microsoft Research and Microsoft Security. First author Aaron Li, a UC Berkeley computer science Ph.D. candidate, worked on the project during his summer internship at Microsoft. The paper is on arXiv and carries an October 2026 date. Microsoft's blog post went up on November 16, and MarkTechPost reported the open-source release back on October 30. This is not new news in the strictest sense, but Microsoft's own write-up is the first detailed official account of the numbers.
Where the tokens go
The researchers profiled Claude Code on 60 SWE-Bench bug-fixing tasks, run in sequence by repository. They found three recurring kinds of waste:
- Repeated actions. Once a repository had at least five completed tasks, 30% of tool calls repeated an action from an earlier task in the same repository. Only 7% matched actions from another repository's history.
- Unused tools. The agent was sent 23 tool descriptions on every turn, and 16 of them were never called.
- Failure spirals. The 17% of tasks that failed accounted for 32% of spending.
The team also tried three popular fixed-strategy plugins: RTK (which compresses command output), Serena (which adds code-navigation tools) and RepoMap (which adds a repository map). The project page says all three cut cost on Django and raised it on SymPy. On scikit-learn only RTK helped, and on Sphinx only RepoMap did. The conclusion is that no single strategy wins everywhere, so the controller learns per repository.
How it works
After each session, TokenEconomizer reads the log and updates its picture of the repository. It then works through three mechanisms, using only interfaces the agent already exposes.
- Micro-skills. These are one-line, repository-specific notes. The README gives examples such as running
python -m pytestwhere barepytestis missing, ornpx tscwheretscis. A fact enters the agent's starting context only after three sessions have confirmed it, and it is dropped if later sessions contradict it. - Tool pruning. Tools that history shows going unused are left out. The README's defaults prune a tool after it goes unused across 10 prompts spread over at least two sessions, or across five sessions of any length. Shell, read and edit tools are always kept, and one command restores a pruned tool.
- Failure-loop intervention. A judge model decides whether the agent is genuinely stuck. If its confidence is at least 0.7, the agent gets a short redirect note, at most once per turn. If the turn is still stuck, the released plugin tells the developer how to stop it and never halts the turn itself.
One nuance is worth flagging. The project's research page describes the experimental controller as also ending a run if a loop recurs, with a forced-stop backstop at 2.5 times the learned turn budget. The page says those are the settings used in the experiments and can be changed for deployment. The shipped plugin, per Microsoft's post and the README, leaves the stop decision to you. Don't assume the benchmark behaviour and the installed behaviour are identical.
The results, with the fine print
The main evaluation covered 277 SWE-Bench tasks from six repositories and five agent–model combinations. TokenEconomizer started with no history in each repository, and the accounting includes its own model calls. Mean cost fell by 18.4% to 30.9%, and the controller was cheaper in all 30 repository-by-combination cells.
Microsoft's summary says success rates stayed "broadly stable". The per-setting figures from the project's materials are more mixed. Pass@1 rose in four of the five settings, but the setting with the largest saving (30.9%) showed a 1.0-point Pass@1 drop. That is small, but it is not zero.
Other points worth knowing:
- It takes time to pay off. Early tasks can cost more while the controller learns. In the Claude Code analysis, cumulative cost fell below the default in every repository by the sixth task.
- Reasoning-effort cuts are not a free alternative. Lowering reasoning effort saved similar or larger amounts but caused substantial performance degradation, according to the researchers.
- Other domains. Costs were 16.0–21.2% lower on Web-Bench. On security auditing, where every task is in a new repository and micro-skills don't apply, costs were 6.4–19.6% lower.
- Each mechanism helps alone. Combining all three gave the biggest reduction. The project page says tool pruning saves the most on its own because it acts on every turn.
These are the authors' own benchmark numbers on open-source Python and web projects. They are not independent replication, and they don't promise the same savings on a private monorepo or a different workflow.
Trying it, and what to know on Windows
The README says the plugin needs one supported agent, signed in any way that agent supports, and Python 3.10 or newer on PATH. It needs no API key of its own. Its own model calls (the fact proposer and the judge) run through your agent's existing login or plan, and their cost is counted in its reports. What it learns stays on your machine in ~/.tokeneconomizer.
According to the README, setup for Claude Code means cloning the repo, adding it as a plugin marketplace, then running the /tokeneconomizer:status command. Codex and Copilot CLI follow a similar pattern, and Pi installs directly from the Git repository. For Claude Code and Copilot CLI, the README also asks you to run a tool-pruning catalog refresh once per machine, and again after the agent updates. Experimental support is listed for opencode, Cursor Agent, Grok Build, Hermes Agent, the Antigravity CLI and Factory Droid. Don't confuse that list with the three agents the paper actually evaluated.
Windows users should read the fine print. The README says Cursor Agent support is macOS and Linux only, because on Windows Cursor runs hook commands through PowerShell and the plugin's launcher is a POSIX shell script. The Antigravity CLI adapter is documented as working natively on Windows with batch launchers, and was tested on Windows 11. The README does not spell out Windows status for the main agents in the text available to me, so check the plugin documentation for your agent before rolling it out.
Reproducing the paper is a heavier job. The experiments harness expects Linux x86_64, Docker, roughly 200 GB of disk for SWE-Bench images, and provider API keys. It is a research harness, not something to run on a laptop on a whim.
Why it matters for IT and dev teams
Agent costs scale with usage, and usage is climbing. The interesting idea here is that the waste is repository-specific and repeats. That makes it learnable without touching the model. A few practical takeaways:
- Teams using agents heavily on a few core repositories are the best fit. People hopping across many one-off repos will see less benefit, as the security-audit results suggest.
- Pruned tools and injected facts change what the agent sees. Review them periodically, especially after the repository's tooling changes. The design includes a re-audit and contradiction handling, but those are the researchers' safeguards, not guarantees.
- Because learned data is stored locally, it is easy to inspect. It is also per-machine, so teams don't automatically share what each developer's copy has learned.
- Measure before you trust. Track cost and pass rate on your own tasks for a few weeks, ideally against a control.
TokenEconomizer won't make agents smarter. It aims to stop them paying twice for the same lesson, and the early evidence suggests that is a sizeable saving. Whether it holds outside SWE-Bench is the question your own repositories will answer.
References
- TokenEconomizer: Learning from Experience to Make AI Coding Agents More Efficient - Microsoft Microsoft · 2026-11-16T17:01:35+00:00
- Meet TokenEconomizer: Microsoft’s Plugin That Cuts Coding Agent Costs by Up to 30.9% - MarkTechPost marktechpost.com
- TokenEconomizer: Experience-Driven Black-Box Cost Control for Coding Agents github.com