Tutti gli articoli
AI and automation 9 min di lettura10 novembre 2026

RTK: fewer tokens wasted with Claude Code

TOKEN Guide: Windows installation, measurements, five use cases and four prompts. Verified on November 10, 2026.

RTK: fewer tokens wasted with Claude Code — free TOKEN guide

1. What is RTK and what you need

RTK: fewer tokens wasted with Claude Code

RTK stands for Rust Token Killer. In the reel I say «RTX», but the correct name is RTK. It trims command text before Claude Code reads it. Here you’ll find the installation, five use cases and four ready prompts. Official sources verified on November 10, 2026.

Want to set it up in your project?

Message us on WhatsApp with the word TOKEN. We’ll help you verify the setup and measure the result on your work.

Imagine a test that prints 500 lines of successes and few errors. It’s the official quick‑start example: RTK keeps failures and summarizes passed tests. Claude Code already limits overly long outputs, but the text it reads still consumes context and usage. With API it impacts billed tokens; a subscription eats plan limits.

  • →Claude Code already working, with an enabled account or API access. Claude’s free plan isn’t enough.
  • →Windows and PowerShell, with winget available. For Claude Code: Windows 10 1809 or later and at least 4 GB RAM, per Anthropic.
  • →A project and its existing tools: RTK won’t install Git, Python, or the program you need to filter.
  • →For the standard automatic filter you need to check the Bash tool. Git for Windows provides Git Bash. The separate PowerShell tool is to be verified.

Cost and license: the CLI is free. Hooks and filters are Apache‑2.0. The full edition also includes a BUSL‑1.1 engine with its own terms. There’s a pure Apache‑2.0 edition. Both use the same rtk name—pick one. Claude Code’s price is separate.

2. Install RTK on Windows

RTK: fewer tokens wasted with Claude Code

Open PowerShell. First check if RTK is already present. These two commands should show the version and a savings summary, even if empty. If they work, move to section 3.

rtk --version
rtk gain

If missing, use the Windows command listed in the official docs. winget must already be available:

winget install rtk-ai.rtk

After installation, reopen the terminal and repeat the check:

rtk --version
rtk gain

Similar name: Rust Type Kit also exists. Don’t use the generic `cargo install rtk`. If the version shows but gain isn’t recognized, verify the package and path before proceeding.

If winget isn’t available: from the official releases download rtk‑x86_64‑pc‑windows‑msvc.zip. Extract rtk.exe and place it in a folder on your PATH. For other architectures the suitable Windows package is to be verified. Don’t double‑click the executable.

Some filters need ripgrep, the rg command, in the PATH. If you get a missing warning, the Windows docs say:

winget install BurntSushi.ripgrep.MSVC

Mac/Linux: the README shows the following command if Homebrew is already installed. The official guide also provides the script for Linux, Mac and WSL.

brew install rtk

3. Connect it to Claude Code and check the limits

RTK: fewer wasted tokens with Claude Code

The automatic connection uses a hook: a rule that runs before the command. For example it turns git status into rtk git status. First you can see the expected changes. Then you apply the global config:

rtk init --global --dry-run
rtk init --global

The first command writes nothing. The second registers the hook in ~/.claude/settings.json and applies to all user projects. Follow the prompts shown by the installer. For this guide you only need the command filter: keep the proxy and optional pipelines disabled. Close and reopen Claude Code.

Note on init: rtk init without --global adds instructions to CLAUDE.md and a filter template in the project. Current versions do not install the automatic hook. Use --global, short -g, for that.

  • →In Claude Code open /hooks and check the RTK PreToolUse hook.
  • →Ask Claude to run git status. See if it uses the Bash tool or the PowerShell tool.
  • →In the terminal look at the history below. Look for a new filtered execution. If it’s missing, the automation isn’t working.
rtk gain --history

Windows is supported. Since v0.37.2 RTK uses a native hook. But Claude Code’s standard filter catches the Bash tool: launching Claude from PowerShell doesn’t guarantee Bash usage. PowerShell tool interception still needs verification. You can explicitly try a supported RTK command:

rtk git status

Read, Grep and Glob built‑ins bypass the Bash filter. The full edition adds extra options, but they aren’t required to start. An unfiltered command may pass unchanged. If you miss useful detail, request the full output with rtk bypass followed by the command.

4. Measure before and after with rtk gain

RTK: fewer tokens wasted with Claude Code

Start with a small comparison. In a Git repo, without changing files between the two runs, compare the same state with and without the filter. First note the counters. Then run the steps below. bypass shows the full output and records the run with zero savings.

rtk gain
rtk bypass git status
rtk git status
rtk gain --history
rtk gain

