rtk

App New

Rust Token Killer - High-performance CLI proxy to minimize LLM token consumption

Checked · Sources

Downloads
2,594
Dependents
Not applicable
Stars
85,939
Forks
5,505
Contributors
195
Commits
2,735
Latest release
0.42.4 ·

About

From the project README ·

Agent-agnostic token optimization: compress, route, filter, and more.

One composable pipeline across everything your AI agent reads and sends — built on RTK's battle-tested bash-output compression (up to 90% smaller).

Website • Install • Troubleshooting • Architecture • Discord

English • Francais • 中文 • 日本語 • 한국어 • Espanol • Português


rtk filters and compresses command outputs before they reach your LLM context. Single Rust binary, 100+ supported commands, <10ms overhead.

Angular builds are supported with rtk ng build: compact build tables with every bundle and diagnostic retained.

What RTK Does

RTK intercepts shell commands and compresses their output before your agent reads it.

Read the full README
OperationWhat RTK does to the output
ls / treeTree format with file counts instead of one line per entry
cat / readSmart file reading: signatures and structure over full bodies
grep / rgTruncates long lines, groups matches by file
ast-grepGroups structural matches by file, caps overflow
git statusCompact stat format, grouped by state
git diffReduced context, headers stripped
git logHash, author and subject only
git add/commit/pushConfirmation line instead of full progress output
cargo test / npm testFailures only, passing tests collapsed to a count
ruff checkGrouped by rule and file
sqlfluff lintGrouped by rule and file
pytestFailures only, traceback trimmed
go testNDJSON parsed, failures only
docker psEssential fields only

How Savings Work

RTK reduces the bash output your agent reads. That is what RTK measures, and it is not the same as cutting your bill by the same amount.

Bash output is one contributor to input tokens, alongside your prompt, the system prompt and conversation history. Input tokens are in turn only part of the bill, which also counts output tokens. The reduction dilutes at every step.

The token counts RTK reports are estimated as bytes / 4 — RTK ships no tokenizer, so the percentages are reliable but the absolute token numbers are approximate.

Full explanation: How RTK Savings Work

Installation

brew install rtk                                              # macOS / Linux
winget install rtk-ai.rtk                                     # Windows
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh

Then check you have the right package — another project named "rtk" exists on crates.io:

rtk --version   # any current version
rtk gain        # must show the savings dashboard, not "command not found"

Cargo, pre-built binaries, native Windows, WSL, and uninstall: Installation guide

What You Install

RTK ships as three downloads. The two rtk editions install a binary with the same name — hooks, scripts and agent config work unchanged across both — so they cannot be installed together. Uninstall one before installing the other.

flowchart TD
    agent["Your coding agent"]

    subgraph editions["Pick one · both install a binary named rtk"]
        direction LR
        full["<b>rtk</b><br/>Apache-2.0 + BUSL-1.1<br/>hooks · filters · engine"]
        oss["<b>rtk-oss</b><br/>Apache-2.0 only<br/>hooks · filters"]
    end

    proxy["<b>rtk-proxy</b><br/>BUSL-1.1<br/>compresses API traffic"]

    agent -->|"command output"| full
    agent -->|"command output"| oss
    agent -.->|"API traffic"| proxy

    classDef apache stroke:#2da44e,stroke-width:2px,fill:none
    classDef busl stroke:#0969da,stroke-width:2px,fill:none
    classDef mixed stroke:#8250df,stroke-width:2px,fill:none
    classDef plain stroke:#8c959f,stroke-width:1px,fill:none
    class full mixed
    class oss apache
    class proxy busl
    class agent plain
    style editions fill:none,stroke:#d0d7de,stroke-dasharray:4 4
DownloadLicenceContains
rtk-<target>Apache-2.0 + BUSL-1.1Hook core, every command filter, and the compression engine
rtk-oss-<target>Apache-2.0 onlyHook core and every command filter. No engine.
rtk-proxy-<target>BUSL-1.1The RTK Proxy daemon. Never bundled with either rtk.

Production use is free, engine and daemon included. What the BUSL grant does not cover is offering RTK or a derivative to third parties as a commercial product or service — for that, contact contact@rtk-ai.app.

