RJ.Raja Jeevan
Product & commerce
AI Generalist
← All portfolioExperiments · Claude Code · Token efficiency

Token-Saving Setup for Claude Code: The One-Prompt Installer

One copy-paste prompt that turns Claude Code into its own setup engineer: an audit first, three verified open-source token-saving tools, four local gap mods, a PDF user guide, and an opt-in maintenance policy with backup and rollback. Smoke-tested components, honest limits, every source linked.

Most of what a Claude Code session spends is not your words. It is command output, big files, web pages and screenshots being read again and again by the most expensive model in the room. This page is a self-help installer: one copy-paste prompt that turns Claude Code itself into the setup engineer for your own machine, on Mac or Windows.

Paste the prompt into Claude Code and it audits your setup first, shows you exactly what it plans to install and where, waits for your go-ahead, installs three verified open-source tools from their official repos, writes four small local mods to fill the gaps, hardens the result, leaves you a PDF user guide, and offers an opt-in maintenance policy: automatic safe updates with backup and rollback, or ask-first, your choice at setup. Nothing is overwritten without a dated backup, and anything uncertain stops and asks rather than guessing.

An honest note before you use it: this is an untested blueprint, not a proven installer. We have not run this prompt end-to-end ourselves, and no savings figures on this page are from our own testing. The three tools it installs are real, actively maintained open-source projects, linked below with their own licenses; the figures quoted for them are their authors’ claims, not our measurements. The Claude Code mechanisms the prompt relies on are checked against current official documentation. Treat the first run as a supervised setup: read the audit, confirm the folder, review what it creates, and measure before you trust the savings.

Where the tokens go, and what pays it back

Value map pairing seven token drains with the components that address them and the business value each protects
The value map: seven token drains, the component that addresses each one, and the business outcome it protects.

What the prompt installs, and what each part does

The installer works in two tiers. First come three verified open-source tools, installed from their official repositories with their licenses intact. Then four small local mods, written fresh for your machine, cover what those tools do not.

RTK – quieter command output

Test runs, git output, builds and logs are compressed before your agent reads them: failures with their assertions, one line per commit, matches grouped by file. Over a hundred commands are covered, and rtk gain shows what was saved, per day and in total. Installed via Homebrew on Mac, winget on Windows, or the project’s own script. One licensing detail worth knowing: the default binary ships a BUSL-1.1 engine; setting RTK_EDITION=oss with the install script installs the Apache-2.0 build. By rtk-ai.

Headroom – smaller reads before they reach the model

A local proxy that compresses tool outputs, logs, files and RAG chunks before they reach the model, with the originals cached on your machine for on-demand retrieval. Compression itself runs locally. Sessions save tokens when launched through headroom wrap claude, which routes that session’s API traffic through the local proxy, so the prompt skips Headroom entirely when it finds a custom provider setup such as Bedrock, Vertex or an existing base URL, and never changes provider or auth settings on its own. Needs Python 3.13 via uv. Apache-2.0 license, by Headroom Labs.

Ponytail – less code, visible spend

A Claude Code plugin that makes the agent write only what the task needs, never cutting validation, security or tests, and shows a band above the prompt with the current task’s cost, tokens and agent time. It adds /ponytail-review and /ponytail-audit for senior-dev-style reviews. The band needs Claude Code 2.1.290 or later. MIT license, by Dietrich Gebert.

Four local mods that fill the gaps

  • Handoff – a /handoff command that writes a structured continuation prompt, so long work survives a fresh chat.
  • Research router – web research moves to a cheaper subagent; a brief with numbered sources comes back.
  • Cache clock – a status line showing time since your last message, clearly labelled an approximation of cache warmth.
  • Screenshot shrinker – a hook that swaps large screenshots for a downscaled copy before the model reads them, keeping the original untouched.

The prompt’s audit phase checks for overlap before writing any of these, so a tool you already have is never duplicated.

Setting it up: one prompt

Six-step loop: paste one prompt, audit and plan, verified tools, gaps filled, guide and upkeep, measure
From one pasted prompt to audited, maintained, measured setup.

Copy everything in the box below and paste it into Claude Code on the machine you are setting up. It will audit before it touches anything, show you the plan and the install folder, and wait for your confirmation.

You are my Claude Code setup engineer. Set up token-saving tooling on this machine end to end, in the phases below. Print a one-line status at the start of each phase. Work on Mac or Windows; write scripts in the native shell of this machine.

PHASE 1 - AUDIT. Report only, change nothing yet:
- My OS and shell; which package managers exist (brew, winget, uv, pip, curl).
- My Claude Code version and where my config lives (~/.claude, ~/.claude.json, project .claude).
- My existing hooks, subagents, slash commands, plugins, status line and MCP servers, so nothing you add collides with them.
- Any custom model provider configuration (ANTHROPIC_BASE_URL, Bedrock, Vertex, a gateway or proxy) - this decides whether Headroom is safe to use.
Then show me an install plan: exactly which components you will install, the precise command for each, and the folder you will use for scripts, logs and backups. Ask me to confirm or change that folder before installing anything.

