> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/rtk-ai/rtk/llms.txt
> Use this file to discover all available pages before exploring further.

# Quick Start

> Get started with RTK in 5 minutes - install, verify, and start saving tokens

# 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:

```bash Homebrew (macOS/Linux) theme={null}
brew install rtk
```

```bash Quick Install (Linux/macOS) theme={null}
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/master/install.sh | sh
```

```bash Cargo (from source) theme={null}
cargo install --git https://github.com/rtk-ai/rtk
```

> [!NOTE]
>
> If you already have RTK installed, verify it's the correct package:
>
> ```bash theme={null}
> rtk gain
> ```
>
> If this command works (even if it says "No tracking data yet"), you're good to go. Skip to [Step 3](#step-3-initialize-rtk).

## Step 2: Verify Installation

Confirm RTK is installed correctly:

```bash theme={null}
rtk --version
```

```bash Expected Output theme={null}
rtk 0.24.0
```

```bash Verify It's Token Killer (Not Type Kit) theme={null}
rtk gain
```

```text Expected Output theme={null}
No tracking data yet.
Run some rtk commands to start tracking savings.
```

> [!WARNING]
>
> 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:
>
> ```bash theme={null}
> 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:

```bash theme={null}
rtk init --global
```

**1. Run the init command**

```bash theme={null}
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.

> [!NOTE]
>
> **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

```bash Standard ls theme={null}
ls -la
```

```text Output (45 lines, ~800 tokens) theme={null}
drwxr-xr-x  15 user  staff    480 Jan 23 10:00 .
drwxr-xr-x   5 user  staff    160 Jan 23 09:00 ..
-rw-r--r--   1 user  staff   1234 Jan 23 10:00 Cargo.toml
-rw-r--r--   1 user  staff    567 Jan 23 10:00 README.md
drwxr-xr-x   8 user  staff    256 Jan 23 10:00 src
drwxr-xr-x   3 user  staff     96 Jan 23 10:00 target
...
```

```bash RTK optimized theme={null}
rtk ls .
```

```text Output (12 lines, ~150 tokens - 81% savings) theme={null}
📁 my-project/
├── src/ (8 files)
│   ├── main.rs
│   ├── lib.rs
│   └── ...
├── Cargo.toml
├── README.md
└── target/
```

### Git Status

```bash Standard git theme={null}
git status
```

```text Output (~25 lines, ~400 tokens) theme={null}
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   src/main.rs
	modified:   src/lib.rs
	modified:   Cargo.toml

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	src/new_feature.rs

no changes added to commit (use "git add" and/or "git commit -a")
```

```bash RTK optimized theme={null}
rtk git status
```

```text Output (4 lines, ~80 tokens - 80% savings) theme={null}
3 modified:
  src/main.rs, src/lib.rs, Cargo.toml
1 untracked:
  src/new_feature.rs
```

### Git Push

```bash Standard git push theme={null}
git add .
git commit -m "Add new feature"
git push
```

```text Output (15+ lines, ~200 tokens) theme={null}
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 342 bytes | 342.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To github.com:user/repo.git
   abc1234..def5678  main -> main
```

```bash RTK optimized theme={null}
rtk git add .
rtk git commit -m "Add new feature"
rtk git push
```

```text Output (3 lines, ~30 tokens - 85% savings) theme={null}
ok ✓
ok ✓ abc1234
ok ✓ main
```

### Test Runner (Failures Only)

```bash Standard cargo test theme={null}
cargo test
```

```text Output (200+ lines on failure) theme={null}
running 15 tests
test utils::test_parse ... ok
test utils::test_format ... ok
test core::test_init ... ok
...
test core::test_edge_case ... FAILED
test utils::test_overflow ... FAILED

failures:

---- core::test_edge_case stdout ----
thread 'core::test_edge_case' panicked at 'assertion failed: ...
...
```

```bash RTK optimized theme={null}
rtk test cargo test
```

```text Output (~20 lines, 90% savings) theme={null}
FAILED: 2/15 tests
  ✗ test_edge_case: assertion failed at src/lib.rs:42
  ✗ test_overflow: panic at src/utils.rs:18
```

## Step 5: View Your Savings

After running a few RTK commands, check your token savings:

```bash theme={null}
rtk gain
```

```text Sample Output theme={null}
📊 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%
```

```bash View savings over time theme={null}
rtk gain --graph
```

```text Daily Savings (last 30 days) theme={null}
────────────────────────────────────────
01-23 │███████████████████                      6.4K
01-24 │██████████████████                       5.9K
01-25 │                                         18
01-26 │████████████████████████████████████████ 13.0K
```

> [!NOTE]
>
> **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](/commands/overview.md)**
>
> See the full list of 50+ optimized commands for git, testing, linting, and more.

> **[Hook Configuration](/integration/hooks.md)**
>
> Learn how auto-rewrite hooks work and customize them for your workflow.

> **[Analytics Deep Dive](/analytics/gain-command.md)**
>
> Export token savings data as JSON/CSV for dashboards and reports.

> **[Troubleshooting](/troubleshooting.md)**
>
> 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:

```bash theme={null}
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](https://github.com/rtk-ai/rtk/issues) - we're always adding more!

## Common Workflows

### Git Workflow

```bash theme={null}
# 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

```bash theme={null}
# 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

```bash theme={null}
# 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

```bash theme={null}
# 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](https://github.com/rtk-ai/rtk/issues)**
>
> Report bugs, request features, or ask questions.

> **[Troubleshooting](/troubleshooting.md)**
>
> Fix common problems with installation, hooks, and commands.

> **[Community](https://www.rtk-ai.app)**
>
> Join the RTK community and share your token savings!

> [!NOTE]
>
> **Pro Tip:** Run `rtk gain --all --format json` to export your savings data and create custom dashboards or CI/CD reports.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.