curl -fsSL .../install.sh | RTK_EDITION=oss sh    # Apache-2.0 edition
brew install rtk-ai/tap/rtk-oss

What the Apache-2.0 edition omits and where the licence boundary falls: Editions and Licensing

Quick Start

# 1. Install for your AI tool
rtk init -g                     # Claude Code / Copilot (default)
rtk init -g --gemini            # Gemini CLI
rtk init -g --codex             # Codex (OpenAI)
rtk init -g --agent cursor      # Cursor
rtk init -g --agent windsurf    # Windsurf
rtk init --agent cline          # Cline / Roo Code
rtk init --agent kilocode       # Kilo Code
rtk init --agent antigravity    # Google Antigravity
rtk init --agent kimi           # Kimi AI
rtk init -g --agent pi          # Pi
rtk init --agent omp            # Oh My Pi (OMP)
rtk init --agent hermes         # Hermes
rtk init -g --agent droid       # Factory Droid
rtk init --agent trae           # Trae (project: .trae/hooks.json)
rtk init -g --agent trae        # Trae global: ~/.trae and existing ~/.trae-cn

# 2. Restart your AI tool, then test
git status  # Automatically rewritten to rtk git status

The agent receives compact output without ever calling rtk explicitly.

The hook only fires on Bash tool calls. Built-in tools like Read, Grep and Glob do not pass through it. Use shell commands (cat, rg, find) or call rtk read, rtk grep, rtk find directly.

Per-agent setup, --dry-run, and uninstall: Quick Start · Supported Agents

How It Works

  Without rtk:                                    With rtk:

  Claude  --git status-->  shell  -->  git         Claude  --git status-->  RTK  -->  git
    ^                                   |            ^                      |          |
    |         full raw output           |            |  compact output      | filter   |
    +-----------------------------------+            +------- (filtered) ---+----------+

Four strategies applied per command type:

  1. Smart Filtering - Removes noise (comments, whitespace, boilerplate)
  2. Grouping - Aggregates similar items (files by directory, errors by type)
  3. Truncation - Keeps relevant context, cuts redundancy
  4. Deduplication - Collapses repeated log lines with counts

Does RTK break Claude's prompt cache? No. RTK filters output once per command. The result is stored in history and cached normally on subsequent API calls, so the cache keeps working as expected. Smaller outputs also mean cheaper cache writes and reads. See Troubleshooting for details.

Supported AI Tools

RTK supports 18 AI coding tools. Each integration rewrites shell commands to rtk equivalents, reducing the bash output the agent reads where the agent supports command interception.

ToolInstallMethod
Claude Codertk init -gPreToolUse hook (native binary)
GitHub Copilot (VS Code)rtk init -g --copilotPreToolUse hook — transparent rewrite
GitHub Copilot CLIrtk init -g --copilotPreToolUse deny-with-suggestion (CLI limitation)
Cursorrtk init -g --agent cursorpreToolUse hook (hooks.json)
Gemini CLIrtk init -g --geminiBeforeTool hook
Codexrtk init -g --codexPreToolUse hook (updatedInput) + AGENTS.md
Windsurfrtk init -g --agent windsurf.windsurfrules (project-scoped)
Cline / Roo Codertk init --agent cline.clinerules (project-scoped)
OpenCodertk init -g --opencodePlugin TS (execute.before / tool.execute.before), needs 1.18.29 or newer
OpenClawopenclaw plugins install ./openclawPlugin TS (before_tool_call)
Pirtk init -g --agent pi (global)TypeScript extension (tool_call)
Oh My Pi (OMP)rtk init -g --agent omp (global) / rtk init --agent omp (project)TypeScript extension (tool_call, shared with Pi)
Hermesrtk init --agent hermesPython plugin adapter (terminal command mutation via rtk rewrite)
Mistral Vibertk init -g --agent vibepre_tool hook (hooks.toml)
Kilo Codertk init --agent kilocode.kilocode/rules/rtk-rules.md (project-scoped)
Google Antigravityrtk init --agent antigravity / rtk init -g --agent antigravity.agents/plugins/rtk/ (project) or ~/.gemini/config/plugins/rtk/ (global): plugin.json, hooks.json, rules/AGENTS.md
Kimi AIrtk init --agent kimiAGENTS.md (project-scoped)
Factory Droidrtk init -g --agent droid (or per-project)PreToolUse hook in ~/.factory/hooks.json (matcher Execute)
Traertk init --agent traeNative PreToolUse hook in .trae/hooks.json (RunCommand)
Trae (global)rtk init -g --agent trae~/.trae/hooks.json, plus ~/.trae-cn/hooks.json when that directory exists

