How to install TokenEconomizer comes down to three steps: it's an open-source plugin from Microsoft Research, UC Berkeley, and Microsoft Security that sits next to Claude Code, Codex, the GitHub Copilot CLI, or Pi, and it tackles the way coding agents burn tokens over and over on the same work. In official tests across 277 real bug-fixing tasks, it cut average cost by 18.4% to 30.9%. But it doesn't pay off the moment it's installed — it first needs enough session history from the same repository.
Install it in three steps
First, make sure your machine has Python 3.10 or newer, and that the agent you want to use is already signed in. Second, clone the official repository, microsoft/TokenEconomizer, add it as a local plugin marketplace, and run the plugin install command for your agent: for Claude Code it's claude plugin install tokeneconomizer@tokeneconomizer; Codex and the Copilot CLI use their own plugin commands, and Pi uses pi install with the repository address. Third, open your agent and run te status or /tokeneconomizer:status to see whether the plugin is loaded and what it has learned.
How it saves you tokens
The plugin reads the log of each finished session and works in three places: it writes recurring facts about the repository down as one-line notes and drops them into the next session's context, so the agent stops rediscovering them by trial and error; it trims tools that go unused from the loaded list, because every tool's description is sent along with every request; and when it spots the agent going around in circles on the same error, it inserts a note suggesting a different approach — and if that doesn't work, it alerts you to step in. Everything it learns stays on your machine, and it needs no API key of its own.
Three real gotchas
First, a fresh repository won't save money at the start — the plugin is still learning, and official data shows cumulative cost only drops below the default from the sixth task onward. Second, the supported versions are pinned tightly: only specific ranges such as Claude Code 2.1.300 to 2.1.329 are covered, so check the compatibility table after your agent updates. Third, micro-skills are off by default — you have to switch them on yourself — and the plugin's own model calls cost money too, so factor them into the bill.