Four Free Tools to Stop Token Leaks in Claude Code: RTK, Caveman, Ponytail, and OmniRouteArticle · digest for November 21
Top-down view of an engineer's desk with four modular token optimization tools
Article3 sections≈ 8 min

Four Free Tools to Stop Token Leaks in Claude Code: RTK, Caveman, Ponytail, and OmniRoute

When Claude Code hits a usage limit mid-task, almost everyone reacts the same way: you write choppy prompts and ration your questions like water in a desert. It seems logical—send less text, spend fewer tokens. That's the blind spot. Your own prompts are a tiny fraction of the bill.

What really eats your quota is a snowball inside the context window. The context window is the chat's working memory: the model re-reads everything already in the thread on every single turn. If a 1,000-line raw test log lands in the history on step two, you pay to re-read it on step three, step four, and step twenty. Who reads those walls of terminal output? Not you—Claude does, and every line drains your limit.

Break down a typical session and four hidden leaks jump out:

  1. Raw terminal output. git diff, pytest, cargo test, and file listings flood the history with tens of kilobytes of noise.
  2. Model politeness. Claude happily writes three intro paragraphs where three words would do. Output tokens cost the most.
  3. Speculative code. You ask for a simple fix, and the agent builds extra wrappers and config options "just in case." Future sessions keep paying to read them.
  4. A flagship model on chores. Using top-tier Claude to rename variables or write tiny summaries is like asking a principal engineer to sort incoming mail.

You don't have to sacrifice output quality. A stack of four free, open-source tools has emerged around Claude Code—one for each leak. They also work in agents like Codex CLI, Cursor, Cline, and Gemini CLI, and take about 15 minutes to set up.

Terminal filter RTK and telegraph-style Caveman

The first two leaks—console noise and wordy answers—get sealed at the input and output.

For the terminal, there's RTK (Rust Token Killer), a lightweight Rust tool (Apache-2.0 / BUSL-1.1). It acts as a CLI hook—a command interceptor sitting between Claude Code and your shell like a faucet filter. When the agent runs git, tests, or file searches, RTK collapses duplicates and strips noise. Useful signal passes through; junk stays out. Latency is under 10 ms, so you won't notice it.

Comparison of cargo test output: 71 raw lines vs. 11 lines after RTK filtering (Source: github.com/rtk-ai/rtk)

RTK's authors claim 60–90% token savings on command output. In Julian Goldie's test, the filter cut tool output by 82.9% with no drop in answer quality.

# Option 1: via Homebrew on macOS and Linux
brew install rtk

# Option 2: official install script
BASE="https://raw.githubusercontent.com/rtk-ai/rtk"
curl -fsSL "$BASE/refs/heads/master/install.sh" | sh

# Option 3: via Cargo (strictly with --git!)
cargo install --git https://github.com/rtk-ai/rtk

# Connect the hook to Claude Code, restart, and verify
rtk init --global
rtk gain

Make sure to restart Claude Code after rtk init --global, or the hook won't load. Running rtk gain shows live savings stats. Projects heavy on tests and git see the biggest drop. In pure text discussions about architecture, the impact is small—there's simply nothing to filter.

The second leak—fluff in replies—is handled by Caveman. It's a free skill (a set of agent instructions and slash commands) by Julius Brussee under Apache-2.0. It switches Claude to telegraph style: short, blunt, no polite filler. The code itself stays byte-for-byte accurate; only the chatter disappears.

# Add the marketplace and install the Caveman plugin
claude plugin marketplace add JuliusBrussee/caveman
claude plugin install caveman@caveman

# Restart and check the plugin list
claude plugin list

In chat, turn it on with /caveman (levels from light to ultra, such as /caveman ultra), and turn it off with normal mode or /caveman off. In the repo's example, explaining an extra React re-render shrinks from 69 tokens to 19 with the exact same meaning.

Caveman report analyzing token leaks and savings across agent sessions (Source: github.com/JuliusBrussee/caveman)

