2.1 KiB
2.1 KiB
| title | description | tags | |||
|---|---|---|---|---|---|
| RTK Token Optimization Template | CLAUDE.md configuration for minimizing token consumption with RTK CLI proxy |
|
RTK Token Optimization
Context: Using RTK (Rust Token Killer) to minimize token consumption from command outputs.
Commands to Optimize
Always use RTK wrapper for these high-verbosity commands:
Git Operations (92.3% avg reduction)
rtk git loginstead ofgit logrtk git statusinstead ofgit statusrtk git diffinstead ofgit diff
File Operations (69.4% avg reduction)
rtk find "*.md" .instead offind . -name "*.md"rtk read <file>instead ofcat <file>(for large files >10K lines)rtk ls .instead ofls -lartk grep "pattern"instead ofgrep -r "pattern"
JS/TS Stack (70-90% reduction)
rtk vitest runinstead ofpnpm testrtk pnpm listinstead ofpnpm listrtk pnpm outdatedinstead ofpnpm outdatedrtk prisma migrate statusinstead ofpnpm prisma migrate status
Rust Toolchain (80-90% reduction)
rtk cargo testinstead ofcargo testrtk cargo buildinstead ofcargo buildrtk cargo clippyinstead ofcargo clippy
Python (90% reduction)
rtk python pytestinstead ofpytest
Go (90% reduction)
rtk go testinstead ofgo test
GitHub CLI (79-87% reduction)
rtk gh pr view <num>instead ofgh pr view <num>rtk gh pr checks <num>instead ofgh pr checks <num>
Token Savings Target
Baseline: ~150K tokens per 30-min session With RTK: ~45K tokens (70% reduction)
Installation
# Homebrew (macOS/Linux)
brew install rtk-ai/tap/rtk
# Cargo (all platforms)
cargo install rtk
# Hook-first install
rtk init
Verification
Check RTK availability:
rtk --version # Should show: rtk 0.16.0+
When NOT to use RTK
- Quick exploration (1-2 commands): overhead not worth it
- Already using tools like Grep/Read (Claude native tools are optimized)
- Small outputs (<100 chars): minimal gain
Automation
Use RTK automatically via hook (see .claude/hooks/bash/rtk-wrapper.sh) or rtk init for hook-first setup.