@bacnh85/pi-rtk
v0.1.9
Published
Pi extension that routes shell commands through RTK for token savings.
Maintainers
Readme
pi-rtk
Pi extension that rewrites bash tool calls through RTK for token savings.
Behavior
- Listens for Pi
tool_callevents for the built-inbashtool. - Listens for context-visible user shell commands entered as
!cmd. - Skips
!!cmduser shell commands because their output is excluded from model context. - Delegates command matching to
rtk rewrite. - Mutates agent bash commands in place or wraps user shell execution when RTK returns a rewrite.
- Falls back to native
findwhen RTK would rewrite to unsupported compound/actionrtk findpredicates. - Fails open on errors: commands pass through unchanged.
- Caches RTK-unavailable state briefly to avoid repeatedly probing a missing binary.
- Does not block, confirm, audit, or permission-gate commands.
Commands
/rtk enableenables rewrites for the current Pi session./rtk disabledisables rewrites for the current Pi session./rtk statusshows session state, cache state, and detected RTK details./rtkshows status.
Requirements
rtk >= 0.23.0available inPATH.- Set
RTK_DISABLED=1to bypass rewrites. The extension reads this from the process environment, current working directory.env.local/.env, or Pi global config.env.local/.envunder$PI_CODING_AGENT_DIRor~/.pi/agent.
Install
Install the published package from npm:
pi install npm:@bacnh85/pi-rtkFrom this repository checkout, install only this extension package:
pi install ./pi-rtkThe package manifest points Pi directly at ./extensions/index.ts, so published npm installs and local installs load the same extension entrypoint.
Install extensions from their own package directories. This repository intentionally has no root Pi package because multiple extension packages live side by side.
Test
pi -e ./pi-rtk
rtk gain --history
RTK_DISABLED=1 pi -e ./pi-rtk