
Context compression is one of the most effective ways to cut token spend for AI coding agents, but many compression products process prompts, tool outputs, and logs on a third-party server before they reach the model. For engineers working with confidential codebases, that extra hop is a data-handling decision, not an implementation detail. Headroom, an open-source context-compression layer, instead ships as a local proxy: compression runs on the developer's own machine, and the only network egress is the call to the LLM provider the client was already configured to use. This article examines that deployment design — the two-hop localhost proxy, the fixed intercept port, and the host-isolation rules that keep the shell, system Python, and PATH clean on both install and uninstall. It also inventories what does leave the machine, identifies where the guarantees are version-sensitive, and outlines how a team can audit the claims. The compression engines and prompt-cache behavior are out of scope and covered separately.

When an AI coding agent prepares a request, it typically bundles source files, test logs, API responses, and conversational history. If a compression layer sits between the agent and the LLM, the critical trust question becomes: does that layer expose sensitive data to a new vendor?
Most existing context‑compression services operate as hosted APIs: the agent sends the raw payload to a remote server, the server compresses it, and the compressed text is then forwarded to the LLM provider — effectively inserting a second data‑handling hop 【2†L9-L12】. For teams that guard proprietary code or confidential logs, that extra hop is a disclosure surface that must be reviewed alongside any LLM provider’s data‑use policy.
Headroom’s design deliberately avoids this pattern. It installs as a local proxy that intercepts calls on a fixed localhost port, runs the chosen compressor on the developer’s machine, and caches the original content in a SQLite‑backed reversible store. The only network egress is the final compressed request sent to the already‑configured LLM provider 【0†L1-L4】. Because the cache lives locally, the raw payload never traverses the public Internet; retrieval is performed with a small reference token that the proxy resolves without external contact 【0†L5-L7】.
The distinction between “no middleman” and “no external egress” matters: the LLM provider still receives the compressed prompt, so its own data‑use terms continue to apply. Headroom removes a second vendor from the pipeline, but it does not eliminate the first (the LLM provider). Consequently, the privacy guarantee is limited to keeping raw data within the developer’s perimeter; any downstream policy of the LLM remains in force.
This discussion targets privacy‑conscious solo engineers and teams that must protect confidential codebases. For such audiences, the decision hinges on the number of network hops introduced between the agent and the model provider. As a rule of thumb, each additional hop creates a vendor relationship that requires security review. When evaluating any compression tool, count the hops:
If the tool adds a hop beyond the direct model call, auditors should treat it as a potential disclosure point, regardless of how much the payload is shrunk. This simple metric lets organizations apply a consistent, evidence‑based gatekeeping process to any context‑compression solution.

Headroom routes every LLM request through a fixed local intercept (127.0.0.1:6767). The client configuration is simple:
ANTHROPIC_BASE_URL=http://127.0.0.1:6767
OPENAI_BASE_URL =http://127.0.0.1:6767/v1
When a request arrives at port 6767, a lightweight Rust intercept proxy (the “shell”) immediately forwards it to the second hop, the managed Python backend (the “brain”) on port 6768. The Python layer applies the Headroom + RTK optimization pipeline, then opens the final upstream call to the real provider (e.g., api.anthropic.com or api.openai.com). By design, nothing exits 127.0.0.1 except that single upstream HTTP request — the same request the client would have made without Headroom source.
| Layer | Responsibility | Language |
|---|---|---|
| Shell | Tauri‑based tray UI, lifecycle management, automatic installation of the proxy, detection of supported clients, delivery of updates | Rust |
| Brain | Runs the Headroom compression engine and the RTK context‑reduction pipeline; forwards the optimized payload to the provider | Python |
This split lets the always‑on proxy remain a tiny, stable binary, while the heavy‑weight optimization lives in a language ecosystem that developers can extend.
The default internal port is 6768. If that port is already bound, the proxy scans the range 6768 – 6790 and selects the first free port. The chosen port can be overridden via the HEADROOM_BACKEND_PORT environment variable. This probing behavior, as well as the watchdog that automatically restarts the proxy if either hop crashes, are baked into the current release and may change in future versions.
For monitoring and runbooks, the intercept port exposes a simple stats endpoint:
GET http://127.0.0.1:6767/stats
When the proxy is active, the endpoint returns a JSON document containing process uptime, active client count, and the current backend port. This built‑in check enables teams to script health verification without attaching debuggers.
/stats JSON schema are likewise tied to the current version of the desktop app. When upgrading, verify the release notes for any changes to these values.By keeping the entire compression stack on the developer’s machine and limiting network egress to a single upstream call, Headroom provides a clear privacy boundary while maintaining a plug‑and‑play deployment model.

