# headroomlabs-ai/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.

Repository: https://github.com/headroomlabs-ai/headroom
Canonical: https://ross.abutalabs.com/products/headroom
Homepage: https://docs.headroomlabs.ai/docs
Language: Python
License: Apache-2.0
License Family: permissive
Topics: agent, ai, anthropic, compression, context-engineering, context-window, fastapi, langchain, llm, mcp, openai, proxy, python, rag, token-optimization, claude-code, cursor, prompt-engineering, tokens, typescript
Last push: 2026-08-26T18:54:56+00:00

## Health v2 (maintenance only)
Score: 78/100 (v2, computed 2026-09-03T02:39:23.370411+00:00)
- activity 99, release rhythm 87, longevity 17
- inputs: {"age_days": 238, "days_push": 7, "days_rel": 11, "gap_med": 0, "n_releases_24m": 168}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 67706, forks 5227 (observed 2026-08-28T04:12:20.852997+00:00)

## What it is
Headroom is a context compression layer for LLM applications that compresses tool outputs, logs, files, RAG chunks, and images before they reach the model, claiming 60-95% token savings on JSON and 15-20% on coding agent traffic. It ships as a Python/TypeScript library, a local proxy server, and an MCP server, with content-aware compressors including statistical JSON pruning, AST-aware code compression, and ML-routed image compression.

## Use cases
- reduce LLM token costs for AI coding agents like Claude Code or Cursor
- compress large JSON tool outputs before sending to GPT-4o or Claude
- shrink RAG retrieval chunks to fit more context in the window
- compress images sent to vision models to cut token spend
- run a local proxy that transparently compresses OpenAI/Anthropic API traffic
- add token compression middleware to LangChain or Vercel AI SDK apps
- compress log files and command outputs fed to agents

## When to choose
- you spend heavily on LLM tokens from verbose tool outputs, JSON arrays, or RAG chunks
- you want drop-in compression via SDK wrappers, a proxy, or MCP without changing prompts
- you need reversible compression so original content can be recovered
- you use coding agents and want fewer tokens without degrading answer quality

## When to avoid
- your prompts are already small and token cost is not a concern
- you cannot tolerate any risk of compression altering model answers
- you need Windows or Intel macOS first-class support without building Rust extensions
- you require a fully managed cloud service rather than a local-first tool

## Facets
- artifact type: library
- maturity: active
- function: compression, rag, prompt-engineering, mcp, proxy, middleware, sdk, developer-tools
- domain: large-language-models, developer-tools, artificial-intelligence
- platform: python, cli, cross-platform
- tags: token-optimization, context-window, context-compression, llm-cost-reduction, coding-agents, claude-code, cursor, langchain, openai, anthropic, reversible-compression, ast-compression, tree-sitter, smartcrusher, image-token-compression, ai-agents, retrieval-augmented-generation, nodejs, docker, macos, linux

## Member repositories
- headroomlabs-ai/headroom (main) score 78

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:12:20.852997+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T16:16:24.009514+00:00, confidence not recorded.
  - readme: https://github.com/headroomlabs-ai/headroom (fetched 2026-08-28T04:12:20.852997+00:00, sha df737a2e5b2c)
  - homepage: https://docs.headroomlabs.ai/docs (fetched 2026-08-28T17:52:11.526201+00:00, sha 47754cae8ea0)
  - site_page: https://docs.headroomlabs.ai/docs/quickstart (fetched 2026-08-28T17:52:11.534877+00:00, sha 71fcadea3338)
  - site_page: https://docs.headroomlabs.ai/docs/installation (fetched 2026-08-28T17:52:11.536911+00:00, sha cd7e522dc1e2)
  - site_page: https://docs.headroomlabs.ai/docs/docker-install (fetched 2026-08-28T17:52:11.538793+00:00, sha fbb56dc3e013)
  - site_page: https://docs.headroomlabs.ai/docs/persistent-installs (fetched 2026-08-28T17:52:11.540565+00:00, sha fdd550424baf)
  - site_page: https://docs.headroomlabs.ai/docs/how-compression-works (fetched 2026-08-28T17:52:11.542375+00:00, sha 4762d663f059)
  - site_page: https://docs.headroomlabs.ai/docs/smart-crusher (fetched 2026-08-28T17:52:11.544128+00:00, sha c5c5ffee05b3)
  - site_page: https://docs.headroomlabs.ai/docs/code-compression (fetched 2026-08-28T17:52:11.546015+00:00, sha f421bd867a1b)
  - site_page: https://docs.headroomlabs.ai/docs/image-compression (fetched 2026-08-28T17:52:11.547710+00:00, sha 70d9a56547e3)
- Data as of 2026-08-30T08:39:29.467469+00:00.
