@mrclrchtr/supi-rtk

SuPi RTK extension — transparent bash command rewriting via RTK for token savings

Packages

Package details

extension

Install @mrclrchtr/supi-rtk from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@mrclrchtr/supi-rtk
Package
@mrclrchtr/supi-rtk
Version
1.14.0
Published
Jun 18, 2026
Downloads
2,563/mo · 430/wk
Author
mrclrchtr
License
MIT
Types
extension
Size
101.5 KB
Dependencies
1 dependency · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./src/extension.ts"
  ],
  "image": "https://raw.githubusercontent.com/mrclrchtr/supi/main/packages/supi-rtk/assets/logo.png"
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@mrclrchtr/supi-rtk

Adds RTK-backed bash rewriting to the pi coding agent.

Install

pi install npm:@mrclrchtr/supi-rtk

This is a beta package. Install individually.

For local development:

pi install ./packages/supi-rtk

What you get

After install, the package intercepts bash execution in two places:

  • model bash tool calls
  • user_bash execution paths

For each command, it tries to run rtk rewrite <command> first. If RTK returns a usable rewrite, the rewritten command is executed. If not, the original command runs unchanged.

Fallback and guard behavior

The package falls back to normal bash execution when:

  • RTK is disabled in settings
  • the rtk binary is not available on PATH
  • the rewrite times out
  • RTK exits without usable output
  • a guard rule decides the command should bypass rewriting

Current bypass rules include:

  • commands prefixed with RTK_DISABLED=1 or env RTK_DISABLED=1
  • commands that invoke biome
  • rg commands
  • package-manager lint commands in projects that use Biome

These guards exist because the current RTK rewrite path can be lossy for those command shapes.

Settings

This package registers an RTK section in /supi-settings.

Available settings:

  • enabled — turn RTK rewriting on or off
  • rewriteTimeout — timeout in milliseconds for rtk rewrite

Defaults:

{
  "rtk": {
    "enabled": true,
    "rewriteTimeout": 5000
  }
}

Extra integration

  • registers an RTK provider section for /supi-context
  • tracks successful rewrites, fallbacks, and estimated token savings for the current session
  • records debug events through supi-core's debug registry, so supi-debug can inspect rewrite and fallback activity when installed
  • warns once per session when RTK is enabled but the rtk binary is missing

Source

  • src/rtk.ts — extension wiring, bash interception, settings, and context-provider registration
  • src/rewrite.tsrtk rewrite execution and result classification
  • src/guards.ts — bypass rules for known lossy rewrites
  • src/tracking.ts — per-session rewrite statistics