headroom is a free, open source ai development platforms project written in Python and released under Apache-2.0. It has 72,745 GitHub stars, 5,589 forks and 643 open issues, and was last pushed 6 hours ago. On this registry it ranks #10 of 61 tracked projects in AI Development Platforms, with 5 head-to-head comparisons available. It gained 426 stars over the last 3 tracked days.

What is headroom?

Headroom is an Apache-2.0 Python library, local proxy, agent wrapper and MCP server that compresses tool outputs, logs, files, RAG chunks and conversation history before they reach an LLM, and it is built for developers running AI coding agents or LLM applications who want to cut token usage without changing the answers they get.

What it is

Headroom sits between an agent or application and an LLM provider. It ships as a Python package and a TypeScript SDK, a CLI, a drop-in HTTP proxy, and an MCP server. Its compression pipeline runs entirely on the local machine, and the README states that no prompt or file content is sent anywhere to be compressed. The pipeline chains CacheAligner, ContentRouter and CCR, with three content-type-specific compressors underneath: SmartCrusher for JSON, CodeCompressor for source code using an AST, and Kompress-v2-base, a text model published on Hugging Face. Originals are cached locally so the model can call headroom_retrieve when it needs the full text. Headroom lives in the Python AI and LLM tooling ecosystem, alongside the frameworks it plugs into: LangChain, Agno, Strands, FastAPI, and MCP clients, with agent integrations for Claude Code, Cursor, Codex, Copilot, Aider and others.

The concrete problem it solves is token cost and context-window pressure from raw, verbose input. Agents read tool outputs, logs, RAG chunks, files and history, and most of that text is noise that still gets billed and still occupies the window. Headroom replaces sending that raw material straight into the prompt. Its README illustrates the effect with a single example, 10,144 tokens reduced to 1,260 with the same FATAL line found. ContentRouter detects content type and picks a compressor per type, and CacheAligner flags volatile content that would otherwise bust a provider KV-cache prefix without rewriting the prompt itself.

Key capabilities

  • Inline compression through compress(messages) in Python or TypeScript, returning result.messages, result.tokens_saved and result.compression_ratio.
  • A drop-in proxy started with headroom proxy --port 8787, requiring zero code changes and working with any language.
  • One-command agent wrapping through headroom wrap claude|codex|grok|copilot|cursor|aider|opencode|cline|continue|goose|openhands, reversible with headroom unwrap.
  • An MCP server exposing headroom_compress, headroom_retrieve and headroom_stats to any MCP client.
  • Reversible compression (CCR) that caches originals locally so the model can retrieve full text on demand.
  • Type-aware compressors: SmartCrusher for JSON, CodeCompressor for source code via AST, and Kompress-v2-base for prose.
  • Cross-agent memory with one shared store across Claude, Codex, Gemini and Grok with automatic dedup, plus headroom learn, which mines failed sessions and writes corrections to CLAUDE.local.md, CLAUDE.md, AGENTS.md, GEMINI.md or GROK.md.

Who uses it and how

  • Developers running coding agents such as Claude Code, Cursor, Codex or Aider wrap a session so the setup runs, routing that agent through Headroom.
  • Teams with polyglot or legacy stacks put the proxy on port 8787 in front of their LLM traffic rather than touching application code.
  • RAG and application builders import compress directly inside LangChain, Agno, Strands or their own Python and TypeScript code.
  • MCP clients call the three exposed tools to compress, retrieve originals and check savings statistics.
  • Multi-agent setups share one memory store across Claude, Codex, Gemini and Grok with dedup, and use headroom learn to feed corrections back into repository instruction files.

Getting started

Install the CLI and full feature set with uv tool install --python 3.13 "headroom-ai[all]" or pip install "headroom-ai[all]", then run headroom deploy for a turnkey local deployment with agent configuration, headroom wrap claude to wrap an agent, or headroom proxy --port 8787 for the proxy mode. The TypeScript SDK alone installs as npm install headroom-ai, and headroom doctor confirms that routing works.

How it compares

The facts provided name no competing paid products that Headroom replaces, and they name no directly equivalent compression layer either; the tools listed are integration targets, such as LangChain, Agno, Strands, Claude Code and Cursor, rather than substitutes. Among those, Headroom occupies a distinct position as the local compression and retrieval layer that sits underneath them, and on this registry it stands alone.

When to use it — and when not to

Part of the trade-off is operational: the dashboard needs the proxy running, and wrapped sessions must be launched each time for the setup to take effect, which adds a step to daily agent use. The headroom CLI ships only in the PyPI package, so a TypeScript user installing headroom-ai from npm gets the SDK without the CLI, and the repository carries 643 open issues, so expect an actively moving project. Anyone who cannot run a local process alongside their agent, or who needs the full original text in every prompt, should not pick it.

project readme (upstream, from github) — read inline

headroomlabs-ai/headroom | Trendshift — #1 Repository Of The Day

GitHub stars CI PyPI npm Model Docs License

Quickstart · Install · Proof · Agents · Docs · Discord · llms.txt

AI agents / LLMs: read /llms.txt here, or fetch the live index · full docs blob.

Headroom compresses everything your AI agent reads — tool outputs, logs, RAG chunks, files, and conversation history — before it reaches the LLM. Same answers, fraction of the tokens. Compression runs on your machine; no prompt or file content is sent anywhere to be compressed.


10,144 → 1,260 tokens. The same FATAL found.

