About the video
If you want to reduce Claude Code token usage without switching models, this Better Stack video, “Claude Code Is Wasting Tokens… Microsoft Built a Fix” (7 minutes 34 seconds), walks through Microsoft’s open-source Token Economizer plugin: what it learns, how to install it, and what the published tests found.
Watch the original video on YouTube.
AI coding agents can waste tokens on mistakes they could have learned from in an earlier session. Microsoft has released a free, open-source plugin called Token Economizer that aims to reduce those costs without replacing the agent or switching to a cheaper model.
In tests by Microsoft and UC Berkeley, Token Economizer reduced average agent costs by 18% to about 31%. It works alongside popular coding agents, including Claude Code, and keeps the information it learns on your machine.
The problem it solves
Imagine asking Claude Code to fix a bug. It tries a command, gets an error, and then tries another command. Sometimes it eventually succeeds, but it may spend extra tokens along the way. In a later session, it can repeat the same mistake from the beginning.
Token Economizer learns from previous sessions and shares useful details with the agent, including:
- Which test commands work in the repository
- Which environment variables are required
- Where important files are located
- Which tools the project actually uses
Instead of rediscovering the same information every time, the agent can start with answers that have already been confirmed.
Installing the plugin
The setup is straightforward:
- Clone the Token Economizer repository.
- Install its Git plugin from the marketplace.
- Keep the cloned folder because the plugin runs from there.
- Open your project and start Claude Code.
- Run
token economizer statusto see what the plugin has learned and the costs it has tracked.
The status command shows what the plugin is doing and what it has observed. Token Economizer also includes features that are disabled by default, such as Micro Skills, so they can be enabled when needed. After changing its settings, refresh the tool catalog with:
tool prune refresh catalog
You do not need to change your normal Claude Code workflow. The plugin works alongside the same prompts and model you already use, including Opus 5.5.
Micro Skills: Remembering project-specific knowledge
Micro Skills address the problem of agents forgetting project-specific commands between sessions.
Suppose a project uses a special command to run its tests. Claude Code may not know that command at first. It tries the usual one, receives an error, and experiments until it finds the right approach. A new session may then repeat the same process.
Token Economizer reviews past sessions and learns small but useful facts about the repository. Once it has confirmed a detail often enough, it can provide that information to the agent at the start of a new session. The agent can then avoid wasting tokens on familiar errors.
Tool pruning: Loading only what the project needs
Coding agents can load many tool definitions into their context. Those definitions consume tokens even when the agent never uses them.
Token Economizer tracks which tools are actually used in the repository. If a tool is consistently unused, it can be left out of future sessions. You can restore it later if the project needs it again.
This feature is especially useful in a repository that the agent has already observed over several sessions. On a new installation, the available information may be empty because the plugin needs time to learn the project’s patterns.
You can inspect what it has learned with the micro skills and tool prune commands. The information remains local inside the Token Economizer folder.
Failure loop intervention
Another common pattern is a repeating failure loop. An agent runs a command, gets an error, changes one small detail, and runs almost the same command again. It may repeat that cycle several times without making real progress.
Token Economizer watches for these patterns. When it believes the agent is stuck, a judge model checks the situation. If a loop is detected, the plugin gives the agent a short instruction to try a different approach.
If the agent still cannot recover, the plugin explains how to stop the turn instead of simply interrupting the process without guidance.
Does it actually save money?
The reported results are encouraging. Microsoft and UC Berkeley tested Token Economizer on 277 SWE-bench tasks, using six repositories and 5 different agent and model combinations.
Average costs fell by 18% to about 31%. Task success improved in four of the five combinations, while one showed a small decline. Across all 30 repository and agent-model combinations, Token Economizer was cheaper than running without it.
Those figures also included the cost of the plugin’s own model calls. Token Economizer is not completely free to operate because some features require extra model requests, but the reported savings already account for that overhead.
When it is most useful
Token Economizer is open source, works with the agents people already use, and keeps its learned information local. Still, not everyone will see the same savings.
The biggest benefits come from repeatedly working in the same repositories across multiple sessions. The plugin needs enough examples to understand the project, its tools, and recurring mistakes.
If you constantly switch between unrelated projects, there is less repeated work for it to learn from. Likewise, if your agent is doing something completely new, there may be few repeated errors or unnecessary tools to eliminate.
For teams that use an AI coding agent every day on one or two core projects, Token Economizer could be worth testing. The most practical approach is to install it in the repository you use most, run it for a week, review its status reports, and compare the cost of similar tasks before and after.
Before installing Token Economizer, think about how you use AI coding agents. If you rely on them every day on one or two core projects, the plugin should have plenty to learn from. It is especially useful when you repeatedly work in the same repository with Claude Code or Codex.
If you work on many unrelated projects or only use an agent from time to time, the benefit will probably be small. Token Economizer needs repeated examples to understand your repository, its tools, and recurring mistakes. When there is little repeated work, there is not much for it to improve.
How to test it
Install Token Economizer in the repository you use most. Run it for about a week, then review its status reports and compare the token costs of similar tasks.
Check two things:
- Is the agent using fewer tokens?
- Is it still completing your work correctly?
If the answer to both is yes, the plugin is doing its job. Keep in mind that each agent learns separately. What Claude Code learns does not automatically carry over to Codex, so test each tool on its own.
Do not judge the plugin after a single session. Its value comes from learning through repeated use. If it saves tokens without getting in the way, keep it. If it does not, you have your answer.
A different approach to reducing AI coding costs
Token Economizer does not reduce costs by making the model smaller or compressing your prompts. Instead, it focuses on the work that repeatedly wastes tokens.
It remembers useful details about your repository, avoids loading tools that are not needed, and helps agents recover when they get stuck. In other words, it targets the practical overhead of repeated coding-agent work without changing the underlying model.
Related reading
- Why Anthropic’s Engineers Build AI Skills Instead of More Agents
- More guides in Tools & Workflows and Save Effort
Source: Better Stack on YouTube