Researchers at Microsoft and UC Berkeley released TokenEconomizer, a free, open-source plugin for Claude Code, OpenAI's Codex, the GitHub Copilot CLI and Pi that learns from an agent's finished sessions in a repository and trims what later sessions there are sent. Version 0.1.0 was published on GitHub on October 26 under the Apache 2.0 license.

In the team's own tests on SWE-Bench, a benchmark of real bug fixes from open-source Python projects, it cut the mean cost per task by 18.4% to 30.9% across five agent and model pairings. The 30.9% figure in this week's coverage is the best of the five, and it came with a slightly lower success rate.

The method is set out in a paper posted to arXiv on October 15 by 11 authors from UC Berkeley, Microsoft Research and Microsoft Security. SaasBuzz has not tested the plugin; this account comes from the paper and the repository.

How it works

The plugin leaves the agent's model and code alone. After each session it reads the log and changes what the next session in that repository gets, in three ways:

  • Micro-skills: facts that sessions keep rediscovering, such as the test command that actually works in this repository, are written down once three sessions confirm them and given to every later session at the start.

  • Tool pruning: every loaded tool's definition is sent with every request, used or not. A tool that goes unused for 10 prompts across at least two sessions, or for five sessions, is switched off through the agent's own settings. One command restores it.

  • Failure-loop intervention: when a turn keeps hitting the same errors, a judge model checks whether it is stuck and, if it is at least 70% sure, adds a short note telling the agent to try another approach. It never stops a turn itself.

The waste is real in the paper's own profiling: the agent was shown 23 tool definitions on every turn, 16 of them were never called, and three accounted for 98% of all calls. The plugin's own model calls run through the user's agent and plan, need no separate API key, and are counted in its cost figures.

Two caveats sit in the documentation rather than the headline. The released plugin ships with micro-skills switched off, because its fact proposer adds model calls and, the README says, its savings depend on the repository. And the paper's experiments did not cover Pi.

The lead author, Aaron J. Li, a UC Berkeley PhD student whose post the repository links, announced the release the same day:

Post on X by @aaron_jli

Do you know that past experience can substantially reduce the token cost of your coding agent? Introducing our recent work TokenEconomizer: 18.4–30.9% lower cache-aware cost on SWE-Bench, with comparable task success. We deployed it as a plugin for mainstream coding agents - https://t.co/UcYBE9r6mv

What the savings depend on

The paper ran 277 SWE-Bench tasks from six projects, including Django, SymPy and scikit-learn, in the order they were fixed, starting each project with nothing learned. Cost is what the tokens would be billed at, with cache pricing, and includes every call the plugin made. The baseline is the unmodified agent at high reasoning effort.

Within each of the 30 project and pairing combinations, cost fell by 5.2% to 40.1%, the source of the rounded 5% to 40% range in the project's README.

The simpler way to save is to turn the agent's reasoning effort down. SaasBuzz set the two side by side from the paper's Table 1:

Setup

Plugin

Medium effort

Claude Code, Sonnet 5

23.6% less, +1.3 pts

26.6% less, -4.7 pts

Claude Code, Opus 4.8

30.9% less, -1.0 pts

16.8% less, -1.8 pts

Codex, GPT-5.6 Terra

24.7% less, +0.9 pts

25.7% less, -4.2 pts

Codex, GPT-5.6 Sol

26.1% less, +1.6 pts

28.9% less, -3.4 pts

Copilot CLI, Sonnet 5

18.4% less, +2.6 pts

25.4% less, -2.4 pts

Cost change against the agent at high effort, and change in the share of tasks solved on the first try, in percentage points. Source: Li et al., arXiv 2610.22732, Table 1; SaasBuzz calculation.

What it means for teams paying for coding agents

Averaged across the five pairings, the plugin and medium effort save the same amount, 24.7% each by SaasBuzz's calculation. The difference is accuracy: medium effort solved fewer tasks in every pairing, by 1.8 to 4.7 points, while the plugin solved more in four of five. On those numbers the plugin's case is a similar saving that, in four of five pairings, came without giving up results, not a bigger saving.

The savings come from repetition, so they favor teams that run an agent on the same codebase day after day; a one-off job in a new repository has little history to learn from. The authors also note their test streams were "related but independent fixes rather than actual user sessions".

How a saving shows up depends on the bill. On metered API use it is money. On flat monthly plans it is room under the usage limits, the terms SaasBuzz covered in Anthropic's Claude Ultra change and OpenAI's reversed ChatGPT Pro cut. The paper opens on the reason both matter: frontier coding agents have "sharply increased the token costs" of AI-assisted software work.