TokenEconomizer plugin

Microsoft Research and UC Berkeley plugin that cuts the cost of Claude Code, Codex and Copilot CLI sessions using earlier sessions

  • 5,852 ★ on the repository
  • Last commit
  • Apache-2.0
PluginOfficial

Broad access

Why this level

  • Plugin hooks run in every agent session and change its settings by writing a deny list of tools
  • The plugin makes extra model calls through your agent on your plan
  • The plugin keeps repository session history in `~/.tokeneconomizer`, which can contain code and command fragments
All reasons and checks
Needs a VPN

microsoft/tokeneconomizer

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add plugins/tokeneconomizer

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Broad accessThe tool can change data, run commands or handle secrets.

  • Plugin hooks run in every agent session and change its settings by writing a deny list of tools
  • The plugin makes extra model calls through your agent on your plan
  • The plugin keeps repository session history in `~/.tokeneconomizer`, which can contain code and command fragments

This is third-party code. Review the repository files before installing.

What it does

TokenEconomizer learns from agent sessions in your repository and removes repeated waste in the next ones. The agent, its model and its code stay as they are. Three mechanisms work separately and each has its own switch. Micro-skills remember facts about the repository, for example `python -m pytest` where `pytest` is missing. A fact enters the start of a session after three confirmations and is dropped when later sessions contradict it. Tool pruning leaves out tools that go unused: every loaded tool definition is sent with every request, so idle ones cost money. A tool is disabled through the agent's own settings and one command brings it back. The loop guard steps in when a turn is stuck on the same failures: a judge model assesses it, and with confidence of 0.7 or more the agent gets a short note to try another approach, at most once per turn. The plugin cannot stop a turn, it only tells you how. Check status and settings with `/tokeneconomizer:status` and `/tokeneconomizer:config`.

Who it is for. For developers who run Claude Code, Codex or Copilot CLI in the same repositories every day and pay for tokens.

Good fit when

  • The agent keeps rediscovering how tests and builds run in one repository
  • Your token bill grows because of connected but unused tools
  • The agent gets stuck in loops on the same error and burns turns
  • You want statistics on what sessions in a repository cost, cache pricing included

Not a fit when

  • You work in each repository only once: the plugin pays back across repeated sessions
  • Your agent version is outside the tested range, for example Claude Code newer than 2.1.310: other versions are untested
  • You need a hard spending cap: the plugin lowers cost but sets no ceiling
  • Company policy forbids installing hooks into the agent

Example request

Show what TokenEconomizer has learned about this repository and what my sessions cost

Limitations

Python 3.10 or newer is required. Tested versions: Claude Code 2.1.300–2.1.310, Codex 0.153.1–0.164.0, Copilot CLI 1.0.83–1.0.102, Pi 1.2.0–1.3.0. opencode support is experimental. The authors measured savings on SWE-Bench and Web-Bench tasks; in your repository the result depends on how many repeat sessions you run. Micro-skills are off by default because their proposals add model calls.

How to disable. Switch each mechanism off with `config set` and `off` for `microskills`, `toolprune` or `loopguard`. For full removal follow `plugin/README.md`. Disabled tools come back with the `toolprune` command.

FAQ

How do I install TokenEconomizer in Claude Code?

Clone the repository and run `claude plugin marketplace add "$PWD/TokenEconomizer"`, then `claude plugin install tokeneconomizer@tokeneconomizer`. After starting `claude`, trust the folder and check the install with `/tokeneconomizer:status`.

How many tokens does TokenEconomizer save?

The authors measured an average cost reduction of 18.4–30.9 percent across five agent and model combinations on SWE-Bench tasks, with Pass@1 up in four of five. These are study measurements, and your repository will differ.

Can the plugin stop my agent's turn?

No. The loop guard only adds a note to try another approach, once per turn by default. If the turn is still stuck, the plugin tells you how to stop it.

Where does the plugin keep its data?

Everything it learns stays on your computer in `~/.tokeneconomizer`. It needs no API key of its own and never handles credentials.

Why are Micro-skills off by default?

Their proposals add model calls and spend tokens, so the mechanism is switched on separately.

Discussion

No questions or reviews yet.

Plugins

A local proxy and plugin for Claude Code and Codex that trims tool output, keeps the prompt cache warm and shows the savings

PluginBroad access74Repository stars

Token Savior indexes code by symbol, keeps memory between sessions and rewrites noisy Bash commands so the agent spends fewer tokens

MCP serverBroad access1.2KRepository stars

A plugin that cuts token use in long sessions: prunes stale tool output, picks a subagent model and narrows the skill list.

PluginExtended access52Repository stars

A skill that wires a whole-run spend cap into a Python agent and checks the budget before every model call to stop runaway cost.

SkillExtended access84Repository stars

Token Optimizer MCP

token-optimizer-mcp

Context compression and caching, token savings tracking per agent. Global npm install turns on Claude hooks and wraps commands; telemetry is off by default

MCP serverExtended access577Repository stars

A token-saving skill for coding agents: shorter code, tighter replies and compact handoffs between agents

PluginExtended access354Repository stars

Comparison with similar tools

Cards that share the main search query, and how they differ.

ToolOfficialRepository starsMain difference
TokenEconomizer (this card)yes5,852
RTKno86,236compresses command output to save tokens, without learning from sessions
Claude Token Optimizer: fewer tokens at startupno653trims the files Claude Code loads at startup
ccusageno19,415counts token usage from logs but does not reduce it

README in short

The repository accompanies an arXiv paper and holds the plugin, architecture docs and scripts to rerun the experiments on SWE-Bench and Web-Bench. Every mechanism parameter has a default and changes through `config set`.

README badge

Report a problem