Headroom’s proxy is deliberately split into two hops:
| Hop | Port | Role | Mobility |
|---|---|---|---|
| Outer hop | 127.0.0.1:6767 (Rust intercept) | The address that every client configuration points to. It is the only network location the developer’s tooling ever sees. | Fixed – never changes while the proxy is running. |
| Inner hop | 127.0.0.1:6768 (Python optimization backend) | Performs the heavy‑weight context‑compression pipeline and then forwards the request to the real LLM provider. | Movable – may be restarted, upgraded, or rebound to a different free port. |
Immutable client surface – Because the outer hop is the sole entry point that appears in ANTHROPIC_BASE_URL, OPENAI_BASE_URL, or similar environment variables, keeping it static guarantees that a developer never has to edit .bashrc, VS Code settings, or any other dotfile when the proxy is upgraded or the backend crashes. The port is hard‑coded at compile time in the Rust binary, so the address is always :6767【source】.
Isolation of instability – The Python stack is where upgrades, wheel changes, and occasional port collisions happen. By allowing it to bind to any free port in the range 6768‑6790, the proxy can silently retry a different port if the default is already in use. This “port‑probing fallback” makes the interior hop collision‑tolerant without forcing the user to change their client configuration【source】.
Small always‑on surface – The Rust intercept layer stays up continuously and does only lightweight forwarding. All heavy computation, hot‑reloading, and crash recovery happen behind it. If the backend dies, a built‑in watchdog restarts the Python process and re‑establishes the interior connection, preserving the outer hop’s availability【source】.
Dual‑path routing configuration – Routing is written in two places: an in‑config block (e.g., a JSON or TOML snippet that the GUI reads) and a managed shell export that is added to the user’s profile. Both are delimited by recognizable comment markers such as # >>> headroom:… >>>. During uninstall, the proxy removes every block that matches these delimiters, ensuring the system’s PATH and PYTHONPATH return to their pristine state. The exact marker format can change between releases, but the fences remain present, allowing automated clean‑up scripts to locate them reliably【source】.
Zero re‑configuration on upgrades – When a new wheel is installed or the backend process restarts, the client continues to talk to 127.0.0.1:6767. No sed‑style edits of .bashrc or editor settings are required.
Crash‑tolerant user experience – The watchdog guarantees that a transient crash of the Python layer does not break the outer hop; the proxy simply reconnects to the newly spawned backend.
Predictable network footprint – Only one outbound connection leaves the machine – the final call to the LLM provider. All intermediate hops remain on localhost.
Rule of thumb for custom local proxies – Keep the address exposed to client code immutable. Push every source of volatility (process restarts, port selection, dependency upgrades) into an interior hop that can be probed, restarted, and cleaned up without touching the client‑facing configuration.
Following Headroom’s pattern eliminates the need for manual dotfile edits, reduces the attack surface, and makes audit trails straightforward: the immutable outer hop can be scanned once, while the interior hop can be examined separately for version‑specific guarantees.

