transcribe

Claude Code Is Wasting Tokens... Microsoft Built a Fix

Better Stack · 7m · transcribed 14d ago
More from Better Stack Business
𝕏 Share ▶ YouTube 📥 PDF 🤖 .md

Section Insights

# 0:00

Introduction to Token Economizer

What is Token Economizer and how does it work?

Token Economizer is a free plugin released by Microsoft that reduces AI coding agent costs by 18-31% by learning from previous sessions, optimizing tool usage, and preventing repetitive errors.

  • Token Economizer effectively reduces token usage for AI coding agents.
  • It learns from user sessions to optimize performance and reduce costs.
  • The plugin supports major coding tools and is easy to install.
# 1:30

Using Token Economizer

How do you check the status and functionality of Token Economizer?

Users can check the status of Token Economizer to see what it has learned and track costs. It requires some initial setup, including enabling micro skills and refreshing the tool catalog.

  • Token Economizer provides insights into its learning and cost tracking.
  • Initial setup includes enabling features and refreshing the tool catalog.
  • It learns from user interactions to improve efficiency over time.
# 3:01

Learning from Previous Sessions

How does Token Economizer learn from past coding sessions?

Token Economizer analyzes previous sessions to remember effective commands, environment variables, and file locations, which helps prevent repeated token waste in future sessions.

  • The plugin remembers successful commands and configurations to optimize future interactions.
  • It reduces token waste by recalling useful details from past sessions.
  • Learning is cumulative, improving efficiency over time.
# 4:32

Effectiveness of Token Economizer

Does Token Economizer provide significant cost savings?

Yes, testing showed that Token Economizer reduced costs by 18.4% to 31% across various tasks and repositories, while also improving task success rates in most cases.

  • Token Economizer has been shown to significantly reduce costs in multiple tests.
  • It improves task success rates in most scenarios.
  • Savings depend on consistent use within the same repositories.
# 6:03

Evaluating Token Economizer's Usefulness

When should you consider using Token Economizer?

Token Economizer is most beneficial for users who work consistently on a few core projects. For those frequently switching between different projects, the savings may be minimal.

  • Evaluate the plugin's effectiveness based on your project usage patterns.
  • It's best suited for users with repetitive tasks in the same repositories.
  • Consider running it for a week to assess its impact on token usage.

Transcript

0:00 It seems there's a lot of heat with tools and extensions that claim to reduce token usage. Many of these have been put to the test and they work well. Now, Microsoft just released their own, a free plugin that cut AI coding agent costs by 18 to 31% in their tests, and they didn't use a cheaper model or a different agent either. It works with all the big names, so it's a win for us. It's called token economizer and it solves a problem you've probably seen yourself. You ask claude code to fix something. Fix this. It tries a command, gets an error, and then keeps running and burning tokens up to find us a fix.

0:44 Token economizer learns from those sessions. It remembers how your repo works, removes tools you don't use, and steps in when the agent keeps making the same mistake. And the more you use it in the same project, the more tokens you actually save. So, let's install it and see what it actually does. If you enjoy coding tools to speed up your workflow, be sure to subscribe. We have videos coming out all the time. Now, I'm going to use CL code for this. But remember, token economizer also supports all the other big names. First, I'll clone it and install the plugin right here. We're going to run our git clone. We're going to install the git plugin from the marketplace and make sure everything is ready to go. That's installed. All super straightforward. Just keep the clone folder because the plug-in runs from there. Now, I'll open one of my existing projects and we're going to fire up Claude Code. Let's check the status. All we need to do to check the status here is I'm going to run token economizer status. This shows what the plugin has learned. It shows what it's doing and the costs it has already tracked. Now, quick note here. Micro skills are turned off by default. So I'm going to enable those and we'll circle back. Then I'll refresh the tool catalog. I'm going to run here tool prune refresh catalog. Now I'll give claude code some tasks. Let's start super simple. I'm going to give cloud code a task. Build a unit test.

2:08 Very straightforward. Run it. Now notice I'm not changing how I use clawed code. It's the same thing just on Opus 5.5 with all the prompts I would normally fire straight at it. token economizer just works alongside it. Now in a repo where it's already watched several sessions, we can check what it's learned so far. So here we are. I'm going to run micro skills. We can check you can run tool prune. Here we can see any repos specific info it's learned in tools.

2:39 It's identified as unused. If you install it for the first time, these might be empty. It needs a few sessions to actually learn what the hell is going on. And all of that info stays on your machine inside the token economizer folder. There are really three parts to this. Now, first up to the plate is called micro skills. Say you're working on a project that needs a specific command to run its tests. Claude Code, it doesn't know that. So, it tries the usual command, gets an error, tries something else, and yeah, okay, it eventually gets it. Great. Except later when you start a new session, it might make the exact same mistake. So there we are paying extra tokens which I would rather not do. Token economizer looks at a previous session all of them and learns small details about the repo.

