Skip to main content

Quick Start

Get RTK up and running in under 5 minutes. This guide walks you through installation, verification, initialization, and your first token-optimized commands.

Prerequisites

  • macOS, Linux, or Windows
  • Command-line access
  • Claude Code, Cursor, or another AI coding assistant (optional but recommended)

Step 1: Install RTK

Choose your preferred installation method:
brew install rtk
If you already have RTK installed, verify it’s the correct package:
rtk gain
If this command works (even if it says “No tracking data yet”), you’re good to go. Skip to Step 3.

Step 2: Verify Installation

Confirm RTK is installed correctly:
rtk --version
rtk 0.24.0
If rtk gain returns “command not found” but rtk --version works, you installed the wrong RTK (Rust Type Kit).Uninstall and reinstall the correct package:
cargo uninstall rtk
cargo install --git https://github.com/rtk-ai/rtk

Step 3: Initialize RTK

Set up RTK to work automatically with your AI coding assistant:
rtk init --global
1

Run the init command

rtk init --global
This installs a hook that automatically rewrites commands across all projects.
2

Answer the prompt

Patch settings.json? [y/N]: y
Type y and press Enter to register the hook with Claude Code.
3

Restart Claude Code

Close and reopen Claude Code for the hook to take effect.
What just happened?
  • Hook installed: ~/.claude/hooks/rtk-rewrite.sh now intercepts bash commands
  • Context optimized: ~/.claude/RTK.md added (only 10 lines, saves ~2000 tokens vs old method)
  • Settings patched: ~/.claude/settings.json now registers the hook
  • Backup created: Original settings saved to ~/.claude/settings.json.bak

Step 4: Test Your First Command

Try a few RTK commands to see the difference:

Directory Listing

ls -la

Git Status

git status

Git Push

git add .
git commit -m "Add new feature"
git push

Test Runner (Failures Only)

cargo test

Step 5: View Your Savings

After running a few RTK commands, check your token savings:
rtk gain
📊 RTK Token Savings
════════════════════════════════════════

Total commands:    12
Input tokens:      3,847
Output tokens:     892
Tokens saved:      2,955 (76.8%)

By Command:
────────────────────────────────────────
Command               Count      Saved     Avg%
rtk git status            4      1,247    81.2%
rtk git push              3        618    92.1%
rtk ls                    3        724    68.4%
rtk test cargo test       2        366    88.7%
First run? The rtk gain command will show “No tracking data yet” until you’ve run at least one RTK command.RTK tracks all usage in a local SQLite database at ~/.local/share/rtk/history.db.

What’s Next?

You’re now set up and saving tokens! Here are some next steps:

Explore Commands

See the full list of 50+ optimized commands for git, testing, linting, and more.

Hook Configuration

Learn how auto-rewrite hooks work and customize them for your workflow.

Analytics Deep Dive

Export token savings data as JSON/CSV for dashboards and reports.

Troubleshooting

Common issues and solutions for installation, hooks, and command failures.

Tips for Maximum Savings

1

Use hooks for automatic optimization

With rtk init --global, you never need to type rtk manually - all commands are rewritten automatically.
2

Prefix commands manually if hooks aren't installed

If you skipped the hook setup, manually prefix commands:
rtk git status
rtk npm test
rtk docker ps
3

Check savings regularly

Run rtk gain weekly to see your cumulative savings and identify high-impact commands.
4

Report missing commands

If you find a command RTK doesn’t optimize, open an issue - we’re always adding more!

Common Workflows

Git Workflow

# Check status
rtk git status

# View recent commits
rtk git log -10

# See changes
rtk git diff

# Stage and commit
rtk git add .
rtk git commit -m "Your message"

# Push to remote
rtk git push

Test-Driven Development

# Run tests (show failures only)
rtk test cargo test
rtk test npm test
rtk pytest
rtk go test

# Run linters
rtk lint
rtk cargo clippy
rtk ruff check

Package Management

# List dependencies
rtk pnpm list
rtk pip list

# Check for updates
rtk pnpm outdated
rtk pip outdated

# Install packages (quiet mode)
rtk pnpm install react
rtk pip install requests

Container Operations

# List containers
rtk docker ps

# View logs (deduplicated)
rtk docker logs my-container

# Kubernetes
rtk kubectl get pods
rtk kubectl logs my-pod

Getting Help

If you run into issues:

Documentation

Browse the full documentation for guides, references, and examples.

GitHub Issues

Report bugs, request features, or ask questions.

Troubleshooting

Fix common problems with installation, hooks, and commands.

Community

Join the RTK community and share your token savings!
Pro Tip: Run rtk gain --all --format json to export your savings data and create custom dashboards or CI/CD reports.