PHASE 2 - INSTALL VERIFIED OPEN-SOURCE TOOLS, only where compatible, only from their official repos. Keep their licenses and attribution intact; never modify their code:
- RTK (github.com/rtk-ai/rtk): compresses the output of 100+ dev commands before the agent reads them. Install via brew on macOS, winget on Windows, or the project's official install script; then run "rtk init -g" for Claude Code. Verify with "rtk gain". Note for me which edition you installed: the default binary ships a BUSL-1.1 engine, while RTK_EDITION=oss with the install script installs the Apache-2.0 build; if I care, offer me the choice.
- Headroom (github.com/headroomlabs-ai/headroom, Apache-2.0): a local proxy that compresses tool outputs, logs and files before they reach the model. Install with: uv tool install --python 3.13 "headroom-ai[all]". Verify with "headroom doctor". Sessions save tokens only when launched via "headroom wrap claude", which routes that session's API traffic through the local proxy. IMPORTANT: if my audit found a custom provider setup (Bedrock, Vertex, an existing ANTHROPIC_BASE_URL or gateway), do not wrap and do not change any provider, base URL, key or auth setting - skip Headroom and tell me why.
- Ponytail (github.com/DietrichGebert/ponytail, MIT): a Claude Code plugin that keeps solutions minimal and adds a per-task cost/token band plus /ponytail-review and /ponytail-audit. The band needs Claude Code 2.1.290 or later. If my version supports installing plugins from the CLI, install it; otherwise print the exact "/plugin marketplace add DietrichGebert/ponytail" and "/plugin install ponytail@ponytail" commands for me to run myself.
Skip any component whose prerequisite is missing or whose version check fails, and list each skip with its reason in the final checklist. RTK compresses at the command level and Headroom at the proxy level; if both are installed their savings overlap - note this in the guide and use each tool's own reporter (rtk gain, headroom savings) separately when measuring.

PHASE 3 - FILL THE GAPS with small local mods you write fresh for my OS, inside the folder I confirmed, and only where they do not duplicate what Phase 2 installed:
- /handoff: a slash command that writes a structured continuation prompt (goal, current state, open questions, next steps) for starting a fresh chat when this one grows long.
- A research router: a subagent on a cheaper model that takes web research out of the main chat and returns a brief with numbered sources.
- A cache clock: a status line script showing time since my last message, clearly labelled as an approximation of cache warmth, not a provider readout. If a status line already exists, merge this into it; never replace it. Do not assume it is compatible with Ponytail's band or any other plugin UI: after setup, inspect a live session and confirm everything renders correctly, and if anything looks wrong, disable the cache clock and tell me.
- A screenshot shrinker: a PreToolUse hook on the Read tool that detects large screenshots and rewrites the call (via updatedInput) to a downscaled copy, keeping the original untouched. Its matcher (Read) differs from RTK's (Bash), which lowers the chance of collision but does not prove compatibility: after setup, run one real compressed command and one real screenshot read, and if either output looks wrong, disable the shrinker and report.
Hook events accept lists of handlers: always append my hooks alongside existing ones (Ponytail registers its own SessionStart hook; RTK registers a PreToolUse hook on Bash), and never remove or reorder existing entries. Then verify in a live session that every hook, old and new, still fires as expected; stop and report any unexpected behavior instead of working around it. Never overwrite any config file without leaving a dated backup next to it first.

PHASE 4 - HARDEN AND SECURE:
- Everything lives in the folder I confirmed; scripts are not world-writable.
- No outbound calls beyond what the installed tools themselves document; no telemetry added by you. Record in the guide what each tool can see: RTK logs command statistics locally, Headroom's local proxy processes LLM traffic on this machine, Ponytail stores its band data locally.
- Every hook fails safe: if a dependency is missing it exits quietly and changes nothing.

