AI Compass / Knowledge cards
Cutting repeated costs
TokenEconomizer put to the test
A coding agent like Claude Code remembers little from one session to the next. If you often work in the same project, costs therefore repeat: the agent works out the same facts again, sends along tools that are never needed here, and gets stuck in the same error loops. TokenEconomizer is an open plugin, an add-on package for Claude Code with its own commands and hooks. Researchers from Microsoft and UC Berkeley built it. It learns from a project’s previous sessions and works in three places. Micro-skills are learned facts about the project that the agent receives at the start of a session. Tool pruning switches off tools that have gone unused for a long time. The loop guard detects a stuck work step and prompts a different approach once.
What it is for
Your usage limit lasts longer, or you pay less, without changing the way you work. You also see in figures what your tokens are spent on.
Steps
- Check the requirements: Python 3.10 or newer. According to the README, the plugin has been tested with Claude Code 2.1.300 to 2.1.310, newer versions not yet.
claude --versionshows yours. - Install according to the README: clone the repo, then
claude plugin marketplace add "$PWD/TokenEconomizer"andclaude plugin install tokeneconomizer@tokeneconomizer. Leave the clone in place, the plugin runs from it. - Start
claudein the project, trust the folder and run/tokeneconomizer:status. Once per computer and after every Claude Code update, also run/tokeneconomizer:toolprune refresh-catalog. - Start with suggestions instead of automation:
/tokeneconomizer:config set toolprune=propose. The plugin then only suggests which tools should go. Onlytoolprune applyputs that into effect. Without this setting, according to the video, it switches tools off without asking. According to the README, a tool is dropped if it went unused over 10 messages in at least 2 sessions or over 5 sessions, and only after an hour without a session in the project. - Only switch on micro-skills in your own projects (
config set microskills=on). According to the README, they are off by default because they cost additional model calls. The video gives a second reason: in other people’s projects, hidden instructions in command output could be stored as “facts”. That is a form of prompt injection, meaning smuggled-in instructions. - Measure instead of believing: according to the README,
statusshows what the sessions cost,toolprunethe switched-off tools with the reason. The video also showstoolprune measure, which compares tokens per message with all tools and with the tools actually used. At first it can cost more, because the plugin has not learned anything yet. So measure over several sessions. - If Claude later lacks a tool:
/tokeneconomizer:toolprune restore. According to the README, the plugin does not switch restored tools off again. You start a single session entirely without the plugin withTE_DISABLE=1 claude.
What the measurement shows
According to the README, five combinations of agent and model ran on the same 277 tasks from six repositories of the SWE-Bench test set. Mean costs fell by 18.4 to 30.9%, including the plugin’s own model calls. It was cheaper in all 30 combinations of repository and agent. With Claude Code and Sonnet 5 it cost 23.6% less, and the share of tasks solved on the first attempt (pass@1) rose by 1.3 percentage points. With Opus 4.8 it cost 30.9% less, and pass@1 fell by 1.0 points.
Limits
- Contradiction with the video: AI LABS says the plugin does not impair performance for any model. According to the README, pass@1 falls by 1.0 points with Opus 4.8. In four of five combinations it rises.
- According to the Claude Code docs, the descriptions of MCP tools only enter the context anyway once Claude uses a tool. Before that, only the names are there. How much switching tools off still gains in your project only step 6 shows.
- Each project learns on its own. According to the video, in the tests it only became cheaper from about the sixth task onwards. AI LABS therefore has the plugin read the stored sessions of the last 30 days on first start. This modified version is only available in the authors’ community.
- According to the video, the plugin runs via hooks at every session start and after every tool call. According to the README, it enters the switched-off tools in
.claude/settings.local.json. Claude Code only shows its notices in the detailed transcript (Ctrl+O). - The figures from AI LABS’ own project (about 34,300 instead of 24,400 tokens per message) are a measurement by the authors. They cannot be verified.
- According to the README, what the plugin learns stays on your own computer (
~/.tokeneconomizer). Its model calls run on your own plan.
Links
- Keeping context clean: the built-in tools that save tokens without a plugin. Step 7 there explains why MCP tools cost less than you might think.
- Maintaining your Claude Code setup: clearing out by hand what the plugin tries to do automatically, with a cross-check without the setup.
- Vetting third-party skills: According to the video, a plugin with hooks runs along with every tool call. Read it first.
- Model choice: cost per task: The README, too, calculates in cost per task, not per token.
Sources
- AI LABS: This Is Microsoft’s New Tool Finally Fixed Claude’s Usage Limits, 28 October 2026, 1:38, 2:42–4:55, 6:04–8:45, 10:51–12:30. Sponsored by DataImpulse, plus self-promotion for AI Labs Pro
- Microsoft Research and UC Berkeley: TokenEconomizer, README (Apache 2.0 license), retrieved 30 October 2026
- Li et al.: TokenEconomizer: Experience-Driven Black-Box Cost Control for Coding Agents, arXiv 2610.22732, retrieved 30 October 2026
- Claude Code docs: Costs (MCP tools are only loaded when needed), retrieved 30 October 2026
Status
Checked 30 October 2026 · Maturity new (available since 13 October 2026; measurements only by the authors, not independently repeated)
You can try this with your team in the AI Lab. See the AI Lab