
I'm going to show you four specific repositories that can dramatically cut your token usage when you're working with Claude Code or any other AI agent. Not theory, not vague advice: actual tools you can install right now and start seeing the difference. I'll walk through what each one does, how they work together, and exactly how to get them running on your local machine. No fluff, let's get into it.
RTK: Trim Bash Command Output and Save 60-90% Tokens
The first tool is called RTK. Think of it as a CLI proxy that sits between your large language model and your command line. Every time your AI agent runs a shell command, like git status, that output can easily be 600 tokens of noise. When that full output gets sent back to the model, you're paying for every single one of those tokens, even the parts that aren't useful.
RTK changes the game. Instead of letting the raw output flood your context, RTK runs the command, captures the result, and trims it down to only what matters. So that same 600-token output might get compressed to 300 tokens before it ever reaches the model. That's how you get the 60-90% reduction on command-line token consumption. The model still gets the information it needs, but without the bloat.
Installing it is dead simple. Copy the install command from the repo and paste it into your terminal. Once it's done, clear your terminal and run the init command. If you want it globally, just do rtk init and it'll hook into your default AI agent. By default it targets Claude Code, but you can also set it up for Codex, Hermes, or whatever you're using. It'll ask you to confirm the global registration, and you're off.
After that, just start your AI agent like normal. RTK is now intercepting every bash command behind the scenes. To see how much you're actually saving, run rtk gain. It'll show you a live tally of tokens saved versus tokens consumed. I ran a quick session where I asked Claude to commit changes and push to a remote branch. Before the job, the saved count was 100 tokens out of about 1,300 total. After the push, it jumped to 200 tokens saved. That's 200 tokens I didn't have to pay for, just by filtering out the noise from command outputs. Saving something is always better than saving nothing, and this scales fast the more your agent interacts with the shell.
Headroom: Compress Conversation History Without Losing Context
RTK handles the noise from CLI commands, but what about the conversation itself? By default, large language models don't have memory. Every message you send builds on the entire history. By the time you're on the 20th or 40th exchange, that context window is stuffed with repetitive information, and every request becomes more expensive.
You might think, "Well, Claude Code has /compact for that." And it does. /compact summarizes the conversation to free up context. The keyword there is summarizes. When you summarize, you lose nuance. Important statements, constant values, subtle decisions: they can get lost in translation. That's where Headroom comes in.
Headroom is a proxy that stands between your request and the large language model. Every time you send a message, Headroom intercepts it, scans the entire conversation history, identifies repetitive or redundant parts, and compresses them. It doesn't summarize and risk dropping critical context. It removes the fluff while keeping the signal intact. The result is a leaner prompt that costs fewer tokens to process, without sacrificing the quality of the model's response.
Installation is straightforward. Pick your package manager: npm, pip, uv, whatever you prefer. I used npm. Once installed, you wrap your AI agent with headroom wrap claude (or codex, or hermes). That's it. Now every request goes through Headroom first.
To see the impact, open a second terminal and run headroom dashboard. It gives you a live view of your token usage: input tokens before and after compression, agent usage, and savings percentage. I fired up a session, asked Claude to simplify a project using a skill, and let it run. Even without a long back-and-forth, the dashboard showed that after processing, we'd gone from 3.88 million tokens down to 3.77 million. That's only a 1% saving in that short test, but the real power kicks in when you have dozens of turns. The more repetitive your conversation gets, the more Headroom shaves off.
Ponytail: Make Your AI Write Less Code (Like a Lazy Senior Dev)
So far we've focused on input tokens: the data you send to the model. Now let's talk about output tokens. Every line of code the AI generates costs you tokens. The more verbose the output, the more you pay.
Ponytail is a skill that makes your AI agent think like the laziest senior engineer you've ever met. What does that mean? When you tell an AI to build an app, it'll happily spit out thousands of lines of code across dozens of files. Sure, that feels productive, but a lot of that code is boilerplate, over-engineered, or just plain excessive. More lines means more tokens, more money, and more time spent reviewing.
Ponytail flips that. It embeds a mindset into Claude Code that says: "Write the same app, but with as few lines as possible, while keeping it clean and functional." If 1,000 lines cost 1,000 tokens, and 100 lines cost 100 tokens, you're looking at a 10x reduction in output cost. Plus, reviewing 100 lines is a whole lot easier than wading through a thousand. You save time, you save money, and you still get the job done.
I've covered Ponytail in a dedicated video before, but here's the quick install. Copy the two commands from the repo. The first one adds the skill to your marketplace. The second installs it. You can choose to install it globally or per project; I went with project scope. After a quick plugin reload, your AI agent will start using Ponytail whenever you ask it to build something. It's not about cutting corners, it's about being deliberate. The lazy senior dev knows exactly what's needed and doesn't write a single line more.
Graphy: Turn Your Codebase into a Queryable Knowledge Graph
The last tool tackles a different kind of token waste: the endless back-and-forth when the AI tries to find something in your project. You've seen it. You ask Claude to modify a function, and it starts running grep, find, and ls over and over. Each command eats tokens, and each round of "is this what you meant?" adds to the bill.
Graphy solves this by turning your entire codebase, or any documentation, into a queryable knowledge graph. Instead of hunting through files with shell commands, the AI gets a map. That map tells it exactly where every function, file, and service call lives. The first time you run Graphy, it indexes your project and produces a structured file (like JSON or text). After that, when your agent needs to locate something, it reads the map instead of firing off a dozen CLI calls.
The result is faster lookups and a massive reduction in token usage. No more wasted turns. No more paying for the model to guess and retry. Graphy gives your agent a second brain for your codebase, and that's a direct line to the information it needs.
Installation follows the same pattern: grab the commands, set it up, and let it index your project. Once that's done, your AI agent can query the graph instead of the raw filesystem. It's one of those things that feels like a cheat code once you start using it.
Key Takeaways
- RTK acts as a CLI proxy that trims bash command outputs before they hit your model, cutting token usage from shell interactions by 60-90%.
- Headroom compresses your conversation history by removing repetitive information without summarizing, preserving context while slashing input token costs.
- Ponytail forces your AI agent to write minimal, efficient code like a lazy senior dev, dramatically reducing output tokens and making review faster.
- Graphy converts your codebase into a knowledge graph so the AI can find files and functions instantly, eliminating the expensive back-and-forth of CLI searches.
- All four tools work together: RTK and Headroom optimize input tokens, Ponytail handles output tokens, and Graphy speeds up codebase navigation, all adding up to serious savings.
These four repositories cover both sides of the token equation: what you send to the model and what you get back. RTK keeps your shell commands lean. Headroom keeps your conversation history tight. Ponytail makes sure the code you receive isn't bloated. And Graphy stops your agent from burning tokens on endless filesystem searches.
If you're building with AI agents regularly, these aren't just nice-to-haves. They're the difference between a $20 session and a $5 one. Install them, wrap your agent, and watch the numbers drop. I've put all the links in the description. Try them out, and if this helped, hit like and subscribe for more practical AI agent content. See you in the next one.
