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.
Install / Use
npx skills add headroomlabs-ai/headroomInstalls into whichever agent you are using.
CLAUDE.md
Claude Code project instructions
Quality Score
Category
AI & Machine LearningSupported Platforms
Our assessment of headroom
headroom scores 100/100 on our quality scale, 3rd of 965 AI & Machine Learning skills we index (top 1%).
Its CLAUDE.md is 30 KB long, well organised into 24 sections with 21 code examples: a thorough specification that gives an agent plenty to work with.
With 78,922 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated today, so headroom is actively maintained.
- Our last check on 2026-10-17 found the source still online.
- It is released under the Apache-2.0 license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit β read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands (1 minor note below). An AI review of the same text found nothing harmful.
- noteInstalls by piping a downloaded script into a shellline 505
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh && rustup default stable
AI review by kimi-k2.7-code on 2026-09-24. Automated pattern scan on 2026-09-24. It catches known dangerous patterns, not every risk β read a skill before letting an agent act on it.
headroom compared with similar skills
headroom has the highest quality score among these 4 similar skills.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| headroom (this skill)by headroomlabs-ai | 100 | 78.9k | today | CLAUDE.md |
| claude-memby thedotmack | 100 | 113.5k | today | CLAUDE.md |
| taste-skillby Leonxlnx | 100 | 110.6k | today | CLAUDE.md |
| Agent-Reachby Panniantong | 100 | 109.2k | today | CLAUDE.md |
| Understand-Anythingby Egonex-AI | 100 | 90.9k | 10d ago | CLAUDE.md |
Frequently asked questions
- How do I install headroom?
- Run
npx skills add headroomlabs-ai/headroom. The install tabs above show the steps for each supported agent. - Which AI agents does headroom work with?
- It is written for Claude Code and Cursor, as a CLAUDE.md file. Other agents that read the same format can often use it too.
- Is headroom safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands (1 minor note below). An AI review of the same text found nothing harmful. It is Apache-2.0-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is headroom still maintained?
- The repository was last updated today, so headroom is actively maintained.
Skill content
View source on GitHub<a href="https://trendshift.io/repositories/20881" target="_blank"><img src="https://trendshift.io/api/badge/repositories/20881" alt="headroomlabs-ai/headroom | Trendshift β #1 Repository Of The Day" width="250" height="55"/></a>
<p> <a href="https://github.com/headroomlabs-ai/headroom"><img src="https://img.shields.io/github/stars/headroomlabs-ai/headroom?style=flat&color=00F0B5&labelColor=0C1118&label=stars" alt="GitHub stars"></a> <a href="https://github.com/headroomlabs-ai/headroom/actions/workflows/ci.yml"><img src="https://github.com/headroomlabs-ai/headroom/actions/workflows/ci.yml/badge.svg" alt="CI"></a> <a href="https://pypi.org/project/headroom-ai/"><img src="https://img.shields.io/pypi/v/headroom-ai.svg?color=00F0B5&labelColor=0C1118&label=pypi" alt="PyPI"></a> <a href="https://www.npmjs.com/package/headroom-ai"><img src="https://img.shields.io/npm/v/headroom-ai.svg?color=00F0B5&labelColor=0C1118&label=npm" alt="npm"></a> <a href="https://huggingface.co/chopratejas/kompress-v2-base"><img src="https://img.shields.io/badge/model-kompress--v2--base-65D8FF?labelColor=0C1118" alt="Model"></a> <a href="https://docs.headroomlabs.ai/docs"><img src="https://img.shields.io/badge/docs-online-00F0B5?labelColor=0C1118" alt="Docs"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-98A4B3?labelColor=0C1118" alt="License"></a> </p> <p> <b><a href="https://docs.headroomlabs.ai/docs/quickstart">Quickstart</a></b> Β· <a href="#get-started-60-seconds">Install</a> Β· <a href="#proof">Proof</a> Β· <a href="#agent-compatibility">Agents</a> Β· <a href="https://docs.headroomlabs.ai/docs">Docs</a> Β· <a href="https://discord.gg/yRmaUNpsPJ">Discord</a> Β· <a href="llms.txt">llms.txt</a> </p><sub><b>AI agents / LLMs:</b> read <a href="llms.txt"><code>/llms.txt</code></a> here, or fetch <a href="https://docs.headroomlabs.ai/llms.txt">the live index</a> Β· <a href="https://docs.headroomlabs.ai/llms-full.txt">full docs blob</a>.</sub>
</div> <!-- mcp-name: io.github.headroomlabs-ai/headroom -->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.
<div align="center"> <img src="HeadroomDemo-Fast.gif" alt="Headroom compressing a 10,144 token log dump to 1,260 tokens while preserving the FATAL line" width="820"> <br><sub>10,144 β 1,260 tokens. The same <code>FATAL</code> found.</sub> </div>What it does
- Library β
compress(messages)in Python or TypeScript, inline in any app. - Proxy β
headroom proxy --port 8787, zero code changes, any language. - Agent wrap β
headroom wrap claude|codex|grok|copilot|cursor|aider|opencode|cline|continue|goose|openhands|openclaw|vibe|omp|zcodein one command; undo withheadroom unwrap <tool>. - MCP server β
headroom_compress,headroom_retrieve,headroom_statsfor 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 toCLAUDE.local.md(default, gitignored),CLAUDE.md,AGENTS.md,GEMINI.mdorGROK.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_retrievewhen 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 steps like reading a file.
Headroom trims it from the proxy, with no change to your code:
- Verbosity steering appends a short "be terse, don't restate context" note to the end of the system prompt, so your prompt cache still hits.
- Effort routing dials thinking effort down when a turn is only the model resuming after a tool result β a file read, a passing test. New questions and errors keep full effort.
Both apply to Anthropic /v1/messages and to OpenAI-compatible
/v1/chat/completions and /v1/responses. Effort routing uses
reasoning_effort on OpenAI and thinking.budget_tokens / output_config.effort
on Anthropic, with the same clamp-only invariant and the same output_shaper:*
labels on both paths.
export HEADROOM_OUTPUT_SHAPER=1 # off by default
headroom proxy --port 8787
Already running a proxy? These switches are read live on every request, so a proxy that
headroom wrapreused rather than started would not see a value you export afterwards β its environment was snapshotted at launch.headroom wraphot-syncs your current settings to the running proxy over a loopbackPOST /admin/runtime-env, so they take effect with no restart and no dropped requests. On a shared proxy these overrides are global; the last explicit setting wins.
Terseness you didn't have to configure. People rarely state how terse they
want answers β they show it, by interrupting long replies or moving on before
they could have read them. headroom learn --verbosity reads past sessions and
picks the level:
headroom learn --verbosity # dry run β preview what it found
headroom learn --verbosity --apply # save it; the proxy picks it up
Measuring it. Output savings are counterfactual β we never see what the model would have written β so Headroom reports an estimate with a confidence range and labels it as one:
headroom output-savings
# Reduction: 31.7% (95% CI 27.7% β¦ 35.7%) [estimated]
For a measured number instead, hold out 10% of conversations as an unshaped
control: export HEADROOM_OUTPUT_HOLDOUT=0.1. The dashboard's Output Tokens
Saved card then reads measured rather than estimated, with the band.
Agent compatibility
| Agent | headroom wrap | Notes |
|---|:---:|---|
| Claude Code | β
| --memory Β· --code-graph Β· --1m Β· --tool-search |
| Codex | β
| shares memory with Claude |
| Grok CLI | β
| routes via GROK_MODELS_BASE_URL |
| Cursor | Manual setup | starts the proxy and prints base URLs for Cursor settings |
| Aider | β
| starts proxy + launches |
| Copilot CLI | β
| starts proxy + launches |
| VS Code Copilot | β
| transparent proxy; keeps the selected model |
| OpenClaw | β
| installs as a ContextEngine plugin |
| OpenCode | β
| injects config Β· starts proxy + launches |
| Cline | β
| starts proxy + injects config |
| Continue | β
| starts proxy + injects co
Truncated for display β read the full file on GitHub.
Related Skills
claude-mem
113.5kPersistent Context Across Sessions for Every Agent β Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
taste-skill
110.6kAgent skills that give coding agents taste: art direction, reference images and a browser check instead of generic AI pages
Agent-Reach
109.2kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu β one CLI, zero API fees.
Understand-Anything
90.9kGraphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit β see the Safety scan above for what the skill file itself contains.
