Headroom
Headroom is the transport layer: it compresses fresh tool output and new turns
before they reach the model. It is not a replacement for source navigation,
code review, or a model's actual context-meter.
When to use this skill
- Install or update Headroom's CLI, proxy, persistent deployment, wrapper, or MCP server.
- Verify whether an agent is actually routed through a healthy Headroom proxy.
- Configure the code-work policy: Graphify preflight before source mutation and
Ponytail minimization only once an authoritative host context percentage reaches 60.
- Diagnose provider routing, proxy health, token savings, or a failed deployment.
When not to use this skill
- The task is source or symbol discovery without compression concerns → use
graphify or codebase-search.
- The task needs a code-size reduction review without a context policy → use
ponytail.
- The task is generic agent configuration ownership → use
agent-configuration.
Installation and persistent routing
Use the smallest upstream extra set that supports proxy, MCP, and code-aware
compression. On macOS Apple Silicon and Linux, isolate it with uv:
uv tool install --python 3.13 'headroom-ai[proxy,mcp,code]'
headroom --version
headroom deploy
headroom install status
headroom doctor
headroom deploy selects a durable local runtime, configures detected supported
clients, and starts the proxy on 127.0.0.1:8787. headroom install status and
headroom doctor are the evidence gates. A binary on PATH alone is not proof
that a client is routed through the proxy.
On Windows, install the documented MSVC and Rust prerequisites before using the
Python CLI; no prebuilt Windows wheel exists at the documented release line.
Code-work policy
The optional Claude Code hook at scripts/jeo-code-policy-hook.py applies only
to source-file Edit and Write operations. It uses a state directory outside
the worktree and never runs graphify update itself.
- On the first source mutation per session, it runs the bounded read-only
preflight
graphify scope <cwd> and, only for an existing graph,
graphify check-update <cwd>, plus headroom doctor.
- It denies that one attempt with concise retry guidance. The agent retries after
using the resulting Graphify/Headroom evidence. Markdown, data, and non-source
paths are untouched.
- If the host hook payload explicitly includes a valid
context_usage_percent >= 60, the hook denies one additional source mutation
and requires the Ponytail ladder before retrying. The ladder still preserves
validation, data-loss handling, security, and accessibility.
- If the host does not expose that exact percentage, the hook does not infer
it from transcript size, proxy savings, model names, or a presumed context
window. No invented threshold is enforcement.
Install the Claude Code adapter only after the CLI and skill are present:
bash ./scripts/setup-claude-code-policy-hook.sh --dry-run
bash ./scripts/setup-claude-code-policy-hook.sh
The adapter merges one owned PreToolUse entry into ~/.claude/settings.json,
backs up an existing regular file before changing it, preserves its permission mode,
creates a new settings file with private 0600 permissions, and refuses symlinks or
invalid JSON. It is idempotent.
Operating modes
| Need |
Command |
Evidence |
| Durable automatic routing |
headroom deploy |
headroom install status |
| Health diagnosis |
headroom doctor |
reachable, configured result |
| One-session wrapped client |
headroom wrap claude |
wrapper launch output |
| On-demand MCP tools |
headroom mcp install |
client MCP listing |
| Manual local proxy |
headroom proxy --mode cache |
/health or headroom doctor |
| Code-policy preflight |
hook-triggered graphify scope + headroom doctor |
one retryable guard decision |
Use headroom wrap <client> only for an intentional one-session path. Do not
stack it on top of an already healthy persistent deployment.
Instructions
- Check
headroom --version and headroom doctor before changing routing.
- Choose exactly one runtime path: durable
deploy, a documented persistent
install apply preset, or a one-session wrap. Do not start duplicate proxies.
- Keep Headroom credentials and provider configuration outside the project.
- For a code-work policy, install Graphify separately and use only
scope and
check-update in pre-mutation hooks. Run graphify update <scope> only when
graph freshness is actually required because it mutates .graphify/.
- Invoke Ponytail only on the authoritative
context_usage_percent >= 60 signal;
never estimate the percentage.
- Verify the code-policy adapter with
python3 scripts/jeo-code-policy-hook.py --self-test and the focused test suite before reporting it active.
Examples
Durable Claude/Codex routing
uv tool install --python 3.13 'headroom-ai[proxy,mcp,code]'
headroom deploy
headroom install status
headroom doctor
Safe context-aware minimization
A Claude Code source edit triggers the policy hook. It runs a Graphify scope
preflight and Headroom diagnostic once. If the host later supplies
context_usage_percent: 60, the next source edit is retried after applying the
existing Ponytail ladder. It does not guess a percentage when the field is absent.
Best practices
- Treat active proxy routing as a runtime property, not an install claim.
- Keep automatic hooks read-only with respect to the target repository.
- Cap command output and use argv lists; never interpolate hook input into shell.
- Make one retryable intervention per condition, then allow the agent to proceed.
- Never sacrifice trust-boundary validation, data-loss safety, security, or accessibility for shorter code.
References
1---2name: headroom3description: Install, configure, and operate Headroom, the local-first context optimization layer for coding agents. Use when the user needs proxy-level compression, Headroom MCP tools, persistent Claude/Codex/OpenCode routing, or a code-work policy that combines Headroom health with Graphify preflight and context-aware Ponytail minimization. Triggers on: headroom, headroom proxy, headroom deploy, headroom wrap, headroom mcp, headroom doctor, context compression, token savings, context budget, or Headroom code policy.4---56# Headroom78Headroom is the transport layer: it compresses fresh tool output and new turns9before they reach the model. It is not a replacement for source navigation,10code review, or a model's actual context-meter.1112## When to use this skill1314- Install or update Headroom's CLI, proxy, persistent deployment, wrapper, or MCP server.15- Verify whether an agent is actually routed through a healthy Headroom proxy.16- Configure the code-work policy: Graphify preflight before source mutation and17 Ponytail minimization only once an authoritative host context percentage reaches 60.18- Diagnose provider routing, proxy health, token savings, or a failed deployment.1920## When not to use this skill2122- The task is source or symbol discovery without compression concerns → use `graphify` or `codebase-search`.23- The task needs a code-size reduction review without a context policy → use `ponytail`.24- The task is generic agent configuration ownership → use `agent-configuration`.2526## Installation and persistent routing2728Use the smallest upstream extra set that supports proxy, MCP, and code-aware29compression. On macOS Apple Silicon and Linux, isolate it with `uv`:3031```bash32uv tool install --python 3.13 'headroom-ai[proxy,mcp,code]'33headroom --version34headroom deploy35headroom install status36headroom doctor37```3839`headroom deploy` selects a durable local runtime, configures detected supported40clients, and starts the proxy on `127.0.0.1:8787`. `headroom install status` and41`headroom doctor` are the evidence gates. A binary on `PATH` alone is not proof42that a client is routed through the proxy.4344On Windows, install the documented MSVC and Rust prerequisites before using the45Python CLI; no prebuilt Windows wheel exists at the documented release line.4647## Code-work policy4849The optional Claude Code hook at `scripts/jeo-code-policy-hook.py` applies only50to source-file `Edit` and `Write` operations. It uses a state directory outside51the worktree and never runs `graphify update` itself.52531. On the first source mutation per session, it runs the bounded read-only54 preflight `graphify scope <cwd>` and, only for an existing graph,55 `graphify check-update <cwd>`, plus `headroom doctor`.562. It denies that one attempt with concise retry guidance. The agent retries after57 using the resulting Graphify/Headroom evidence. Markdown, data, and non-source58 paths are untouched.593. If the host hook payload explicitly includes a valid60 `context_usage_percent >= 60`, the hook denies one additional source mutation61 and requires the Ponytail ladder before retrying. The ladder still preserves62 validation, data-loss handling, security, and accessibility.634. If the host does not expose that exact percentage, the hook does **not** infer64 it from transcript size, proxy savings, model names, or a presumed context65 window. No invented threshold is enforcement.6667Install the Claude Code adapter only after the CLI and skill are present:6869```bash70bash ./scripts/setup-claude-code-policy-hook.sh --dry-run71bash ./scripts/setup-claude-code-policy-hook.sh72```7374The adapter merges one owned `PreToolUse` entry into `~/.claude/settings.json`,75backs up an existing regular file before changing it, preserves its permission mode,76creates a new settings file with private `0600` permissions, and refuses symlinks or77invalid JSON. It is idempotent.7879## Operating modes8081| Need | Command | Evidence |82| --- | --- | --- |83| Durable automatic routing | `headroom deploy` | `headroom install status` |84| Health diagnosis | `headroom doctor` | reachable, configured result |85| One-session wrapped client | `headroom wrap claude` | wrapper launch output |86| On-demand MCP tools | `headroom mcp install` | client MCP listing |87| Manual local proxy | `headroom proxy --mode cache` | `/health` or `headroom doctor` |88| Code-policy preflight | hook-triggered `graphify scope` + `headroom doctor` | one retryable guard decision |8990Use `headroom wrap <client>` only for an intentional one-session path. Do not91stack it on top of an already healthy persistent deployment.9293## Instructions94951. Check `headroom --version` and `headroom doctor` before changing routing.962. Choose exactly one runtime path: durable `deploy`, a documented persistent97 `install apply` preset, or a one-session `wrap`. Do not start duplicate proxies.983. Keep Headroom credentials and provider configuration outside the project.994. For a code-work policy, install Graphify separately and use only `scope` and100 `check-update` in pre-mutation hooks. Run `graphify update <scope>` only when101 graph freshness is actually required because it mutates `.graphify/`.1025. Invoke Ponytail only on the authoritative `context_usage_percent >= 60` signal;103 never estimate the percentage.1046. Verify the code-policy adapter with `python3 scripts/jeo-code-policy-hook.py105 --self-test` and the focused test suite before reporting it active.106107## Examples108109### Durable Claude/Codex routing110111```bash112uv tool install --python 3.13 'headroom-ai[proxy,mcp,code]'113headroom deploy114headroom install status115headroom doctor116```117118### Safe context-aware minimization119120A Claude Code source edit triggers the policy hook. It runs a Graphify scope121preflight and Headroom diagnostic once. If the host later supplies122`context_usage_percent: 60`, the next source edit is retried after applying the123existing Ponytail ladder. It does not guess a percentage when the field is absent.124125## Best practices126127- Treat active proxy routing as a runtime property, not an install claim.128- Keep automatic hooks read-only with respect to the target repository.129- Cap command output and use argv lists; never interpolate hook input into shell.130- Make one retryable intervention per condition, then allow the agent to proceed.131- Never sacrifice trust-boundary validation, data-loss safety, security, or accessibility for shorter code.132133## References134135- [Integration and recovery](references/integration-and-recovery.md)136- [Code-policy hook](scripts/jeo-code-policy-hook.py)137- [Claude Code adapter](scripts/setup-claude-code-policy-hook.sh)138- [Headroom persistent installs](https://headroom-docs.vercel.app/docs/persistent-installs)139- [Headroom installation](https://headroom-docs.vercel.app/docs/installation)140- [Headroom MCP](https://headroom-docs.vercel.app/docs/mcp)141- [Graphify](../graphify/SKILL.md)142- [Ponytail](../ponytail/SKILL.md)143- [Skill standard](../skill-standardization/SKILL.md)