In the history compare the two executions. In the summary view the difference from the initial counters. The cumulative percentage also includes the bypass run: it’s not just the filter’s percentage. Stats are shared across projects and sessions on the machine. Avoid other RTK commands during the test.

How to read the numbers

ItemMeaning
InputEstimated tokens of the original output.
OutputEstimated tokens after filtering.
SavedDifference between Input and Output.
Save%Reduction of output bytes, not of the invoice.

Illustrative example of the official quick start. Not a measurement of your project:

Total commands : 10
Input tokens   : 50,000
Output tokens  : 5,000
Saved          : 45,000  (90.0%)

Estimated tokens: RTK uses bytes / 4. It doesn’t count the model’s exact tokens. The project advertises 60–90% on common commands and up to 90% less output. Your percentage must be measured. A 90% shorter output doesn’t make the whole session 90% cheaper.

To continue: measure a comparable workday and check retained errors. For cost impact also look at Claude usage. Don’t compare two consecutive installations: the second may print less because packages are already present. Don’t reset history for this test.

5. Five concrete use cases

RTK: fewer wasted tokens with Claude Code

Pick the case that exists in your project. The commands below are separate examples: you don’t have to run them all. Use the tools of the respective project. After each test check the result and the savings history.

Test: find the failure immediately

In a Rust project, summarize passed tests and focus on failures. RTK also supports JavaScript, pytest and Go tests: verify your project’s command.

rtk cargo test

Build: read errors and warnings

Still in a Rust project, cut compilation noise. If a diagnostic detail is missing, retry with bypass.

rtk cargo build

Git log and diff: review changes

Read a compact history and a diff with less context. Before approving a delicate change, revert to the full diff if needed.

rtk git log
rtk git diff

Packages: remove progress bars

In a Node.js project, install the dependencies declared by the project. The npm filter reduces noise, but can also remove warnings: to diagnose an installation check the full output.

rtk npm install

Long logs: group repetitions

With Docker already present, rtk docker logs container-name summarizes repetitions of the last 100 log lines (replace container-name with an existing container). If the exact error sequence is missing, use bypass.

6. Four ready prompts and CLAUDE.md

RTK: fewer tokens wasted with Claude Code

Paste one prompt at a time into Claude Code, from the project folder. They are templates to adapt. When you use them, Claude can run commands and modify the configuration. Here they are just ready‑to‑copy texts.

PROMPT 1 — SETUP

Install and configure RTK for this project using only the official rtk-ai/rtk docs. First check rtk --version and rtk gain. On Windows run winget install rtk-ai.rtk if missing. Show me rtk init --global --dry-run and explain that the hook applies to all projects. Configure only the base filter. Verify which shell tool you use and run rtk gain --history. Flag PowerShell for review if not intercepted.

PROMPT 2 — TEST

Find the test command for this project. Check if RTK supports it. Run it with the filter and report failures, messages and final outcome. If details are missing, use rtk bypass on the same command. Do not modify code in this initial diagnosis.

PROMPT 3 — GIT REVIEW

Use rtk git log and rtk git diff to explain local changes. If the diff context is insufficient, get the full output with rtk bypass git diff. List files, issues and points to check. Do not create a commit.

PROMPT 4 — MEASUREMENT

Log RTK gain. Compare rtk bypass git status and rtk git status without modifying files during tests. Read rtk gain --history and the final summary. Separate cumulative counters and single commands. Explain estimated tokens, output percentage and measurement limits. Do not promise euro savings or reset history.

One line for CLAUDE.md

Add this rule to the existing CLAUDE.md without deleting the other instructions. It's an editorial reminder, not a replacement for the hook:

- Usa RTK per i comandi supportati; se mancano dettagli usa rtk bypass, controlla rtk gain e verifica l'hook quando usi PowerShell.

Start with a command, then measure

RTK: fewer tokens wasted with Claude Code

Test a simple command first. Ensure the filter keeps needed data. Then extend to test, build and log. It must stay short yet useful. If not, get full output. PC compatibility still to verify.

Need help with Claude Code?

Message us on WhatsApp with TOKEN. Tell us which project you use and where you waste time. We'll help set up RTK, verify commands and read results.

Official sources — checked November 10, 2026

Commands and limits: RTK installation, quick start, supported commands. Measures: rtk gain and meaning of savings. Licenses: RTK editions.

Code checks: RTK hook, npm, Docker log. For Claude Code: PowerShell hook, setup, command output and costs. Repository: rtk-ai/rtk.

Free PDF guide: Download PDF (PDF in Italian)

RTK: fewer tokens wasted with Claude Code | Marketizzati