Skip to content
FossShelf
Home / Categories / For Engineers

rtk

CLI proxy that removes 89% of agent context noise on average

Replaces Tokenade, Tokenshift, Portkey, Bifrost Maxim Ai, Tokencrush

86.80K starsApache-2.0reviewed 19 Aug 2026last commit 13 Nov 2026
Screenshot of rtk

Who it's for

Developers on API-billed AI coding tools

Teams using Aider, Gemini CLI, or the OpenAI Codex API pay per input token. For these users, every filtered command call directly reduces cost. The website cites a ten-person team wasting roughly $1,750 per month on CLI noise before filtering. rtk's 89% average bash output reduction on common commands translates to measurable billing impact, diluted by prompt and output tokens but real in absolute terms.

You are on a flat-rate subscription and have never hit context overflow or rate limits during a session. Token compression still extends sessions, but the direct billing impact is absent.

Claude Code and Cursor users with long agentic sessions

On flat-rate plans, rtk extends how many tool calls fit in a session before context overflow forces a restart. For complex multi-file refactors or long debugging sessions with many git and test commands, the extra headroom can mean completing a task in one session instead of two. The auto-rewrite hook makes adoption invisible: install once, restart the agent, and every subsequent Bash call is filtered automatically.

Your sessions are short and focused on reading and editing files through native agent tools. rtk's value compounds with Bash tool call volume; low-Bash workflows see limited benefit.

Teams deploying AI coding infrastructure

Organizations running their own LLM infrastructure can deploy rtk alongside existing tooling without any vendor dependency. Since rtk operates as a local binary that compresses shell output before it reaches any network boundary, it integrates cleanly with on-premise AI coding setups and requires no changes to LLM routing or API configuration.

Your managed AI coding platform already compresses or summarizes tool call output at the platform level, in which case rtk adds redundant filtering.

The problem

Every command an AI coding agent runs dumps raw output into the context window. A cargo test suite with 262 passing tests outputs over 4,800 tokens of boilerplate. A git diff on a medium-sized change can reach 21,500 tokens. For pay-per-token users on tools like Aider, Gemini CLI, or the raw Anthropic API, that verbose output makes up the majority of the bill. For flat-rate users on Claude Code or Cursor, the same noise fills the context window faster, triggering rate limits and forcing session restarts before complex tasks finish. The website cites a team of ten wasting roughly $1,750 per month on CLI noise alone. The problem is structural: developer CLI tools output for human readers who scan rather than read every line. Test runners print every passing test. Git diff shows full surrounding context. Directory listings expand to one line per file. None of these tools have an agent-friendly output mode, and teams either accept the waste or maintain fragile per-tool wrappers that break across version updates.

How it works

100+ command-specific output filters

rtk ships pre-built filters for the commands AI coding agents call most: git status, git diff, git log, cargo test, pytest, go test, jest, vitest, docker ps, kubectl pods, AWS CLI subcommands, eslint, tsc, ruff, and more. Each filter applies the right strategy for that command's structure. Cargo test collapses all passing tests to a count and shows only failures; git log trims to hash, author, and subject; git push returns a single confirmation line instead of 15 lines of progress output.

Auto-rewrite hook for 16 AI coding tools

Run `rtk init -g` once to install a PreToolUse hook in your AI tool's configuration. From that point, every Bash call is transparently rewritten to the rtk equivalent before the agent sees any output. Supports Claude Code, GitHub Copilot, Cursor, Gemini CLI, Codex, Windsurf, Cline, OpenCode, Pi, Hermes, Mistral Vibe, Kilo Code, Google Antigravity, Kimi AI, and Factory Droid across macOS, Linux, and native Windows.

Token savings analytics via rtk gain

The `rtk gain` command shows a summary of tokens saved, broken down by command type, with daily, weekly, and monthly views and an ASCII graph of the last 30 days. Savings are stored locally in SQLite with no external telemetry. One developer reported 138 million tokens saved across 15,720 commands after several weeks of daily use. The `rtk discover` command scans recent session logs to identify commands not yet routed through rtk.

Single Rust binary, under 10ms overhead

rtk is a single statically-linked Rust binary with zero runtime dependencies. It adds under 10 milliseconds of overhead per command, making it transparent during interactive and agentic use. Install options: Homebrew (`brew install rtk`), the curl one-liner for Linux and macOS, pre-built binaries for macOS, Linux, and Windows from GitHub releases, or `cargo install --git https://github.com/rtk-ai/rtk`.

Smart file reading and code summarization

The `rtk read` command applies heuristic file summarization: standard mode returns signatures and structure rather than full file bodies; aggressive mode (`-l aggressive`) returns function and type signatures only. The `rtk smart` command produces a two-line heuristic code summary. These reduce the token cost of file inspection operations that AI coding agents frequently perform during code exploration.