Headroom’s “zero‑host‑pollution” claim rests on a deliberately isolated installation model. When the desktop proxy is installed, it creates its own managed Python runtime (≈2 GB) inside the platform‑specific application‑support directory (e.g., ~/Library/Application Support/Headroom on macOS, similar paths on Windows and Linux) 【3†content】. The system Python interpreter is never touched and no pip install --user operations are performed, so the global PATH, the user’s shell configuration, and any existing Python environment remain unchanged.
The only exception is an optional, reversible addition to PATH that points to the bundled rtk tool; this entry is removed automatically on uninstall 【1†content】. Because all heavy components (the runtime, rtk, and the pre‑built vendor wheels) are fetched on first launch and stored privately, the Tauri front‑end stays tiny (a few megabytes) while the runtime stays sandboxed 【3†content】.
Headroom installs the headroom-ai package from a single pinned wheel. Three constants in the Rust source (HEADROOM_PINNED_VERSION, HEADROOM_PINNED_WHEEL_URL, HEADROOM_PINNED_SHA256) define the exact version, download URL, and SHA‑256 checksum that are verified before execution 【2†content】. The same pattern is applied to every bundled artifact—rtk, the Python runtime itself, and the vendor‑wheel index—each with one version string and one checksum per platform. Automatic upgrades are disabled; a new release updates all three constants together, guaranteeing that the binary and its Python dependencies always match the declared version (e.g., 0.8.2 in the current release) 【2†content】.
In practice, uninstalling Headroom removes the entire support directory and the optional rtk PATH entry, leaving the host environment exactly as it was before installation. This design gives teams a strong guarantee that confidential code and tooling never leak into a shared Python environment, while still allowing the proxy to perform aggressive context compression locally.

Headroom’s local‑proxy installer touches a handful of configuration files only after making a timestamped backup (e.g. settings.json.20231118‑124530.bak). The backup name includes the date‑time of the edit, enabling a deterministic restore if the user disables or removes Headroom.
| Client | Concrete edit(s) | Backup behavior |
|---|---|---|
| Claude Code | • Adds a PreToolUse hook entry in ~/.claude/settings.json<br>• Installs a routing script at ~/.claude/hooks/headroom‑rtk‑rewrite.sh<br>• Inserts an env block referencing http://127.0.0.1:6767<br>• Appends a managed shell export (wrapped in # >>> headroom … >>> markers) | Writes settings.json.<timestamp>.bak before any change |
| Codex | • Inserts a Headroom provider block in ~/.codex/config.toml, fenced with # >>> headroom:provider >>> … # <<< comments<br>• Adds an OPENAI_BASE_URL export to the managed shell block<br>• Retags existing thread entries to the new provider | Writes config.toml.<timestamp>.bak before edit |
| OpenCode | • Replaces the provider base URLs in its config with http://127.0.0.1:6767<br>• Deploys a tiny transport plugin that forwards requests to the local proxy | Writes a timestamped copy of the original config |
| Grok Build | • Adds a GROK_CLI_CHAT_PROXY_BASE_URL export inside the managed shell block (again surrounded by Headroom markers) | Backed up before insertion |
All edits are scoped to the managed shell block so that ordinary shell startup scripts remain untouched. When Headroom is disabled, the block is removed, returning the environment to its pre‑install state.
1. Quit or pause – temporary stop of the proxy
2. Uninstall – full removal
~/Library/Application Support/Headroom, ~/Library/LaunchAgents/com.headroom.proxy.plist, ~/Library/Preferences/com.headroom.plist) so the user can confirm the full cleanup.Snapshot the affected dotfiles yourself before Headroom touches them. While Headroom’s internal backup mechanism is reliable, a manual copy (e.g. cp ~/.claude/settings.json ~/.claude/settings.json.pre‑headroom) gives an extra safety net and makes rollback independent of the proxy’s state. This practice is especially important in tightly controlled environments where any unexpected script modification must be auditable.

