Cover: TokenEconomizer, cut coding agent tokens. White title on a teal gradient beside a tilted VibeiDE screenshot with four agent terminals in a grid.
All articles

TokenEconomizer: how it cuts coding agent tokens

How Microsoft's TokenEconomizer cuts coding agent costs: micro-skills, tool pruning and a loop guard, Claude Code install steps, results, and VibeiDE's take.

TokenEconomizer is an open source plugin from Microsoft (Apache 2.0) that makes coding agents cheaper in repositories you work in often. It learns from earlier sessions in the same repository and removes three kinds of waste: rediscovering the same environment facts, sending tool definitions nobody uses, and turns stuck in a failure loop. Its README reports 18.4 to 30.9% lower mean cost on SWE-Bench tasks across five agent and model combinations, including the plugin's own model calls (as of November 2026).

Stop juggling terminal tabs.VibeiDE puts every agent in one Grid you can actually read.Try free

This guide explains how each mechanism works, how to install the plugin for Claude Code, what the published numbers do and do not show, and how VibeiDE built the same design into its Brain. Plugin facts come from the TokenEconomizer repository as of 15 November 2026; check it for changes.

What problem does TokenEconomizer solve?

A coding agent starts every session knowing nothing about your repository except what you put in its instructions. So it pays again for lessons it already learned: it runs pytest, finds it missing, tries python -m pytest, and moves on. Next session, the same thing. Every request also carries the full definition of every attached tool, used or not, and a turn that keeps hitting the same error keeps spending tokens until someone notices.

Animated bar chart: in one long session the tokens sent per message grow with every message because the history is resent, while with /clear between tasks each task starts small and stays flat
Claude Code resends the conversation with every request, so a long session costs more per message. /clear starts small again; /compact itself reads the whole conversation.

None of this changes the model or your code. It is overhead around the work, which is why a plugin that only watches sessions can remove part of it. If you want the basics of where tokens go first, our guide to Claude Code cost covers plans, /usage and the history that every request resends.

How does TokenEconomizer work?

The plugin has three mechanisms. Each can be turned on or off on its own, and micro-skills start off by default.

MechanismWhat it watchesWhat it does
Micro-skillsRepeated failures and their repairs, plus a model that reviews recent sessionsInjects a short repository fact at session start once three sessions confirm it; drops it when later sessions contradict it
Tool pruningTools that go unused across many prompts and sessionsRemoves them through the agent's own settings; one command restores them
Failure-loop guardTurns that keep repeating the same failuresA judge model checks whether the turn is stuck and sends a short redirect, at most once per turn by default; it never stops the turn

The key design choice is that nothing becomes a rule after one session. A fact needs three confirming sessions, and a contradiction retires it, so a one-off accident does not turn into a permanent instruction. The loop guard also only advises: it tells the agent to change approach and tells you how to stop the turn, but it never stops it itself.

How do I install TokenEconomizer for Claude Code?

The plugin needs Python 3.10 or later and one of the supported agents. It needs no API key of its own. For Claude Code, the README gives these steps:

git clone https://github.com/microsoft/TokenEconomizer
claude plugin marketplace add "$PWD/TokenEconomizer"
claude plugin install tokeneconomizer@tokeneconomizer

Then, inside Claude Code, run /tokeneconomizer:status to see what it has learned. The other commands are microskills, toolprune, toolprune restore and config, and config set changes settings, including turning each mechanism on or off.

As of November 2026 the README lists Claude Code, Codex, GitHub Copilot CLI and Pi as supported, and OpenCode, Cursor Agent and Hermes Agent as experimental. Pi installs it with pi install git:github.com/microsoft/TokenEconomizer and uses /te status.

How much does TokenEconomizer save?

The README reports results from a paper run on 277 SWE-Bench tasks from six repositories. Each repository's tasks ran in order, starting with nothing learned, and the costs include the plugin's own model calls.

Agent and modelMean cost changePass@1 change
Claude Code, Sonnet 523.6% lower+1.3
Claude Code, Opus 4.830.9% lower-1.0
Codex, GPT-5.6 Terra24.7% lower+0.9
Codex, GPT-5.6 Sol26.1% lower+1.6
Copilot CLI, Sonnet 518.4% lower+2.6

It was cheaper in all 30 repository and combination cells. On Web-Bench the savings were 16 to 21%, and on two security-auditing benchmarks, where each task ran in a new repository, 6 to 20%.

