Skip to content

Performance and Token Optimization

Craft Agents can route Bash tool output through RTK, a local CLI that compresses common development-command output before it is sent back to the model.

This is useful when a session runs commands that produce lots of repetitive text: diffs, directory listings, search results, test logs, package-manager output, and build output. RTK does not make commands run faster; it reduces how many output tokens the model has to read and pay attention to.

Verbose tool output is one of the easiest ways to burn context. For example:

Terminal window
git diff
rg "TODO|FIXME" .
bun test
npm install
ls -R

Without RTK, the full raw output is appended to the conversation. With RTK enabled, Craft Agents invokes the local rtk binary to rewrite eligible Bash commands so their output is compacted before it reaches the model.

Typical benefits:

  • Lower token usage for common development commands
  • More usable context left for code and reasoning
  • Less noise from repetitive logs, huge diffs, and long file listings
  • Visibility in Settings through RTK’s saved-token / efficiency stats

RTK is most useful for coding and repository-maintenance sessions. It helps less for commands that already print short, targeted output.

  • RTK installed locally as rtk on your system PATH
  • RTK version 0.23.0 or newer
  • Craft Agents v0.9.4 or newer

Craft Agents does not bundle RTK. It detects the rtk executable on PATH and invokes it locally with telemetry disabled for Craft Agents’ rewrite and stats calls.

  1. Install RTK for your operating system.
  2. Open Settings → AI → Performance and click Re-check. If you edited PATH environment variables, restart Craft Agents first so the desktop process sees the new PATH.
  3. Enable Token Optimization.
  4. Run a command-heavy session.
  5. Return to Settings → AI → Performance to view saved-token stats once RTK has processed commands.

If Craft Agents still shows Get RTK, the rtk binary is either missing, below the required version, or not visible on the PATH used by the desktop app.

Homebrew is the simplest option:

Terminal window
brew install rtk-ai/tap/rtk

Or use RTK’s install script:

Terminal window
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/master/install.sh | sh

Verify:

Terminal window
which rtk
rtk --version
rtk gain

If you are verifying from Windows PowerShell 5.1:

  • Use Get-Command rtk or where.exe rtk; which is not a PowerShell command.
  • Use ; between commands instead of Bash-style &&.

Example:

Terminal window
Get-Command rtk; rtk --version; rtk gain
Craft Agents still says RTK is not installed

Click Re-check in Settings → AI → Performance. If it still fails, verify rtk from the same operating-system shell Craft Agents can see:

  • macOS/Linux: which rtk && rtk --version
  • Windows: Get-Command rtk; rtk --version

On Windows, make sure the folder is on the Windows PATH, not only on Git Bash/MSYS PATH.

rtk --version works, but Craft Agents does not enable it

Check the version. Craft Agents requires RTK 0.23.0 or newer because it depends on rtk rewrite.

rtk gain fails or looks wrong

Make sure you installed Rust Token Killer (rtk-ai/rtk), not the unrelated Rust Type Kit package with the same binary name. The correct RTK supports rtk gain.

Do I need to initialize every project?

No. Craft Agents does not require rtk init; it uses the installed rtk binary directly. You only need rtk init if you also want RTK hooks for another tool that uses RTK that way.