Open Source · MIT License · Written in Rust

Stop wasting tokens.
Start using rtk.

A high-performance CLI proxy that filters and compresses command outputs before they reach your LLM context. Save 60-90% of tokens on every session.

10M+ tokens saved
89% avg. savings
30+ commands
Install rtk Star on GitHub

See the difference

Real outputs from the rtk codebase. 10M+ tokens saved, 89% average reduction over 2,500+ commands.

ls -la src/ ~3,200 tokens
total 928
drwxr-xr-x  41 patrick  staff   1312  2 feb 21:43 .
drwxr-xr-x  25 patrick  staff    800  2 feb 21:35 ..
-rw-r--r--   1 patrick  staff  16394  2 feb 21:35 cargo_cmd.rs
-rw-r--r--   1 patrick  staff  27220  2 feb 21:35 cc_economics.rs
-rw-r--r--   1 patrick  staff   9503  2 feb 21:35 ccusage.rs
-rw-r--r--   1 patrick  staff   2884  2 feb 21:35 config.rs
-rw-r--r--   1 patrick  staff  12886  2 feb 21:35 container.rs
-rw-r--r--   1 patrick  staff   3406  2 feb 21:35 curl_cmd.rs
-rw-r--r--   1 patrick  staff   9040  2 feb 21:35 deps.rs
-rw-r--r--   1 patrick  staff  10667  2 feb 21:35 diff_cmd.rs
drwxr-xr-x   6 patrick  staff    192  2 feb 21:35 discover
-rw-r--r--   1 patrick  staff   9732  2 feb 21:35 display_helpers.rs
-rw-r--r--   1 patrick  staff   5500  2 feb 21:35 env_cmd.rs
-rw-r--r--   1 patrick  staff  12156  2 feb 21:35 filter.rs
-rw-r--r--   1 patrick  staff   3007  2 feb 21:35 find_cmd.rs
-rw-r--r--   1 patrick  staff  10648  2 feb 21:35 gain.rs
-rw-r--r--   1 patrick  staff  24865  2 feb 21:35 gh_cmd.rs
-rw-r--r--   1 patrick  staff  36053  2 feb 21:35 git.rs
-rw-r--r--   1 patrick  staff   5263  2 feb 21:35 grep_cmd.rs
... 20 more lines
rtk ls src/ ~640 tokens -80%
discover/
parser/
cargo_cmd.rs  16.0K
cc_economics.rs  26.6K
ccusage.rs  9.3K
config.rs  2.8K
container.rs  12.6K
curl_cmd.rs  3.3K
deps.rs  8.8K
diff_cmd.rs  10.4K
display_helpers.rs  9.5K
env_cmd.rs  5.4K
filter.rs  11.9K
find_cmd.rs  2.9K
gain.rs  10.4K
...

37 files, 2 dirs (37 .rs)
git status ~800 tokens
Sur la branche master
Votre branche est à jour avec 'origin/master'.

Modifications qui ne seront pas validées :
  (utilisez "git add <fichier>..." pour mettre
   à jour ce qui sera validé)
  (utilisez "git restore <fichier>..." pour
   annuler les modifications dans le répertoire
   de travail)
	modifié :         src/ls.rs

aucune modification n'a été ajoutée à la
validation (utilisez "git add" ou "git commit -a")
rtk git status ~160 tokens -80%
📌 master...origin/master
📝 Modified: 1 files
   src/ls.rs
cat src/main.rs | head -40 ~1,800 tokens
mod cargo_cmd;
mod cc_economics;
mod ccusage;
mod config;
mod container;
mod curl_cmd;
mod deps;
mod diff_cmd;
mod discover;
mod display_helpers;
mod env_cmd;
mod filter;
mod find_cmd;
mod gain;
mod gh_cmd;
mod git;
mod grep_cmd;
mod init;
mod json_cmd;
mod lint_cmd;
mod local_llm;
mod log_cmd;
mod ls;
mod next_cmd;
mod npm_cmd;
mod parser;
mod playwright_cmd;
mod pnpm_cmd;
mod prettier_cmd;
mod prisma_cmd;
mod read;
mod runner;
mod summary;
mod tracking;
mod tsc_cmd;
mod utils;
mod vitest_cmd;
mod wget_cmd;