1. Deliberate, unavoidable egress
messages list that LiteLLM passes upstream【0†https://docs.litellm.ai/docs/proxy/headroom】.2. Maintenance‑time network traffic (no user‑authored content)
| What leaves the machine | When it happens | Where it goes | Mitigation / offline option |
|---|---|---|---|
| Managed Python runtime & pinned wheels (first launch) | Installation of the desktop app | Download URLs baked into the Tauri binary (SHA‑256‑verified)【1†https://github.com/gglucass/headroom-desktop】 | None – required for the local runtime; can be pre‑downloaded behind a proxy. |
| GitHub Releases poll (built‑in updater) | Background check, once per day, prompts before installing | https://api.github.com/repos/gglucass/headroom-desktop/releases (Tauri updater)【2†https://github.com/gglucass/headroom-desktop】 | Disable the UI prompt or set HEADROOM_UPDATE_CHECK=off in the desktop settings. |
| ONNX Runtime binary | First use of the ML compressor (pip/npm install) | https://cdn.pyke.io/onnxruntime/...【3†https://explainx.ai/blog/headroom-ai-context-compression-agents-guide-2026】 | Set ORT_STRATEGY=system and point ORT_LIB_LOCATION to a system‑installed ORT to skip the download. |
| Kompress‑base model | On‑demand model loading (pip/npm install) | https://huggingface.co/.../kompress-base【3†https://explainx.ai/blog/headroom-ai-context-compression-agents-guide-2026】 | Export HF_HUB_OFFLINE=1 after pre‑downloading the model, or use a private mirror via HF_ENDPOINT. |
These downloads are not user data, but they matter in corporate‑proxy or air‑gapped environments because they still traverse the network.
3. Honest limits
4. Version‑sensitive teardown
The current pip/npm CLI does not expose a single headroom uninstall command. The open tracker issue #748 describes teardown as a “multi‑command scavenger hunt”: each wrapped tool must be unwrapped, the MCP server removed, the supervisor‑managed service torn down, and finally the headroom-ai package uninstalled via pip or npm — a process that differs from the desktop app’s one‑click uninstall【4†https://tokenade.net/en/articles/headroom-alternatives】.
Recommendation
Before deploying in regulated environments, audit the egress list against the latest documentation (e.g., check the CLI readme for any new uninstall helper or offline‑mode flags) and verify that corporate firewalls allow the listed URLs or that pre‑downloaded assets are staged locally.

When a vendor promises that only the final request reaches the LLM provider, the claim can be verified locally without contacting the vendor. Headroom’s design makes this possible because the entire compression stack lives on the developer’s machine and the only network egress is the upstream API call.
1. Detect the proxy is running
Headroom installs a fixed‑port HTTP interceptor on 127.0.0.1:6767 — the “intercept port” that client configurations point at 【source 2】. The proxy also exposes a /stats endpoint that can be queried with a plain GET request (or via the built‑in /headroom stats slash command) to confirm the process is alive and to see per‑request token savings 【source 2 (slash commands)】. A simple check such as:
curl -s http://127.0.0.1:6767/stats | jq .
should return JSON with request counts, saved tokens, and uptime. If the endpoint is unreachable, no proxy is active.
2. Identify the ultimate LLM provider
Headroom never rewrites the provider hostname; it merely forwards the request. Inspect the client’s environment variables or configuration file (e.g., ANTHROPIC_BASE_URL or OPENAI_BASE_URL)—they should still point at api.anthropic.com, api.openai.com, etc., after the proxy has stripped the local prefix. This confirms that the final hop goes to the provider you already trust.
3. Verify what is written locally
The repository publishes a full write‑list in its install documentation and repeats it in the uninstall dialog 【source 1】. Files are confined to a dedicated application‑data directory (e.g., ~/Library/Application Support/Headroom on macOS) and to backup copies of any client config that Headroom modifies. Before confirming removal, the uninstall UI enumerates every path that will be deleted, allowing a final manual audit.
4. Look for accidental logs of raw content
Headroom’s local logs live under the same application‑data folder. Review the logs/ subdirectory for any entries that might contain uncompressed prompts, tool output, or retrieved documents. The open‑source Tauri shell and Python backend are both MIT‑licensed, so you can read the source to see exactly what is written 【source 4】.
5. Apply an independent due‑diligence checklist
| Checklist item | How to verify |
|---|---|
| Upstream endpoint | Confirm the *_BASE_URL still resolves to the official provider DNS. |
| Raw data storage | Search the Headroom data directory for files larger than a few kilobytes; inspect their contents. |
| Local log leakage | grep for known secret patterns (e.g., API keys, credentials) in logs/*.log. |
| Organizational policy | Ensure your security policy permits running third‑party local proxies; record the version and checksum of the installed binary. |
| Provider data‑use policy | Review the LLM provider’s terms to understand whether submitted payloads may be used for model training. |
6. Treat “local” as an observable property
tcpdump or Wireshark) and confirm the only external destination is the provider’s API endpoint.7. Limits of the guarantee
Headroom removes any third‑party compression service from the data path, but it does not change the downstream obligations you have toward the LLM provider. Compliance (e.g., GDPR, HIPAA) remains the responsibility of the team using the model, not of the proxy topology.
By systematically probing the local proxy, reviewing its disclosed file writes, and confirming the final network hop, engineers can turn marketing language into a verifiable security posture.