← All reviews

TokenEconomizer manages memory and tools for coding agents

TokenEconomizer is a Microsoft plugin for coding agents that remembers project facts and stops loading tools you never use. Its own model calls add to your agent's existing usage.

Seen from above, a pigeon in orange earmuffs shoves a sled of snow-covered tools across a snowy yard, while its footprint trail leads only to three clean tools and dozens of others lie buried in untouched snow.
TokenEconomizer removes the tools you never use; the facts it learns can go out of date.

A coding agent starts each session mostly from scratch. It works out the test command again, can get stuck repeating a fix that keeps failing, and loads the description of every tool it is connected to, such as file or Git tools, whether it uses them or not. You pay tokens for all of it, in every session.

TokenEconomizer is a plugin from Microsoft that tries to cut that repeated waste in Claude Code and other coding agents. It learns from the sessions your agent has already run in a repository and changes what later sessions load.

Tested: commit 81e32e56bb3c4c1b4c9756b429be91e3960116ca on November 11, 2026. Workflow: fix six bugs in a Python project with Claude Code, then check project memory and tool removal. Result: automatic removal took unused connected tools out of the next session, shrinking its first request from 19,225 tokens to 7,082. With learning turned on, a learned test command stayed active after it broke. Verdict: adopt with care for agents with many connected tools, with learning off.

Set up TokenEconomizer with your coding agent

Paste this into your coding agent:

Install the latest TokenEconomizer plugin from https://github.com/microsoft/TokenEconomizer.
Keep its default settings, with learning off.
Refresh its tool catalog and show its status.

TokenEconomizer learns from past sessions what later ones can skip

The plugin learns short project facts called micro-skills, leaves unused tools out of later sessions and nudges an agent that keeps hitting failures. Learning those facts is off by default; the checks for repeated failures are on. Learning and those checks for repeated failures can add model calls through your existing agent login.

Its authors, from UC Berkeley and Microsoft Research, report 18.4% to 30.9% lower mean cost per completed task on SWE-Bench (real GitHub issues), counting the plugin’s own model calls, in their paper. In Claude Code, tool removal alone gave the largest single share of that saving. They also report that in all but one repository the plugin cost more than the plain agent at first and less from the sixth task on.

Users report the cost saving comes from tool removal

TokenEconomizer removes a tool by adding it to a deny list (tools Claude Code’s settings block), so later sessions skip its description. Developers who compared sessions with and without the plugin found lower costs only once that list existed:

Who Setup Result
yoDEV (a developer community) Older version, many connected tools, shorter wait before removal 15% lower estimated cost in sessions with removal active
A developer on X Claude Code on their own repository, learning off 27% lower cost; the same deny list written by hand saved 26%
Another developer on X 40 SymPy (a Python math library) bugs at defaults, one session each $4.60 without, $4.55 with; the deny list appeared an hour after the run ended

So if you already know which connected tools a project never uses, adding them to permissions.deny in Claude Code’s settings yourself gets you most of the way; TokenEconomizer finds them for you. Because removal waits for five sessions without a tool and an idle hour, a benchmark run right after installing will likely end before removal does anything.

Automatic removal took 45 unused tools out of the next session

By default, TokenEconomizer removes a tool once it has gone unused for five sessions and the repository has been idle for an hour. In a SymPy project with 52 tools loaded, that took out the 45 connected file and Git tools Claude Code never called. The next session’s first request carried 7,082 tokens instead of 19,225. The plugin’s own model calls cost $0.0003.

The deny list lives in the project’s .claude/settings.local.json, and /tokeneconomizer:toolprune restore brings the tools back. In proposal mode (/tokeneconomizer:config set toolprune=propose), nothing changes until you run /tokeneconomizer:toolprune apply, and /tokeneconomizer:toolprune lists what it would remove:

sessions observed: 5 (5 prompts)  catalog: probe+observed
applied (tools this plugin added to /workspace/proposal-project/.claude/settings.local.json): -
proposed: mcp__code__append_file, mcp__code__copy_file, mcp__code__create_directory, ...

At defaults, removal does not ask first. One user found tools they had approved switched to denied and only later traced it to TokenEconomizer, and a task that needs a removed tool stays blocked until you restore it. If that would surprise you or your team, set toolprune=propose.

Learned commands can stay active after they break

With learning enabled, TokenEconomizer learned this test command and its checks:

{
  "injection": "Run tests from the repository root with `python bin/test -C --verbose <path/to/test_file.py>`.",
  "detector": { "confirm": "python bin/test -C --verbose", "contradict": null },
  "life": { "state": "ACTIVE", "fire_num": 7, "fire_den": 7, "contradicts": [] }
}

When we renamed a project’s test runner, TokenEconomizer kept supplying the old command in each session that followed, although its README says a contradicted fact is dropped. In the saved fact above, the contradict check is empty and the confirm check only looks for the command text. Each failed run of the old command raised its confirmation count instead of retiring it.

Leave learning off (microskills=off, the default) and put important commands in a reviewed CLAUDE.md file (project instructions Claude Code reads). If you turn learning on, run /tokeneconomizer:microskills after renaming a build or test command to see which facts it still supplies.

TokenEconomizer alternatives handle memory or long tool output

For persistent project history, claude-mem captures session observations and makes them searchable. A reviewed instruction file is simpler for a few stable build and test commands.

If long command output fills your context, rtk filters it. context-mode runs and indexes large outputs outside the agent’s context, then lets the agent search for useful parts. headroom compresses tool output while retaining originals. These address the size of results your tools return; TokenEconomizer decides which tool definitions future sessions load.

Use TokenEconomizer’s tool removal and skip its learning

Adopt TokenEconomizer with care if your coding agent loads many connected tools it rarely uses: keep the defaults and leave learning off. Automatic removal worked as described, taking 45 unused tools out of the next session, and /tokeneconomizer:toolprune restore brings them back. Users who measured it once it had removed tools report lower costs, and a deny list written by hand did almost as well. To check removals before they apply, set toolprune=propose and run /tokeneconomizer:toolprune apply when you agree. With learning turned on, a renamed test command stayed active, so keep stable commands in a reviewed CLAUDE.md.