use anyhow::{Context, Result};
... continues for 600+ lines
rtk read src/main.rs -l aggressive ~520 tokens -71%
use anyhow::{Context, Result};
use clap::{Parser, Subcommand};
use std::path::PathBuf;
struct Cli {
    // ... implementation
enum Commands {
    // ... implementation
enum GitCommands {
    // ... implementation
enum DockerCommands {
    // ... implementation
enum KubectlCommands {
    // ... implementation
enum VitestCommands {
    // ... implementation
enum CargoCommands {
    // ... implementation
fn main() -> Result<()> {
    // ... implementation
cat Cargo.toml ~2,100 tokens
[package]
name = "rtk"
version = "0.8.1"
edition = "2021"
authors = ["Patrick Szymkowiak"]
description = "Rust Token Killer - ..."
license = "MIT"
repository = "https://github.com/rtk-ai/rtk"
readme = "README.md"
keywords = ["cli", "llm", "token", ...]
categories = ["command-line-utilities", ...]

[dependencies]
clap = { version = "4", features = ["derive"] }
anyhow = "1.0"
ignore = "0.4"
walkdir = "2"
regex = "1"
lazy_static = "1.4"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
colored = "2"
dirs = "5"
rusqlite = { version = "0.31", features = ... }
toml = "0.8"
chrono = "0.4"
thiserror = "1.0"

[dev-dependencies]
tempfile = "3"

[profile.release]
opt-level = 3
lto = true
codegen-units = 1
... 20 more lines (deb, rpm config)
rtk deps ~320 tokens -85%
Rust (Cargo.toml):
  Dependencies (14):
    clap (4)
    anyhow (1.0)
    ignore (0.4)
    walkdir (2)
    regex (1)
    lazy_static (1.4)
    serde (1)
    serde_json (1)
    colored (2)
    dirs (5)
    ... +4 more
  Dev (1):
    tempfile (3)
grep -rn "fn " src/git.rs ~3,600 tokens
src/git.rs:21:pub fn run(cmd: GitCommand, ...
src/git.rs:38:fn run_diff(args: &[String], ...
src/git.rs:105:fn run_show(args: &[String], ...
src/git.rs:194:pub(crate) fn compact_diff(...
src/git.rs:260:fn run_log(args: &[String], ...
src/git.rs:317:fn format_status_output(por...
src/git.rs:412:fn run_status(args: &[String...
src/git.rs:467:fn run_add(files: &[String],...
src/git.rs:519:fn run_commit(message: &str,...
src/git.rs:561:fn run_push(args: &[String],...
src/git.rs:610:fn run_pull(args: &[String],...
src/git.rs:682:fn run_branch(args: &[String...
src/git.rs:734:fn filter_branch_output(out...
src/git.rs:788:fn run_fetch(args: &[String]...
src/git.rs:830:fn run_stash(subcommand: Op...
src/git.rs:917:fn filter_stash_list(output...
src/git.rs:938:fn run_worktree(args: &[Str...
src/git.rs:983:fn filter_worktree_list(out...
src/git.rs:1015:fn test_compact_diff() {
src/git.rs:1020:fn main() {
src/git.rs:1030:fn test_filter_branch_out...
src/git.rs:1042:fn test_filter_branch_no_...
src/git.rs:1051:fn test_filter_stash_list...
src/git.rs:1060:fn test_filter_worktree_l...
... 5 more matches
rtk grep "fn " src/git.rs ~800 tokens -78%
🔍 29 in 19F:

📄 21 (1):
  GitCommand, args: &[String], ...
📄 38 (1):
  &[String], max_lines: Option...
📄 105 (1):
  &[String], max_lines: Option...
📄 194 (1):
  &str, max_lines: usize) -> ...
📄 260 (1):
  &[String], _max_lines: Optio...
📄 317 (1):
  &str) -> String {
📄 412 (1):
  &[String], verbose: u8) -> ...
📄 467 (1):
  &[String], verbose: u8) -> ...
📄 src/git.rs (11):
  1015: fn test_compact_diff() {
  1020: fn main() {
  1030: fn test_filter_branch_output()
  ... +8 more
git log --oneline -5 ~600 tokens
d6ff33f Merge pull request #52 from
        FlorianBruniaux/docs/point-
        to-upstream
48ed221 Revise RTK roadmap for
        clarity and updated goals
67f93a5 Update README.md
b1f15cf Fix repository link in
        INSTALL.md
8138071 Update name collision
        warning in CLAUDE.md
rtk git log -n 5 ~320 tokens -80%
48ed221 Revise RTK roadmap (9d ago)
67f93a5 Update README.md (9d ago)
b1f15cf Fix repo link INSTALL.md (9d)
8138071 Update CLAUDE.md warning (9d)
15a34ae Fix install script URL (9d)

Built for AI-assisted development

rtk sits between your shell and your LLM, compressing everything automatically.

Smart Filtering

Removes noise — comments, whitespace, boilerplate — keeping only what matters for your LLM.

Grouping

Aggregates similar items: files by directory, errors by type, logs by pattern.

Truncation

Keeps relevant context, cuts redundancy. Your LLM sees the signal, not the noise.

Deduplication

Collapses repeated log lines with counts. 500 identical errors become one line.

Auto-Rewrite Hook

Transparently intercepts Bash commands and rewrites them to rtk equivalents. Zero config, 100% adoption.

Analytics

rtk gain shows savings stats, graphs, and history. rtk discover finds missed opportunities.

Token savings by operation

Measured on real-world Claude Code sessions.

Operation Standard With rtk Savings
ls / tree File listings with metadata Filtered tree, grouped -80%
cat / read Full file contents Signatures only (aggressive) -70%
grep / rg Verbose match output Grouped by file, compact -80%
git status Multi-line with hints One-line per category -80%
git diff Full unified diff Ultra-condensed diff -75%
git log Verbose commit history Compact one-liners -80%
git add/commit/push Multi-line confirmations ok ✓ abc1234 -92%
test runners Full test output Failures only -90%
docker ps Wide table with IDs Compact container list -80%

Get started in 30 seconds

rtk is written in Rust for maximum performance. Choose your install method.

Quick Install

One-liner for Linux & macOS

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

Via Cargo

From GitHub or crates.io

cargo install --git https://github.com/rtk-ai/rtk

Pre-built Binaries

macOS, Linux, Windows

Then activate the auto-rewrite hook

rtk init --global

This installs a PreToolUse hook that transparently rewrites Bash commands to rtk equivalents. Zero token overhead, 100% adoption.

30+ commands, one tool

Everything you need, from file browsing to Kubernetes logs.

Files

rtk ls .Filtered tree
rtk read file.rsSmart read
rtk find "*.rs"Compact find
rtk grep "pattern"Grouped grep
rtk diff f1 f2Condensed diff

Git

rtk git statusCompact status
rtk git logOne-line commits
rtk git diffCondensed diff
rtk git commit -m "msg"ok ✓ abc1234
rtk git pushok ✓ main

Test & Build

rtk test <cmd>Failures only
rtk err <cmd>Errors only
rtk tscTS errors grouped
rtk lint eslint .Violations grouped
rtk vitest runCompact output

Data & Analytics

rtk json config.jsonStructure only
rtk depsDependencies summary
rtk envVars filtered
rtk gainSavings stats
rtk discoverMissed savings

Containers

rtk docker psCompact list
rtk docker logs <c>Deduplicated
rtk kubectl podsCompact pods
rtk kubectl logs <p>Deduplicated

Network & More

rtk curl <url>Auto JSON schema
rtk gh pr listCompact PRs
rtk cargo buildCargo compact
rtk prisma migrateNo ASCII art
rtk next buildNext.js compact

Your LLM doesn't need to read all that.

Install rtk, save tokens, ship faster.