Tools

RTK: compress terminal output before it reaches Claude Code to save tokens

TL;DR

RTK (Rust Token Killer) is a CLI that compresses terminal command output before it enters an AI agent’s context. For Claude Code it installs a PreToolUse hook that automatically rewrites <code>git status</code> to <code>rtk git status</code>, and so on.

How it works

  1. Install RTK, then run rtk init -g to add the Claude Code hook.
  2. When the agent calls Bash, the hook rewrites the command to its RTK equivalent.
  3. The agent receives compressed output — still informative, minus the noise.
PointDetails
Coverage100+ commands: git, gh, npm/pnpm, jest/vitest, tsc, pytest, ruff, go test, cargo, docker, kubectl, terraform…
SavingsUp to ~90% of bash output (per the project); that’s only part of input tokens, so total cost drops less
LimitationOnly intercepts Bash; built-in Read/Grep/Glob tools don’t pass through the hook
LicenceCLI is Apache-2.0; some engine/proxy components are BUSL-1.1 (an Apache-only rtk-oss edition exists)

How to put it to work

  • Best for repos with large test suites and long build logs, where command output dominates context.
  • After installing, run rtk --version and rtk gain to confirm the right package (another “rtk” exists on crates.io).
  • Measure before/after with real usage rather than trusting headline numbers.
  • Spot-check important commands: over-aggressive compression can hide error details the agent needs.