There is one catch. In Julian Goldie's test project, Caveman cut output tokens by 69%, while total spend fell by roughly 30%. The skill doesn't shrink hidden reasoning (thinking tokens), and its own prompt adds a tiny weight on every turn. It shines on long text explanations, but helps less when a model thinks for minutes and outputs a short patch.

Lazy senior Ponytail and router OmniRoute

The third leak—over-engineering—is treated by Ponytail, an open-source plugin by Dietrich Gebert.

The idea is simple: turn on "lazy senior" mode. Not a slacker, but an experienced developer looking for the shortest safe path. Before creating a new file, Ponytail checks six questions: is this needed at all, does something similar already exist, can the standard library do it, are current dependencies enough, can it be a one-liner, and what's the minimal code? Core essentials—validation, error handling, security, and accessibility—stay intact.

# Run inside a Claude Code session with two commands
/plugin marketplace add DietrichGebert/ponytail
/plugin install ponytail@ponytail

Inside, you get /ponytail lite, /ponytail full (default), and /ponytail ultra, plus /ponytail-review and /ponytail-audit checks. In the author's tests, the plugin wrote 54% less code, cut run costs by roughly 20%, and sped up work by 27%. Independent JetBrains measurements on mixed tasks were smaller but steady: 15–27% savings. Ponytail keeps new features from bloating your codebase, though the difference on tiny bug fixes is modest.

The fourth tool—OmniRoute (MIT)—plugs the costliest leak. It's a local LLM routing gateway running on your machine at port 20128. You point Claude Code at this proxy, and it routes requests across over a hundred providers, more than 90 of which offer free tiers (OpenRouter, Groq, Mistral, NVIDIA NIM). API keys are encrypted locally with AES-256-GCM.

Hard tasks stay with Claude while routine work goes to free models. If one provider hits a rate limit, OmniRoute automatically falls back to the next. It even includes built-in request compression inspired by RTK and Caveman.

# Install the gateway globally and start the server
npm install -g omniroute
omniroute serve

# Configure providers at http://localhost:20128
# Auto-connect to Claude Code:
omniroute setup-claude
omniroute launch

# Or manually (strictly without /v1 at the end!)
export ANTHROPIC_BASE_URL="http://localhost:20128"
export ANTHROPIC_AUTH_TOKEN="oma_live_xxx"
claude

Once started, type /status in Claude Code to confirm traffic hits http://localhost:20128. If configuring manually, don't append /v1 to ANTHROPIC_BASE_URL—the client adds /v1/messages on its own.

The trade-off is clear: if a task needs deep architectural reasoning, free models will make mistakes and rework will wipe out your savings. Free tiers also enforce strict rate limits, so you'll need a fallback chain of providers.

LeakToolWhat it doesMain limitation
Raw terminal logsRTKFilters git, test, and file output via hookMinimal impact on chats without commands
Wordy repliesCavemanCuts fluff while keeping code exactDoesn't compress hidden thinking tokens
Speculative codePonytailLimits the agent to minimal safe codeSmaller gains on tiny bug fixes
Flagship on choresOmniRouteRoutes simple tasks to free modelsWeaker on complex architecture

Common setup traps and two free habits

Even with this stack, it's easy to lose half your savings. The #1 trap is installing the wrong RTK.

Do not install RTK with cargo install rtk

On crates.io, the short name rtk belongs to a completely different crate: reachingforthejack/rtk (Rust Type Kit for type generation). Running cargo install rtk installs that one instead. Check with rtk gain: the right tool prints a table of saved tokens. If your terminal errors out or talks about types, run cargo uninstall rtk and reinstall via brew install rtk or cargo install --git https://github.com/rtk-ai/rtk.

The second mistake is expecting 80% off in every chat. Peak savings happen in test-heavy sessions where RTK shines; calm design chats will save less. The third mistake is still chopping down your own prompts. When the model misunderstands a vague request, extra rounds of fixes burn far more tokens than two clear sentences upfront.

Finally, two habits require zero installs. First, run /clear when switching to a new unrelated task so the agent doesn't drag dead conversation weight along. Second, put CLAUDE.md on a diet. Claude Code loads this project instruction file on every session start, meaning every outdated line in it costs you again and again.

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 5