Two things follow from how the test was set up. First, savings grow with repetition: the plugin learns per repository, so a repository you open once gains little. Second, these are benchmark tasks, not your workload. Measure your own sessions with /usage before and after, as described in our Claude Code usage limits guide.

How VibeiDE uses TokenEconomizer's design

VibeiDE added its own implementation of TokenEconomizer's published design to the Brain, VibeiDE's project memory. It shipped in version 0.10.8 on 16 November 2026, whose release notes say the Brain learns from recurring failures, redirects stuck tasks and trims unused tools. It lives in the Brain panel as an Economizer view that credits the original project; the TokenEconomizer use case page shows it in the app, and How we built TokenEconomizer into the VibeiDE Brain covers the engineering. The other changes in that release are in our 10 to 16 November roundup. The three parts are adapted to how VibeiDE runs agents:

  • Repository facts. When three tasks in a project show the same failure and the same way around it, that becomes one short line agents get at the start of a conversation. A fact that stops being true retires by itself, and you can forget or restore any fact.
  • Loop guard. It first learns how long a turn that ends well runs in this project, per provider. A turn that goes far past that while it keeps editing and keeps getting the same failure gets one note asking for a different approach. If it stays stuck, a line in the task tells you. Claude Code gets the note inside the turn; for Codex, only you get the line. It never stops a turn.
  • Unused tools. VibeiDE's own browser and task tools are left out of new conversations when no task in the project used them in ten prompts over two tasks. The view shows how many tokens each tool set adds to every request. A prompt that names them brings them back, and so can you.

The main difference from the plugin is that VibeiDE's version makes no model calls: it reads the agents' own tool calls, needs no key, writes nothing into your repository and keeps what it learns on your computer. That is also why its loop guard uses fixed rules and the learned turn length instead of a judge model.

Animated diagram: the MEMORY.md index loads its first 200 lines or 25KB every session, lines past the limit stay grey, and an arrow fetches a topic file such as feedback_testing.md only when needed
Auto memory keeps a MEMORY.md index in a per-repository folder under ~/.claude/projects/. Only the first 200 lines or 25KB load at session start; topic files are read on demand.

Around it, VibeiDE is a desktop app for macOS, Windows and Linux that coordinates the Codex, Claude Code and OpenCode CLIs you already installed; each user signs in to their own provider accounts, and slots control how many processes run at once without raising a provider allowance. See the product guide and the release notes.

Should you use TokenEconomizer?

It fits best when you run agents in the same few repositories every day, because every mechanism learns per repository. Run /tokeneconomizer:status to see which mechanisms are on, and turn on micro-skills once you have reviewed what they would inject. If you attach many MCP servers, tool pruning matters most; our Claude Code MCP guide shows how to see which servers a session loads.

It helps least for one-off repositories, short sessions and tasks that never fail the same way twice. And it does not change your plan's allowance: it only makes each task use less of it.

FAQ

Is TokenEconomizer free?

Yes. It is open source under the Apache 2.0 license and needs no API key of its own. As of November 2026 its micro-skill review and loop judge use model calls, which the published costs already include.

Does TokenEconomizer work with Codex and OpenCode?

Codex is supported. OpenCode is listed as experimental as of November 2026.

Can I undo what it learned?

Yes. Tool pruning has a restore command, and each mechanism can be turned off with config set. In VibeiDE, the Economizer view has Forget and Restore for facts and Bring back for tools.

Takeaways

  • TokenEconomizer cuts repeated waste: rediscovered repository facts, unused tool definitions and failure loops.
  • Its README reports 18.4 to 30.9% lower mean cost on SWE-Bench tasks, with costs that include its own model calls.
  • Install it for Claude Code from the repository and check /tokeneconomizer:status.
  • Savings come from repetition, so it pays off in repositories you use daily.
  • VibeiDE's Brain adds the same three ideas with no model calls and nothing written into your repository, shipped in 0.10.8.

Share this article

Post on XShare on LinkedIn

Related articles

Necessary cookies support sign-in, security, your language and this choice. Optional categories stay off until accepted.

First-party page views and acquisition measurement, plus Google Analytics 4 (Google Ireland, data may reach the US). Advertising personalization stays off.

With Analytics enabled, retain Google, Microsoft and Reddit ad click identifiers and share download, signup, activation and purchase conversions with the relevant ad provider. No personalized advertising.

Privacy · Cookie inventory