Markdown version of https://extraheadroom.com/best-claude-code-token-saving-tools

# The best Claude Code token-saving tools (November 2026)

Every Claude Code session spends tokens in four places: the files the agent reads, the tool output it collects, the code it writes back, and the model it runs on. These are the tools worth installing for each, plus the built-in commands that cost nothing. We make Headroom, so weigh that entry accordingly. Every figure from another maker is labelled as that maker's claim.

## Quick answer

Start with the free built-ins: `/clear` between unrelated tasks, `/context` to see what fills the window, and a smaller model for subagents. Then add one input-side compressor (Headroom or Caveman, not both), Ponytail for the code the agent writes, and Serena or Codebase Memory if most of your context goes to reading a large codebase. ccusage tells you whether any of it worked.

## At a glance

| Tool | What it cuts | Price | License |
| --- | --- | --- | --- |
| Headroom | Tool output, logs and history before they reach the model | App: paid, 7-day free trial. CLI: free | Apache-2.0 engine |
| Caveman | Agent context (proxy) and reply length (skill) | Free | Apache-2.0 |
| context-mode | Large tool output, kept out of the window | Free plugin, paid hosted gateway | Elastic-2.0 (source-available) |
| Ponytail | The code the agent writes | Free | MIT |
| Serena | Whole-file reads | Free | GPL-3.0 |
| Codebase Memory | File-by-file exploration | Free | MIT |
| vexp | The code the agent reads | Free tier, Pro $19 a month | Proprietary |
| MarkItDown | PDFs and Office files | Free | MIT |
| Context7 | Retries caused by outdated library APIs | Free tier, Pro $10 a seat a month | MIT (MCP server) |
| claude-code-router | Model choice | Free | MIT |
| ccusage | Nothing: it measures | Free | MIT |

## Compress what the agent sends

Most of a long session's input is not your prompt. It is test runs, build logs, search results and earlier turns, re-sent on every request. A local proxy compresses that before it leaves your machine. Pick one: two proxies on the same request fight over the same tokens.

### 1. Headroom: a finished app for Claude Code and ChatGPT Codex

[Headroom](/) is a menu bar app for macOS, Windows and Linux that routes Claude Code and ChatGPT Codex through a local proxy. It compresses tool output, logs and history by content type and keeps the originals retrievable, so the model can ask for anything it needs back. It sets itself up, updates itself and shows what it saved per session. It also installs most of the tools below as one-click add-ons. Across 183 Claude Code users in one week, it removed 34% of input tokens ([our production data](/blog/claude-code-savings-real-usage)). The engine is the free, Apache-2.0 [Headroom CLI](/headroom-desktop-vs-cli); the app is paid after a 7-day trial with no credit card.

### 2. Caveman: an open-source toolkit for many agents