For per-agent setup details, override controls, and graceful degradation, see the Supported Agents guide. The Hermes plugin source and tests live in hooks/hermes/; installed Hermes runtime files still live under ~/.hermes/plugins/rtk-rewrite/.

What RTK Covers

100+ commands across Git, GitHub CLI, Cargo/Rust, JavaScript (npm, pnpm, vitest, jest, tsc, Next.js, Playwright, Prisma), Python (ruff, pytest, mypy, pip), Go (go test, golangci-lint), Ruby, .NET, JVM (Gradle, Maven), PHP, Docker, Kubernetes, AWS, Terraform, and the file/search builtins.

-v, --verbose          # increase verbosity (-v, -vv, -vvv)
rtk bypass <cmd>       # run one command unfiltered, still tracked

Every command and its filter: What RTK Optimizes

Escape hatches

rtk filters command output by default. When a result looks wrong, bypass the filter for one command to see the raw output and tell a filter bug apart from the real thing:

rtk bypass git log --oneline -20        # full git log, no truncation
rtk bypass npm install express          # raw npm output, no filtering
rtk bypass curl https://api.example.com/data
  • What it does: runs one command unfiltered and still tracks it — bypassed commands appear in rtk gain --history with 0% bash output reduction.
  • When to use it: an output looks off and you need to know whether the filter or the command produced it, when debugging a filter, or for an edge case a filter mishandles.
  • rtk proxy <cmd> is a deprecated alias of rtk bypass <cmd>.

Not the same thing as rtk llm-proxy. rtk bypass runs one local command unfiltered. rtk llm-proxy manages the rtk-proxy daemon, which compresses your agent's provider-API traffic — see RTK Proxy.

Measure It

rtk gain                        # Summary stats
rtk gain --graph                # ASCII graph (last 30 days)
rtk gain --history              # Recent command history
rtk gain --daily                # Day-by-day breakdown
rtk gain --all --format json    # JSON export for dashboards

rtk discover                    # Find missed savings opportunities
rtk discover --all --since 7    # All projects, last 7 days

rtk session                     # Show RTK adoption across recent sessions

Attribution, the live dashboard and export formats: Token Savings Analytics

RTK Proxy (optional)

rtk optimizes command output before your agent reads it. The rtk-proxy daemon extends the same engine to your agent's provider-API traffic — a local background process that sits between your agent and the provider and runs the pipeline on the traffic itself: it compresses payloads, strips bytes no model ever needed before forwarding, and carries the calls your pipeline routes to cheaper models, so they borrow the credential your agent already sends and show up in rtk gain. It can also align prompt-cache breakpoints where the agent leaves them open (opt-in).

rtk claude              # start the daemon if needed, then launch Claude through it
rtk llm-proxy status    # is it up
rtk gain                # savings, command-filtering and proxy side by side

Two independent ways in, because not every harness has a session hook:

What it does
rtk init -gOffers to set it up once: writes the base URL and the rtk:proxy pipeline, then asks how the daemon should come back after a reboot — SessionStart hook, background service, or neither.
rtk <harness>No configuration at all. Starts the daemon, points the harness at it, then execs it. Needs no hook system, which is why it covers harnesses that have none.

rtk <harness> resolving is itself the signal that traffic really goes through the daemon — the subcommand exists only where redirection is verified. Today that is rtk claude. A harness without one is never silently unproxied: it falls through to plain passthrough, and rtk llm-proxy setup lists what can be launched.

It is a separate binary under a separate licence (BUSL-1.1), shipped as its own rtk-proxy-<target> archive — rtk never links it.

Setup and subcommands: RTK Proxy · what it compresses: What the Proxy Compresses · settings and endpoints: Proxy Configuration

The Engine (pipeline.toml)

Everything RTK does — which commands get rewritten, what happens to a tool's output, what the proxy compresses — is expressed in one composable file. The engine (engine/, crate rtk-engine, BUSL-1.1) reads it, so the levers are configurable instead of hard-coded.

