@mrclrchtr/supi-rtk
v1.12.0
Published
SuPi RTK extension — transparent bash command rewriting via RTK for token savings
Maintainers
Readme
@mrclrchtr/supi-rtk
Adds RTK-backed bash rewriting to the pi coding agent.
Install
pi install npm:@mrclrchtr/supi-rtkThis is a beta package. Install individually.
For local development:
pi install ./packages/supi-rtkWhat you get
After install, the package intercepts bash execution in two places:
- model
bashtool calls user_bashexecution 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
rtkbinary is not available onPATH - 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=1orenv RTK_DISABLED=1 - commands that invoke
biome rgcommands- package-manager
lintcommands 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 offrewriteTimeout— timeout in milliseconds forrtk 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, sosupi-debugcan inspect rewrite and fallback activity when installed - warns once per session when RTK is enabled but the
rtkbinary is missing
Source
src/rtk.ts— extension wiring, bash interception, settings, and context-provider registrationsrc/rewrite.ts—rtk rewriteexecution and result classificationsrc/guards.ts— bypass rules for known lossy rewritessrc/tracking.ts— per-session rewrite statistics
