headroom: Instructions file for Codex

AGENTS.md

headroom AGENTS.md is an instructions file for Codex, OpenCode from headroomlabs-ai/headroom. It costs 946 tokens per session, scanned A, original, Apache-2.0.

Repository instructions for using and changing Headroom, a tool that compresses large messages before sending them to an AI model.

In plain words
What is it for?
It is for installing Headroom in a Python app, verifying it without a provider key, and following the repository's contribution rules.
Why use it?
It explains the correct package, import, offline checks, and usage details so contributors do not guess how the project works.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions Claude Code; mentions AGENTS.md; mentions Codex.

This is headroomlabs-ai/headroom's own configuration. It tells Codex and OpenCode how to work on headroom itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything headroom configures →

About the project

Headroom is a library, proxy, and MCP server that compresses tool outputs, logs, files, retrieval chunks, and conversation history before they reach a language model. It helps coding agents use fewer context tokens while keeping the original content available locally when needed. Its catalogue add-ons support using Headroom with agent workflows.

headroomlabs-ai/headroom · 81,156 stars · on GitHub · docs.headroomlabs.ai

Reuse

Borrowing it

Nothing to install: this file belongs to headroomlabs-ai/headroom. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/headroomlabs-ai/headroom/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/headroomlabs-ai/headroom

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for headroom AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/headroomlabs-ai/headroom/agents-md/github.svg)](https://agentmods.dev/instructions/headroomlabs-ai/headroom/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/headroomlabs-ai/headroom/agents-md"><img src="https://agentmods.dev/badge/instructions/headroomlabs-ai/headroom/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for headroom AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/headroomlabs-ai/headroom/agents-md"><img src="https://agentmods.dev/badge/instructions/headroomlabs-ai/headroom/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 946 This file is loaded in full into every session.
When invoked 946 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00946 $0.00946
Opus 5.5 $0.00378 $0.00378
Sonnet 5.5 $0.00189 $0.00189
Haiku 4.5 $0.00095 $0.00095

Measured 25d ago against content hash 8c011f404da8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

headroom AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 25d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 42 lines

How it starts

The opening of the file, as written. The whole thing — 42 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md

If you landed here to use Headroom in an app

The PyPI package is headroom-ai; the import and the CLI are headroom.

pip install headroom-ai
from headroom import compress

result = compress(messages, model="gpt-4o")  # OpenAI or Anthropic message dicts
# send result.messages instead of messages; log result.tokens_before / tokens_after / tokens_saved

In-process, no API key, no model download. HEADROOM_OFFLINE=1 makes the run zero-network (no update check, no model or pricing-table downloads, no beacon). Verify without a provider key:

HEADROOM_OFFLINE=1 python -c "from headroom import compress; log='\n'.join(f'INFO step {i} ok' for i in range(3000))+'\nFATAL disk full'; r=compress([{'role':'user','content':'What failed?'},{'role':'assistant','content':None,'tool_calls':[{'id':'c1','type':'function','function':{'name':'logs','arguments':'{}'}}]},{'role':'tool','tool_call_id':'c1','content':log}], model='gpt-4o'); print(r.tokens_before, '->', r.tokens_after, 'FATAL kept:', 'FATAL' in str(r.messages))"
  • FastAPI example: https://docs.headroomlabs.ai/docs/fastapi
  • Full docs index for agents: https://docs.headroomlabs.ai/llms.txt (hand-curated subset: llms.txt in this repo)
  • Coding agents (Claude Code, Codex, Cursor, Copilot): uv tool install --python 3.13 "headroom-ai[all]" then headroom wrap claude
  • headroom.integrations.asgi.CompressionMiddleware is for apps that serve /v1/chat/completions-style routes, not for an app that calls a provider; use compress() for that
  • Canonical repo: https://github.com/headroomlabs-ai/headroom. github.com/chopratejas/headroom redirects here; there is no headroom-sdk org. The PyPI distribution named headroom is a different project.

If you are changing this repo

  • Layout: Python package in headroom/, Rust core and PyO3 extension in crates/ (built by maturin), TypeScript SDK in sdk/typescript/, docs site (Next.js + Fumadocs) in docs/content/docs/, agent plugins in plugins/, examples in examples/.
  • Setup: uv sync --extra dev and make install-git-hooks (pre-commit, commitlint, pre-push). Python checks: uv run ruff check ., uv run ruff format ., uv run pytest. Rust checks: make ci-precheck-rust. All gates: make ci-precheck. See CONTRIBUTING.md.
  • Commits and PR titles are Conventional Commits (feat:, fix:, docs:, ...). Never edit CHANGELOG.md; release-please writes it from PR titles.
  • Every external PR needs a "Real behavior proof" section (setup, exact commands, observed output, what was not tested). Bug fixes need a test that fails before the fix.
  • One docs site: docs/, deployed by Vercel to docs.headroomlabs.ai. wiki/ and the gh-pages branch are not published; do not add content there.
  • Public API examples in README.md, llms.txt, AGENTS.md and docs/ must use names that exist in headroom/compress.py (compress, CompressResult.messages, .tokens_before, .tokens_after, .tokens_saved, .compression_ratio, .transforms_applied).
  • Savings claims anywhere in the repo must match the measured table under "Proof" in README.md: 21-57% on the four agent scenarios, 90%+ on repeated JSON arrays and log lines, little on prose.
  • Version-carrying files (pyproject.toml, plugin and marketplace manifests, sdk/typescript/package.json, server.json) are kept in step by scripts/version-sync.py and gated by scripts/verify-versions.py; add any new one to both.

Read the full file on GitHub · 42 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 25d ago First seen · 42 lines · 946 tokens per session scan A 8c011f404da8

Subscribe to this mod's changes

headroom AGENTS.md is an instructions file published in the GitHub repository headroomlabs-ai/headroom (81,156 stars, last pushed today), licensed Apache-2.0. It adds 946 tokens to every session, about $0.0038 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-05.

Related

headroom AGENTS.md compared with instructions from other repositories

headroom AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
headroom AGENTS.mdheadroomlabs-ai/headroomInstructions file81ktodayApache-2.0A946Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file196ktodayMITA9,887GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file144ktodayMITA7,230Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file196ktodayMITA5,685GitHub Copilot
langchain AGENTS.mdlangchain-ai/langchainInstructions file150kyesterdayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file196ktodayMITA3,303GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file289k2d agoMITA4,393Codex, OpenCode