Visualize your Headroom token savings in a rich, information-dense dashboard — available both as a terminal CLI and a VS Code extension. A far more detailed alternative to
headroom perf: per-project, per-model, per-agent, prefix-cache and RTK savings, trends over time, and cost in real dollars.
headroom-stats turns the raw /stats data from the Headroom AI context-compression proxy into an at-a-glance view of how many tokens — and how much money — you save when running Claude Code and other LLM agents. Track token-usage reduction, compression ratio, prefix-cache savings, and per-project / per-model / per-agent breakdowns over time, live.
Two ways to use it:
- 🖥️ Terminal CLI (
headroom-stats) — pure-Python, zero-dependency dashboard for macOS, Linux, and Windows. (this repo's main script) - 🧩 VS Code extension — a live, graphical dashboard + status-bar widget inside your editor. Tabs for Today, All Time, Sessions, Agents, Models, Projects, Cache and Layers, with filters and an in-app settings page. See
vscode-extension/.
Keywords: Headroom · LLM token savings · token usage optimization · context compression · Claude Code · AI agent cost reduction · prefix cache · RTK · savings dashboard · VS Code extension.
headroom-stats is a dashboard that visualises everything Headroom tracks about your LLM token savings in one colourful, information-dense view.
It replaces headroom perf with a far more visual and detailed overview:
| Feature | headroom perf |
headroom-stats |
|---|---|---|
| Lifetime savings summary | ✓ | ✓ |
| Per-project breakdown | — | ✓ |
| By Command table (RTK) | — | ✓ |
| Daily breakdown (15 days) | — | ✓ |
| Weekly summary | — | ✓ |
| Monthly summary | — | ✓ |
| Savings-over-time bar chart | — | ✓ |
| Session vs lifetime view | — | ✓ |
| Active config flags | — | ✓ |
| Auto-refresh watch mode | — | ✓ |
- Python 3.10+
- Headroom proxy running locally (
hr-proxy start, or just runclaude-hr) - Optional: RTK installed for the By Command section
Runs on macOS, Linux, and Windows — pure Python standard library, no dependencies. On Windows 10+ ANSI colours are enabled automatically; the RTK database is located per-OS (%APPDATA%\rtk, ~/Library/Application Support/rtk, or $XDG_DATA_HOME/rtk), overridable with RTK_DB.
macOS / Linux
# Copy to somewhere on your PATH
cp headroom-stats claude-hr hr-proxy hr-reap ~/.local/bin/
chmod +x ~/.local/bin/{headroom-stats,claude-hr,hr-proxy,hr-reap}Windows — copy the scripts somewhere on your PATH and run them with Python (python headroom-stats), or create .cmd shims. Environment overrides: HEADROOM_PORT, RTK_DB, HEADROOM_STATS_REPO.
# One-shot render (default: last 15 days)
headroom-stats
# Show more/fewer days in Daily Breakdown
headroom-stats --days=30
# Live auto-refresh every 5 seconds
headroom-stats --watch
# Custom refresh interval
headroom-stats --watch=10Four summary cards: tokens saved, cost saved, total requests, and proxy status.
Current session metrics including compression ratio, average savings %, and session start time.
Bar chart of token savings per interval, trimmed to start from the first actual activity date — no dead whitespace for periods before you started using Headroom.
Table ranked by total tokens saved, showing count, saved tokens, average savings %, average exec time, and an impact bar. Requires RTK to be installed.
Token and cost savings broken down by project, with a share bar.
Last 15 days of daily savings with dual sparkline bars. Configurable with --days=N.
All available data aggregated by ISO week.
All available data aggregated by calendar month.
Key Headroom configuration flags including Auto Memory, Force Kompress, Accuracy Guard, and compression settings — with real ON/OFF state detection.
Prefer a graphical dashboard inside your editor? The Headroom Stats VS Code extension brings the same token-savings data to VS Code:
- A status-bar widget showing live tokens spent / saved / $ saved, color-coded by savings %, with a rich hover popup.
- A glassmorphic dashboard with tabs — Overview, Today, All Time, Sessions, Agents, Models, Projects, Cache, Layers — plus charts, donuts, a token-flow view, and date/project/agent filters.
- Multi-proxy support (switch between every running
claude-hr --port Nsession) and an in-app Settings page. - Reads the Headroom proxy
/statsendpoint directly with a disk fallback — no CLI required.
→ Full details, screenshots and install instructions in vscode-extension/.
These two scripts ship in this repo. They make running Claude Code through Headroom a one-word command instead of a long incantation — and, like headroom-stats, they run on macOS, Linux, and Windows (the originals were mac/linux-only shell functions).
Normally you'd start Claude behind the compression proxy with something like:
headroom wrap claude --port 8787 --no-proxy -- --dangerously-skip-permissionsclaude-hr collapses that to just:
claude-hrWhat it does for you:
- Resolves a port —
--port Nif given, else the nearest.claude-hr-portfile walking up from the current directory, else it picks a free port and saves it to your repo root. This means each project gets its own stable proxy port, so per-project savings show up correctly in the dashboard's Per-Project Breakdown. - Auto-starts the proxy on that port if nothing is listening yet.
- Launches Claude wrapped by Headroom, with permissions skipped so you don't get prompted mid-session.
claude-hr # auto port from .claude-hr-port (or prompt once, then remembered)
claude-hr --port 9000 # force a specific proxy port
claude-hr --port 9000 chat # extra args pass straight through to claudeWith no resolvable port it falls back to Headroom's own managed proxy (--memory mode on the default port).
Auto-stop on exit: when Claude exits (including Ctrl-C), claude-hr stops that port's proxy — but only if no other client (another claude-hr session, the VS Code extension) is still connected to it. This stops orphaned proxies from piling up and eating RAM. POSIX-only (uses lsof); on Windows it no-ops.
Orphaned proxies from earlier sessions still hogging RAM? hr-reap kills every proxy that has no client connected, leaving the ones you're actively using untouched:
hr-reap # kill every idle proxy
hr-reap -n # dry-run — show what would be killed
hr-reap keep mynes # never touch a proxy whose repo dir matches "mynes""In use" = some process other than the proxy holds an ESTABLISHED connection to its port. POSIX-only (pgrep/ps/lsof).
A tiny manager for the background Headroom proxies, tracked in ~/.headroom-proxy.tsv:
hr-proxy start [PORT] # start a proxy (default 8787), remembers pid/port/dir
hr-proxy stop PORT|PID # stop one
hr-proxy list # show running sessions
hr-proxy log [PORT] # show the log file path + last linesclaude-hr calls hr-proxy's start logic under the hood, so you rarely need it directly — but hr-proxy list / stop are handy for cleaning up proxies across projects.
Why they help: together they turn "remember the port, start the proxy, wrap Claude, skip permissions" into claude-hr, and keep each project pinned to its own port so headroom-stats can attribute savings per-project.
