← All repos

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.

agentaianthropicclaude-codecompressioncontext-engineeringcontext-windowcursorfastapilangchainllmmcpopenaiprompt-engineeringproxypythonragtoken-optimizationtokenstypescript
Browse cluster: Claude AI Agent Frameworks & MCP Tools
2,558commits
261contributors
13languages

Tech stack & purpose

Headroom is a token optimization library and proxy for large language model applications that compresses tool outputs, logs, files, and retrieval-augmented generation chunks before they reach the LLM, reducing token consumption by 20% for coding agents and 60–95% for JSON while maintaining answer quality. Built in Python and TypeScript, it provides multiple deployment patterns including a library, HTTP proxy, and Model Context Protocol server, with integrations for LangChain, OpenAI, Anthropic Claude, AWS Bedrock, and other LLM platforms. The project includes a Rust-based compression core (`headroom-core`) using trait-based detectors for content classification, a comprehensive evaluation framework benchmarked against standard datasets like GSM8K and SQuAD v2, and deployment templates for macOS LaunchAgent integration.

Community & reference links

Languages

Python
79.7%
Rust
14.0%
JavaScript
2.4%
TypeScript
2.0%
HTML
1.0%
Shell
0.4%
PowerShell
0.3%
Dockerfile
0.1%
PLpgSQL
0.1%
C
0.0%
Makefile
0.0%
CSS
0.0%
HCL
0.0%

Contributors (top 30 of 261)