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

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 36 minutes ago
Added to GitGenius on June 5th, 2026
Created on January 7th, 2026
Open Issues & Pull Requests: 610 (-1)
Number of forks: 5,038
Total Stargazers: 65,983 (+6)
Total Subscribers: 193 (+0)

Issue Activity (beta)

Open issues: 336
New in 7 days: 48
Closed in 7 days: 13
Avg open age: 15 days
Stale 30+ days: 156
Stale 90+ days: 0

Recent activity

Opened in 7 days: 32
Closed in 7 days: 10
Comments in 7 days: 16
Events in 7 days: 54

Top labels

  • bug (227)
  • enhancement (110)
  • status: stale (69)
  • good first issue (2)
  • rust (2)
  • documentation (1)

Repository Insights (GitGenius)

Median issue/PR response: 15.9 hours
Mean response time: 4.1 days
90th percentile: 9.2 days
Tracked items: 695

Most active contributors

Sign in to see contributor activity.

How this project is maintained

Around half of the issues opened in the past year never receive a reply. 97% of open issues come from outside the core team, so the backlog reflects real-world use rather than internal planning. Work labelled "status: stale" is answered fastest, typically in about 3 hours, while "enhancement" waits about 32 hours. Almost all tracked open issues have seen activity in the last three months. Only 9% of issues opened in the past year have been closed.

Detailed Description

Headroom is a context compression tool designed to reduce token consumption for AI agents and language models by compressing tool outputs, logs, files, and RAG chunks before they reach the LLM. The repository demonstrates real-world token savings of 60-95% across various workloads while maintaining answer accuracy, making it particularly valuable for cost-sensitive AI applications where context window management is critical.

The project is implemented primarily in Python and offers three deployment modes to accommodate different use cases. As a library, developers can call compress functions directly in Python or TypeScript applications. As a proxy server, it requires zero code changes and works with any language or framework by intercepting requests. As an MCP server, it integrates with any MCP-compatible client through dedicated compression, retrieval, and statistics endpoints. The repository also provides agent wrapping functionality that automatically configures popular AI tools including Claude Code, Cursor, Aider, Cline, Continue, and others with a single command.

The compression architecture relies on several specialized components. ContentRouter automatically detects content types and selects appropriate compressors. SmartCrusher, CodeCompressor, and a custom Kompress-v2-base model handle compression of JSON, abstract syntax trees, and prose respectively. CacheAligner stabilizes prefixes to maximize provider KV cache hits. The reversible compression system (CCR) caches original content locally, allowing the LLM to retrieve uncompressed versions on demand through MCP calls if needed.

Accuracy benchmarks demonstrate that compression preserves model performance, with GSM8K maintaining 0.870 accuracy, TruthfulQA improving to 0.560, and SQuAD v2 achieving 97% accuracy with 19% compression.

Beyond input compression, Headroom addresses output token reduction through verbosity steering and effort routing. Verbosity steering appends terseness guidance to system prompts while preserving prompt cache hits. Effort routing reduces model thinking on routine tasks like file reads while maintaining full effort for novel questions and errors. The headroom learn command mines failed sessions to automatically calibrate verbosity levels based on user behavior patterns.

Installation is available via PyPI for Python 3.10 and above, with optional extras for proxy, MCP, machine learning, code analysis, memory, vector operations, relevance scoring, image processing, and framework integrations. The project is licensed under Apache 2.0 and maintains comprehensive documentation at headroom-docs.vercel.app.

headroom
by
headroomlabs-aiheadroomlabs-ai/headroom

Repository Details

Fetching additional details & charts...