RTK (Rust Token Killer)

A Rust CLI proxy that filters and compresses command output before it reaches an agent's context window. Use it to reduce noisy shell output in Claude Code, Cursor, Codex, and related coding harnesses.

What it does

Agent harnesses bleed tokens on raw command output: git status, test runners, linters, kubectl, build logs, directory trees, and long grep results. RTK intercepts shell commands, runs the underlying command, and returns compact output that keeps the decision-relevant parts while dropping boilerplate. The project claims 60-90% reductions on common development commands, with the website citing 89% average noise removed across 2,900+ real-world commands. Treat those numbers as project claims until benchmarked on the target repo. Source: X/@sdusteric, 2026-05-27; Source: rtk-ai/rtk README, 2026-06-30

How it works

RTK is a command-proxy architecture. The CLI routes a command through per-tool filters, executes the real command, compresses output, and tracks savings with rtk gain. Four strategies do the work:

  • Smart filtering - remove comments, whitespace, progress bars, boilerplate, and other low-signal output.
  • Grouping - aggregate similar items such as files by directory or errors by category.
  • Truncation - keep relevant head/tail/context while cutting repetitive middle sections.
  • Deduplication - collapse repeated log lines with counts.

It covers many common shell-heavy workflows: git/gh, package managers, test runners, Python/Rust/Go/.NET/Ruby tooling, Docker, Kubernetes, AWS, Playwright, Vitest, Jest, find, grep/rg, and file reads. rtk init can install hooks for Claude Code, Cursor, OpenAI Codex, Gemini CLI, Copilot, Windsurf/Cline, Hermes, and related harnesses. Source: rtk-ai/rtk README, 2026-06-30

Bounds and caveats

The hook only fires when the agent uses a shell/Bash tool. Native harness tools such as Read, Grep, or Glob bypass the shell hook, so they will not be automatically compressed. To get RTK's compact output for those flows, call rtk read, rtk grep, rtk find, or use shell commands intentionally. This is why it complements Kevin's rg convention rather than replacing it.

There is also a name-collision caveat: unrelated projects named rtk exist. Use rtk-ai/rtk as the authority and verify install source before adding it to a harness. Source: rtk-ai/rtk README, 2026-06-30

Where it fits

RTK attacks the same problem as Lean Ctx, but at a different layer: Lean Ctx trims what the harness injects as standing context; RTK trims what commands emit during the run. They compose. This is Context Engineering applied to the tool-output channel and a direct lever on Agent Unit Economics, complementary to Prompt-Caching Economics.

Highest value for Kevin:

  • long agent sessions on noisy repos;
  • CI/test/build debugging where logs dominate the context window;
  • Dedalus monorepo work where command output can dwarf the actual decision;
  • harness experiments that need lower-cost repeated loops.

Adopt cautiously. Run the wiki's Brin/skill-auditor/reputation gates, install only from the canonical repo or Homebrew formula, benchmark against real command traces, and keep a clear bypass path for cases where compact output hides necessary detail.

Version Snapshot

2026-06-30 source check:

Field Value
Repo rtk-ai/rtk
License Apache-2.0
Default branch develop
Latest release v0.43.0, published 2026-06-28
Default-branch HEAD 36dd8f24792b4d36af59a114bdce01d4f5a8cbf1
HEAD date 2026-06-29
HEAD message fix(hook): use ask action in audit log for AskRewrite verdict
GitHub stats 67,177 stars, 4,146 forks

The enriched bookmark text referenced issues #2104 and #2012 about confidence and token/context balance. That is a useful caution: compression should be treated as an evaluator-backed optimization, not a blind global rewrite. Source: GitHub API; enriched X bookmark, 2026-06-30


Timeline