headroom
The Context Optimization Layer for LLM Applications. Compresses tool outputs that are 70-95% redundant boilerplate, dramatically reducing token usage while preserving accuracy. Use when you need to optimize LLM context, reduce token costs, or compress long outputs before sending to LLMs.
- License 许可
- MIT
- 最近更新
- 2026-09-28
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- headroom
- metadata
- { "openclaw": { "emoji": "🧠", "requires": { "env": [], "binaries": [ "python3" ] }, "user-invocable": true } }
- description
- The Context Optimization Layer for LLM Applications. Compresses tool outputs that are 70-95% redundant boilerplate, dramatically reducing token usage while preserving accuracy. Use when you need to optimize LLM context, reduce token costs, or compress long outputs before sending to LLMs.
03 SKILL.md 正文
Headroom - Context Optimization Layer
Primary purpose: Compress LLM context to reduce token usage by 70-95% while preserving accuracy. Headroom intelligently compresses tool outputs, JSON, code, and text using various compression techniques.
Activation
- Trigger when user wants to reduce token usage in LLM conversations
- Use for compressing long tool outputs, JSON responses, code files
- Use when context window is approaching limits
- Use for cost optimization when working with expensive LLMs
Features
| Feature | Description |
|---|---|
| Content Router | Auto-detects content type, routes to optimal compressor |
| SmartCrusher | Universal JSON compression for arrays, objects, nested data |
| CodeCompressor | AST-aware compression for Python, JS, Go, Rust, Java, C++ |
| LLMLingua-2 | ML-based 20x text compression |
| CCR | Reversible compression - LLM retrieves originals when needed |
| Proxy Mode | Zero code changes - run as proxy server |
Usage Examples
Proxy Mode (Recommended for OpenClaw)
# Start the proxy server
source ~/headroom-env/bin/activate
headroom proxy --port 8787
# Then configure OpenClaw to use the proxy
# Set environment variables for your LLM provider
Python API
from headroom import compress
result = compress(messages, model="claude-sonnet-4-20250514")
response = client.messages.create(
model="claude-sonnet-4-20250514",
messages=result.messages
)
print(f"Saved {result.tokens_saved} tokens ({result.compression_ratio:.0%})")
Command Line
source ~/headroom-env/bin/activate
headroom learn # Analyze past sessions
headroom learn --apply # Write learnings to CLAUDE.md
Requirements
- Python 3.10+
- Virtual environment: ~/headroom-env
- Activate with:
source ~/headroom-env/bin/activate
Environment Setup
The headroom package is installed in a virtual environment at:
~/headroom-env
To use headroom in OpenClaw, activate the environment first:
source ~/headroom-env/bin/activate
headroom proxy --port 8787
Notes
- Headroom can reduce token usage by 70-95% while maintaining accuracy
- Supports multiple backend providers (OpenAI, Anthropic, Azure, AWS Bedrock, Google Vertex)
- Works with any OpenAI-compatible tool when run as proxy
04 同仓库更多 Skills
youtube
YouTube Data API integration with managed OAuth. Search videos, manage playlists, access channel data, and interact with comments. Use this skill when users want to interact with YouTube. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).
xcellent
Free, open-source X (Twitter) growth tool. Analytics dashboard, niche discovery, AI tweet writer, best posting times, and credit usage monitoring — all running locally on your machine. BYOK (Bring Your Own Key) model means users only pay X directly for API usage (~$5-15/mo). A free alternative to SuperX ($39/mo), Typefully, and Tweet Hunter.
work-application
CV generation, job scraping, offer analysis, and application tracking. Use when: (1) generating or adapting a CV/resume for a job offer, (2) scraping job offers from French platforms, (3) analyzing and ranking job offers, (4) generating a full analysis report for a single offer (skills, company, location, salary), (5) tracking candidatures and their status, (6) validating CV content against formatting guardrails. NOT for: cover letter generation (planned), LinkedIn direct messaging, job application submission, salary negotiation coaching.
weather
Get current weather and forecasts (no API key required).
to-do
Give your AI the power to act in the future. Schedule delayed prompts and one-off reminders that automatically wake the agent up at an exact moment to execute workflows, check systems, or send notifications.
summarize
Summarize URLs or files with the summarize CLI (web, PDFs, images, audio, YouTube).