ByteCosts
token-optimizer-mcp-review.mdx

AI Coding Agents

token-optimizer-mcp Review: Hooks, a Proxy, and a Vendor Benchmark Done Right

token-optimizer-mcp (ooples/token-optimizer-mcp) combines pre-execution hooks, a request proxy, an MCP tool server and a per-project knowledge graph to cut what coding agents are billed for. It claims 0.71× the cost of plain Claude Code on SWE-bench Verified and a 91.5% token reduction on Headroom’s own benchmark. Both are vendor-run numbers, but the project is unusually transparent about its losses, which makes its claims more checkable than most.

token-optimizer-mcp is a JavaScript, MIT-licensed optimizer for Claude Code, Codex, Copilot, Gemini and twelve more clients. It combines pre-execution hooks, a request-compression proxy, MCP tools for narrower reads and searches, and a per-project knowledge graph that can surface findings from earlier sessions. As of November 30, 2026 it had 596 stars and 76 forks, 16 open issues, and a v7.11.0 release from November 14, 2026, on a codebase over a year old. Its headline claims are vendor-run, but the README publishes intervals, failed arms and the cases where it lost, which is the right way to read any self-benchmark: this post walks through what the numbers do and do not show.

At a glance

QuestionAnswer
What is it?An optimizer combining hooks, a compression proxy, MCP tools, and a per-project knowledge graph.
What cost does it target?Input from tool results, file reads, and request history, plus repeated work across sessions and subscription quota use.
Where does it act?Hooks run before tools execute, the proxy rewrites requests, and MCP tools offer narrower reads and searches.
How do you try it?Use the Claude Code marketplace plugin or the documented npm package and client configuration.
How do you undo it?Use the plugin or hook uninstaller. The hook uninstaller previews changes before applying them.
What license is stated?MIT.
What is its maturity signal?596 stars and 16 open issues as of November 30, 2026.
When is it a good fit?You use Claude Code and want hooks, request compression, narrower reads, and cross-session memory together.

What it is and which cost layer it targets

The README describes four mechanisms:

  1. Hooks sit in front of the client’s built-in tools on clients with a pre-execution hook API. In the default assist mode they route, retrieve, capture and compress without refusing anything; in enforce mode a large Read, Grep, cat or grep -r is refused outright with a message naming the cheaper call. Re-reading a file already read this session returns only the diff.
  2. The proxy sits between client and provider, compressing request bodies while keeping the cached prefix stable so cache reads stay cheap. The README explicitly prices this tradeoff: providers bill a cached prefix at 0.1× and a rewritten one at 1.25×, so it optimizes the bill, not the byte count.
  3. The MCP server provides smart_read, smart_grep, smart_edit, optimize_text, token_audit and friends: diff-on-reread, bounded search, and an out-of-context store.
  4. The knowledge graph collects findings, decisions and dead ends per project as a side effect of normal work and feeds them back when the agent touches the relevant file. The README’s framing: carrying a finding costs about 150 tokens; re-deriving it costs 5k–50k.

So it touches input tool output, file reads, wire-level history, memory and a fifth layer most competitors ignore: subscription quota. On detected subscription plans it optimizes finished work per unit of quota rather than per dollar, spending leftover 5-hour capacity only while the week is on pace.

Modes are set with TOKEN_OPTIMIZER_MODE: assist (default), enforce, advise and off (hooks and proxy off; MCP tools still work).

Install and first run

On Claude Code, install the plugin rather than the bare MCP server; the hooks do the saving while the server alone only offers tools the model can ignore:

/plugin marketplace add ooples/token-optimizer-mcp
/plugin install token-optimizer@token-optimizer
/reload-plugins

Requirements: Node.js 22.18+ or 24.11+ on the client’s PATH, and Claude Code 2.1.139 or later (the hooks use the exec form; older versions ignore args and silently do nothing). Then verify:

npx token-optimizer-doctor