PHASE 5 - MAINTENANCE, AS AN EXPLICIT OPT-IN:
Offer me two modes and use the one I pick:
(A) Automatic safe updates: when a Claude Code session starts, the SessionStart health check may update an installed tool by itself only when ALL of these hold:
- The candidate is a patch or minor release from the tool's official source; review its release notes from the official repo first, and refuse any unreviewed mirror or repackaged build.
- Record the exact currently installed version and the exact command that returns to it before upgrading. If the tool's install path cannot reinstall that pinned version, there is no rollback and the update is not automatic: list it for my decision instead. A config backup alone is not rollback.
- After upgrading, re-run the health check plus one functional test per tool (a compressed command for RTK, headroom doctor for Headroom, a plugin presence check for Ponytail). If anything fails, return to the pinned version and tell me.
A patch or minor version number alone is not evidence of safety. Anything major, security-sensitive, conflicting, or unclear is never auto-applied: list it for my decision.
(B) Ask-first: the health check only reports available updates; nothing is applied without my yes.
Either mode: checks run only when Claude Code runs - at most once a week, gated by a timestamp file. Do not install any background scheduler, launch agent or cron job unless I explicitly authorize one, and if I do, it runs only the same health-check script. Never describe the setup as always fresh; the guide states exactly when updates happen and which mode I chose. Include one documented OFF switch and per-tool uninstall steps (headroom unwrap, rtk's uninstall, plugin removal, deleting the mod files) with rollback from the dated backups.

PHASE 6 - USER GUIDE:
- Write a plain-language user guide as HTML in the install folder: what was installed and which RTK edition, what each part does, the daily commands, how to measure savings (per tool, since RTK and Headroom overlap), the maintenance mode I chose and when updates actually run, the privacy notes, how to update, how to roll back, and how to uninstall cleanly.
- Convert it to PDF with whatever exists on this machine (pandoc, or the browser's print-to-PDF). If no converter exists, leave the HTML and give me exact print-to-PDF steps instead.

FINISH by printing a verification checklist: every file you created, every hook, plugin and command you registered, every tool with its version and edition, the maintenance mode chosen, and one safe test I can run for each. If anything conflicts with my existing configuration in a way you cannot merge cleanly, stop and show me the conflict instead of guessing.

RULES THROUGHOUT: ask before installing anything not listed here; use only the official sources named above; stop on ambiguity rather than guessing; preserve my existing provider, auth and permission settings unless I approve a change; no paid tiers, accounts or API keys.

Using it day to day

After setup, the tools are quiet helpers:

  • Run sessions through headroom wrap claude when you want compression on; your normal launches stay untouched.
  • rtk gain shows what compressed command output has saved, today and in total.
  • The Ponytail band shows each task’s cost and tokens as you work; /ponytail-review gives a senior-dev review of a change.
  • /handoff writes the continuation prompt when a chat grows long.

Measuring the benefit

Each tool reports its own numbers: rtk gain for command output, headroom savings and its dashboard for compression, the Ponytail band and board for per-task cost. Treat them as three views of one question: is the same work costing less? Note that RTK compresses at the command level and Headroom at the proxy level, so their reported savings overlap; measure with each tool’s own reporter rather than adding the numbers. Savings figures only exist once the setup has actually run on your machine; until then, everything on this page is design intent plus the tool authors’ own claims.

Trade-offs, honestly

For each component, the expected benefit alongside the trade-off to watch
Each component’s expected benefit, paired honestly with what to watch. Vendor and author figures are their claims, not our measurements.

How it stays maintained: an opt-in policy

At setup the prompt asks you to pick one of two maintenance modes, and the user guide records your choice:

  • Automatic safe updates. When a Claude Code session starts, a health check confirms every tool is still on PATH, hooks and plugins still registered, versions unchanged. It may then apply an update by itself only when all of these hold: the candidate is a patch or minor release from the tool’s official source with its release notes reviewed; the exact installed version and its downgrade command are recorded first, because a config backup alone is not rollback; and after upgrading, the health check plus one functional test per tool passes, with a return to the pinned version on any failure. A version number alone is not evidence of safety, and anything major, security-sensitive, conflicting or unclear is never auto-applied; it is listed for your decision.
  • Ask-first. The same health check runs, but updates are only reported, never applied without your yes.

Two honest boundaries. Checks run only when Claude Code runs, at most once a week; no background scheduler, launch agent or cron job is installed unless you explicitly authorize one, and even then it only runs the same health-check script. And no installer can promise zero conflicts or permanently fresh installations: this one is built so that anything uncertain stops and asks instead of overwriting a working setup, and one documented off switch plus dated backups keep rollback close.

Limits and honest notes

  • This prompt has not been executed end-to-end inside Claude Code by us; the first run on any machine is a supervised setup, and the audit step exists so you can see the plan before anything changes. What we could test in an isolated Linux sandbox at no cost, we did: RTK 1.2.0 installed via its official script and its rtk gain savings tracking works; Headroom 0.42.0’s compress() ran offline on synthetic tool output and cut it materially; Ponytail’s plugin structure, hooks and MIT license check out. What remains untested here: the full prompt running inside Claude Code, Mac and Windows install paths, and Ponytail’s band.
  • Savings figures quoted for RTK, Headroom and Ponytail are their authors’ measurements. RTK’s own docs note that compressed command output is one part of the token bill, and that its absolute token counts are byte-based estimates; independent verification of bill impact is still preliminary.
  • Headroom’s savings apply to sessions launched through its wrap command; it needs Python 3.13 via uv. Ponytail’s band needs Claude Code 2.1.290 or later and does not appear in every client.
  • The PDF guide is produced with whatever converter the machine has; where none exists, the prompt leaves an HTML guide with exact print-to-PDF steps.
  • The tools are free and open source; some of their publishers also sell hosted tiers, which this setup does not use.

Sources and credit

Beyond setup

Token efficiency is one lever in making AI-assisted delivery dependable. If you want help choosing where these tools fit a real workflow, or auditing what your team’s agent setup actually costs, that is the kind of work I do. Work with me.