---
title: "RTK alternative: try Caveman shrink and the proxy"
description: "Start with one command, not your whole setup. Run a test suite you know through RTK and through Caveman, read both outputs, and decide from there. Many people end up keeping RTK for shell commands and"
canonical: https://caveman.ac/switch/rtk
last-updated: 2026-10-04
---

# RTK alternative: try Caveman shrink and the proxy

Start with one command, not your whole setup. Run a test suite you know through RTK and through Caveman, read both outputs, and decide from there. Many people end up keeping RTK for shell commands and adding the Caveman proxy for everything else, which this guide also covers. The [comparison page](/compare/rtk) explains the trade-offs.

This page means [RTK, the Rust Token Killer](https://github.com/rtk-ai/rtk). If `rtk gain` fails, you may have the unrelated crate with the same name.

## Step 1: Find and save your RTK hook

Check what RTK installed and where:

```bash
rtk --version
rtk init --show
```

Note whether the hook is global (`rtk init -g`) or per project, and which agent it targets. Copy the agent's settings file somewhere safe so you can restore it exactly. For Claude Code the hook lives in its settings, and RTK also writes an `RTK.md`.

Pick a disposable workspace and one noisy command with a known result, ideally a test run with one failing test.

## Step 2: Install Caveman

The CLI needs Node.js 22.13 or newer. `setup --install` downloads about 205 MB of signed Go binaries into `~/.caveman/bin/`:

```bash
npm install -g @caveman-ai/cli
caveman setup --install
```

No account is needed for anything on this page.

## Step 3: Run the same command through both

Save the raw output once, so both tools see the same bytes:

```bash
cargo test > baseline.txt 2>&1
```

Then run it through each tool:

```bash
rtk cargo test
caveman shrink -- cargo test
```

Swap `cargo test` for your own runner: `pytest`, `npm test`, `go test`. For an exact comparison on identical input, replay the saved file through Caveman:

```bash
caveman shrink --file baseline.txt
```

Read both views side by side. Each one must keep the failing test name, the assertion message and the file and line. A shorter output that buries the failure has failed the trial, whatever the token count says.

Caveman prints a footer with an inferred token estimate and a recovery handle, and sends a JSON report to stderr. RTK's counts are `bytes / 4` estimates, so compare the direction of the numbers, not the exact values.

## Step 4: Check the exit code and the bytes

Both tools must pass the exit code through, or an agent and a CI job will both be fooled:

```bash
caveman shrink -- cargo test; echo "exit: $?"
```

A failing suite has to print a non-zero exit.

Then check recovery. Use the `ccr_` handle from the footer, with no query, since a query returns a filtered view:

```bash
caveman retrieve ccr_YOUR_HANDLE > recovered.txt
cmp baseline.txt recovered.txt
```

For a live run, capture the command's raw output yourself and compare against that. RTK keeps the full output of failed or truncated commands; `rtk recall` with the id it printed gets it back. Caveman keeps every shrunk output, including passing runs. Small outputs pass through unchanged and get no handle, which is correct.

## Step 5: Choose your setup

**Option A: replace RTK's hook with Caveman's.** Remove RTK's hook first, then install Caveman's, so only one tool rewrites commands:

```bash
rtk init -g --uninstall
caveman hooks install
```

Restart the agent. Caveman's hook rewrites allow-listed, non-interactive commands with no pipes or redirects, on Claude Code, Codex, opencode, Gemini CLI, Hermes and OpenClaw. Check that your agent is on that list; RTK covers more tools.

**Option B: keep RTK and add the proxy.** Leave RTK's hook alone and run the agent through Caveman's local proxy, which compresses file reads, MCP results and other tool output in each request:

```bash
caveman wrap claude
```

That runs one session and writes nothing to your config. `caveman claude` makes it permanent. RTK filters first and Caveman sees RTK's output, so for those commands the original Caveman stores is RTK's filtered text.

Whichever you pick, run one real task before and after and compare finished results and provider-reported input tokens. The [cost measurement guide](/guides/measure-agent-cost) has a format. Don't add the two tools' percentages together.

## Roll back

For Option A, remove Caveman's hook and put RTK's back:

```bash
caveman hooks uninstall
rtk init -g
```

If you saved the agent's settings file in Step 1, you can also restore it directly. Restart the agent either way.

For Option B, stop launching through `caveman wrap`. If you ran `caveman claude`, `caveman disable claude` restores the agent's config. Leave Caveman installed while any open conversation still refers to Caveman handles.

## Related

- [Caveman vs RTK](/compare/rtk)
- [Coding agent setup guide](/guides/coding-agent-setup)
- [Caveman shrink docs](https://docs.caveman.so/docs/shrink)
- [RTK quick start](https://www.rtk-ai.app/guide)