The doctor feeds a synthetic payload to the real hook and names a fix for each failure. If node cannot start, hooks pass calls through ("onFailure": "continue"), so a broken install costs savings rather than sessions. Other clients run the same server, npx -y @ooples/token-optimizer-mcp@latest, with per-client configs in docs/INSTALLATION.md and src/integrations/. Ten clients get the enforcing tier (hooks can veto); Roo Code, Zed, Amp, Continue, Crush and Droid get always-on routing rules because they have no veto API.

Removal: /plugin uninstall token-optimizer@token-optimizer, or npx token-optimizer-uninstall for hook installs, which prints the plan and changes nothing until --apply, removing only files that still match what it wrote. Releases ship with npm provenance plus CHECKSUMS.sha256, so npm audit signatures ties a package to its CI run.

What it saves: reading a vendor-run head-to-head

This is the interesting part, because the README is a case study in how a vendor benchmark should disclose itself. The headline claims:

  • SWE-bench Verified: default assist mode at 0.705× the cost of plain Claude Code (confidence interval 0.63–0.80), 10 instances per arm, 7 of 10 resolved in each arm. A learned-cost-control variant after a hoist fix: 0.634× (0.54–0.74), 14 of 15 resolved in each arm. The off mode lands at 0.999× (0.83–1.20), which is what it should do. Across nine runs, 84 tasks resolved without the plugin and 83 with it.
  • Against Headroom on Headroom’s own benchmark (18 workloads): the proxy removes 91.5% of tokens versus Headroom’s 61.4%, costing less on 18 of 18 workloads when moved-out content is never read back, and 17 of 18 when all of it is.
  • Installed proxy versus Headroom’s proxy, 120 Codex task pairs: $22.26 estimated cost versus $30.43, 119/120 versus 120/120 passed: 26.9% cheaper, 30.1% faster on average.
  • Campaign with tokenjuice, Tokenade, and claude-token-optimizer: across 1,050 vendor runs, the optimizer reported costs per finished task 33.6%, 32.0%, and 33.6% below plain Claude Code in those comparison rows, respectively.

Now the disclosures, all in the same README:

  • Without the proxy, its compressor removes fewer tokens than Headroom on 9 of 18 workloads; on agentic-conversation it loses outright, 30.8% versus 33.4%. The 91.5% figure counts content moved out of the request that the agent may need to fetch back.
  • On one small Claude Code task the result is a tie: 49,053 versus 48,626 weighted input (input + 1.25 × cache writes + 0.1 × cache reads), 0.9% worse.
  • It cost more on 30 of the 120 Codex pairs and crashed once where Headroom passed every task.
  • The Tokenade arm used its rules text only. The campaign did not run the full Tokenade product.
  • claude-token-optimizer’s hooks do nothing on Claude Code 2.1.251 as shipped (they read a CLAUDE_TOOL_NAME variable Claude Code does not set); the row uses a one-line patch so the comparison is fair.
  • On one 342 KB-file task its hooks took about 6 minutes per run versus 0.3 for plain Claude Code, at no extra token cost.
  • In the four-product run, most of the saving came from the rules file; the hooks added no measurable saving on top.
  • The campaign had no bias-control task, so a task set that happens to favor it cannot be ruled out.

The vendor ran all these comparisons. The SWE-bench Verified arms use 10 or 15 instances. The Headroom fixture comparison and installed-proxy trial use separate workloads and sample sizes. The 0.63× to 0.80× interval describes the vendor’s default SWE-bench configuration on its task sample. Keep the three denominators in view when comparing headlines. The fixture table measures how much text remains in a request. The installed-proxy comparison estimates costs on completed Codex task pairs. The SWE-bench comparison reports task costs against plain Claude Code. Measure both completed work and usage when you try the tool on your own tasks.

Prompt-cache and extra-turn risk

