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.
Why enable RTK?
Section titled “Why enable RTK?”Verbose tool output is one of the easiest ways to burn context. For example:
git diffrg "TODO|FIXME" .bun testnpm installls -RWithout 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.
Requirements
Section titled “Requirements”- RTK installed locally as
rtkon your system PATH - RTK version
0.23.0or 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.
Enable RTK in Craft Agents
Section titled “Enable RTK in Craft Agents”- Install RTK for your operating system.
- 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.
- Enable Token Optimization.
- Run a command-heavy session.
- 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.
Install RTK
Section titled “Install RTK”Homebrew is the simplest option:
brew install rtk-ai/tap/rtkOr use RTK’s install script:
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/master/install.sh | shVerify:
which rtkrtk --versionrtk gainHomebrew on Linux:
brew install rtk-ai/tap/rtkOr use RTK’s install script:
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/master/install.sh | shIf you prefer Cargo:
cargo install --git https://github.com/rtk-ai/rtk rtkVerify:
which rtkrtk --versionrtk gainDownload the Windows zip from the RTK releases page, extract rtk.exe, and copy it to a directory on the Windows PATH.
The no-admin, no-environment-edit option is to use the per-user WindowsApps folder. It is normally already on the Windows PATH, so it avoids administrator rights and global system folders:
Copy-Item "C:\Users\<you>\bin\rtk.exe" "$env:LOCALAPPDATA\Microsoft\WindowsApps\rtk.exe" -ForceVerify from a new PowerShell window:
Get-Command rtkrtk --versionrtk gainIf you prefer a dedicated user bin folder, add it to your Windows user PATH once:
[Environment]::SetEnvironmentVariable( "Path", [Environment]::GetEnvironmentVariable("Path", "User") + ";C:\Users\<you>\bin", "User")Then reopen PowerShell and verify again. If Craft Agents was already running when you edited PATH, restart Craft Agents before clicking Re-check.
Windows PowerShell notes
Section titled “Windows PowerShell notes”If you are verifying from Windows PowerShell 5.1:
- Use
Get-Command rtkorwhere.exe rtk;whichis not a PowerShell command. - Use
;between commands instead of Bash-style&&.
Example:
Get-Command rtk; rtk --version; rtk gainTroubleshooting
Section titled “Troubleshooting”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.