headroomlabs-ai/headroom
headroom
Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
GitHub metrics
- Stars
- 75K
- +810 this week
- Forks
- 5.8K
- 30-day growth
- —
- Open issues
- 211
| Day | GitHub stars |
|---|---|
| 2026-10-04 | 74357 |
| 2026-10-10 | 74880 |
| 2026-10-13 | 75167 |
What it does
Headroom is a Python and TypeScript tool that shrinks the text an AI agent sends to a model (tool output, logs, files, RAG chunks and chat history) so each request uses fewer tokens. The compression runs on your own machine.
You can use it in four ways: a compress() library for Python and TypeScript, a local proxy you point an app at, a headroom wrap command that starts coding agents such as Claude Code, Codex or Aider through that proxy, or an MCP server. A router looks at each piece of content and picks a compressor: one for JSON, one for source code, and a small Hugging Face model called Kompress-v2-base for prose. Originals stay in a local cache, and the model can call a retrieve tool when the short version is not enough.
The project publishes its own offline benchmark of four MCP-style scenarios, with savings from 21% to 57%. The README also describes steering the model toward shorter replies and labels that saving as an estimate. The latest release is v0.39.1, from September 2026.
Why it matters
Agents spend much of their context window on bulky tool results and logs that the model only skims. Headroom compresses that material before it is sent, picks a different method for JSON, code and prose, and keeps the originals so nothing is lost for good. It drops into existing setups as a proxy or a one-command agent wrapper, so you do not have to change application code to try it.
Main features
- `compress()` library for Python, plus a TypeScript SDK
- Local proxy started with `headroom proxy --port 8787`
- `headroom wrap` launches a supported coding agent through the proxy; `headroom unwrap` reverts it
- MCP server with compress, retrieve and stats tools
- Separate compressors for JSON, source code and prose
- Local cache of originals that the model can retrieve on demand
- `headroom learn` writes corrections from failed sessions into agent instruction files
- `headroom doctor` health check and a live savings dashboard
Who it's for
- Developers running coding agents such as Claude Code, Codex or Aider who hit context or token limits
- Teams building LLM apps with large tool outputs, logs or RAG results
- Python or TypeScript developers who want to call compression inline before an API request
Strengths
- Compression happens locally; the README says prompt and file content is not sent elsewhere to be compressed
- Several entry points (library, proxy, agent wrapper, MCP server) cover most setups
- Originals are kept, so the model can fetch the full text when needed
- Apache 2.0 licence and frequent releases (15 in the last 90 days)
Limitations
- Anonymous telemetry is on by default; turn it off with `HEADROOM_BEACON=off`, `DO_NOT_TRACK=1` or `--offline`
- The README says short exchanges, prose and already dense content see little or no reduction
- `headroom wrap` also installs the Serena MCP server unless you pass `--code-memory none`
- The npm package has no CLI, and the TypeScript SDK depends on the Python proxy running
Getting started
The Python package includes the headroom command; the npm package is only the TypeScript SDK and talks to a running Headroom proxy. A Docker image is also published.
uv tool install --python 3.13 "headroom-ai[all]"
pip install "headroom-ai[all]"
npm install headroom-ai
docker pull ghcr.io/headroomlabs-ai/headroom:latest
Requirements: Python 3.10 or newer (the uv install pins 3.13); the TypeScript SDK needs a running Headroom proxy; an account with your own LLM provider.
Always follow the official instructions in the README on GitHub. This overview is our summary, not a copy.
Sources
- headroomlabs-ai/headroomRepositoryPrimarygithub.com
- Introduction | HeadroomOfficial sitePrimarydocs.headroomlabs.ai
- docs.headroomlabs.ai/docs/quickstartOfficial docsPrimary