Skip to content

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.

docs(wiki): correct the unpublished tree, and remove invented telemetry (#3390)

Tejas Chopra27bdc2a899e2
diff --git a/wiki/ARCHITECTURE.md b/wiki/ARCHITECTURE.md
index c8dccb921..5da5d140f 100644
--- a/wiki/ARCHITECTURE.md
+++ b/wiki/ARCHITECTURE.md
@@ -91,6 +91,14 @@ When you use AI models like GPT-4 or Claude, you pay for **tokens** - the pieces
### 1. HeadroomClient (`client.py`) - The Wrapper
+`HeadroomClient` is still exported (`headroom/__init__.py:93,197`), but it is
+no longer the only SDK entry point: the site's current architecture
+documentation (`docs/content/docs/architecture.mdx`) describes SDK mode as
+calling the one-function `compress()` API (`headroom.compress`,
+`headroom.CompressConfig`) directly on your messages, with `HeadroomClient`
+as the client-wrapping alternative. Both exist; this section covers only the
+wrapper.
+
This is what you interact with. It wraps your existing OpenAI or Anthropic client:
```python
@@ -500,19 +508,19 @@ When SmartCrusher compresses, the original content is stored for on-demand retri
```python
@dataclass
class CompressionEntry:
- hash: str # 16-char SHA256 for retrieval
+ hash: str # 24-char SHA256 prefix for retrieval
original_content: str # Full JSON before compression
compressed_content: str # Compressed JSON
original_item_count: int
compressed_item_count: int
tool_name: str | None # For feedback tracking
created_at: float
- ttl: int = 300 # 5 minute default
+ ttl: int = 1800 # 30 minute default (DEFAULT_CCR_TTL_SECONDS)
```
**Features:**
- Thread-safe in-memory storage
-- TTL-based expiration (default 5 minutes)
+- TTL-based expiration (default 30 minutes; `DEFAULT_CCR_TTL_SECONDS`, override via `HEADROOM_CCR_TTL_SECONDS`)
- LRU-style eviction when capacity reached
- Hash-keyed retrieval that always returns the full original content
@@ -1085,12 +1093,17 @@ This means:
## The Numbers (From Our Tests)
-Real-world SRE incident investigation:
-- **5 tool calls**: Metrics, logs, status, deployments, runbook
-- **Original**: 22,048 tokens
-- **After SmartCrusher**: 2,190 tokens
-- **Reduction**: 90%
-- **Quality Score**: 5.0/5 (no information loss)
+> **Audit note (2026-09-02):** the specific token counts previously shown here
+> (a "5 tool call SRE incident" example) could not be traced to any benchmark,
+> test, or committed artifact in this repo and have been removed rather than
+> replaced with another unverified figure. For sourced compression numbers see
+> [Benchmarks](benchmarks.md) / `docs/content/docs/benchmarks.mdx`.
+
+Real-world SRE incident investigation (metrics, logs, status, deployments,
+runbook tool calls in one turn) is the kind of workload SmartCrusher targets:
+statistical, repetitive tool output where most of the redundancy is in
+constant fields and stable regions, not in the handful of data points (spikes,
+errors) that actually matter to the model's answer.
The model could still:
- Identify the CPU spike (preserved by change point detection)
diff --git a/wiki/LIMITATIONS.md b/wiki/LIMITATIONS.md
index 905e0416d..5de34b0e2 100644
--- a/wiki/LIMITATIONS.md
+++ b/wiki/LIMITATIONS.md
@@ -24,7 +24,7 @@ Headroom includes an AST-aware CodeCompressor (tree-sitter, 8 languages) but it'
**Why code mostly passes through:**
-1. **Word count gate**: Content under 50 words is silently skipped
+1. **Token/char gate**: Content under 50 tokens (`min_tokens_to_compress`) or under 500 chars (`min_chars_for_block_compression`, Anthropic content-block path) is silently skipped — this is measured in tokens/chars, not words
2. **Recent code protection** (`protect_recent_code=4`): Code in the last 4 messages is never compressed. In typical tool-call patterns, the tool result is always "recent"
3. **Analysis intent protection** (`protect_analysis_context=True`): If the most recent user message contains keywords like "analyze", "review", "explain", "fix", "debug", "optimize", "error", "bug" — ALL code in the conversation is protected
@@ -98,7 +98,7 @@ Errors are logged at WARNING level and never propagated to callers.
The Tool Output Intelligence Network (TOIN) learns compression patterns from usage. For new tool types:
- No learned patterns exist → falls back to statistical heuristics
-- Confidence below `toin_confidence_threshold` (default 0.3) → TOIN hints ignored
+- Confidence below `toin_confidence_threshold` (default 0.5 at the runtime `SmartCrusherConfig` used by `ContentRouter`; the separate `headroom.config.SmartCrusherConfig` dataclass defaults to 0.3 but is not wired into the router unless explicitly passed) → TOIN hints ignored
- Patterns build up over time as tools are used repeatedly
- Cross-session learning requires persistence (`TelemetryConfig.storage_path`)
@@ -136,4 +136,4 @@ The Tool Output Intelligence Network (TOIN) learns compression patterns from usa
| `protect_analysis_context` | True | Protect code when user asks about it |
| `protect_recent_code` | 4 | Messages from end to protect code |
| `skip_user_messages` | True | Never compress user messages |
-| `toin_confidence_threshold` | 0.3 | Minimum TOIN confidence to apply hints |
+| `toin_confidence_threshold` | 0.5 (transforms-level `SmartCrusherConfig`, the one actually used by `ContentRouter`; the exported `headroom.config.SmartCrusherConfig` defaults to 0.3 but isn't wired in by default) | Minimum TOIN confidence to apply hints |
diff --git a/wiki/agno.md b/wiki/agno.md
index 028f36ef7..70312905d 100644
--- a/wiki/agno.md
+++ b/wiki/agno.md
@@ -137,7 +137,7 @@ config = HeadroomConfig(
model = HeadroomAgnoModel(
wrapped_model=OpenAIChat(id="gpt-4o"),
- config=config,
+ headroom_config=config,
)
```
@@ -362,7 +362,7 @@ We're tracking these potential enhancements:
- **Tool schema deduplication** — Cache and reference repeated tool definitions
- **Team-level optimization** — Shared context compression across agent teams
-Contributions welcome! See [CONTRIBUTING.md](https://github.com/chopratejas/headroom/blob/main/CONTRIBUTING.md).
+Contributions welcome! See [CONTRIBUTING.md](https://github.com/headroomlabs-ai/headroom/blob/main/CONTRIBUTING.md).
---
@@ -373,7 +373,7 @@ Contributions welcome! See [CONTRIBUTING.md](https://github.com/chopratejas/head
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `wrapped_model` | Any | Required | The Agno model to wrap |
-| `config` | `HeadroomConfig` | `None` | Custom configuration |
+| `headroom_config` | `HeadroomConfig` | `None` | Custom configuration |
| `auto_detect_provider` | `bool` | `True` | Auto-detect provider for token counting |
**Properties:**
diff --git a/wiki/api.md b/wiki/api.md
index 28dd29ec1..fce1b03ac 100644
--- a/wiki/api.md
+++ b/wiki/api.md
@@ -19,11 +19,14 @@ client = HeadroomClient(
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `original_client` | `OpenAI \| Anthropic` | Required | The underlying LLM client |
-| `provider` | `Provider` | Auto-detected | Token counting provider |
+| `provider` | `Provider` | Required (no default) | Token counting provider — e.g. `OpenAIProvider()`, `AnthropicProvider()` |
| `default_mode` | `str` | `"audit"` | Default mode: "audit", "optimize", "off" |
| `store_url` | `str` | `None` | Storage URL for metrics |
-| `smart_crusher_config` | `SmartCrusherConfig` | Default | Compression settings |
-| `cache_aligner_config` | `CacheAlignerConfig` | Default | Cache alignment settings |
+| `model_context_limits` | `dict[str, int]` | `None` | Override context limits for models |
+| `cache_optimizer` | `BaseCacheOptimizer` | `None` (auto-detect) | Custom cache optimizer |
+| `enable_cache_optimizer` | `bool` | `True` | Enable provider-specific cache optimization |
+| `enable_semantic_cache` | `bool` | `False` | Enable query-level semantic caching |
+| `config` | `HeadroomConfig` | `None` | Full config object; set `config.smart_crusher` / `config.cache_aligner` here to override compression/cache-alignment settings — there is no separate `smart_crusher_config`/`cache_aligner_config` constructor kwarg |
### Methods
diff --git a/wiki/benchmarks.md b/wiki/benchmarks.md
index c6d30ba8b..c2751af15 100644
--- a/wiki/benchmarks.md
+++ b/wiki/benchmarks.md
@@ -1,10 +1,9 @@
# Benchmarks
-Headroom's core promise: **compress context without losing accuracy**. This page shows accuracy benchmarks, compression performance, and real-world production telemetry from 250+ active proxy instances.
+Headroom's core promise: **compress context without losing accuracy**. This page shows accuracy benchmarks and compression performance, all reproducible from this repo (see [Reproducing Results](#reproducing-results)).
!!! success "Key Results"
**98.2% recall** on article extraction with **94.9% compression**.
- **52ms median overhead** in production. **1.4 billion tokens saved** across 249 instances.
---
@@ -29,58 +28,6 @@ Tested on Apple M-series (CPU), headroom v0.5.18. Each test runs `compress()` on
---
-## Production Telemetry
-
-Real-world data from **50,000+ proxy sessions** across 250+ unique instances (March 30 – April 2, 2026). Collected via anonymous telemetry beacon (opt-in: `HEADROOM_TELEMETRY=on`; telemetry is off by default).
-
-### Proxy Overhead
-
-| Percentile | Latency |
-|---|---|
-| **Median (P50)** | **52ms** |
-| P90 | 309ms |
-| P99 | 4,172ms |
-| Mean | 161ms |
-
-The median 52ms overhead is negligible compared to LLM inference time (typically 2-10 seconds).
-
-### Compression Rate
-
-| Percentile | Compression |
-|---|---|
-| P25 | 4.8% |
-| **Median** | **4.8%** |
-| P75 | 6.9% |
-| Mean | 11.3% |
-
-Median compression is modest because many requests are short conversational turns. Heavy tool-use sessions (file reads, shell output) see 40-80% compression.
-
-### Pipeline Step Timing (Production Median)
-
-| Step | Median | P90 | Description |
-|---|---|---|---|
-| `pipeline_total` | **16.9ms** | 289ms | Full compression pipeline |
-| `content_router` | 11.7ms | 259ms | Content detection + routing |
-| `compressor:smart_crusher` | 50.1ms | 50ms | JSON array compression |
-| `compressor:text` | 32.0ms | 576ms | Text compression (Kompress ONNX) |
-| `compressor:mixed` | 316ms | 428ms | Mixed content compression |
-| `compressor:code_aware` | 815ms | 886ms | Tree-sitter AST compression |
-| `_initial_token_count` | 2.9ms | 16ms | Token counting (tiktoken) |
-| `_deep_copy` | 0.1ms | 0.3ms | Message copy overhead |
-
-### Fleet Summary
-
-| Metric | Value |
-|---|---|
-| Clean instances | 249 |
-| Total tokens saved | 1.4 billion |
-| Total $ saved | ~$4,000 |
-| OS distribution | Linux 57%, macOS 38%, Windows 5% |
-| Top version | 0.5.17 (77%) |
-| Models used | Claude Opus 4.6, Sonnet 4.6, Haiku 4.5 |
-
----
-
## Accuracy Benchmarks
### HTML Extraction
@@ -148,14 +95,14 @@ SmartCrusher preserves first N items (schema), last N items (recency), all anoma
### When Headroom Adds the Most Value
-- **Long agent sessions** with accumulated tool outputs (40-80% compression)
-- **JSON-heavy workflows** (API responses, database queries) — 83-94% compression
-- **Build/test output** — 85-94% compression
-- **Multi-tool agents** — 60-76% compression across tool results
+- **Long agent sessions** with accumulated tool outputs
+- **JSON-heavy workflows** (API responses, database queries) — see the JSON array rows above
+- **Build/test output** — see the Shell/Build log rows above
+- **Multi-tool agents** — repeated tool results compound the per-call savings shown above
### When Headroom Adds Little Value
-- **Short conversational exchanges** — median 4.8% compression
+- **Short conversational exchanges** — overhead can exceed savings on small payloads (see "What Headroom Does NOT Compress" above)
- **Code-only sessions** (reading/writing files) — code passes through
- **Single-turn requests** — no accumulated context to compress
@@ -179,20 +126,13 @@ Compression = 1 - (compressed_size / original_size)
A 94.9% compression means the output is 5.1% of the original size.
-### Production Telemetry
-
-- Collected via anonymous beacon (no prompts, no content, no PII)
-- Image-inflated instances excluded (base64 counted as text tokens — fixed in v0.5.18)
-- Multi-worker beacon spam excluded (per-instance MAX, not SUM)
-- Opt-in: `HEADROOM_TELEMETRY=on` (telemetry is off by default)
-
---
## Reproducing Results
```bash
# Clone the repo
-git clone https://github.com/chopratejas/headroom.git
+git clone https://github.com/headroomlabs-ai/headroom.git
cd headroom
# Install with eval dependencies
diff --git a/wiki/ccr.md b/wiki/ccr.md
index 4f3212c36..a8a76f216 100644
--- a/wiki/ccr.md
+++ b/wiki/ccr.md
@@ -130,11 +130,11 @@ The older conversation turns, system prompt, and tool definitions — the provid
# Proxy with CCR enabled (default)
headroom proxy --port 8787
-# Disable CCR response handling
-headroom proxy --no-ccr-responses
+# Disable CCR entirely: no retrieval markers, no headroom_retrieve tool
+headroom proxy --no-ccr
-# Disable proactive expansion
-headroom proxy --no-ccr-expansion
+# Disable proactive expansion of previously-compressed content
+headroom proxy --no-ccr-proactive-expansion
```
## Why This Matters
@@ -149,30 +149,27 @@ CCR gives you the savings of aggressive compression with zero risk — the LLM c
## Demo
-Run the CCR demonstration to see it in action:
+`examples/ccr_demo.py` no longer exists in this repo. The closest working example is `examples/test_ccr.py`, which compresses a tool result and checks that key content survives compression:
```bash
-python examples/ccr_demo.py
+python examples/test_ccr.py
```
-Output:
+Verified output (`.venv/bin/python examples/test_ccr.py`):
```
-1. COMPRESSION STORE
- Original: 100 items (7,059 chars)
- Compressed: 8 items (633 chars)
- Reduction: 91.0%
-
-3. RESPONSE HANDLER
- Detected CCR tool call: True
- Retrieved 100 items automatically
-
-4. CONTEXT TRACKER
- Turn 5: User asks "show authentication middleware"
- Tracker found 1 relevant context
- → relevance=0.73
- Proactively expanded: 100 items
+Tokens: 2904 -> 2703 (201 saved)
+Transforms: ['router:protected:user_message', 'router:mixed:0.97']
+
+No CCR markers
+
+ reward tampering: FOUND
+ sycophancy: FOUND
+ ...
+6/6 key concepts preserved in compressed output
```
+Note this run shows "No CCR markers" — `examples/test_ccr.py` calls the SDK `compress()` function directly, and this particular payload doesn't cross the size threshold that triggers a CCR marker. The full compress-cache-retrieve tool-call loop (`headroom_retrieve`, proactive expansion) only runs inside `headroom proxy`, not the standalone SDK call.
+
## Architecture
-For implementation details, see [ARCHITECTURE.md](ARCHITECTURE.md#ccr-compress-cache-retrieve).
+For implementation details, see [ARCHITECTURE.md](ARCHITECTURE.md#ccr-architecture-compress-cache-retrieve).
diff --git a/wiki/cli.md b/wiki/cli.md
index 42a591960..4d23cadc6 100644
--- a/wiki/cli.md
+++ b/wiki/cli.md
@@ -2,6 +2,17 @@
This page is the authoritative reference for the **Python Headroom CLI** exposed by the `headroom` console script.
+> **Audit note (2026-09-02):** `headroom --help` on this branch lists 30 top-level
+> commands; this page documents 15 of them and omits `agent-savings`,
+> `audit-reads`, `capture`, `copilot-auth`, `dashboard`, `deploy`, `diff`,
+> `doctor`, `init`, `loc`, `output-savings`, `recover`, `rollout`, `savings`,
+> `sg`, `tools`, and `update` entirely. The `headroom proxy` and
+> `headroom install apply` option tables below are similarly stale — `proxy
+> --help` alone now runs to ~90 options vs. the ~30 documented here. Treat the
+> command list and captured `--help` blocks in this file as historical
+> snapshots, not current reference; verify against `headroom <cmd> --help`
+> before relying on any option in this file. See the audit report for detail.
+
## Global behavior
### Entry points
@@ -55,22 +66,47 @@ Usage: headroom [OPTIONS] COMMAND [ARGS]...
headroom proxy Start the optimization proxy
headroom memory list List stored memories
headroom memory stats Show memory statistics
+ headroom update Update Headroom to the latest release
Options:
-v, --version Show the version and exit.
-?, --help Show this message and exit.
Commands:
- evals Memory evaluation commands.
- install Install and manage persistent Headroom deployments.
- learn Learn from past tool call failures to prevent future ones.
- mcp MCP server for Claude Code integration.
- memory Manage memories stored in Headroom.
- perf Analyze proxy performance from logs.
- proxy Start the optimization proxy server.
- unwrap Undo durable Headroom wrapping for supported tools.
- wrap Wrap CLI tools to run through Headroom.
-```
+ agent-savings Render or verify Codex/Claude/Cursor token-savings...
+ audit-reads Audit Read-tool traffic for compression opportunities.
+ capture Capture and compare network traffic for Headroom...
+ copilot-auth Manage Headroom's GitHub Copilot OAuth token.
+ dashboard Open the Headroom savings dashboard in your browser.
+ deploy Deploy a turnkey local Headroom proxy and configure...
+ diff Run difftastic (structural diff).
+ doctor Check that the Headroom proxy and client routing are...
+ evals Evaluation commands (memory, compression robustness,...
+ init Install durable Headroom integrations for supported...
+ inspect Show original vs compressed content for recent proxy...
+ install Install and manage persistent Headroom deployments.
+ learn Learn from past tool call failures to prevent future ones.
+ loc Run scc (fast lines-of-code / repo-shape probe).
+ mcp MCP server for Claude Code integration.
+ memory Manage memories stored in Headroom.
+ output-savings Show estimated/measured output-token reduction from the...
+ perf Analyze proxy performance from logs.
+ proxy Start the optimization proxy server.
+ recover Recover agent state left in a temporary Headroom home.
+ rollout Inspect runtime feature-rollout policy (not package...
+ savings Show durable compression savings over time.
+ sg Run ast-grep (AST-aware structural search/replace).
+ tools Manage bundled CLI tool binaries (ast-grep, difft, scc).
+ unwrap Undo durable Headroom wrapping for supported tools.
+ update Update Headroom to the latest release.
+ wrap Wrap CLI tools to run through Headroom.
+```
+
+Captured from `headroom --help` on this branch, 2026-09-02 (`headroom/cli/main.py`,
+per-command modules under `headroom/cli/`). None of `agent-savings`,
+`audit-reads`, `capture`, `copilot-auth`, `dashboard`, `deploy`, `diff`,
+`doctor`, `init`, `loc`, `output-savings`, `recover`, `rollout`, `savings`,
+`sg`, `tools`, or `update` is documented elsewhere in this file.
### Top-level command help snapshots
diff --git a/wiki/compression.md b/wiki/compression.md
index 5de8bd55e..0dc84ef8b 100644
--- a/wiki/compression.md
+++ b/wiki/compression.md
@@ -99,7 +99,7 @@ config = UniversalCompressorConfig(
| Option | Default | Description |
|--------|---------|-------------|
| `use_magika` | `True` | Use ML-based content detection |
-| `use_llmlingua` | `True` | Use LLMLingua for compression |
+| `use_kompress` | `True` | Use Kompress for content compression (`use_llmlingua` was retired; passing it raises `TypeError`) |
| `compression_ratio_target` | `0.3` | Target ratio (0.3 = keep 30%) |
| `min_content_length` | `100` | Minimum chars to compress |
| `use_entropy_preservation` | `True` | Preserve high-entropy tokens |
@@ -362,7 +362,7 @@ from headroom.compression import UniversalCompressor, UniversalCompressorConfig
config = UniversalCompressorConfig(
compression_ratio_target=0.25, # Keep 25%
use_magika=True,
- use_llmlingua=True,
+ use_kompress=True,
ccr_enabled=True,
)
diff --git a/wiki/configuration.md b/wiki/configuration.md
index b74c2e89f..aa21ea497 100644
--- a/wiki/configuration.md
+++ b/wiki/configuration.md
@@ -177,11 +177,14 @@ config = SmartCrusherConfig(
max_items_after_crush=15,
# Minimum tokens before applying compression
min_tokens_to_crush=200,
- # Relevance scoring tier: "bm25" (fast) or "embedding" (accurate)
- relevance_tier="bm25",
- # Always keep items with these field values
- preserve_fields=["error", "warning", "failure"],
+ # Guarantee rows matching these patterns survive compression verbatim
+ # (requires audit_safe=True; matched against each row's canonical JSON)
+ audit_safe=True,
+ protected_patterns=["error", "warning", "failure"],
)
+# Error items and statistical anomalies (>2 std from mean) are always kept
+# automatically. Relevance-scoring tier ("bm25"/"embedding"/"hybrid") is a
+# separate `relevance_config` argument to SmartCrusher(), not a field here.
```
## Cache Aligner Configuration
@@ -189,13 +192,18 @@ config = SmartCrusherConfig(
Control prefix stabilization:
```python
-from headroom.transforms import CacheAlignerConfig
+from headroom import CacheAlignerConfig
config = CacheAlignerConfig(
- # Enable/disable cache alignment
+ # Enable/disable cache alignment (disabled by default: prefix-stability
+ # gains are marginal in practice -- see headroom/config.py:61)
enabled=True,
- # Patterns to extract from system prompt
- dynamic_patterns=[
+ # Legacy pattern list (only used when use_dynamic_detector=False;
+ # the field is `date_patterns`, not `dynamic_patterns`). Default mode
+ # (use_dynamic_detector=True) auto-detects dates, UUIDs, tokens, etc.
+ # via detection_tiers instead -- see headroom/config.py:68-79.
+ use_dynamic_detector=False,
+ date_patterns=[
r"Today is \w+ \d+, \d{4}",
r"Current time: .*",
],
diff --git a/wiki/docker-install.md b/wiki/docker-install.md
index de3956275..1e0c724a1 100644
--- a/wiki/docker-install.md
+++ b/wiki/docker-install.md
@@ -7,13 +7,13 @@ Run Headroom without installing Python or Node.js on the host. The install scrip
### Linux
```bash
-curl -fsSL https://raw.githubusercontent.com/chopratejas/headroom/main/scripts/install.sh | bash
+curl -fsSL https://raw.githubusercontent.com/headroomlabs-ai/headroom/main/scripts/install.sh | bash
```
### macOS (bash 4.3+)
```bash
-curl -fsSL https://raw.githubusercontent.com/chopratejas/headroom/main/scripts/install.sh | "$(brew --prefix bash)/bin/bash"
+curl -fsSL https://raw.githubusercontent.com/headroomlabs-ai/headroom/main/scripts/install.sh | "$(brew --prefix bash)/bin/bash"
```
Stock `/bin/bash` on macOS is 3.2, so install a newer bash first (for example via Homebrew) and run the installer with that shell. The installed wrapper pins that same bash interpreter so later invocations stay on the supported runtime.
@@ -21,7 +21,7 @@ Stock `/bin/bash` on macOS is 3.2, so install a newer bash first (for example vi
### Windows PowerShell
```powershell
-irm https://raw.githubusercontent.com/chopratejas/headroom/main/scripts/install.ps1 | iex
+irm https://raw.githubusercontent.com/headroomlabs-ai/headroom/main/scripts/install.ps1 | iex
```
## What the installer does
diff --git a/wiki/getting-started.md b/wiki/getting-started.md
index dddee019d..c826366c2 100644
--- a/wiki/getting-started.md
+++ b/wiki/getting-started.md
@@ -39,13 +39,13 @@ npm install headroom-ai
**Docker-native:**
```bash
-curl -fsSL https://raw.githubusercontent.com/chopratejas/headroom/main/scripts/install.sh | bash
+curl -fsSL https://raw.githubusercontent.com/headroomlabs-ai/headroom/main/scripts/install.sh | bash
```
PowerShell:
```powershell
-irm https://raw.githubusercontent.com/chopratejas/headroom/main/scripts/install.ps1 | iex
+irm https://raw.githubusercontent.com/headroomlabs-ai/headroom/main/scripts/install.ps1 | iex
```
See [Docker-native install](docker-install.md) for wrapper behavior, compose usage, and host-integrated `wrap` flows.
@@ -140,7 +140,7 @@ plan = client.chat.completions.simulate(
messages=[...],
)
print(f"Would save {plan.tokens_saved} tokens")
-print(f"Transforms: {plan.transforms_applied}")
+print(f"Transforms: {plan.transforms}")
```
## Next Steps
diff --git a/wiki/image-compression.md b/wiki/image-compression.md
index 0fa22ae9c..14b40e136 100644
--- a/wiki/image-compression.md
+++ b/wiki/image-compression.md
@@ -55,9 +55,10 @@ Images are automatically compressed based on your queries.
### With HeadroomClient
```python
-from headroom import HeadroomClient
+from headroom import HeadroomClient, OpenAIProvider
+from openai import OpenAI
-client = HeadroomClient(provider="openai")
+client = HeadroomClient(original_client=OpenAI(), provider=OpenAIProvider())
response = client.chat.completions.create(
model="gpt-4o",
@@ -94,11 +95,10 @@ print(f"Technique: {compressor.last_result.technique.value}")
### Proxy Configuration
```bash
-# Enable image compression (default: true)
-headroom proxy --image-optimize
-
-# Disable image compression
-headroom proxy --no-image-optimize
+# Image compression runs as part of the `image` built-in compressor and is
+# enabled by default. There is no dedicated --image-optimize toggle; select
+# compressors explicitly to disable it (flag is singular: --compressor):
+headroom proxy --compressor smart_crusher,kompress,code_aware,search,log,tabular,config,html
```
### Programmatic Configuration
@@ -183,7 +183,7 @@ For text extraction (converts image to text):
- "What does it say?"
- "Transcribe the document"
-*Note: Requires vision model call. Currently falls back to preserve.*
+*Note: Runs OCR and replaces the image with the extracted text. If OCR fails or returns low confidence, it falls back to `full_low` (not `preserve`).*
## The Trained Router
@@ -249,10 +249,12 @@ compressor = ImageCompressor(device="cpu")
### Disable Image Compression
-```python
-# Proxy
-headroom proxy --no-image-optimize
+```bash
+# Proxy (flag is singular: --compressor)
+headroom proxy --compressor smart_crusher,kompress,code_aware,search,log,tabular,config,html
+```
+```python
# Direct
# Simply don't call compress()
```
@@ -265,7 +267,7 @@ headroom proxy --no-image-optimize
class ImageCompressor:
def __init__(
self,
- model_id: str = "chopratejas/technique-router",
+ model_id: str | None = None, # resolves to "chopratejas/technique-router" if unset
use_siglip: bool = True,
device: str | None = None,
): ...
diff --git a/wiki/index.md b/wiki/index.md
index ea294ab48..0e8c47df9 100644
--- a/wiki/index.md
+++ b/wiki/index.md
@@ -12,7 +12,7 @@ Compress everything your AI agent reads. Same answers, fraction of the tokens.
[![PyPI](https://img.shields.io/pypi/v/headroom-ai.svg)](https://pypi.org/project/headroom-ai/)
[![Python](https://img.shields.io/pypi/pyversions/headroom-ai.svg)](https://pypi.org/project/headroom-ai/)
-[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/chopratejas/headroom/blob/main/LICENSE)
+[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/headroomlabs-ai/headroom/blob/main/LICENSE)
[![Discord](https://img.shields.io/badge/Discord-Join%20us-5865F2?logo=discord&logoColor=white)](https://discord.gg/yRmaUNpsPJ)
</div>
@@ -224,7 +224,7 @@ ContextEngine plugin for OpenClaw agents. Auto-compresses context in `assemble()
headroom wrap openclaw
```
-[OpenClaw Plugin &rarr;](https://github.com/chopratejas/headroom/tree/main/plugins/openclaw)
+[OpenClaw Plugin &rarr;](https://github.com/headroomlabs-ai/headroom/tree/main/plugins/openclaw)
</div>
@@ -418,4 +418,4 @@ your default `python3` is newer than the current wheel set.
---
-Apache 2.0 — Free for commercial use. [GitHub](https://github.com/chopratejas/headroom) | [PyPI](https://pypi.org/project/headroom-ai/) | [Discord](https://discord.gg/yRmaUNpsPJ)
+Apache 2.0 — Free for commercial use. [GitHub](https://github.com/headroomlabs-ai/headroom) | [PyPI](https://pypi.org/project/headroom-ai/) | [Discord](https://discord.gg/yRmaUNpsPJ)
diff --git a/wiki/integration-guide.md b/wiki/integration-guide.md
index 6d076ab06..58eff4e57 100644
--- a/wiki/integration-guide.md
+++ b/wiki/integration-guide.md
@@ -211,7 +211,7 @@ For translated backends, the Copilot wrapper can switch to Headroom's OpenAI-com
headroom wrap copilot --backend anyllm --anyllm-provider groq -- --model gpt-4o
```
-For Copilot's **hosted** API (`--subscription` and the implicit OAuth path), Headroom routes to the generic host `https://api.githubcopilot.com`, which serves the full model set. **Enterprise / data-residency** tenants on a dedicated Copilot host pin it with `GITHUB_COPILOT_API_URL` (e.g. `export GITHUB_COPILOT_API_URL=https://api.<your-host>.githubcopilot.com`); the override flows through to the upstream request. See [`TESTING-copilot-subscription.md`](https://github.com/chopratejas/headroom/blob/main/TESTING-copilot-subscription.md).
+For Copilot's **hosted** API (`--subscription` and the implicit OAuth path), Headroom routes to the generic host `https://api.githubcopilot.com`, which serves the full model set. **Enterprise / data-residency** tenants on a dedicated Copilot host pin it with `GITHUB_COPILOT_API_URL` (e.g. `export GITHUB_COPILOT_API_URL=https://api.<your-host>.githubcopilot.com`); the override flows through to the upstream request. See [`TESTING-copilot-subscription.md`](https://github.com/headroomlabs-ai/headroom/blob/main/TESTING-copilot-subscription.md).
### With Cloud Providers
@@ -303,7 +303,7 @@ openclaw plugins install --dangerously-force-unsafe-install headroom-ai/openclaw
The plugin auto-detects a running Headroom proxy or starts one. Compression happens in `assemble()` — zero changes to the agent's behavior.
-See the [OpenClaw plugin documentation](https://github.com/chopratejas/headroom/tree/main/plugins/openclaw) for full setup.
+See the [OpenClaw plugin documentation](https://github.com/headroomlabs-ai/headroom/tree/main/plugins/openclaw) for full setup.
---
diff --git a/wiki/langchain.md b/wiki/langchain.md
index c89bf3fc8..432601fd6 100644
--- a/wiki/langchain.md
+++ b/wiki/langchain.md
@@ -35,8 +35,9 @@ Headroom automatically:
```python
# After some usage
-print(llm.get_metrics())
-# {'tokens_saved': 12500, 'savings_percent': 45.2, 'requests': 50}
+print(llm.get_savings_summary())
+# {'total_requests': 50, 'total_tokens_saved': 12500, 'average_savings_percent': 45.2,
+# 'total_tokens_before': ..., 'total_tokens_after': ...}
```
---
@@ -61,13 +62,10 @@ llm = HeadroomChatModel(ChatAnthropic(model="claude-3-5-sonnet-20241022"))
# Custom configuration
from headroom import HeadroomConfig, HeadroomMode
-config = HeadroomConfig(
- default_mode=HeadroomMode.OPTIMIZE,
- smart_crusher_target_ratio=0.3, # Target 70% compression
-)
+config = HeadroomConfig(default_mode=HeadroomMode.OPTIMIZE)
llm = HeadroomChatModel(
ChatOpenAI(model="gpt-4o"),
- headroom_config=config,
+ config=config,
)
```
diff --git a/wiki/learn.md b/wiki/learn.md
index 07bb9d471..b0e423ba3 100644
--- a/wiki/learn.md
+++ b/wiki/learn.md
@@ -157,7 +157,7 @@ Options:
--apply Write recommendations (default: dry-run)
--target TEXT Context file to write (default: CLAUDE.local.md for Claude Code)
--main-only Write only to the main context file, skip MEMORY.md
- --agent [auto|claude|codex|gemini]
+ --agent [auto|claude|codex|gemini|grok|opencode]
Which agent to analyze (default: auto-detect)
--model TEXT LLM for analysis (default: auto from API keys or CLI)
--workers / -j INTEGER Parallel analysis workers (min 1, default: auto)
@@ -188,6 +188,8 @@ To keep the shaper on across proxy restarts, export both variables before starti
| **Claude Code** | Reads `~/.claude/projects/*.jsonl` | ClaudeCodeWriter | CLAUDE.md, MEMORY.md |
| **OpenAI Codex** | Reads `~/.codex/sessions/*.json` | CodexWriter | AGENTS.md, instructions.md |
| **Gemini CLI** | Reads `~/.gemini/tmp/*/chats/session-*.json` | GeminiWriter | GEMINI.md |
+| **Grok CLI** | Reads `~/.grok/sessions/<workspace>/<session-id>/updates.jsonl` | GrokWriter | GROK.md |
+| **OpenCode** | Reads the OpenCode SQLite DB at `~/.local/share/opencode/opencode.db` (or `opencode-local.db`; override with `HEADROOM_OPENCODE_DB`) | CodexWriter (shared) | AGENTS.md, instructions.md |
## LLM Backend Selection
diff --git a/wiki/mcp.md b/wiki/mcp.md
index fea4c7102..2b1922cf8 100644
--- a/wiki/mcp.md
+++ b/wiki/mcp.md
@@ -216,7 +216,7 @@ headroom proxy # In another terminal
### "Entry not found or expired"
- Content compressed via `headroom_compress`: stored for 1 hour (session TTL)
-- Content compressed by the proxy: stored for 5 minutes (proxy TTL)
+- Content compressed by the proxy: stored for 30 minutes by default (proxy CCR TTL, `HEADROOM_CCR_TTL_SECONDS`)
- The proxy must be running for proxy-compressed content
### Claude doesn't see headroom tools
diff --git a/wiki/plans/2026-04-17-fix-codex-proxy-resilience-plan.md b/wiki/plans/2026-04-17-fix-codex-proxy-resilience-plan.md
index 67c2378e3..ca10d04a8 100644
--- a/wiki/plans/2026-04-17-fix-codex-proxy-resilience-plan.md
+++ b/wiki/plans/2026-04-17-fix-codex-proxy-resilience-plan.md
@@ -109,7 +109,7 @@ None used for this plan. Python `asyncio` lock, `asyncio.Semaphore`, `asyncio.Ta
### Resolved During Planning
-- *Q: Target upstream or the fork?* Resolved: target the fork (`fix/responses-retries-keep-compression`), structured so each unit is cherry-pickable into a PR against `chopratejas/headroom#172`.
+- *Q: Target upstream or the fork?* Resolved: target the fork (`fix/responses-retries-keep-compression`), structured so each unit is cherry-pickable into a PR against `headroomlabs-ai/headroom#172`.
- *Q: Should Unit 5's debug endpoints require an explicit flag to enable?* Resolved: **no** — loopback-only gating is sufficient and the debug data is useless if it isn't always available when the process is struggling.
- *Q: Does `MemoryHandler._ensure_initialized` already have a concurrency guard?* Resolved: **no**. It relies on `self._initialized = True` flip, which is not atomic across `await` points. Unit 1 adds an `asyncio.Lock`.
- *Q: Are the WS relay tasks already cancelled on partner exit?* Resolved: **no**. `asyncio.gather(return_exceptions=True)` waits for both; the survivor only exits when its own loop raises. Unit 3 fixes this.
@@ -483,6 +483,6 @@ Decision matrix for "where does this request wait?":
- `headroom/transforms/content_router.py` — `eager_load_compressors`
- `headroom/transforms/kompress_compressor.py` — `_load_kompress_onnx`, `_kompress_cache`
- Related PRs/issues:
- - Upstream: `https://github.com/chopratejas/headroom/issues/172`
+ - Upstream: `https://github.com/headroomlabs-ai/headroom/issues/172`
- Fork branch: `fix/responses-retries-keep-compression` (commit `0b11637`)
- External docs: none used for this plan.
diff --git a/wiki/proxy.md b/wiki/proxy.md
index 03c586b68..845b0afbf 100644
--- a/wiki/proxy.md
+++ b/wiki/proxy.md
@@ -68,7 +68,7 @@ When configured, Headroom emits OTLP traces for the shared compression pipeline
|--------|---------|-------------|
| `--host` | `127.0.0.1` | Host to bind to |
| `--port` | `8787` | Port to bind to |
-| `--mode` | `token` | Run mode: `token` (maximize compression) or `cache` (freeze prior turns) |
+| `--mode` | `cache` | Run mode: `token` (maximize compression) or `cache` (freeze prior turns) |
| `--no-optimize` | `false` | Disable optimization (passthrough mode) |
| `--no-cache` | `false` | Disable semantic caching |
| `--no-rate-limit` | `false` | Disable rate limiting |
@@ -436,11 +436,13 @@ For production deployments:
# Use a process manager
pip install gunicorn
-# Run with gunicorn
-gunicorn headroom.proxy.server:app \
+# Run with gunicorn — server.py has no module-level `app`; FastAPI is built
+# by the create_app() factory, so gunicorn needs --factory
+gunicorn headroom.proxy.server:create_app \
--workers 4 \
--bind 0.0.0.0:8787 \
- --worker-class uvicorn.workers.UvicornWorker
+ --worker-class uvicorn.workers.UvicornWorker \
+ --factory
```
Or with Docker:
diff --git a/wiki/quickstart.md b/wiki/quickstart.md
index 405b32404..724903174 100644
--- a/wiki/quickstart.md
+++ b/wiki/quickstart.md
@@ -38,7 +38,7 @@ npm install headroom-ai
**Docker-native:**
```bash
-curl -fsSL https://raw.githubusercontent.com/chopratejas/headroom/main/scripts/install.sh | bash
+curl -fsSL https://raw.githubusercontent.com/headroomlabs-ai/headroom/main/scripts/install.sh | bash
```
See [Docker-native install](docker-install.md) if you want Docker to provide the Headroom runtime while your agent CLIs stay on the host.
@@ -327,7 +327,7 @@ response = client.chat.completions.create(
|--------------|-------------------|-----------------|
| **Tool outputs with lists** | Keeps errors, anomalies, high-score items | 70-90% |
| **Repeated search results** | Deduplicates and samples | 60-80% |
-| **Long conversations** | Drops old turns, keeps recent | 40-60% |
+| **Long conversations** | Compresses the newest tool output / user turn only (live-zone-only); never drops messages | varies |
| **System prompts with dates** | Stabilizes for cache hits | Cache savings |
---
diff --git a/wiki/sdk.md b/wiki/sdk.md
index 674d5c3e6..dc9e77dc8 100644
--- a/wiki/sdk.md
+++ b/wiki/sdk.md
@@ -107,7 +107,8 @@ response = client.messages.create(
### Google
```python
-from headroom import HeadroomClient, GoogleProvider
+from headroom import HeadroomClient
+from headroom.providers import GoogleProvider
import google.generativeai as genai
client = HeadroomClient(
diff --git a/wiki/typescript-sdk.md b/wiki/typescript-sdk.md
index eb2c9bd3f..de1cf175c 100644
--- a/wiki/typescript-sdk.md
+++ b/wiki/typescript-sdk.md
@@ -202,7 +202,7 @@ The `headroom-ai` package has no runtime dependencies. Framework SDKs (Vercel AI
## OpenClaw Plugin
-The TypeScript SDK powers the [`headroom-openclaw`](https://www.npmjs.com/package/headroom-openclaw) plugin for [OpenClaw](https://github.com/openclaw/openclaw) agents. The plugin uses `HeadroomClient` internally to compress context during the `assemble()` lifecycle hook. The preferred install flow is `headroom wrap openclaw`; the direct plugin command is `openclaw plugins install --dangerously-force-unsafe-install headroom-ai/openclaw`. See the [plugin source](https://github.com/chopratejas/headroom/tree/main/plugins/openclaw) for details.
+The TypeScript SDK powers the [`headroom-openclaw`](https://www.npmjs.com/package/headroom-openclaw) plugin for [OpenClaw](https://github.com/openclaw/openclaw) agents. The plugin uses `HeadroomClient` internally to compress context during the `assemble()` lifecycle hook. The preferred install flow is `headroom wrap openclaw`; the direct plugin command is `openclaw plugins install --dangerously-force-unsafe-install headroom-ai/openclaw`. See the [plugin source](https://github.com/headroomlabs-ai/headroom/tree/main/plugins/openclaw) for details.
## Comparison with Python SDK
diff --git a/wiki/vertex.md b/wiki/vertex.md
index d00d9185c..ddc44bc3d 100644
--- a/wiki/vertex.md
+++ b/wiki/vertex.md
@@ -71,7 +71,7 @@ Anthropic publisher route.
To run **Claude Code** against Claude-on-Vertex **with Headroom compressing the
context**, use the dedicated, tested runbook:
-➡️ **[Claude Code + Vertex + Headroom](https://headroom-docs.vercel.app/docs/claude-code-vertex)**
+➡️ **[Claude Code + Vertex + Headroom](https://docs.headroomlabs.ai/docs/claude-code-vertex)**
Short version: run Claude Code in **normal Anthropic mode** (`ANTHROPIC_BASE_URL`
→ the proxy) and start the proxy with `--backend litellm-vertex_ai --region <loc>