// Agent profile
Headroom by Headroom Labs is an open-source context compression tool that sits between your agent's orchestrator and the LLM API. It intercepts outbound context — tool results, file contents, conversation history, RAG chunks — and compresses it using specialized strategies: SmartCrusher for JSON (keeps error items, statistical outliers, first/last boundaries), CodeCompressor for AST-aware code compression across 8 languages (Python, JS/TS, Go, Rust, Java, C/C++, C#, PHP), and Kompress-v2-base (a custom model trained on agentic traces for prose). Available as a Python/Node library, a drop-in proxy (`headroom proxy --port 8787`), an agent wrapper (`headroom wrap <agent>`), or an MCP server. CacheAligner flags volatile content to preserve provider KV-cache prefixes. CCR mode stores originals locally for reversible compression — the model can call `headroom_retrieve` to get the full text on demand. Cross-agent memory shares context across Claude, Codex, Gemini, and Grok. `headroom learn` mines failed sessions and writes corrections to CLAUDE.local.md or AGENTS.md. 77K+ stars, 6K forks. Apache 2.0 licensed.
Headroom compresses everything your AI agent reads — tool outputs, logs, files, RAG chunks, and conversation history — before it reaches the LLM. The tool achieves 20% fewer tokens for coding agents and 60–95% fewer tokens for JSON, while maintaining answer quality as validated on GSM8K (unchanged at 0.870), TruthfulQA (+0.030 within confidence interval), and SQuAD v2 + BFCL (97% accuracy at 19–32% compression). Compression takes under a millisecond (0.21 ms p50 on a 10K-token JSON result) and runs entirely locally.
With 77K+ GitHub stars and 6K forks, Headroom has become the standard context compression layer for the coding agent ecosystem, compatible with 16+ agents out of the box.
Headroom routes content through a ContentRouter that detects the type and applies the right compression strategy. SmartCrusher handles JSON arrays and nested objects with deterministic, schema-preserving compression — keeping error items, statistical outliers, and first/last boundaries. CodeCompressor parses syntax trees for eight languages (Python, JS/TS, Go, Rust, Java, C/C++, C#, PHP). Kompress-v2-base is a custom model trained on agentic traces for prose and documentation.
Live-zone compression compresses only new content (fresh tool output) so the earlier prompt prefix stays byte-identical, maximizing provider KV-cache hits. CacheAligner flags volatile content that would break the cache prefix without rewriting prompts. CCR (reversible compression) caches originals locally — the model can call headroom_retrieve to get the full text when needed.
Cross-agent memory provides one shared store across Claude, Codex, Gemini, and Grok with automatic deduplication. headroom learn mines failed sessions and writes corrections to CLAUDE.local.md or AGENTS.md.
Real-world benchmarks: code search 100 results at 21% token retention, SRE incident debugging at 57%, codebase exploration at 42%, GitHub issue triage at 30%, log dump 10,144 → 1,260 tokens with the FATAL line preserved.
Proxy mode requires zero code changes — headroom proxy --port 8787 and point your agent’s base URL at it. Agent wrap mode: headroom wrap <agent> starts the proxy and launches the agent through it; headroom unwrap reverses it. Supports Claude Code, Codex, Grok CLI, Aider, Copilot CLI, VS Code Copilot, OpenClaw, OpenCode, Cline, Continue, Goose, OpenHands, and more. MCP server exposes headroom_compress, headroom_retrieve, and headroom_stats tools. Library mode provides compress(messages, model=...) for Python and TypeScript. SDK integrations for Anthropic, OpenAI, Vercel AI, LiteLLM, LangChain, Agno, and Strands. Python 3.10+ required, npm package for TypeScript SDK. Apache 2.0 licensed.
Open protocol for connecting AI agents to frontend applications — a universal contract for streaming events, tool calls, and state between agents and UIs.
Rust-based browser automation CLI from Vercel Labs that lets AI agents drive browsers one command at a time via accessibility-tree snapshots.
Rust-based desktop computer-use framework from Vercel Labs — agents control apps via accessibility trees instead of screenshots.