Two failure surfaces to watch. The proxy rewrites request bodies, and the project itself notes that a cached prefix bills at 0.1× while a rewritten one bills at 1.25× at write time, so the design keeps the prefix stable by intent; verify in your own runs that cache-read share does not collapse. The hooks add a second risk class: a refused or rerouted call can send the agent on a longer path, and the README’s own data (6 minutes versus 0.3 on the 342 KB task) shows the latency side of that tradeoff. In assist mode nothing is refused, which lowers risk but caps savings; enforce raises both.

What the GitHub issues show

Sixteen open issues, and the closed list contains the usual honest-engineering artifacts plus two worth reading before installing:

  • Issue #454: an SSRF in smart_api_fetch: unvalidated url argument plus unguarded redirect: follow (CWE-918). Closed, but worth noting because the tool fetches URLs.
  • Issue #449: the postinstall once silently wrote hooks into the real global ~/.claude/settings.json with no opt-in step. Closed.
  • Issue #473: subagents and workflows got almost no savings because shell reads bypassed substitution. Closed, and a reminder that savings claims may not extend to delegated work.
  • Issue #478: outlines never reached large files in the default assist mode; “long sessions priced as ending.” Closed.
  • Issue #615: Codex learned pruning disables connected apps in trusted projects. Open as of November 30, 2026.
  • Issue #357: the benchmark harness and competitive program to rank first on measured session cost. Open.

The dashboard and telemetry

The local dashboard reads a ledger of verified savings, excluded reports, per-agent attribution, hook health and the knowledge graph. It prices usage with the exact provider, model and rate tier it captured and marks ambiguous models “Not priced” rather than guessing; modeled savings are kept apart from measured ones. Telemetry requires two opt-ins (TOKEN_OPTIMIZER_TELEMETRY=1 counts into a local file; TOKEN_OPTIMIZER_BEACON=1 uploads it), events can hold only numbers and flags so strings are dropped before writing, and DO_NOT_TRACK=1 overrides everything.

A cost example (estimate)

For an input-only estimate, assume 30 million fresh Sonnet input tokens at $2 per million, or $60 per month. If your measured fresh-input spend ratio were 0.705×, estimated savings would be $60 × (1 − 0.705) = $17.70 per month. The vendor measured that ratio for task cost on its 10-instance SWE-bench arm. See the AI provider pricing index for current rates.

Who should use it, who should skip it

Try it if you:

  • Use Claude Code (the enforcing tier plus the plugin) and want the widest mechanism coverage: hooks, proxy, tools and cross-session memory in one install
  • Are on a subscription and care about quota pacing, a feature none of the other tools here offer
  • Value a project that keeps modeled and measured savings separate on its own dashboard

Skip it if you:

  • Need independently verified numbers; none exist yet
  • Cannot run a proxy or grant pre-execution hooks (locked-down environments)
  • Are on a rules-tier client (Roo Code, Zed, Amp, Continue, Crush, Droid), where the savings surface is thinnest

How to trial it safely

  1. Install the plugin, run npx token-optimizer-doctor, and confirm hooks actually fire (older Claude Code versions silently no-op).
  2. Stay in assist mode for a week; enforce only after you trust the routing.
  3. Compare provider-billed totals and resolved-task throughput against a baseline week, per how to measure coding agent token savings. Check the dashboard’s measured tier, not the modeled one.
  4. Watch cache-read share in your provider billing to confirm the proxy kept the prefix stable.
  5. If you test enforce, watch wall-clock time on large-file tasks, since the README’s own data shows a worst case of 6 minutes versus 0.3.

Alternatives and next reads

Sources

How this note was produced

Drafted with AI assistance from committed ByteCosts pricing snapshots and deterministic cost formulas. Figures are grounded in the linked sources (last updated 2026-11-30). Read our editorial & automation policy, inspect the methodology, or report a discrepancy.

token-optimizer-mcp Review: Hooks, a Proxy, and a Vendor Benchmark Done Right. ByteCosts. Updated 2026-11-30. https://bytecosts.com/blog/token-optimizer-mcp-review/

Sources