# TokenEconomizer: what Microsoft's cost plugin changes in a Claude Code request, and how much of the paper's 18-31% it can reach

> Satyajit Ghana — Head of Engineering @ Inkers Technology
> canonical: https://ai.satyajit.si/articles/tokeneconomizer
> date: 2026-11-16
> tags: agents, agentic-coding, harness, pricing, context-management, tool-calling

On 15 November NZ [posted on X](https://x.com/CodeByNZ/status/2121906179588735472) that "Microsoft just made Claude Code and Codex cheaper without touching the agent." The post lists four things. TokenEconomizer remembers the repo facts your agent keeps rediscovering. It stops loading tools that never get used, "since every tool definition is sent with every request". It works with Claude Code, Codex, Copilot CLI and Pi. And it gets "18.4% to 30.9% lower cost across 5 agent-model setups on SWE-Bench." The post ends: "If you hit your usage limits every week, this is free money."

The source is the repository [microsoft/TokenEconomizer](https://github.com/microsoft/TokenEconomizer) and the paper behind it, [TokenEconomizer: Experience-Driven Black-Box Cost Control for Coding Agents](https://arxiv.org/abs/2610.22732). The paper was submitted on 15 October. Its first author, Aaron J. Li, is at UC Berkeley, with co-authors from Microsoft Research and Microsoft Security. Li [announced it](https://x.com/aaron_jli/status/2114797313613053952) on 26 October, so "just" means three weeks ago.

I cloned the repository at commit `583fff7` (15 November) and read the plugin, its design notes and the experiment harness. That is about 17,800 lines of Python in the package, 18,700 in `experiments/` and 14,400 in tests. I did not run the plugin: it needs a signed-in coding agent, and the paper's numbers need Docker, SWE-Bench images and two API keys. What I did run, on a Linux box with no API key, is Claude Code itself at the paper's version and at a current one, pointed at a fake Messages API that records every request. That shows what the paper's tool mask and the plugin's deny list each take out of a real request, and where the plugin's injected text lands relative to the cache breakpoints. Where the paper and the plugin disagree, I say which one the post's number comes from.

<RepoCard repo="microsoft/TokenEconomizer" />

<Video
  src="https://ai.satyajit.si/articles/tokeneconomizer/clip1"
  poster="https://media.thesatyajit.com/ai/articles/tokeneconomizer/clip1-poster.jpg?v=69bcb411b8c6fefe"
  alt="An animated chart of six sessions in one repository. Each bar stacks the work itself with three kinds of waste: re-learning the repo, tools never used and getting stuck in loops. A panel on the right adds one lesson per session: micro-skills remember to run tests with python -m pytest, tool pruning keeps Read and Edit and strikes out Notebook and Browser, and failure-loop intervention answers the same error three times with try another way. The bars step down below a dashed line labelled without TokenEconomizer."
  caption="The authors' own explainer: each finished session teaches the controller one thing and the next sessions waste less. A schematic, not data (video from @aaron_jli's post on X)."
/>

## It is a set of hooks, not a proxy

The first thing to settle is where it sits, because the post's "without touching the agent" invites guesses. It is not a proxy in front of the API: nothing intercepts or rewrites requests. It does not compact context, trim tool output or reorder anything for the prompt cache. It is a plugin that each agent loads through its own hook system. For Claude Code that is `plugin/hooks/hooks.json`, which runs one launcher, `te-hook`, on six events:

| Hook | What it does |
|---|---|
| `SessionStart` | injects the learned facts as `additionalContext` |
| `UserPromptSubmit` | opens a turn for the loop guard |
| `PostToolUse`, `PostToolUseFailure` | folds the call into the guard, and delivers a redirect as `additionalContext` |
| `Stop` | closes the turn; a turn that "ended green" feeds the repository's typical-turn statistics |
| `SessionEnd` | hands the finished session to a detached `te fold` |

`te fold` reads the agent's own session log after the session ends and updates what the plugin knows about the repository. That state lives in `~/.tokeneconomizer`, one directory per repository and agent. The hooks are standard-library Python and fail open: an error becomes an empty answer and a traceback in `errors.log`.

So it does touch the agent, in two places. It adds text to the conversation through hooks. And it writes deny rules into the repository's own settings: `.claude/settings.local.json` for Claude Code, `.codex/config.toml` for Codex, `.github/copilot/settings.local.json` for Copilot. What it leaves alone is the model, the weights and the agent's code. The paper's phrase is "black-box": it acts only through what each harness already exposes.

<Figure
  src="https://media.thesatyajit.com/ai/articles/tokeneconomizer/fig1.png?v=444adb800cfdcf09"
  alt="A diagram with a controller on the left holding repository state and three boxes: micro-skill injection, tool pruning and failure-loop intervention. Arrows go to a sealed agent and harness on the right. Knowledge enters the instruction prefix between the harness instructions and the task. Interface: shell, read, edit, grep, git and test are loaded while web, jupyter, browser and mcp are struck out. Control: repeated edit and test failures lead to a redirect, then to an abort after which the remaining edits and tests never run. A learners box at the bottom updates all three from each completed trace."
  caption="The controller and the three places it acts. Note the last row: in the paper's harness a second stuck verdict aborts the run (TokenEconomizer paper, Figure 4)."
/>

## Why a tool you never call still costs money

An agent turn is one API request carrying everything the model has seen: the tool definitions, the system prompt, the task, then every earlier message and tool result. Turn 30 re-sends turns 1 to 29. The paper's Figure 1(a) draws this, and its Section 2 says it plainly: caching "discounts this replayed context but does not eliminate its cost."

The price list makes the shape concrete. `tokeneconomizer/pricing.py` keeps the ratios the paper bills by, in units of a fresh input token: a cache read is 0.10, a cache write 1.25 for the 5-minute cache and 2.0 for the 1-hour cache, and output 5.0 for Claude models. A few newer models read the cache at 0.05. Its docstring puts cache reads at "~90%+" of an agent loop's tokens.

Now take a tool schema of $T$ tokens that the agent never calls. In a session of $n$ turns that starts cold, the first request writes it to the cache and every later request reads it back:

$$
\text{cost of } T \text{ per session} = T\,\big(w + r\,(n-1)\big)
$$

With $w = 1.25$, $r = 0.1$ and 30 turns, each unused token costs 4.15 fresh-token equivalents per session (my arithmetic). Nothing about the task changes that number. A tool is charged for being present, on every turn, in every session.

The calculator below runs that model for a whole session. The default prefix is the paper's own figure for Claude Code's first request on a Django task, 42,866 tokens, and the default cut is the 26,571 tokens its tool mask removed (the next section has where both come from). Turn count, context growth and output per turn are knobs, not data.

<CacheBill />

The toy model will happily show a saving above 30% from tools alone. The paper measured less: 13.2% and 17.7% from pruning alone on its two Claude Code settings. Real sessions add more context per turn and more output, and those parts of the bill do not shrink. Move the cut down to 2,000 tokens and the saving falls to a few percent. Which of those two cuts you get is the question the rest of this piece keeps returning to.

## The mask in the paper and the mask the plugin writes

The paper's evidence for the tool problem is its profiling run: 60 SWE-Bench tasks on Claude Code with Opus 4.8. The agent was shown 23 tool schemas on every turn, and no repository invoked more than 7. Sixteen were never called, and three (`Bash`, `Read`, `Edit`) took 98% of all calls.

<Figure
  src="https://media.thesatyajit.com/ai/articles/tokeneconomizer/fig2.png?v=08d199d5dc077df4"
  alt="A grid of tools against six repositories: sklearn, SymPy, Django, Sphinx, Matplotlib and xarray. Bash, Read and Edit are used in all six. TaskUpdate and TaskCreate are used in Matplotlib and xarray, Write in Sphinx and xarray, WebFetch only in xarray. A final row, 16 other tools, is empty in every column. The caption reads 23 tools loaded every turn."
  caption="Which loaded tools each repository actually used in the profiling run, square size by frequency (TokenEconomizer paper, Figure 3b)."
/>

The paper's Appendix I(f) shows what the mask did to the bill. On the Django stream, with Claude Code and Sonnet 5, the first task ran with all 23 tools and its first request carried 42,866 prompt tokens. Before the second task the tool judge masked 19 tools, and that request carried 16,295 tokens against default execution's 43,351. Four tools stayed: `Bash`, `Edit`, `Read`, `Write`. On my subtraction that is 27,056 tokens off the first request, and 26,571 against task one's default. On Copilot CLI the same judge masked 10 of 19 tools, and the first request went from 26,249 to 11,347.

Here is the problem for anyone installing the plugin. Its file `tokeneconomizer/plugin/adapter.py` defines `INTERACTIVE_PROTECTED`, the tools "a person relies on in an interactive session", and the deny-list writer never proposes one. Of the paper's 19, 11 are on it: `AskUserQuestion`, `EnterPlanMode`, `ExitPlanMode`, `Skill`, `Task` and the six `Task*` list tools. The web tools are protected too. That leaves eight the plugin may prune on Claude Code: three `Cron*` tools, two worktree tools, `NotebookEdit` (only after three times the usual evidence), `ScheduleWakeup` and `Workflow`.

On Copilot it is worse. Copilot has no persistent per-tool filter, so the plugin can only switch off a whole MCP server through `disabledMcpServers`. The ten tools the paper masked are built-ins, and its deny list removes none of them.

<RequestAnatomy />

The plugin's own design note explains why the two differ, and the reasoning is sound. The benchmark judge's prompt (Appendix G.2) tells it the agent is "headless and single-shot (no human, one sealed container, no sub-agents, scheduling, or external memory)." Under that premise a question tool or a sub-agent is dead weight. In a real session you ask the agent questions and it spawns sub-agents. `docs/PLUGIN.md` says so in its table of differences: "A person asks questions, plans and browses in a real session." The plugin also has no per-task judge at all, because it never sees a task description before a session starts. It prunes only on evidence: unused over 10 prompts across at least 2 sessions, or over 5 sessions of any length.

There is a second gap, and the paper does not cover it. Its experiments pinned Claude Code 2.1.170. The plugin supports 2.1.300 to 2.1.310. Newer Claude Code defers many tools: it lists them by name and fetches a schema only when the model asks for it through `ToolSearch`. The plugin's own trace reader puts the consequence in a comment: "Deferred tools cost one listing line each, not a schema, so they matter little to the bill." The design note records a check on 2.1.307 where a deny list took the request from 12 tools to 11, and an end-to-end run where it went from 12 to 8. The repository's catalog-capture code warns that pointing Claude Code at a local endpoint "changes which tools it offers", so those counts are indicative. Either way, the 23-schema, 42,866-token request in the paper is not the request a current Claude Code sends.

The paper reports one token count for all 19 masked tools together, so I measured the split. I installed Claude Code 2.1.170 and 2.1.307 on a Linux box, pointed each at a local fake Messages API that records request bodies and answers "OK", and captured the first request with no deny list, with the paper's 19-tool mask (`--disallowed-tools`), and with the plugin's 8-tool list written as bare-name deny rules in `.claude/settings.local.json`, the way the plugin writes it. Sizes are bytes of compact JSON per tool definition, since Claude's tokenizer is not public:

| Claude Code | Tools sent, default | Tool JSON, default | After the paper's mask | After the plugin's list |
|---|---|---|---|---|
| 2.1.170 | 25 | 71,518 B | 6 tools, 7,495 B | 17 tools, 34,657 B |
| 2.1.307 | 12 | 28,970 B | 8 tools, 11,680 B | 10 tools, 18,729 B |

On 2.1.170 the 25 are the paper's 23 plus `WebFetch` and `WebSearch`, which every arm of the experiments dropped. One schema dominates: `Workflow` alone is 20,562 bytes, more than the next five together. It is on the plugin's prunable list, which is why the plugin's eight still take 36,861 bytes out, 58% of the 64,023 the paper's mask removed. If bytes per token is roughly constant across schemas, that is about 15,000 of the paper's 26,571 tokens (my estimate).

On 2.1.307 the picture changes. The default request already carries 12 tools and 28,970 bytes of tool JSON; the plan-mode, question, worktree, cron and task-list tools are deferred to a one-line listing. Of the eight the plugin may prune, only `Workflow` and `ScheduleWakeup` are still sent in full, and dropping them takes 10,241 bytes off: 35% of the tool JSON and 22% of the whole first request (46,004 bytes to 35,700). The paper's mask would take 17,290, because it also drops `Agent` and `Skill`, which the plugin protects. Two caveats on these numbers. A non-first-party base URL changes the tool set a little (`ReportFindings` and `ListAgents` appear here), and the default model in this capture was Opus 5.5. Setting `ENABLE_TOOL_SEARCH=true` took 2.1.170 from 25 tools to 9 (17 deferred, `ToolSearch` added) and changed nothing on 2.1.307, where deferral is already on.

So the plugin can still reach a real slice of the tool bill on a current Claude Code, but it is a slice of a request that Claude Code has already cut by more than half.

## Micro-skills: a short manual the agent did not write

The second mechanism targets rediscovery. The profiling found that actions recurring in at least half of a repository's tasks account for 12-28% of the bytes its tool calls send and receive. The share of calls that repeat an earlier task's action rises from 14% on the second and third tasks to 30% once five tasks precede it. Against another repository's history it is 7%.

A micro-skill is one operational fact about one repository: which test runner works, which setup step is unnecessary. A model proposes candidates from digests of recent sessions (command templates, edited file names, error lines, never file contents). Each candidate carries detectors, regexes or built-in predicates that the controller runs on every later trace with no model call. A trace can exercise a skill, confirm it, contradict it, or show it was needed. Support decays and contradictions weigh more than confirmations:

$$
q_i(f)=\sum_{j<i}\gamma^{\,i-j}\Big(\mathbf{1}[\xi_j \text{ confirms } f]-\lambda\,\mathbf{1}[\xi_j \text{ contradicts } f]\Big)
$$

with $\gamma = 0.8$ and $\lambda = 5$ in the paper's configuration (Table 4). A skill is injected only after three confirmations on tasks whose edited files do not overlap, and only while its need rate stays at or above 0.4 over at least four exercises. It retires once $q$ goes negative, and a high-stakes skill such as a test command retires at its first contradiction.

The paper's example (a) is a good one. On SymPy, `pytest` is not installed in the task image. Default execution on sympy-13615 tried `python -m pytest`, got "No module named pytest", tried `sympy.utilities.runtests` and got no tests run, then found `sympy.test(...)`: 15 turns. With the learned skill stated up front the task took 11. That is the mechanism working as designed, and it is the kind of thing a `CLAUDE.md` line also fixes, except that nobody has to notice and write it.

In the plugin, micro-skills is **off by default**. The README gives the reason: the proposer "adds model calls and how much it saves depends on the repository and the work you do there." The design note gives a second one. A learned fact is text injected into your agent's context, derived from command output that the repository controls. That is a prompt-injection channel, and the plugin suggests leaving it off on repositories you do not trust, or using `microskills=envfacts`, a free layer that fills fixed templates and calls no model. The free layer's block is capped at 4 facts and 150 tokens. The plugin's notes also say that in the experiments the free layer alone "formed almost nothing once the harness set each environment up properly."

## The loop guard: in the paper, a redirect meant a restart

The third mechanism exists because failures are expensive. In the profiling run, 10 failed executions were 17% of the tasks and 32% of the spend. A fixed turn cap cannot catch them, because what counts as long differs by repository: Matplotlib failures ran 45 turns against 20 for successes, Sphinx failures 36 against 31.

The guard learns a turn budget per repository from the successful runs, $B_i = \beta \cdot Q_p$ of their turn counts, with $\beta = 1.25$ and the 90th percentile. After every tool call a free rule checks for repeated failure signatures, dense errors or a run past $B_i$. When it fires, a judge model reads a digest of recent actions and decides whether the agent is stuck. A confident verdict (at least 0.7) gets a redirect, an LLM-written summary of the agent's own actions and a request to try "a MATERIALLY DIFFERENT hypothesis", in the words of the fallback text in `loopguard/rules.py`.

What a redirect *is* differs between the paper and the plugin, and this matters for the numbers. Appendix J describes the paper's harness on all three agents: "To redirect, it stops the CLI and starts a new invocation in the same container, with the redirect in its prompt and the agent's edits still on disk. A second stuck verdict ends the task." A new invocation starts a new conversation. The history the agent had piled up is gone, so every later turn re-reads less. On top of that, runs get aborted: Table 6 counts 2.0 and 2.2 aborts per stream for the full stack on the two Claude Code settings. An aborted run is a failure the benchmark would probably have recorded anyway, now billed for fewer turns. Example (i) is exactly that: xarray-6798 fails under both, seven turns sooner with the guard.

The plugin does neither. Its redirect is `PostToolUse` `additionalContext`, a note attached to a tool result in the same conversation. If the turn is still stuck afterwards, you get one line telling you how to stop it, and the plugin "never stops a turn itself." The design note says it outright: "Different intervention, so its effect is not inherited from the experiments." It also says the plugin's guard has been exercised on provoked loops on every agent, but "whether a nudge changes a looping model's course is not established." In the paper the guard alone saved 7.1% and 5.4% on the two Claude Code settings. Part of that came from context resets and aborts the plugin does not do.

## Does it break prompt caching?

Mostly no, and this is the most carefully engineered part of the repository. A prompt cache matches the request from the left: tools first, then the system prompt, then the conversation. Changing anything invalidates everything after it. I wrote about where open harnesses put their breakpoints in [Prompt caching in coding agents](/articles/prompt-caching-harnesses). The plugin's design note has a section dated 21 October that checks each mechanism against that rule. The Claude Code check ran against a local fake Messages API with no model calls; Codex, Copilot and Pi went through a logging proxy.

- **Facts** are rendered when the previous session is folded and given once, at session start. They land after the tools and system prompt, so the expensive cached prefix is untouched. Facts that change on disk mid-session leave a running session alone. A resumed conversation has to carry the same facts byte for byte; Claude Code and Codex replay them from their logs, and for Copilot the plugin records the text a session started with and gives it again.
- **Redirects** come after a tool result, so the next request still extends the last one.
- **Deny lists** are where it could hurt. A running session keeps its tool list even if the settings file changes under it; Claude Code reloaded the rule and kept the tool. A *resumed* conversation does not. `claude --continue`, `codex exec resume --last` and `copilot --continue` all sent the old history with the new tool list, so the whole history is written to the cache again instead of read. In the calculator's terms that costs $(w - r)\,H$, or 1.15 fresh-token equivalents per token of history $H$ (my arithmetic). The plugin's answer is to hold a new deny list as pending and write it only once every session in the repository has been idle for 60 minutes, past the cache's lifetime, or after a day. Toggle "resumed after the tools changed" in the calculator to see why.

The capture confirms the first two points on Claude Code 2.1.307. I registered a `SessionStart` and a `PostToolUse` hook that answer with `additionalContext`, as the plugin's do, and had the fake API return one `Bash` call. The cache breakpoints sit on `system[1]`, `system[2]` and the first conversation message. The fact text landed in the second message, after all of them, and added 129 bytes. Between the turn's first and second requests the tools and system prompt were byte-identical, and the redirect landed as the last message, after the tool result. The fact message did change form, from a block list to a plain string with the same text, which matches what the plugin's design note reports; the text the model sees is the same.

The first session after a deny list lands pays one cold write of a smaller prefix, which it would have paid anyway on a new day. So the cache cost of pruning is small and bounded. I would still turn on `toolprune=propose` for the first week, so nothing changes until you have read the list.

Does it change model behaviour? By construction, yes, a little: fewer tools, a few lines of facts, the occasional redirect. The plugin's own model calls (the judge and redirect writer, and the proposer when micro-skills is on) run through your agent CLI on the cheapest model it can find, Haiku on Claude Code, and are charged to its ledger. So "free" means free software. The guard's judge spends a small amount of your plan on every repository where it fires.

## Did task success hold?

On the paper's own numbers, yes, within noise. Table 1 runs 277 SWE-Bench tasks from six repositories, three seeds each, with costs paired against default execution at high reasoning effort and including every controller call:

| Setting | Cost change | Pass@1 default → TE |
|---|---|---|
| Claude Code, Sonnet 5 | -23.6% | 74.7 → 76.0 |
| Claude Code, Opus 4.8 | -30.9% | 74.0 → 73.0 |
| Codex, GPT-5.6 Terra | -24.7% | 73.8 → 74.7 |
| Codex, GPT-5.6 Sol | -26.1% | 80.1 → 81.7 |
| Copilot CLI, Sonnet 5 | -18.4% | 75.0 → 77.6 |

The seed standard deviations on Pass@1 are 0.6 to 1.5 points, and one task out of 277 is 0.36 points. So the Opus drop of 1.0 point is about three tasks per seed, and the gains are of the same size. The fair reading is "comparable", which is the paper's own word. The useful comparison is with turning reasoning effort down: medium effort on Sonnet 5 saves 26.6% but costs 4.7 points (74.7 to 70.0), and low effort saves 45.5% at 9.6 points. TokenEconomizer gets a similar saving without the quality loss. One of the replies under NZ's post made the Opus point on its own, and NZ agreed.

The saving also held per repository, which fixed strategies fail. The paper ran two of those as baselines: RTK, which compresses shell output, and Aider's RepoMap, which injects a symbol map. Across the 30 repository-by-setting cells TokenEconomizer was cheaper in all 30, by 5.2-40.1%, while RTK alone raised cost in 12 cells and RepoMap in 15.

<Figure
  src="https://media.thesatyajit.com/ai/articles/tokeneconomizer/fig3.png?v=aa90f5ca764f3c15"
  alt="A strip plot of cost change against default for five methods, one dot per repository and setting. RTK and RepoMap scatter around zero, with 12 of 30 and 15 of 30 cells more expensive. TE, TE plus RTK and TE plus RepoMap sit between about minus 5 and minus 50 percent, with 0, 0 and 1 of 30 cells more expensive."
  caption="Cost change in each of the 30 repository-by-setting cells, with the count of cells that got more expensive on the right (TokenEconomizer paper, Figure 5a)."
/>

The savings take a few tasks to arrive. The controller starts each repository with nothing learned, and the first tasks pay for its proposer and judge. Averaged over the two Claude Code settings, every repository except xarray cost more at first, all were cheaper by the sixth task, and they ended 16.9-32.0% cheaper cumulatively.

<Figure
  src="https://media.thesatyajit.com/ai/articles/tokeneconomizer/fig4.png?v=9d3370dd2935a003"
  alt="Cumulative cost change against tasks completed for six repositories. Most lines start above zero, sphinx near plus 40 percent, then drop below zero within the first few tasks and level off between about minus 15 and minus 35 percent by task 20 to 60."
  caption="Cumulative cost change over each repository's task stream, averaged over the two Claude Code settings (TokenEconomizer paper, Figure 5b)."
/>

Three caveats belong next to that table. First, the streams are not user sessions. They are independent SWE-Bench fixes in commit order, each from a fresh checkout. The paper argues this is a conservative test, since a real developer's repository drifts less between sessions. That may be true for facts, but it says nothing about tools, where a real session uses more of them. Second, every arm, including default, ran behind an answer-key guard that blocked GitHub and dropped the web tools. Third, the repository ships the harness and the task ids, not the run logs, so the table can be rerun at the cost of two API bills but not re-read.

<Figure
  src="https://media.thesatyajit.com/ai/articles/tokeneconomizer/fig5.png?v=fa71b016bb920863"
  alt="A scatter of Pass@1 change against cost change for each method in each setting. TokenEconomizer variants cluster at minus 15 to minus 35 percent cost with Pass@1 changes between about minus 1 and plus 3, forming a dashed Pareto frontier. Low and medium effort points sit further left but 2 to 10 points lower. RTK and RepoMap sit near zero cost change."
  caption="Cost against Pass@1 change for every method and setting; TokenEconomizer variants make up the frontier at or above the default pass rate (TokenEconomizer paper, Figure 1b)."
/>

## What was measured is not what you install

Put the sections together and the post's number comes from a different configuration than the one you get by installing the plugin:

| | Paper's measured stack | Plugin defaults |
|---|---|---|
| Micro-skills | on, proposer every 5 tasks | off (`microskills=on` to enable) |
| Tool pruning | per-task LLM judge plus 3 unused tasks; masked `Task`, `AskUserQuestion`, plan mode, `Skill` | evidence only; those tools protected; Copilot built-ins untouched |
| Claude Code version | 2.1.170, 23 loaded schemas | 2.1.300-2.1.310, many tools deferred |
| Loop guard | kill, restart with a fresh conversation, abort on a second verdict | a note in the same conversation, then a message to you; never stops |
| Unit of learning | one benchmark task | one session, one prompt-turn for the guard |

The ablation in Table 2(a) shows how much each part carried on Claude Code with Sonnet 5: micro-skills alone 11.8%, tool pruning alone 13.2%, the guard alone 7.1%, all three 23.6%. On Opus 4.8 the same parts gave 14.3%, 17.7% and 5.4%, for 30.9% together. The default plugin ships the second and third. It ships the second with most of the paper's mask out of reach, and the third without the restart.

None of this makes the work dishonest. The repository is unusually candid. `docs/PLUGIN.md` has a whole table titled "What changes relative to the experimental setting", and its known-limitations section admits what has not been shown. The test suite even pins that the experiments' mask must be earned from observed disuse, never a static prior, because a free prior "shows up only as a suspiciously large cost win." The post dropped all of that.

Line by line, then. "Microsoft just made": a Berkeley-led paper with Microsoft co-authors, released under the `microsoft` GitHub org and announced three weeks ago. "Without touching the agent": it does not modify the agent, but it writes into its settings files and its context. "Works with Pi": installable, but Pi was not in the evaluation, and the plugin prunes nothing there because Pi loads only four tools. "Free money" and "usage limits": the paper measures cache-aware cost in token-price units, not plan quota, and the plugin's judge spends some of that quota.

## What I would do with it

If you run Claude Code or Codex all day in the same few repositories, install it. The hooks are careful, the state stays on your machine, and the cache handling is better thought out than in most harnesses I have read. Turn on `history_import` right after installing, so it learns from your existing Claude Code logs. Use `toolprune=propose` until you trust its lists, and run `/tokeneconomizer:toolprune refresh-catalog` once, or it sees only the tools your sessions used. Then read `te status`, which prices each session from the agent's own usage records. That ledger is the number that counts for you, and it is the only one that measures the plugin as shipped.

Do not expect 18-31%. On Claude Code 2.1.307 the plugin's deny list took 10,241 bytes off a request that Claude Code 2.1.170 sent at 83,481 bytes in my capture and 2.1.307 already sends at 46,004. That saving is real, it hits every turn, and it shrinks as a share of the bill as the conversation grows. The guard cannot reset context. And micro-skills, second only to pruning in the paper's ablation, is off until you turn it on and pay for its proposer. My guess is high single digits on default settings for most people, more with micro-skills on in a repository with real quirks. That is a guess, and the plugin's ledger will tell you whether it is right after a week.

The idea I would keep is the paper's framing more than the plugin. Cost control that learns per repository beats fixed tricks applied everywhere: RTK and RepoMap made two fifths and a half of the cells more expensive. If you maintain an agent harness, the Appendix I(f) number is the one to take away. A sealed task carried roughly 27,000 tokens of tool schemas it never touched, on every turn. Claude Code's move to deferred tools is the harness fixing that itself, and that will save more than any plugin can.

Related reading on this site: [the harness effect](/articles/harness-effect) on orchestration setting the bill, [Codex from the source](/articles/codex-harness-from-the-source), [Claude Code's sandbox](/articles/claude-code-sandbox-internals), [agent harnesses](/articles/agent-harness) and [AutoCompact](/articles/autocompact), which attacks the history half of the same bill.

<Callout type="note">
How I checked: I read the repository at commit `583fff7`, the README, `docs/PLUGIN.md`, `docs/ARCHITECTURE.md`, the tool sets in `toolprune/tools.py` and `plugin/adapter.py`, `pricing.py`, the loop guard and micro-skills packages, and the SWE-Bench adapter and tests under `experiments/`. I read the paper's v1 HTML, including Appendices B to J, and took the numbers in Tables 1, 2 and 6 and Appendix I from it. I ran nothing from the repository. I did run Claude Code 2.1.170 and 2.1.307 on a Linux server against a fake Messages API (no model calls, no key), with no deny list, the paper's 19-tool mask, the plugin's 8-tool list, tool search forced on, and two hooks that answer as the plugin's do; the byte counts and cache-breakpoint positions above come from those captured requests. The per-session formula, the 4.15 and 1.15 multipliers, the token differences and the counts of protected tools are my own arithmetic on those sources. The paper's figures are rendered from its SVGs onto white.
</Callout>
