┌─────────────────┬─────────────┬──────────────────────────────┐
│ Data Type │ Compression │ Why │
├─────────────────┼─────────────┼──────────────────────────────┤
│ Server logs │ 90%+ │ Highly repetitive patterns │
├─────────────────┼─────────────┼──────────────────────────────┤
│ MCP tool output │ 70%+ │ JSON structure overhead │
├─────────────────┼─────────────┼──────────────────────────────┤
│ Database rows │ 50-70% │ Same schema, many records │
├─────────────────┼─────────────┼──────────────────────────────┤
│ File trees │ 40-50% │ Repeated metadata │
├─────────────────┼─────────────┼──────────────────────────────┤
│ Code diffs │ 0% │ Every line unique │
├─────────────────┼─────────────┼──────────────────────────────┤
│ Dense prose │ -0.3% │ No patterns, slight overhead │
├─────────────────┼─────────────┼──────────────────────────────┤
│ Encrypted │ 0% │ Incompressible │
└─────────────────┴─────────────┴──────────────────────────────┘ 1. Smart compression - not random truncation. For JSON arrays, we keep errors (100%), statistical anomalies, items matching the user's query (BM25 + embeddings), first/last items. For code, we use tree-sitter AST parsing to preserve imports, signatures, types - output is guaranteed syntactically valid. For logs, we keep errors and state transitions.
2. CCR (Compress-Cache-Retrieve) - everything compressed gets cached locally. We inject a `headroom_retrieve` tool. If the model needs more data, it asks and gets it in <1ms.
The retrieval is what makes aggressive compression safe. In practice, the model almost never retrieves because the smart compression keeps what matters. But when it does need more, it can get it.
Results on my workloads:
- Search results (1000 items): 45k → 4.5k tokens (90%)
- Agent with tools (10 calls): 100k → 15k tokens (85%)
- Overhead: 1-5ms per request As a proxy (zero code changes):
pip install "headroom-ai[proxy]"
headroom proxy --port 8787
ANTHROPIC_BASE_URL=http://localhost:8787 claude
Or wrap your client:
from headroom import HeadroomClient
client = HeadroomClient(OpenAI())
I am the core maintainer of Headroom. Headroom remains OSS and free to use :)
If youre a dev that wants to try it out, use the Github pip install directly.
We are building it for multiple languages, harnesses and models.
Extraheadroom was started by one of the initial users of Headroom to attract a crowd of non devs who would not like to get into pip installs etc. they have attributed Headroom OSS on their webpage - and being OSS, Headroom is in principle available to folks to build on top of it.