headroom
社区使用中by headroomlabs-ai
Headroom 是一个面向 AI Agent 的上下文压缩层,可在内容到达 LLM 之前压缩工具输出、日志、文件、RAG 块及对话历史,在保持答案质量的前提下显著减少 token 消耗(JSON 数据可减少 60-95%,编码 Agent 减少 15-20%)。它以 Python/TypeScript 库、代理服务器、MCP server 及命令行包装器等多种形式提供,支持
安装配置
将以下配置添加到你的 AI 编程助手中
预览配置(粘贴到 claude_desktop_config.json 或 Cursor 设置中)
{
"mcpServers": {
"headroom": {}
}
}启动命令
npm install headroom-ai # TypeScript SDK only — noJSON配置
{}描述
<p align="center"><a href="https://trendshift.io/repositories/20881" target="_blank"><img src="https://trendshift.io/api/badge/repositories/20881" alt="chopratejas%2Fheadroom | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a></p>
Headroom compresses everything your AI agent reads — tool outputs, logs, RAG chunks, files, and conversation history — before it reaches the LLM. Same answers, fraction of the tokens.
<p align="center"> <img src="HeadroomDemo-Fast.gif" alt="Headroom in action" width="820"> <br/><sub>Live: 10,144 → 1,260 tokens — same FATAL found.</sub> </p>What it does
- Library —
compress(messages)in Python or TypeScript, inline in any app - Proxy —
headroom proxy --port 8787, zero code changes, any language - Agent wrap —
headroom wrap claude|codex|grok|copilot|cursor|aider|opencode|cline|continue|goose|openhands|openclaw|vibe|omp|zcodein one command; undo withheadroom unwrap <tool> - MCP server —
headroom_compress,headroom_retrieve,headroom_statsfor any MCP client - Cross-agent memory — shared store across Claude, Codex, Gemini, Grok, auto-dedup
headroom learn— mines failed sessions, writes corrections toCLAUDE.local.md(default, gitignored) orCLAUDE.md/AGENTS.md/GEMINI.md/GROK.md- Output token reduction — trims what the model writes back (not just what you send): drops ceremony/restated code and skips deep "thinking" on routine steps. See Output token reduction.
- Reversible (CCR) — originals are cached for retrieval on demand
How it works (30 seconds)
Your agent / app
(Claude Code, Cursor, Codex, LangChain, Agno, Strands, your own code…)
│ prompts · tool outputs · logs · RAG results · files
▼
┌────────────────────────────────────────────────────┐
│ Headroom (runs locally — your data stays here) │
│ ──────────────────────────────────────────────── │
│ CacheAligner → ContentRouter → CCR │
│ ├─ SmartCrusher (JSON) │
│ ├─ CodeCompressor (AST) │
│ └─ Kompress-v2-base (text, HF) │
│ │
│ Cross-agent memory · headroom learn · MCP │
└────────────────────────────────────────────────────┘
│ compressed prompt + retrieval tool
▼
LLM provider (Anthropic · OpenAI · Bedrock · …)
- ContentRouter — detects content type, selects the ri…
统计信息
66k
星标
5.1k
Fork
Python
语言
2026/8/16
更新
Apache-2.0
开源协议
标签
相关服务器
private-gpt
PrivateGPT 是一个开源 API 层,将本地模型转化为生产级 AI 应用,提供 RAG、工具调用、MCP 连接器、text-to-sql 等能力。它本身不运行模型,而是通过 OpenAI 兼容接口连接 Ollama、vLLM 等推理服务器,并遵循 Claude API 规范,适合构建私有化、本地部署的 AI 产品。
SurfSense
SurfSense 是一款开源的 NotebookLM 替代品,专为 AI agents 设计,提供开放网络研究平台。它通过统一的 REST API 或 MCP server 连接 Reddit、YouTube、Instagram、Google Search 等实时数据源,返回结构化 JSON 数据,并内置知识库、引用检索与自动化报告功能。项目支持自托管,适合需要实时网络数据与
hexstrike-ai
HexStrike AI MCP Agents 是一个基于 MCP 协议的高级网络安全自动化平台,允许 Claude、GPT、Copilot 等 AI 代理自主调用 150+ 安全工具,实现自动化渗透测试、漏洞发现、漏洞赏金和 CTF 挑战。其多智能体架构包含智能决策引擎、12+ 专业 AI Agent 及实时可视化面板,显著提升安全研究的效率与智能化水平。
mcp-toolbox
MCP Toolbox for Databases 是一个开源的 Model Context Protocol (MCP) server,用于将 AI agents、IDE 和应用程序直接连接到企业级数据库。它提供开箱即用的预构建工具(如 list_tables、execute_sql)用于数据探索,同时也是一个自定义工具框架,支持构建安全的生产级 AI 工具,包括结构化查询、