---
title: 'Microsoft Just Found a Way to Stop AI Agents Wasting Tokens!'
source: 'https://youtube.com/watch?v=frUZeGq3pKA'
video_id: 'frUZeGq3pKA'
date: 2026-11-19
duration_sec: 642
channel: 'Julian Goldie SEO'
---

# Microsoft Just Found a Way to Stop AI Agents Wasting Tokens!

> Source: [Microsoft Just Found a Way to Stop AI Agents Wasting Tokens!](https://youtube.com/watch?v=frUZeGq3pKA)

## Summary

Microsoft Research, UC Berkeley, and Microsoft Security have released Token Economizer, an open-source plugin that reduces token waste in AI coding agents by learning from past sessions. The plugin addresses three major inefficiencies: rediscovered facts, unused tool descriptions, and expensive failure loops. Testing shows cost reductions of 18.4% to 30.9% on SWE-bench tasks without sacrificing task success.

### Key Points

- **Token Economizer Introduction** [00:17] — Microsoft Research, UC Berkeley, and Microsoft Security released Token Economizer, an open-source plugin that reduces token waste in AI coding agents by learning from past sessions.
- **Three Major Token Leaks Identified** [01:41] — Researchers found three leaks: 30% of tool calls repeated actions from earlier tasks in the same repository, 16 of 23 tool descriptions were never used, and 17% of failed tasks consumed 32% of total cost.
- **Micro Skills Feature** [03:41] — Micro skills are one-line notes about the repository, learned from repeated failures and model reviews. They are only added after three sessions confirm them and dropped if contradicted. Off by default in GitHub version.
- **Tool Pruning Feature** [04:22] — Tool pruning removes unused tools based on repository history. Tools unused for 10 prompts across two sessions or five sessions are removed. Core tools always stay, and removed tools can be restored with one command.
- **Failure Loop Intervention** [05:03] — A judge model detects when an agent is stuck and nudges it to try a different approach if 70% confident. If still stuck, it alerts the user to intervene.
- **Test Results** [05:58] — On SWE-bench, costs dropped 18.4% to 30.9% across all 30 repository-combination pairs. Pass@1 improved in four of five combinations. Costs also dropped on Web Bench (16-21%) and security auditing (6.4-19.6%).
- **Comparison to Reducing Reasoning Effort** [06:41] — Lowering reasoning effort saves similar tokens but significantly hurts performance. Token Economizer saves tokens by making the agent smarter, not worse.
- **Initial Learning Cost** [07:10] — The first few tasks may cost more, but total cost drops below default by the sixth task in every repository tested.
- **Availability and Setup** [07:57] — The plugin is available on GitHub at msft.it/6017xdtyc. Supports Claude Code, Codex, GitHub Copilot CLI, and Pi, with experimental support for others. Requires Python 3.10+ and no separate API key.

### Conclusion

Token Economizer demonstrates that coding agents can become more efficient by learning from their own past sessions, reducing token waste without compromising performance. It is available now as an open-source plugin, offering a practical way to cut costs for developers using AI coding agents regularly.

## Transcript

agents wasting tokens. What if your AI coding agent has been paying for the same lesson over and over? Every session, it wakes up with no memory. It asks the same questions. It hits the same walls, and you burn tokens on every
Microsoft just measured how much of that is pure waste. Today, I'm breaking down Token Economizer. It's a brand new open source plugin from Microsoft Research, UC Berkeley, and Microsoft Security. I'll show you exactly where your agent's
tokens are leaking, the three tricks this plugin uses to plug those leaks, and whether you can install it today. And stick around because one result in their testing completely flips a shortcut a lot of people use to save
tokens. So here's the update. On November 16th, Microsoft Research Economizer. Here's the problem it tackles. Most coding agents start every session from scratch. Each time, the model gets sent the instructions, the
tool descriptions, and the history. All of that eats tokens. And because the agent doesn't remember your project, it keeps rediscovering stuff it already figured out. Token Economizer learns from your past sessions instead. After
each session, it reads the log, updates what it knows about your repository, and uses that to cut waste next time. A repository is just the folder where your project's code lives, and it doesn't change your agent or your model. It
works through what your agent already offers. First, the researchers had to find the leaks. They watched Claude code work through 60 tasks from SWE-bench, a test set of real bug fixes from open source Python projects. They ran the
tasks one after another in each repository, just like you'd use an agent on your own project. And they found three big leaks. Leak number one is rediscovered facts. Once a repository had at least five finished tasks, 30% of
the agent tool calls repeated an action it had already in an earlier task in that same repository. Only 7 % matched something from a different repository. So the agent wasn't relearning general coding, it was relearning your project.
Leak number two is unused tools. The agent got 23 tool descriptions on every single turn. 16 of them were never called, not once. That's text the model reads every turn for nothing. Leak number three is failure loops. The
Leak number three is failure loops. The 17 % of tasks that failed ate up 32 % of the total cost. So when an agent gets stuck, it doesn't just fail, it fails expensively. The team tested three popular open source plugins that try to
cut token use. Each one helped in some repositories, but not in others. So their takeaway is that saving tokens has to adapt to each project. That's exactly what token economizer is built for. It has three parts. Quick pause before I
show you how token economizer actually plugs those leaks. Inside the AI profit boardroom, we've got a 30-day AI coding agent roadmap that takes you step by step from setup to a working daily workflow, so you're never guessing what
to do next. And there are four coaching calls every week. So if you're setting up a coding agent or a plugin like this one and you get stuck on a setting or a command, you bring it to a call and get unstuck fast. It's a simple way to turn
use every day. Link in the description or go to aiprofitboardroom.com. All right, first micro skills. These are tiny one-line notes about your repository, stuff like the right build
order or the correct way to spell a command in your project. The plugin learns these from repeated failures and from a model that reviews your recent sessions. But here's the clever bit. It doesn't trust the facts straight away. A
note only gets added to the start of your agent sessions once three sessions confirm it. And if later sessions contradict it, the note gets dropped. So it's not stuffing random guesses into your context. It only keeps what keeps
proving true. One thing to note, in the GitHub version, micro skills is switched off by default. You turn it on with one config command. There's also a lighter mode that learns only from failures with no extra model calls at all. Second,
tool pruning. Remember those 16 tools that never got used? Tool pruning removes tools your agent probably won't need based on your repository's history. It does this through the agent's own settings. In the GitHub version, a tool
gets left out after it goes unused for 10 prompts across at least two sessions or across five sessions of any length. The core tools for running commands and editing files always stay. And if you need a removed tool back, one command
restores it. There's even a propose mode where it just suggests what to remove and lets you decide. Third, failure loop intervention. This one goes after those expensive stuck tasks. It watches for your agent hitting
the same failure again and again. Then a separate judge model decides whether the agent is truly stuck or slowly making progress because from the outside, those two can look the same. If the judge is at least 70% confident it's
stuck, the agent gets one short note nudging it to try a different approach. And if it's still stuck after that, the plugin doesn't kill the work. It alerts you and tells you how to step in so you stay in control. The whole system keeps
updating its decisions as new evidence comes in. And the savings Microsoft reports already include the tokens token economizer spends on its own model So the plugin's own overhead isn't hidden. They also found each of the
three parts saves on its own, but stacking all three gives the biggest Okay, so does it actually work? Here's what they tested. On Swell Bench, they what they tested. On Swell Bench, they ran 277 tasks across six repositories
using five different agent and model combinations. Every repository started with zero history, no head start. The average cost history, no head start. The average cost per task dropped by 18.4% to 30.9%
and costs were lower in all 30 repository and combination pairs. Not most of them, all 30. What about quality? They measured something called pass at one. That just means the agent solved the task on its very first try.
Pass at one went up in four of the five combinations and dipped in the other one. So overall, task success held steady while token use came down. Now here's that result I teased earlier. A lot of people try to save tokens by just
turning down the model's reasoning efforts. Microsoft tested that too. It saved a similar amount, sometimes more, but performance dropped a lot. So that shortcut saves tokens by making your agent worse. Token economizer saves
tokens by making your agent smarter about your project. There's one catch and I want to be straight with you. Your first few tasks can actually cost a bit learning. But in their Claude code tests, total cost dropped below the
normal default in every repository by the sixth task. So give it a little time And it's not just bug fixes. On Web Bench, which is a set of web development tasks done in order, costs came down 16.0%
to 21.2%. And on security auditing, where every task happened in a brand new repository, costs still came down 6.4% to 19.6%. That makes sense. Less history means less to learn from, so the savings are
smaller, but it still helped. So is it available now? Yes. The open source plugin is available right now on GitHub. The link is msft.it/6017xdtyc
It officially supports Claude code, Codex, GitHub Copilot, CLI, and Pi. It also has experimental support for Open Code, Cursor agent on Mac and Linux, and Hermes agent. To use it, you need one of those agents signed in the way you
normally sign in, and Python 3.10 or newer. You don't need a separate API key, and everything it learns stays on your own machine. Setup is pretty simple. You clone the repository, add it as a plugin marketplace in your agent,
and install the plugin. Then you run the status command to check it's working. If you're on Claude Code or Copilot CLI, there's also a one-time command to refresh the tool catalog on each machine. The README walks you through
every step for each agent. Out of the box, tool pruning and the failure loop guard are on. Micro skills is off, so if you want all three working, switch that one on. You can turn any of them on or off for one repository or for all of
them at once. So here's the bottom line. Coding agents have had a memory problem. Every session starts cold. Token economizer shows that just by learning from your own past sessions, an agent can stop rediscovering the same facts,
stop reading tool descriptions it never uses, and stop spinning in circles when it's stuck. No new model, no changes to the agent, just experience. Microsoft calls it a path toward coding agents that learn not just how to solve
tasks, but how to spend their computing power well. And if you use the same agent on the same project every day, this is exactly the kind of tool that gets better the more you use it. There's a window right now where most business
owners haven't figured this out yet, and that window won't stay open forever. If you want to get ahead on learning AI coding agents and tools like this one, the AI Profit Boardroom is where we learn it together. You get daily
tutorials so you keep learning new tools as they drop. You get four coaching calls every week to ask questions live. You get a prompt library so you never start from a blank page, and you get the member map so you can see who else is in
the community and connect. Link in the description or go to aiprofitboardroom.com. If you want the full process, the SOPs and over 100 AI use cases like this one, join the AI success lab. It's our free
community. Links in the comments and description. You'll get all the video notes from this episode plus access to 95,300 members. It's completely free. The video notes break down everything from today,
from where agents waste tokens to token economizers three features so you don't have to rewatch. And it's a place to keep learning with people building with AI every day. So jump in, grab the notes, and I'll see you inside.
