
Microsoft and UC Berkeley’s new TokenEconomizer cut reported coding costs by 18.4-30.9%, but task success did not improve in every configuration. The plugin targets repeated work by your coding agent, including rediscovering repository details and getting stuck on the same mistakes. Better Stack breaks down how it learns from repeated sessions, with that knowledge kept on your machine. Learn how it handles recurring failures and what the reported savings could mean for work on your own codebase.
TokenEconomizer: Cutting Repeated AI Coding Costs
TL;DR Key Takeaways :
- TokenEconomizer is a free, MIT-licensed plugin from Microsoft and UC Berkeley researchers, first released on October 26, 2026.
- Microsoft reports 18.4% to 30.9% lower mean costs across five configurations on 277 SWE-Bench tasks, although Opus 4.8’s first-pass success fell from 74.0% to 73.0%.
- Optional micro-skills can supply repository facts after three sessions confirm them, with learned state stored locally for each agent and repository.
- Default tool pruning removes unused tool definitions from context after qualifying sessions, and removed tools can be restored.
- The default failure-loop guard uses a judge model to detect repeated mistakes and can suggest another approach without stopping the agent itself.
TokenEconomizer is an open source plugin from researchers at Microsoft and UC Berkeley. Its first release arrived on October 26, 2026, and the plugin is free under the MIT license.
It works alongside a coding agent without changing the agent’s model, weights or code. Its model calls use your existing agent plan or login, and their costs appear in its reports.
Install It Alongside a Supported Agent
TokenEconomizer requires Python 3.10 or newer and a supported coding agent signed in through a supported plan or login; it does not need a separate API key. Supported versions include Claude Code 2.1.300-2.1.329, Codex 0.153.1-0.171.0, GitHub Copilot CLI 1.0.83-1.0.114 and Pi 1.2.0-1.5.2. Pi 0.99.x can load the extension by path.
For Claude Code, the installation shown uses a clone of the TokenEconomizer repository and the plugin marketplace. Keep the clone folder, because the plugin runs from it. A unit-test task used Claude Code with Opus 5.5 and the usual prompts.
TokenEconomizer also has experimental support for Cursor Agent, Grok Build, opencode, Hermes Agent, Antigravity CLI and Factory Droid. Cursor support is limited to macOS and Linux; the documented Antigravity integration was tested on Windows 11, macOS and Linux, and Factory Droid on macOS.
Browse through more resources below from our in-depth content covering more areas on Claude Code and Sonnet 5.
- Anthropic Adds Persistent JavaScript Mods to Claude Code
- How to Use Claude Code to Draw Amazing Diagrams With Excalidraw
- Claude Sonnet 5 : 1M Context, Lower Cost & Early Coding Tests
- Sonnet 5 Launches: Everything You Need to Know About Anthropic’s Mid-Tier AI
- Expected Anthropic Sonnet 5.5 Launch Next Week Will Hopefully Reduces Costs
Microsoft Reports Lower Costs on Coding Tasks
Microsoft and UC Berkeley evaluated TokenEconomizer on 277 SWE-Bench tasks across six repositories, using three seeds for each agent-model setting. The baseline was the unmodified agent at high reasoning effort, and the reported costs included the plugin’s controller calls.
Microsoft reports the following mean cost reductions and Pass@1 scores, the share of tasks passed on the first attempt:
- Claude Code, Sonnet 5: 23.6% lower cost; 76.0% passed, versus 74.7% without the plugin.
- Claude Code, Opus 4.8: 30.9% lower cost; 73.0% passed, versus 74.0%.
- Codex, GPT-5.6 Terra: 24.7% lower cost; 74.7% passed, versus 73.8%.
- Codex, GPT-5.6 Sol: 26.1% lower cost; 81.7% passed, versus 80.1%.
- Copilot CLI, Sonnet 5: 18.4% lower cost; 77.6% passed, versus 75.0%.
The researchers report lower costs across all 30 repository and agent-model combinations, though success declined for the Opus 4.8 configuration despite its lower mean cost.
Micro-Skills Remember Repository Details
Micro-skills are off by default. Once turned on, they learn repository facts from repeated failures and model reviews, including which test commands work, which environment variables are needed and where files live.
After three sessions have confirmed a fact, TokenEconomizer can supply it at the start of a new session; it drops facts that are contradicted. Its learned state stays on your local machine, inside the Token Economizer folder, and is kept separately for each agent and repository, so knowledge learned with Claude Code does not automatically carry over to Codex.
The micro-skills view can show what the plugin has learned, though it may be empty after a first installation. The plugin needs a few sessions to learn about a repository.
Tool Pruning Removes Unused Definitions
Coding agents can load tool definitions into their context even when they never use those tools. Tool pruning, which is on by default, tracks usage in a repository and can leave out a tool after qualifying sessions in which it goes unused. The tool prune view can show tools identified as unused, though the list may be empty on first installation.
You can restore a removed tool if you need it again. For Claude Code and Copilot CLI, refresh the tool catalog once per machine and after updating the respective agent, so pruning can consider all loaded tools.
Tool pruning is not offered on Pi or the experimental Cursor Agent, Grok Build, opencode, Hermes Agent, Antigravity CLI and Factory Droid integrations. Antigravity CLI supports only model-free micro-skills; its paid proposer and loop guard are off.
The Loop Guard Redirects Repeated Mistakes
The default failure-loop guard watches for patterns such as an agent repeatedly running a command after small changes. When the plugin suspects a loop, it uses a judge model to check and can send the agent a short instruction to try another approach.
If the agent still cannot recover, TokenEconomizer tells you how to stop the turn rather than stopping it itself. The published research used a controller that could stop benchmark runs, while the installable plugin leaves that decision to you.
Microsoft Reports Results With RTK and RepoMap
Microsoft also reports results when TokenEconomizer is combined with RTK or RepoMap. These use the same unmodified-agent baselines above; the figures pair the reported cost reduction with the Pass@1 score.
With RTK, Microsoft reports:
- Claude Code, Sonnet 5: 23.5% lower cost; 76.4% Pass@1.
- Claude Code, Opus 4.8: 33.2% lower cost; 74.8% Pass@1.
- Codex, GPT-5.6 Terra: 23.8% lower cost; 75.2% Pass@1.
- Codex, GPT-5.6 Sol: 23.3% lower cost; 81.3% Pass@1.
- Copilot CLI, Sonnet 5: 13.2% lower cost; 77.4% Pass@1.
With RepoMap, Microsoft reports the following results. The two Codex scores fall below their respective baseline scores.
- Claude Code, Sonnet 5: 18.3% lower cost; 76.7% Pass@1.
- Claude Code, Opus 4.8: 24.9% lower cost; 75.1% Pass@1.
- Codex, GPT-5.6 Terra: 21.9% lower cost; 73.5% Pass@1.
- Codex, GPT-5.6 Sol: 29.2% lower cost; 79.0% Pass@1.
- Copilot CLI, Sonnet 5: 6.3% lower cost; 76.8% Pass@1.
Better Stack expects the greatest benefit from repeated work in the same repositories, while someone moving constantly between unrelated projects may have less repeated work for the plugin to remove. It recommends running TokenEconomizer on a frequently used repository for a week, then checking its status reports and comparing costs and task completion on similar work.
Results will not necessarily match the benchmark figures, and Cursor session costs are unavailable in the reports because its hooks do not expose per-session token usage.
In our view, the notable idea is that it goes after repeated waste, such as the same mistake in every new session, instead of shrinking the model or the prompt. Waste like that is easy to overlook and easy to fix. Micro-skills can supply confirmed repository facts at the start of a new session, saving the agent from rediscovering them. We would treat the savings figures as a ceiling, not a promise. They came from benchmark tasks, and your own work may look different, so compare costs on similar tasks before deciding the plugin earns its place.
Better Stack sees TokenEconomizer’s approach as tackling repeated waste rather than shrinking the model. If you regularly use coding agents on the same codebase, TokenEconomizer is worth checking out in more detail as a way to reduce what you spend on work your agent has encountered before.
Media Credit: Better Stack
Disclosure: Some of our articles include affiliate links. If you buy something through one of these links, Geeky Gadgets may earn an affiliate commission. Learn about our Disclosure Policy.