---
title: "Switch an RTK command workflow to Caveman"
description: "Use one command to decide whether Caveman belongs in your RTK workflow. Do not begin by replacing every hook on your machine. A test run with a known failure gives you a clear check for output fidelit"
canonical: https://caveman.so/switch/rtk
last-updated: 2026-09-07
---

# Switch an RTK command workflow to Caveman

Use one command to decide whether Caveman belongs in your RTK workflow. Do not begin by replacing every hook on your machine. A test run with a known failure gives you a clear check for output fidelity and exit status.

This guide refers to [Rust Token Killer](https://github.com/rtk-ai/rtk). Other projects use the RTK name. Record the installed version and confirm which tool your agent calls before changing configuration.

## Inspect the current hook

Find the hook or instruction that rewrites shell commands through RTK. Save the relevant configuration file and note whether it applies to one project or all projects. Keep unrelated hooks, permission settings, and tool servers intact.

RTK's [quickstart](https://github.com/rtk-ai/rtk/blob/develop/docs/guide/getting-started/quick-start.md) documents project and global initialization. A project-level experiment will not disable a global hook by itself. Check the command the agent actually ran in its transcript.

Choose a disposable test workspace with a task you already understand. Keep its source revision and test command fixed for the comparison.

## Install Caveman and test one command

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

Run the normal command once, then run it through Caveman. Replace `npm test` with your real test command if the project uses another runner.

```bash
caveman shrink -- npm test
```

`shrink` captures stdout and stderr for the view the agent reads and returns the underlying command's exit code. It can store an eligible larger output and attach a recovery handle. If the output is already small, unchanged output is an expected result.

For an exact source comparison, use a saved transcript so the two runs do not differ because of timings or test order:

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

Inspect the emitted view. It should retain the failure details the agent needs to decide its next action. A shorter wall of text that hides the failed test name has not passed the trial.

## Check the original and exit status

Retrieve the actual handle returned by your run:

```bash
caveman retrieve YOUR_RECOVERY_HANDLE > recovered-test-output.txt
cmp baseline-test-output.txt recovered-test-output.txt
```

`YOUR_RECOVERY_HANDLE` is replaced with the emitted `ccr_` value. Use no query for this exact-byte check. If there was no lossy transform, there may be no handle to retrieve.

Separately run a deliberately failing test and confirm that the caller receives a failing exit status through the wrapper. A pipeline that only prints the error but returns success can mislead both an agent and CI.

## Try the complete agent path

For provider-request compression, start a new supported session:

```bash
caveman claude
```

Use a saved test configuration with RTK command rewriting disabled for that experiment. The point is to measure Caveman alone first. Keep the same model and instructions, including any output-shortening skill, across the comparison or declare the skill as part of the candidate.

Include a non-shell tool result if that is why you are considering the proxy. If all large context comes from terminal output, the command wrapper may be enough. The [wrap reference](https://docs.caveman.so/docs/proxy/wrap) describes supported hosts and recovery behavior.

## Decide whether to combine them

If you keep RTK for some commands and Caveman for the provider path, inspect the exact ordering. Caveman can store only the bytes it receives. When RTK runs first, recovering Caveman's original gives you RTK's output, not the command output from before RTK.

Check one failing test, a long successful test run, and a command with a rare value the agent must preserve. Compare whole-task usage and correctness using [this method](/guides/measure-agent-cost). Do not add percentages from the two tools as if they were independent savings.

## Roll back

Restore the saved hook or project instruction and launch a fresh agent session. Stop using the Caveman launcher for new tasks if the trial loses. Keep the local recovery store while any in-flight conversation still refers to its handles.

The [comparison](/compare/rtk) explains the two integration boundaries. [Caveman recovery documentation](https://docs.caveman.so/docs/proxy/recoverable) covers store lifetime and exact retrieval.
