Find your next open-source project

Search by name, purpose, or keyword — or paste a GitHub repository URL

rtk-ai/rtk

Developer Tools

A Rust CLI proxy that compresses command output before AI coding agents read it, cutting token use on common dev commands.

86,436
5,541
Rust
Apache-2.0
9 months old

What it does

RTK sits between an AI coding agent and the shell. When the agent runs a command such as git status or cargo test, RTK executes it, filters the output, and passes a shorter version back, so the agent reads a 3-line summary instead of 40 lines of raw text (README). It covers 100+ commands across Git, GitHub CLI, Cargo/Rust, JavaScript, Python, Go, Ruby, .NET, JVM, PHP, Docker, Kubernetes, AWS, Terraform, and file/search tools, with per-command filters that must cut at least 20% to ship (command coverage).

It is a single Rust binary aimed at developers running AI coding agents who want to reduce input tokens without changing their workflow. RTK advertises up to 60–90% less command output, but the compressor only affects command output, one part of the input tokens and one part of the bill. Token counts are estimated as bytes/4, so percentages are directional and absolute numbers approximate (savings explanation).

Getting started

Install with Homebrew on macOS/Linux, winget on Windows, or the install script on Linux, macOS and WSL:

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

Then register the hook for your agent and restart it:

rtk init -g          # Claude Code; other agents have their own flags

After that, commands the agent runs are rewritten to rtk <command>, and output is compressed automatically. Check savings with rtk gain, or rtk gain --graph for a 30-day ASCII chart; rtk bypass <command> runs a command unfiltered while still tracking it (README install section). Note there is another rtk on crates.io: rtk gain should show a savings dashboard, not "command not found". Agent-specific setup for Copilot, Cursor, Gemini CLI, Codex and others is in the supported agents guide.

Usage constraints

  • The automatic hook is installed per agent; with rules-file agents RTK asks the model to prefer rtk commands rather than enforcing them (agent coverage).
  • Built-in tools such as Read, Grep and Glob pass through untouched by default; compressing them requires a pipeline (README).
  • Pipelines can rewrite commands and send content to the models they declare, so read a shared pipeline file before installing it (pipelines overview).
  • The optional rtk-proxy daemon handles provider API traffic, is a separate binary and release archive, and is licensed BUSL-1.1 (proxy docs).
  • Two rtk editions install the same binary name and cannot coexist: rtk bundles the pipeline engine under Apache-2.0 + BUSL-1.1, while rtk-oss is Apache-2.0 only (editions).
  • Telemetry is anonymous and off by default; no command content or file contents are collected (telemetry).

HotRepo's take

The project's HotRepo record shows 50,542 stars on 2026-05-19 and 51,504 on 2026-05-20, gaining 667 and 704 stars on those daily all-language snapshots; by a 2026-11-13 Rust-language daily snapshot it had 86,426 stars and 5,540 forks, ranking 9th on that language list that day. Those points sit months apart, so they describe a long-run climb rather than a single trend window.

HN discussion adds a concrete engineering question: one commenter asked whether compressing CLI output could confuse models that were mostly trained on raw CLI output, since the agent may lose the exact format it knows (Oras, 2026-04-10). The README's own answer is that filters are written against real output and each cut must save at least 20%, but that is the maintainer's design claim, not a measured test of the training-data concern. A separate naming complaint says the existing RTK project on crates.io creates confusion (adithyassekhar, lsaferite). The repo has a rtk gain analytics path to verify savings on your own commands, which is the practical way to check whether the filtering works for your stack.

Written by AI from the project's README, updated . The project's own docs are the source of truth.

Hacker News

Rtk – reduce Claude Code token usage
▲ 18 · 3 comments · February 28, 2026
CLI proxy that reduces LLM token consumption by 60-90% on common dev commands
▲ 5 · 2 comments · April 10, 2026
Show HN: RTK – Wrap your CLI commands, save 60-90% of tokens in AI coding agents
▲ 4 · 4 comments · February 11, 2026

You might also like

  1. headroomlabs-ai/headroomCompress agent tool outputs, logs, files, and RAG chunks locally before they reach the LLM, cutting input tokens.Python79,529
  2. affaan-m/ECCA shared layer of skills, memory and guardrails that makes coding agents behave consistently across different CLI harnesses.JavaScript287,735
  3. QwenLM/qwen-codeA terminal AI coding agent that can read, edit, run and review code, with editor, desktop, web and chat interfaces.TypeScript28,828
  4. JuliusBrussee/cavemanCuts token spend in coding agent sessions by shortening replies and compressing what the agent reads, without touching your prompts.Go114,824
  5. rorkai/App-Store-Connect-CLIA scriptable command-line client for the App Store Connect API, aimed at teams that automate iOS release chores.Go8,061