What it does

  • Librarycompress(messages) in Python or TypeScript, inline in any app.
  • Proxyheadroom proxy --port 8787, zero code changes, any language.
  • Agent wrapheadroom wrap claude|codex|grok|copilot|cursor|aider|opencode|cline|continue|goose|openhands|openclaw|vibe|omp|zcode in one command; undo with headroom unwrap .
  • MCP serverheadroom_compress, headroom_retrieve, headroom_stats for any MCP client.
  • Cross-agent memory — one shared store across Claude, Codex, Gemini and Grok, with automatic dedup.
  • headroom learn — mines failed sessions and writes corrections to CLAUDE.local.md (default, gitignored), CLAUDE.md, AGENTS.md, GEMINI.md or GROK.md.
  • Output token reduction — trims what the model writes back, not only what you send. See below.
  • Reversible (CCR) — originals are cached locally and retrieved on demand.

How it works

 Your agent / app
   (Claude Code, Cursor, Codex, LangChain, Agno, Strands, your own code…)
        │   prompts · tool outputs · logs · RAG results · files
        ▼
    ┌────────────────────────────────────────────────────┐
    │  Headroom   (runs locally — your data stays here)  │
    │  ────────────────────────────────────────────────  │
    │  CacheAligner  →  ContentRouter  →  CCR            │
    │                    ├─ SmartCrusher   (JSON)        │
    │                    ├─ CodeCompressor (AST)         │
    │                    └─ Kompress-v2-base (text, HF)  │
    │                                                    │
    │  Cross-agent memory  ·  headroom learn  ·  MCP     │
    └────────────────────────────────────────────────────┘
        │   compressed prompt  +  retrieval tool
        ▼
 LLM provider  (Anthropic · OpenAI · Bedrock · …)
  • ContentRouter detects the content type and selects a compressor for it.
  • SmartCrusher / CodeCompressor / Kompress-v2-base handle JSON, source code and prose respectively.
  • CacheAligner flags volatile content that would bust a provider KV-cache prefix. It never rewrites prompts.
  • CCR stores originals locally so the model can call headroom_retrieve when it needs the full text.

Architecture · CCR · Kompress-v2-base model card

Get started (60 seconds)

# 1 — Install
uv tool install --python 3.13 "headroom-ai[all]"  # CLI in a self-contained env
pip install "headroom-ai[all]"                    # Python — ships the `headroom` CLI
npm install headroom-ai                           # TypeScript SDK only — no CLI

# 2 — Pick a mode
headroom deploy                         # turnkey local deployment + agent config
headroom wrap claude                    # wrap a coding agent
headroom proxy --port 8787              # drop-in proxy, zero code changes
# or: from headroom import compress     # inline library

# 3 — Check it and watch the savings
headroom doctor                         # health check — confirms routing works
headroom perf
headroom dashboard                      # live savings (proxy must be running)

Inline, in Python:

from headroom import compress
from openai import OpenAI

messages = [{"role": "user", "content": "Analyze these results"}]
result = compress(messages, model="gpt-4o")

client = OpenAI()
response = client.chat.completions.create(model="gpt-4o", messages=result.messages)
print(f"Saved {result.tokens_saved} tokens ({result.compression_ratio:.0%})")

Launch a wrapped agent session each time, so the setup runs. headroom wrap starts a local proxy, installs Serena for semantic code navigation, and launches the agent configured to route through Headroom. Serena is registered at user scope (for Claude Code, in ~/.claude.json), so it stays available in your other projects until you run headroom unwrap. Skip it with --code-memory none.

The headroom CLI ships only in the PyPI package. The npm headroom-ai package is the TypeScript SDK — a library you import (import { compress } from 'headroom-ai') — and provides no headroom command.

Proof

Four scenarios built from real MCP server output formats, measured with the provider tokenizer and the shipped compress(). Seeded and offline, so you get the same numbers we did:

uv run python benchmarks/index_proof_table.py --seed 20260902
Scenario Before After Saved
Code search (100 results) 17,199 13,597 21%
SRE incident debugging 55,957 24,340 57%
Codebase exploration 58,801 33,895 42%
GitHub issue triage 46,067 32,429 30%

Savings scale with how repetitive the payload is. Repeated JSON arrays and log lines clear 90% in benchmarks/bench_latency.py; prose and already-dense output compress very little. Run headroom savings against your own traffic for the number that applies to you.

Compression costs well under a millisecond — 0.21 ms p50 on a 10K-token JSON search result, 1.4 ms at 100K tokens — so it does not show up in agent latency.

Accuracy. python -m headroom.evals suite --tier 1:

Benchmark Category N Baseline Headroom Delta
GSM8K Math 100 0.870 0.870 ±0.000
TruthfulQA Factual 100 0.530 0.560 +0.030
SQuAD v2 QA 100 97% at 19% compression
BFCL Tools 100 97% at 32% compression

At N=100 a delta of ±0.03 falls inside the confidence interval, so TruthfulQA shows no detectable difference rather than an improvement. Methodology →

Output token reduction

Everything above shrinks the prompt you send. You also pay for every token the model writes back, and on Opus-class models output costs 5× input. Much of that output is ceremony: "Great, let me…" preambles, code re-printed straight back at you, and deep reasoning spent on routine step

readme truncated — read the full docs on github

Frequently asked questions

Is headroom free to use?

headroom is open source under the Apache-2.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does headroom do?

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. Li

What is headroom written in?

headroom is primarily written in Python. Its source is publicly available at https://github.com/headroomlabs-ai/headroom, and it has 72,745 GitHub stars.