3:26 Things like which test commands actually work which environment variables are needed and where certain files live. Once something has been confirmed enough times it can give us that information to the agents at the start of a new session. So instead of wasting tokens over and over again, the agent already has the answer. Now, next up to the plate is tool pruning. When you start a coding agent, it can load a bunch of tools into its context, and those tool definitions use tokens, even if the agent never touches them. Token economizer tracks which tools actually get used in your repo. If a tool consistently goes unused, it can stop loading it in a feature session. And if you need it again, you can just restore it. Then finally, we go to something called a failure loop intervention.

4:15 You've probably watched an agent run a command, get an error, change one small thing, and run almost the exact same command again. Sometimes it just keeps repeating that process. Token Economizer watches for these patterns. When it thinks the agent might be stuck, it uses a judge model to check what's happening. If it detects this loop, it sends the agent a short instruction to try a different approach. And if the agent still can't recover, it tells you how to stop the turn. It doesn't just freak out and stop. But does it actually save enough money to even matter? That's sort of the question. Yes, it appears to do pretty much that. Microsoft in UC Berkeley tested token economizer on 277 SWE bench tasks across six repos using five different agent and model combinations and the average cost dropped between 18.4 and about 31%. So the results were pretty good in four of the five combinations. Tasks success actually improved. one saw a small decline, but across all 30 repository and agent model combinations, Token Economizer was cheaper than running without it. And they even included the plugin's own model calls in those. Token Economizer isn't completely free to run.

5:28 Some of its features use additional model calls, so those reported savings already accounted for the overhead. It is open- source. It works with the same agents we already use, and the info it learns stays local. But I wouldn't expect all of us to see the same results. His first public release was in October of this year, and the biggest savings come from working in the same repositories over multiple sessions. If you're constantly jumping between unrelated projects, there's much less to actually learn from it, or for I should say. If your agent is doing something completely new, there might not be much repeated work to eliminate at all. So ask yourself, based on the work you do, will this actually be useful? If you use agents every day on one or a couple core projects, then yeah, this should help.

6:14 If you're working on the same repo over and over with claw codeex, yes, this is going to help. But if you're building a ton of different projects or you're just playing around, this is not really going to change anything. It's probably not even worth it. So, here's what I'd do. Install Token Economizer on the repo you use the most. Run it for a week, then check the status reports like I showed us, and compare the costs of similar tasks. If the agent is actually using fewer tokens and whether it's still completing your tasks properly also it is working. One thing to remember each agent learns separately. So whatever cla code learns doesn't automatically carry over to codeex. And don't judge it entirely on the first session. That's why I say run it for a week. The whole point is that it learns from repeated use. If it's saving you money without getting in your way, keep it. If not, you've got the answer. So what it really does is takes a different approach to reducing AI coding costs. Instead of making the model smaller or compressing your prompts, it looks at the work your agent keeps wasting tokens on. It remembers useful details about your repo, stops loading unused tools, and helps agents recover when it gets stuck.

7:23 I'm Josh from Better Stack. If you enjoy coding tips and tricks like this, be sure to subscribe. We'll see you in another video. >>

Summary

Microsoft's new Token Economizer plugin aims to reduce AI coding costs by optimizing token usage during coding sessions. By learning from previous interactions, it minimizes unnecessary token consumption and enhances efficiency across various coding agents.

- Token Economizer can reduce AI coding costs by 18-31% without using a cheaper model.
- It learns from past sessions to remember repo-specific details, reducing repeated token usage on errors.
- Features include micro skills (remembering successful commands), tool pruning (removing unused tools), and failure loop intervention (helping agents recover from repeated errors).
- The plugin is open-source and works with major coding agents, maintaining local data storage.
- Best results are seen when used consistently on the same projects; less effective for varied or one-off tasks.
- Users are encouraged to test the plugin over a week to assess token savings and task completion efficiency.
- Each agent learns independently, so improvements in one do not transfer to others.

Questions Answered

What is Token Economizer and how does it work?

Token Economizer is a free plugin released by Microsoft that reduces AI coding agent costs by 18-31% by learning from previous sessions, optimizing tool usage, and preventing repetitive errors.

How do you check the status and functionality of Token Economizer?

Users can check the status of Token Economizer to see what it has learned and track costs. It requires some initial setup, including enabling micro skills and refreshing the tool catalog.

How does Token Economizer learn from past coding sessions?

Token Economizer analyzes previous sessions to remember effective commands, environment variables, and file locations, which helps prevent repeated token waste in future sessions.

Does Token Economizer provide significant cost savings?

Yes, testing showed that Token Economizer reduced costs by 18.4% to 31% across various tasks and repositories, while also improving task success rates in most cases.

When should you consider using Token Economizer?

Token Economizer is most beneficial for users who work consistently on a few core projects. For those frequently switching between different projects, the savings may be minimal.

© transcribe · For agents Built with care and craft by Gokul Rajaram