Skip to content

RTK integration

The rtk extension rewrites compatible Bash tool calls to use the Rust Token Killer binary. Selesai reuses a valid system installation or provisions a verified managed binary, reducing noisy command output without changing Selesai’s own rewrite behavior.

Bundled with Selesai

Loaded automatically with Selesai; no per-extension npm install is required.

Manifest entry
./rtk.ts
Runtime surface
Automatic

Setup and prerequisites

  • The extension is bundled with Selesai and provisions the pinned RTK release into Selesai’s managed binary directory when no usable system binary is available.
  • rtk must report version 0.23.0 or newer (rtk rewrite was introduced in 0.23.0).
  • Selesai also runs rtk gain to reject the unrelated Rust Type Kit binary that uses the same command name.
  • Set PI_OFFLINE=1 to prevent downloads; the extension then remains disabled if no valid RTK binary is available.

What it sets up

  • Reuses a valid system rtk or downloads the pinned official release into Selesai’s managed binary directory with checksum verification.
  • Probes rtk --version and rtk gain at extension load time and bails out if the binary is missing, unrelated, or too old.
  • Registers a tool_call listener that intercepts Bash tool calls and delegates command rewriting to rtk rewrite.
  • Applies the rewritten command only when rtk rewrite exits 0 or 3 and returns a non-empty stdout that differs from the original command.

What you can configure

RTK is managed by Selesai when needed. The extension rewrites commands when a verified rtk binary is available and not disabled.

No user configuration

This capability does not expose user-editable settings. Its behavior is controlled by the commands and runtime rules documented below.

Command, tool, and shortcut controls

Key / pathDescription
automatic bash rewriteTransparent; no user command required.
RTK_DISABLED=1Set this environment variable to disable RTK command rewriting and managed installation for the session.
PI_OFFLINE=1Set this environment variable to disable startup network operations, preventing managed binary downloads.

Source evidence

What you can do

  • Start Selesai normally; it provisions RTK when needed. Compatible bash tool calls are rewritten automatically.
  • Set RTK_DISABLED=1 before launching Selesai to bypass the rewriter and managed installation.
  • Set PI_OFFLINE=1 to run without network provisioning.
  • Inspect the rewritten command in the tool output if the model asks for the exact shell behavior.

Commands, tools, and shortcuts

There are no slash commands, tools, or shortcuts. The extension only rewrites Bash tool calls.

MechanismDescription
rtk rewrite <cmd>External subprocess that returns a quieter equivalent or signals no rewrite.
Bash tool call hookIntercepts bash tool calls before execution.

Limits and safety

  • Only bash tool calls are rewritten; other tools are untouched.
  • Commands that already start with rtk are skipped to avoid recursion.
  • Rewrites are advisory: if rtk rewrite exits with an unexpected code, times out after 2 seconds, or throws, the original command runs unchanged (fail-open).
  • The extension does not add new tools or change model behavior; it only mutates the command string passed to Bash.
  • Selesai does not run rtk init; its own Pi hook handles command rewriting and avoids duplicate RTK configuration.

Source evidence

Selesai version: 0.10.0