Skip to content

AI Compass / Knowledge cards

Cutting repeated costs

TokenEconomizer put to the test

Checked Costs Automation

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

  1. 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 --version shows yours.
  2. Install according to the README: clone the repo, then claude plugin marketplace add "$PWD/TokenEconomizer" and claude plugin install tokeneconomizer@tokeneconomizer. Leave the clone in place, the plugin runs from it.
  3. Start claude in the project, trust the folder and run /tokeneconomizer:status. Once per computer and after every Claude Code update, also run /tokeneconomizer:toolprune refresh-catalog.
  4. Start with suggestions instead of automation: /tokeneconomizer:config set toolprune=propose. The plugin then only suggests which tools should go. Only toolprune apply puts 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.
  5. 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.
  6. Measure instead of believing: according to the README, status shows what the sessions cost, toolprune the switched-off tools with the reason. The video also shows toolprune 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.
  7. 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 with TE_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

Sources

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