Upgrading changes nothing. With no pipeline file you are on rtk:default: the same PreToolUse rewrite, the same awareness file, your filters.toml, your config.toml. Everything beyond that is opt-in, one line at a time:

# ~/.config/rtk/pipeline.toml
[pipeline]
extends = ["rtk:posthook", "rtk:proxy"]

The tour: Pipelines · the reference: Writing a Pipeline, Conditions and Judges, Methods, Tasks and Upstreams · the commands: Pipeline Commands · write your own method: Plugins

Documentation

rtk-ai.app/guide is the full user guide.

Installationevery install method, Windows, WSL, uninstall
Quick Startper-agent init, --dry-run, first savings
Supported Agentssetup detail, override controls, degradation
Agent Coveragewhat each agent's hook API lets RTK do
What RTK Optimizesevery command and its filter
Configurationconfig.toml, env vars, recall recovery
Token Savings Analyticsrtk gain in full
Pipelinesthe engine: pipeline.toml, rules, judges, tasks, sharing
RTK Proxythe daemon: setup, what it compresses, settings
Editions and Licensingwhat each download contains
Telemetry & Privacywhat is collected, how to opt in, your GDPR rights
Troubleshootingcommon issues, prompt-cache questions

Repository references: engine/README.md · proxy/README.md · ARCHITECTURE.md · CONTRIBUTING.md · SECURITY.md

RTK collects no command content and no file contents. Telemetry is anonymous and off by default — it sends nothing until you opt in with explicit consent (GDPR Art. 6 & 7) via rtk telemetry enable, and documented in Telemetry & Privacy.

Star History

StarMapper

Core team

Contributing

Contributions welcome! Please open an issue or PR on GitHub.

Join the community on Discord.

License

The rtk CLI is Apache-2.0 — see LICENSE.

It links one component under a different licence. rtk-engine (engine/) is BUSL-1.1, source-available: see engine/LICENSE. Its Additional Use Grant permits production use as part of the rtk binary, so running rtk is covered; using the engine on its own, or inside another product, is not until the Change Date.

The rtk-proxy daemon (proxy/) is BUSL-1.1 on the same terms and ships as its own archive with its licence alongside — rtk never links it.

RTK Pro

Your company is looking to take control back on your AI fleet ? RTK Pro provides the control layer for costs, security and governances for all agents.

Check it out : RTK Pro.

Disclaimer

See DISCLAIMER.md.

Runs on
GPU support unknown
What shows it
  • no dependency or feature matches a backend row
Native code
Required
  • Binds native code: libsqlite3-sys
Python bindings
No Python binding crate found
License
Apache-2.0

Compare with similar projects

Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.

rtk beside the projects that share a topic with it
ProjectDownloadsDependentsStarsLatest releaseRuns on (GPU)Native codeLicense
rtk This page App New

Rust Token Killer - High-performance CLI proxy to minimize LLM token consumption

2,594 binary downloads per release Not applicable 85,939 0.42.4 GPU support unknown Binds native code: libsqlite3-sys Apache-2.0
tabby App Featured

Self-hosted AI coding assistant

8,774 binary downloads per release Not applicable 33,925 Not measured Not measured Not measured
llmfit App Featured

Right-size LLM models to your system hardware. Interactive TUI and CLI to match models against available RAM, CPU, and GPU.

3,821 binary downloads per release Not applicable 38,787 1.1.20 Metal No native code found MIT
code2prompt App Listed

A CLI tool to convert your codebase into a single LLM prompt with source tree, prompt templating, and token counting.

2,317 binary downloads per release Not applicable 7,756 4.3.0 GPU support unknown Binds native code: libgit2-sys, libz-sys MIT

OpenTelemetry components and utilities for Langfuse LLM observability

2,119 downloads over 30 days 2 4 0.7.2 GPU support unknown No native code found Apache-2.0 OR MIT
axp App Listed

An open protocol that gives AI agents a secure, sandboxed place to run code and use tools — with lean context usage. AXP works alongside MCP

Not measured Not applicable 3 Not measured Not measured Not measured Apache-2.0
tensorzero App Archived

