RTK (Rust Token Killer) integration for Pi coding agent. Reduces LLM token consumption by 60-90% on common dev commands.
This Pi extension transparently intercepts bash tool calls and rewrites them to use RTK equivalents before execution. The LLM receives compressed, token-optimized output without any changes to your workflow.
Example transformations:
git status→rtk git status(80% savings)cargo test→rtk cargo test(90% savings)npm install→rtk npm install(80% savings)
- Pi coding agent installed
- RTK installed (
brew install rtkor see RTK docs)
# Clone to Pi extensions directory
git clone https://github.com/yourusername/pi-rtk.git ~/.pi/agent/extensions/pi-rtk
# Or install as a Pi package
pi install git:github.com/yourusername/pi-rtkpi install npm:pi-rtk- Copy
src/index.tsto~/.pi/agent/extensions/rtk.ts - Restart Pi or run
/reload
Once installed, the extension works automatically. All supported bash commands are transparently rewritten to use RTK.
/rtk-status- Show RTK token savings statistics/rtk-discover- Find missed RTK savings opportunities
Per-command:
RTK_DISABLED=1 git status # Runs raw git statusGlobally:
export RTK_DISABLED=1The extension automatically rewrites these commands:
Git: git status, git diff, git log, git add, git commit, git push, git pull, git show
GitHub CLI: gh pr, gh issue, gh run
File Operations: cat, head, tail, ls, find, grep, rg
Build Tools: cargo, npm, pnpm, yarn, make, cmake
Test Runners: vitest, jest, pytest, playwright
Linters: eslint, biome, ruff, golangci-lint, rubocop
Containers: docker, kubectl
Package Managers: pip, bundle, prisma
TypeScript: tsc
Formatting: prettier
See RTK documentation for the full list.
User/LLM: "git status"
↓
Pi bash tool call
↓
Pi RTK Extension intercepts
↓
rtk rewrite "git status" → "rtk git status"
↓
Modified command executes
↓
LLM receives: "ok main" (10 tokens instead of 2000+)
# Clone the repository
git clone https://github.com/yourusername/pi-rtk.git
cd pi-rtk
# Install dependencies
npm install
# Link for local testing
ln -s $(pwd) ~/.pi/agent/extensions/pi-rtk
# Test with Pi
pi -e ./src/index.tsContributions welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
MIT License - see LICENSE for details.