RTK (Rust Token Killer) integration for Pi — reduces LLM token consumption by 60-90% on common dev commands.
RTK compresses CLI output before it reaches your AI agent's context window, enabling better reasoning, longer sessions, and lower costs.
pi install npm:pi-rtkOr via git:
pi install git:github.com/voska/pi-rtkRTK must be installed on your system:
cargo install rtk
# or
brew install rtk-ai/tap/rtkRequires rtk >= 0.23.0.
The extension hooks into Pi's tool_call event. When the model invokes the bash tool, the command is passed through rtk rewrite — RTK's built-in command rewriter. If RTK has a compressed equivalent (e.g. git status → rtk git status), the command is transparently replaced before execution.
All rewrite logic lives in the RTK binary. This extension is a thin shim — no rules to maintain, always in sync with the latest RTK release.
RTK handles 40+ commands including:
- Git: status, diff, log, show, branch, stash
- GitHub CLI: pr, issue, run, release
- JS/TS: pnpm, npm, vitest, tsc, eslint, prettier, playwright, prisma
- Rust: cargo test, build, clippy, check
- Python: pytest, ruff, mypy, pip
- Go: go build, test, vet, golangci-lint
- Containers: docker, kubectl
- Infrastructure: aws, psql, terraform
- File ops: ls, tree, find, grep, curl, wget
Run rtk --help for the full list.
Run rtk gain in your terminal to see cumulative savings:
$ rtk gain
Total commands: 3,241
Tokens saved: 24.6M (83.7%)
pi remove npm:pi-rtkMIT