TensorZero is an open-source LLMOps platform that unifies an LLM gateway, observability, evaluation, optimization, and experimentation.

35 downloads over 30 days Not applicable 11,705 0.0.0 GPU support unknown No native code found Apache-2.0
Why NewIts first release on 18 Jun 2026 is under 180 days old.

The check tests the Featured gates once the first release passes this age limit.

What else the check found

  • The last activity is on 8 Nov 2026, 1 day ago. The rules expect an update within 365 days. Dormancy rule

Check notes

  • published from commit a73ab41f6974eec11930d567bc0d543e91dc9675 that no branch or tag of the repo holds

Exact rules: New. The check on applied thresholds version 9.

Every rule outcome, as the check records it
  • expected-interval: app: E = 365 days
  • dormancy: last activity 2026-11-08, 1 days ago, E = 365: active
  • new: new: first release 2026-06-18 is under 180 days old

Measurements and sources

Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.

Sources6 sources
Adoption2,594 binary downloads per release4 not measured
Adoption measurements
SignalValueSourceFetchedCounts
Active dependentsNot measuredYes
New dependents (365 days)Not measuredYes
Peak active dependentsNot measuredYes
Active dependents as a share of the peakNot measuredYes
Binary downloads per release2594GitHub releasesYes
MaintenanceLatest human commit: 1 day ago4 not measured
Maintenance measurements
SignalValueSourceFetchedCounts
Latest human commit2026-11-08GitHub repositoryYes
Latest release2026-11-08GitHub releasesYes
First release2026-06-18crates.io database dumpYes
Latest version0.42.4crates.io database dumpNo
Days the oldest outside issue waits for a reply10GitHub repositoryYes
Maintainer replies over 365 days11GitHub repositoryYes
Repository archivedfalseGitHub repositoryYes
Repository gonefalseGitHub repositoryYes
Release commit or manifest in the repofalsecrates.io packageNo
Published docsNot measuredYes
Latest release fails cargo checkNot measuredYes
Build check dateNot measuredYes
Build check toolchainNot measuredYes
SecurityNot measured
Security measurements
SignalValueSourceFetchedCounts
Unpatched vulnerabilities past the grace windowNot measuredYes
RustSec unmaintained advisoryNot measuredYes
Deprecation noticeNot measuredYes
Deprecated requirementNot measuredYes
Distribution1 releases, 76 downloads over 30 days6 not measured
Distribution measurements
SignalValueSourceFetchedCounts
Releases1crates.io database dumpNo
Downloads over 30 days76crates.io database dumpNo
Binary downloads over the last 3 releases7782GitHub releasesYes
Homebrew installs on request over 365 daysNot measuredYes
Repology repository familiesNot measuredYes
Docker pull growth over 90 daysNot measuredYes
Docker pulls at the growth baselineNot measuredYes
Every version a prereleasefalsecrates.io database dumpYes
Every version 0.0.xfalsecrates.io database dumpYes
Every version yankedNot measuredYes
Crate deleted from crates.ioNot measuredYes
Repository85,939 stars, 5,505 forks, 195 contributors, 2,735 commits. Stars alone never qualify a project.
Repository measurements
SignalValueSourceFetchedCounts
GitHub stars85939GitHub repositoryYes — one part of the repository route
GitHub forks5505GitHub repositoryYes — one part of the repository route
Contributors with a GitHub account195GitHub contributorsYes — one part of the repository route
Commits on the default branch2735GitHub repositoryNo
Repository's main crate left out of the entrynonecrates.io database dumpYes
Facts that never count
Facts that never count measurements
SignalValueSourceFetchedCounts
LicenseApache-2.0crates.io database dumpNo
Runs on, from listed crates and their direct dependenciesGPU support unknowncrates.io database dumpNo
What shows each backendno dependency or feature matches a backend rowcrates.io database dumpNo
Native code, from listed crates and their dependenciesBinds native code: libsqlite3-syscrates.io database dumpNo
Python bindings, from direct dependencies of listed cratesNo Python binding crate foundcrates.io database dumpNo
Crates that depend on a listed crate directlyNot measuredNo

Corrections and review history

Report a correction

No correction applies to this entry.

Judgments

A judgment enters only through an approved issue and a merged pull request.

No judgment applies to this entry.