pi-speed-inhibitor
v1.0.1
Published
pi extension that sleeps a configurable amount of milliseconds before every tool call, adjustable live via ctrl+up / ctrl+down or /speed-inhibit
Maintainers
Readme
pi-speed-inhibitor
A pi extension that deliberately slows the agent down by sleeping a configurable number of milliseconds before every tool call, so you can see what's about to run and watch it work.
How it works
- Registers a
tool_execution_starthook that sleeps for the configured delay before each tool call runs, blocking the agent loop until the delay elapses (pi awaits extension handlers, so the tool waits). - Two keyboard shortcuts adjust the delay live:
ctrl+up— increase the delay by 100ms ("up")ctrl+down— decrease the delay by 100ms, floored at 0ms ("down")
- A
/speed-inhibit <ms>command sets the delay to an exact value (e.g./speed-inhibit 5000); no argument shows the current delay. - Every adjustment is persisted to the extension's
config.json, so the delay and keys survive restarts. - An always-visible widget above the editor shows the current delay (e.g.
🐢 speed inhibitor: 400ms before each tool call), so you always know it's loaded and how much it's inhibiting pi. - A notification confirms the extension loaded and reports the current delay on startup/
/reload. - The sleep is abort-aware: pressing Esc cancels the wait immediately instead of holding up the agent.
Why arrow keys
The bindings went through a few iterations before landing on arrow keys:
ctrl+(/ctrl+)— the parentheses live on the shifted number row, and terminals report the gesture under different key IDs depending on the keyboard protocol (kitty:shift+ctrl+(, modifyOtherKeys:shift+ctrl+8). The plain form matched nothing.ctrl+shift+u— intercepted by the Kitty terminal itself (its Unicode-input dialog), so it never reached pi.ctrl+u— collides with a pi built-in binding (app.tree.filter.userOnly).
Arrow keys have no such problems: pi binds ctrl+left/ctrl+right but not ctrl+up/ctrl+down, tmux and Kitty don't intercept them, and the key IDs are identical under every keyboard protocol (kitty: ESC[1;5A/B, legacy: ESC Oa/Ob).
Install
Copy or symlink this folder into a pi extension location, then run /reload in pi:
# global (all projects)
mkdir -p ~/.pi/agent/extensions
cp -r pi-speed-inhibitor ~/.pi/agent/extensions/
# or project-local
mkdir -p .pi/extensions
cp -r pi-speed-inhibitor .pi/extensions/No npm install needed — the extension only uses Node built-ins.
Usage
| Key / command | Effect |
| --- | ------ |
| ctrl+up | Add 100ms to the per-tool-call delay ("up") |
| ctrl+down | Remove 100ms from the per-tool-call delay ("down", min 0ms) |
| /speed-inhibit 5000 | Set the per-tool-call delay to exactly 5000ms |
| /speed-inhibit | Show the current delay |
Configuration
The delay and keys are stored in <agent dir>/extensions/pi-speed-inhibitor/config.json:
{
"sleepMs": 400,
"decreaseKeys": ["ctrl+down"],
"increaseKeys": ["ctrl+up"]
}<agent dir> is $PI_CODING_AGENT_DIR if set, otherwise ~/.pi/agent. You can edit the file directly to change the delay or the keys — the extension re-reads it on load, so run /reload to pick changes up. The first entry of each list is the display name shown in the widget; every entry is registered, so list all the key IDs your terminal may report for the gesture you want. Any key combo pi supports (see the keybindings docs) works.
Development
npm install # dev deps only (typescript + pi's types)
npm run typecheck