$ rtk --version
rtk 1.0.0 # (or similar)
$ rtk gain
rtk: 'gain' is not a rtk command. See 'rtk --help'.You installed the wrong rtk package. You have Rust Type Kit (reachingforthejack/rtk) instead of Rust Token Killer (rtk-ai/rtk).
1. Uninstall the wrong package:
cargo uninstall rtk2. Install the correct one (Token Killer):
curl -fsSL https://github.com/rtk-ai/rtk/blob/master/install.sh | shcargo install --git https://github.com/rtk-ai/rtk3. Verify installation:
rtk --version
rtk gain # MUST show token savings stats, not errorIf rtk gain now works, installation is correct.
| Project | Repository | Purpose | Key Command |
|---|---|---|---|
| Rust Token Killer ✅ | rtk-ai/rtk | LLM token optimizer for Claude Code | rtk gain |
| Rust Type Kit ❌ | reachingforthejack/rtk | Rust codebase query and type generator | rtk query |
# Check if "gain" command exists
rtk gain
# Token Killer → Shows token savings stats
# Type Kit → Error: "gain is not a rtk command"If Rust Type Kit is published to crates.io under the name rtk, running cargo install rtk will install the wrong package.
NEVER use cargo install rtk without verifying.
Always use explicit repository URLs:
# CORRECT - Token Killer
cargo install --git https://github.com/rtk-ai/rtk
# OR install from fork
git clone https://github.com/rtk-ai/rtk.git
cd rtk && git checkout feat/all-features
cargo install --path . --forceAfter any installation, ALWAYS verify:
rtk gain # Must work if you want Token KillerClaude Code doesn't seem to be using rtk, outputs are verbose.
1. Verify rtk is installed and correct:
rtk --version
rtk gain # Must show stats2. Initialize rtk for Claude Code:
# Global (all projects)
rtk init --global
# Per-project
cd /your/project
rtk init3. Verify CLAUDE.md file exists:
# Check global
cat ~/.claude/CLAUDE.md | grep rtk
# Check project
cat ./CLAUDE.md | grep rtk4. Install auto-rewrite hook (recommended for automatic RTK usage):
Option A: Automatic (recommended)
rtk init -g
# → Installs hook + RTK.md automatically
# → Follow printed instructions to add hook to ~/.claude/settings.json
# → Restart Claude Code
# Verify installation
rtk init --show # Should show "✅ Hook: executable, with guards"Option B: Manual (fallback)
# Copy hook to Claude Code hooks directory
mkdir -p ~/.claude/hooks
cp .claude/hooks/rtk-rewrite.sh ~/.claude/hooks/
chmod +x ~/.claude/hooks/rtk-rewrite.shThen add to ~/.claude/settings.json (replace ~ with full path):
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "/Users/yourname/.claude/hooks/rtk-rewrite.sh"
}
]
}
]
}
}Note: Use absolute path in settings.json, not ~/.claude/...
$ cargo install --path . --force
Compiling rtk v0.7.1
Finished release [optimized] target(s)
Installing ~/.cargo/bin/rtk
$ rtk --version
zsh: command not found: rtk~/.cargo/bin is not in your PATH.
1. Check if cargo bin is in PATH:
echo $PATH | grep -o '[^:]*\.cargo[^:]*'2. If not found, add to PATH:
For bash (~/.bashrc):
export PATH="$HOME/.cargo/bin:$PATH"For zsh (~/.zshrc):
export PATH="$HOME/.cargo/bin:$PATH"For fish (~/.config/fish/config.fish):
set -gx PATH $HOME/.cargo/bin $PATH3. Reload shell config:
source ~/.bashrc # or ~/.zshrc or restart terminal4. Verify:
which rtk
rtk --version
rtk gain$ cargo install --path .
error: failed to compile rtk v0.7.11. Update Rust toolchain:
rustup update stable
rustup default stable2. Clean and rebuild:
cargo clean
cargo build --release
cargo install --path . --force3. Check Rust version (minimum required):
rustc --version # Should be 1.70+ for most features4. If still fails, report issue:
Report issues:
- Fork-specific: https://github.com/rtk-ai/rtk/issues
- Upstream: https://github.com/rtk-ai/rtk/issues
Run the diagnostic script:
# From the rtk repository root
bash scripts/check-installation.shThis script will check:
- ✅ RTK installed and in PATH
- ✅ Correct version (Token Killer, not Type Kit)
- ✅ Available features (pnpm, vitest, next, etc.)
- ✅ Claude Code integration (CLAUDE.md files)
- ✅ Auto-rewrite hook status
The script provides specific fix commands for any issues found.