claude-code-ultimate-guide/examples/claude-md/rtk-optimized.md
Florian BRUNIAUX d1182af4cf docs: v3.27.1 — fact-check corrections, grepai docs, RTK overhaul
Fact-check (README positioning):
- Template count: 120/123 → 108 (ground truth recount)
- Ratio: 14× → 24× (19,000 ÷ 784 = 24.2×)
- everything-cc stars: 31.9k → 45k+ (verified Feb 15)
- Commands count: 20 → 23, hooks: 30 → 31

Added:
- Grepai MCP documentation (semantic search, call graphs)
- 3 hook templates (rtk-baseline, session-summary, session-summary-config)
- 2 resource evaluations (system-prompts update, qmd token savings)

Changed:
- RTK documentation overhaul (v0.7.0 → v0.16.0, rtk-ai org)
- Exports deprecated (kimi.pdf, notebooklm.pdf → deprecated/)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 18:41:45 +01:00

74 lines
2 KiB
Markdown

# 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 log` instead of `git log`
- `rtk git status` instead of `git status`
- `rtk git diff` instead of `git diff`
### File Operations (69.4% avg reduction)
- `rtk find "*.md" .` instead of `find . -name "*.md"`
- `rtk read <file>` instead of `cat <file>` (for large files >10K lines)
- `rtk ls .` instead of `ls -la`
- `rtk grep "pattern"` instead of `grep -r "pattern"`
### JS/TS Stack (70-90% reduction)
- `rtk vitest run` instead of `pnpm test`
- `rtk pnpm list` instead of `pnpm list`
- `rtk pnpm outdated` instead of `pnpm outdated`
- `rtk prisma migrate status` instead of `pnpm prisma migrate status`
### Rust Toolchain (80-90% reduction)
- `rtk cargo test` instead of `cargo test`
- `rtk cargo build` instead of `cargo build`
- `rtk cargo clippy` instead of `cargo clippy`
### Python (90% reduction)
- `rtk python pytest` instead of `pytest`
### Go (90% reduction)
- `rtk go test` instead of `go test`
### GitHub CLI (79-87% reduction)
- `rtk gh pr view <num>` instead of `gh pr view <num>`
- `rtk gh pr checks <num>` instead of `gh pr checks <num>`
## Token Savings Target
**Baseline**: ~150K tokens per 30-min session
**With RTK**: ~45K tokens (70% reduction)
## Installation
```bash
# Homebrew (macOS/Linux)
brew install rtk-ai/tap/rtk
# Cargo (all platforms)
cargo install rtk
# Hook-first install
rtk init
```
## Verification
Check RTK availability:
```bash
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.