[Caveman](https://github.com/JuliusBrussee/caveman) started as a skill that makes the agent reply in fewer words. Version 4 added a local proxy and engine, which makes it Headroom's closest open-source counterpart. It covers more agents (Gemini CLI and Aider among them) and more experimental features, and you assemble and update it yourself. It is free and Apache-2.0; install it with `npx @caveman-ai/cli@latest`. Maker's claim: 33.2% fewer input tokens, over 54 runs in August 2026. See the [Headroom vs Caveman comparison](/headroom-vs-caveman) for both sides.

### 3. context-mode: keep big tool output out of the window

[context-mode](https://github.com/mksglu/context-mode) works through hooks rather than a proxy. It runs large tool output in a local sandbox, indexes it, and hands the agent only the parts it asks for. It works with Claude Code, Codex, Gemini CLI, OpenCode and more. The plugin is free and source-available under the Elastic License 2.0, which is not an open-source license. Maker's claim: 99.4% of output bytes saved, counted on runs with more than 10 KB of output. It overlaps with a compressor on tool output, so measure before running both.

## Write less code

### 4. Ponytail: the least code that works

[Ponytail](https://github.com/DietrichGebert/ponytail) is a free skill that makes the agent ship the smallest change that solves the task. Output tokens cost five times as much as input on Claude's list prices, and less code is also less to re-read and edit later. It works in Claude Code, Codex and OpenCode. Maker's claim: 45% fewer tokens and 26% lower cost, across 39 tasks run 5 times each with and without it. Install it with `/plugin marketplace add DietrichGebert/ponytail`, then `/plugin install ponytail@ponytail`. The [Ponytail guide](/ponytail-claude-code) covers the levels and commands.

## Read less of the codebase

On a large repository the agent can spend most of its context finding the code it needs. These tools let it look things up instead of reading file after file.

### 5. Serena: read one symbol, not the whole file

[Serena](https://github.com/oraios/serena) gives the agent language-server tools: find a function, its references, or one class, and read only that. It is free, GPL-3.0 since September 2026, and works with Claude Code, Codex, OpenCode and Cursor. Install it with `uv tool install -p 3.13 serena-agent`, then `serena setup claude-code`. Its maker publishes no savings figure.

### 6. Codebase Memory: a code graph the agent queries

[Codebase Memory](https://github.com/DeusData/codebase-memory-mcp) indexes your repository into a local graph once and answers the agent's questions from it through MCP tools. It is free, MIT-licensed, and detects Claude Code, Codex, OpenCode and Cursor on install. Maker's claim: 10x lower token use and 2.1x fewer tool calls than file-by-file exploration, from a 31-repository study.

### 7. vexp: a paid context engine

[vexp](https://vexp.dev) builds a local index of your code and hands the agent a token-budgeted bundle of the parts that matter. It is proprietary, with a free tier capped at 20 calls a day and a Pro plan at $19 a month. Maker's claim: 65% fewer input tokens, on 7 tasks in one FastAPI codebase. It stacks with an input-side compressor; the [Headroom vs vexp page](/headroom-vs-vexp) explains how.

## Read documents and docs efficiently

### 8. MarkItDown: documents as Markdown

[MarkItDown](https://github.com/microsoft/markitdown), from Microsoft, converts PDF, Word, PowerPoint and Excel files to Markdown before the agent reads them, so it gets the text without the file format around it. It is free and MIT-licensed. Install it with `pip install 'markitdown[all]'`; `markitdown-mcp` exposes it to any MCP client.

### 9. Context7: current library docs

[Context7](https://github.com/upstash/context7) pulls version-specific library documentation into the session. It adds tokens rather than removing them. It earns them back when the agent would otherwise write code against an outdated API and spend several turns fixing it. The free tier gives 1,000 calls a month, then 20 a day; Pro is $10 a seat a month.

## Route and measure

### 10. claude-code-router: pick the model per request

[claude-code-router](https://github.com/musistudio/claude-code-router) is a free local gateway that sends Claude Code's requests to the providers and models you choose, for example a cheaper model for background tasks. It changes which model you pay for rather than how many tokens you send. Install it with `npm install -g @musistudio/claude-code-router`.

### 11. ccusage: see where the tokens went

[ccusage](https://github.com/ccusage/ccusage) reads Claude Code's local logs and reports tokens and cost by day or by session. It saves nothing on its own, but it is how you check that the tools above did. Run `npx ccusage@latest`; it reads Codex and OpenCode logs too.

## Built into Claude Code, and free

Claude Code's [cost docs](https://code.claude.com/docs/en/costs) put the average at about $13 per developer per active day. These settings lower it before you install anything:

- **Clear between tasks.** `/clear` costs nothing and drops everything the next task does not need. `/compact` keeps a summary, but the summary is itself a large request, so tell it what to keep.
- **Look before you trim.** `/context` shows what fills the window, with suggestions. `/usage` (formerly `/cost`) shows what used your plan.
- **Use a smaller model where it is enough.** `/model` and `/effort` set the main session. Give a subagent `model: haiku`, or set `CLAUDE_CODE_SUBAGENT_MODEL` for all of them.
- **Keep CLAUDE.md short.** It loads on every session. The docs suggest under 200 lines, with workflow detail moved into skills that load only when used.
- **Block files with deny rules.** A `.claudeignore` file has no effect. To keep the agent out of build output, add a rule such as `"permissions": { "deny": ["Read(./dist/**)"] }` to your settings.
- **Filter tool output with hooks.** A hook can trim a command's output before Claude sees it.

The [guide to reducing Claude Code costs](/reduce-claude-code-costs) walks through each of these levers in order.

## How to combine them

The tools in different sections stack, because they cut different tokens. A typical setup is one compressor, Ponytail, one code-lookup tool and ccusage. Two tools from the same section mostly overlap: two compressors fight over the same request, and Serena, Codebase Memory and vexp all answer the same question. Headroom installs Ponytail, Serena, Codebase Memory, MarkItDown, Context7 and Caveman's skill from its Add-ons screen, so you can try them without setting each one up.

## How we checked

Prices, licenses, install commands and supported agents come from each project's own repository or site, checked on November 5, 2026. Savings figures are the makers' own and are measured on different tasks, so they do not compare with each other. The figure that counts is your own: run a task you already do with and without a tool, and compare in ccusage or Headroom's activity view.
