rtk
by rtk-ai
Command-line proxy that reduces how many tokens AI coding agents use on common developer commands.
- Stars
- 87,747 stars
- Forks
- 5.6k forks
- Last push
- today
- Activity
- Active
# Install (macOS, or Linux with Homebrew)$ brew install rtk# Plug it into Claude Code$ rtk init -g# See what it saved$ rtk gainCommands from the project's README. Run them after installing (see below).
Overview
Understand rtk in 60 seconds
- What it does
- RTK is a command-line tool that shrinks the output of shell commands before an AI coding agent reads it. Test runs, diffs, logs and builds become short summaries, which cuts the tokens your agent spends.
- The problem it solves
- Coding agents read the full output of commands like git status or npm test, which wastes context and money. RTK hooks into the agent and rewrites those commands so the agent reads a compact version instead.
- Why choose it
- Choose it for a free, install-and-forget way to cut command output for 18 coding agents. Savings apply to command output only, which is one part of your total bill.
- Who should use it
- Claude Code, Codex, Cursor and Gemini CLI users
- Developers who want lower AI agent bills
- Teams running agents on large codebases
- Anyone curious how many tokens commands waste
- Setup difficulty
You'll need:
- macOS, Linux, or Windows (winget, WSL or Git Bash)
- A supported AI coding agent
How rtk works
After installing, rtk init adds a hook to your agent. When the agent runs git status, RTK runs rtk git status and the agent reads a few lines instead of dozens. It covers 100+ commands across Git, the GitHub CLI, Rust, JavaScript, Python, Go and more, in under 25 ms per command.
RTK promises never to block (if a filter fails you get the raw output and the original exit code), never to print more than the command did, and to say where the full output is when it cuts something. rtk bypass runs a command unfiltered, and rtk gain shows the savings recorded on your machine.
Pipelines go further: one file can hand big file reads to a cheaper model, compress more than shell output or make the agent write less. An optional proxy, under a separate BUSL-1.1 license, cleans API traffic. Telemetry is off by default.
Features
Key features
Compressed command output
Tests show failures only; git commands become short summaries.
100+ commands
Git, GitHub CLI, Cargo, npm, pytest, go test, docker and more.
18 agents
Hooks for Claude Code, Copilot, Cursor, Gemini CLI, Codex and others.
Savings dashboard
rtk gain shows tokens saved per day and per command.
Safe by design
Never blocks, never longer than the original, rtk bypass for raw output.
Pipelines
Optional rules to compress more or hand reads to a cheaper model.
Strengths
- Install once, then nothing to learn
- Fast, under 25 ms per command
- Works across many agents
- Apache-2.0 CLI, telemetry off by default
Limitations
- Only command output is compressed by default; built-in Read and Grep tools pass through
- Another crate named rtk exists on crates.io, so check you have the right one
- The proxy has a separate BUSL-1.1 license
Practical use cases
Cheaper Claude Code sessions
Run rtk init -g and let test and git output shrink automatically.
Measure waste
Use rtk discover to find commands that could be compressed.
Team cost control
Roll it out to every developer's agent.
Installation
Install rtk
Commands come from RTK's README. AIRepoHub hasn't run them yet. View source
Prerequisites
- Homebrew, winget, or a shell with curl
Supported systems
- macOS
- Linux
- Windows
- 1
Install
Also works on Linux with Homebrew.
Shellbrew install rtk - 2
Hook it into Claude Code
Shellrtk init -g - 3
Restart your agent
- 1
Install
Shellwinget install rtk-ai.rtk - 2
Hook it into your agent
Shellrtk init -g
- 1
Run the install script
Works on Linux, macOS, WSL and Git Bash.
Shellcurl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh - 2
Hook it into Claude Code
Shellrtk init -g
Configuration and API keys
| Setting | What it's for |
|---|
First run
- 1
Check it is the right rtk
This should show the savings dashboard, not command not found.
Shellrtk gain
rtk's documentation doesn't include sample output, so we don't show any. Expect the results in your terminal.
Your first project
Cut your coding agent's command output
Install RTK, connect it to your agent and check the savings.
Before you start
- A supported agent such as Claude Code
- 1
Install RTK
Shellbrew install rtk - 2
Connect it
For other agents use the flag from the README table, for example --codex or --gemini.
Shellrtk init -g - 3
Restart your agent and work as usual
- 4
Check the savings
Shellrtk gainrtk gain --graph
What to expect
Your agent's git and test commands return short summaries, and rtk gain shows the tokens saved.
Next steps
- Run rtk discover to find missed savings
- Use rtk bypass when you need full output
- Try a built-in pipeline
Costs and requirements
What it costs to run
- License
- Apache-2.0 for the CLI; the optional proxy is BUSL-1.1.Free
- RTK CLI
- Free and open source.Free
- RTK Pro
- Optional paid control layer for teams.Paid
- Pipelines using another model
- That model's provider bills the calls.Depends
Troubleshooting
Common setup issues
rtk gain says command not found or shows no dashboard
You may have a different crate named rtk. Reinstall from this project.
The agent still reads full output
Restart the agent after rtk init, and check your agent uses a hook rather than a rules file.
You need the uncut output
Run the command with rtk bypass, for example rtk bypass git log --oneline -20.
Does it break the prompt cache?
No; output is filtered once, before it enters the conversation.
Alternatives
Similar AI repositories
cc-switch
farion1231
Desktop app for Windows, macOS and Linux that manages settings for Claude Code, Codex, OpenCode and similar AI coding tools.
impeccable
pbakaus
Design toolkit for AI coding agents that helps them review, critique and polish the user interfaces they build.
RuView
ruvnet
Project that uses ordinary WiFi signals to detect presence and monitor vital signs without any cameras.
ECC
affaan-m
Add-on system for Claude Code, Codex, Cursor and similar coding agents that adds skills, memory and security checks.