Features

  • 100+ command-specific output filters
  • Auto-rewrite hook for 16 AI coding tools
  • Token savings analytics via rtk gain
  • Single Rust binary, under 10ms overhead
  • Smart file reading and code summarization

How to install

Install rtk as a single binary via Homebrew, then run setup to activate the auto-rewrite hook for your AI coding tool.

brew install rtk
rtk init -g

Recommended for this setup

Strengths

  • Zero-infrastructure deployment: rtk runs locally as a single binary with no server, no API key, and no routing layer between your agent and the LLM. Token savings happen on the input side before any network call. This is categorically different from cloud-based token management tools that require proxying LLM traffic through an external service. A developer on a corporate network with outbound restrictions can use rtk without any external dependency.
  • Apache 2.0 license with no commercial restrictions: The Apache 2.0 license permits commercial use, modification, and redistribution without restriction. Teams can include rtk in internal tooling, CI environments, or shipped developer products without a license review. Unlike paid token management platforms where usage costs scale with volume, rtk's cost is fixed at zero for the binary itself.
  • Savings measured on real developer commands: The 89.2% average noise reduction comes from 2,927 actual developer commands, not a synthetic benchmark. The README explicitly notes that bash output savings do not map 1:1 to billing reduction: bash output is one input token source, and input tokens are only part of the bill. This honest disclosure distinguishes rtk from tools that present savings figures without qualification.
  • Native Windows support since v0.37.2: The auto-rewrite hook runs as a native binary command on Windows from v0.37.2, requiring no Unix shell, bash, or jq. Command Prompt, PowerShell, and Windows Terminal all work identically to macOS and Linux. Pre-built binaries for x86_64 Windows are available in GitHub releases. WSL is also fully supported with the standard Linux install path.

Trade-offs

  • Token counts are approximations, not exact figures: rtk estimates token counts as bytes divided by 4 rather than using a model-specific tokenizer. The README explicitly flags this: percentage reductions are reliable relative indicators, but the absolute token numbers shown in `rtk gain` are approximate and should not be used for billing reconciliation. If you need exact token counts for cost attribution, compare against your LLM provider's usage dashboard.
  • Hook applies to Bash calls only, not native agent tools: The auto-rewrite hook intercepts Bash tool calls made by the AI agent. Claude Code built-in tools (Read, Grep, Glob) bypass the hook entirely. To get rtk filtering on those workflows, you must use shell equivalents (cat, rg, find) or call rtk commands directly. Agents that rely heavily on native tool calls rather than shell commands see less benefit.
  • High open issue count reflects broad adoption and coverage gaps: The repo carried 1,970 open issues at time of writing, against 76,500+ stars. The volume reflects both project scale and gaps in filter coverage for niche commands. Core git, cargo, pytest, and docker filters are well-tested; if your toolchain includes less common tools (Scala sbt, some OpenShift oc subcommands), verify filter behavior before relying on it in production sessions.

Tech stack

Languages
Rust, Shell, TypeScript, Python, JavaScript, Ruby
Frameworks
—
Databases
—
Tooling
—

FAQ

Is rtk free to use?

Yes. rtk is Apache 2.0 licensed and free to use, modify, and redistribute. The core CLI tool has no feature restrictions on the open source tier. RTK Pro is a separate commercial tier for teams that need token governance, security controls, and organizational analytics, but the open source binary covers the full filtering and savings analytics feature set.

Does rtk work with Claude Code?

Yes. Run `rtk init -g` to install a PreToolUse hook in Claude Code's settings.json. After restarting Claude Code, every Bash call is automatically rewritten to the rtk equivalent before execution. Claude Code's built-in tools (Read, Grep, Glob) are not intercepted by the hook; to get rtk filtering on those workflows, use shell commands (cat, rg, find) or explicit rtk subcommands instead.

How much does rtk actually reduce my LLM bill?

rtk removes an average of 89.2% of bash output by bytes, but that does not translate to an 89% billing reduction. Bash output is one contributor to input tokens, alongside your prompt, system prompt, and conversation history. Input tokens are also only part of the bill, which also counts output tokens. The README makes this explicit. The actual billing reduction is real but diluted at each step; it is most significant for API-billed tools where CLI-heavy sessions generate high input token counts.

Does rtk send any data to external servers?

No. rtk runs entirely as a local binary. It intercepts and compresses command output locally and writes savings data to a local SQLite database. No telemetry or usage data is sent externally. RTK Pro, the commercial team tier, may have different data handling for its governance features; check its documentation if that tier is relevant to your team.

What AI coding tools does rtk support?

rtk supports 16 AI coding tools as of the current README: Claude Code, GitHub Copilot (VS Code and CLI), Cursor, Gemini CLI, Codex, Windsurf, Cline and Roo Code, OpenCode, OpenClaw, Pi, Hermes, Mistral Vibe, Kilo Code, Google Antigravity, Kimi AI, and Factory Droid. Each has its own init flag documented in the README and on the project website's supported agents guide.

Similar tools

More in Engineers