@vanillagreen/pi-hooks

First-class Pi port of the vstack safety hooks: bare-cd blocking, pre-commit fmt+clippy, post-edit clippy, end-of-turn lint. Per-hook toggles via pi-extension-manager.

Packages

Package details

extension

Install @vanillagreen/pi-hooks from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@vanillagreen/pi-hooks
Package
@vanillagreen/pi-hooks
Version
0.1.3
Published
Jun 1, 2026
Downloads
386/mo · 14/wk
Author
vanillagreencom
License
MIT
Types
extension
Size
82.9 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./extensions/hooks.ts"
  ]
}

Security note

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

README

@vanillagreen/pi-hooks

pi-hooks settings panel

First-class Pi port of the vstack safety hooks. Each hook is independently toggleable.

Hooks

Hook Pi event Behavior
Block bare cd tool_call (bash) Blocks bare cd /path commands with no subshell or chaining. Use (cd /path && command) instead.
Pre-commit fmt + clippy tool_call (bash) When git commit targets the active project repo, runs cargo fmt --check then cargo clippy in async child processes so Pi stays responsive. Blocks on failure. Skips commits targeting other repos and only fires when .rs files are staged or modified; if the bash command contains git add, untracked .rs files are treated conservatively as possibly staged by that command.
Post-edit clippy tool_result (edit/write of .rs) Runs workspace clippy after .rs edits and appends issues mentioning the edited file. Advisory only — doesn't undo the edit.
End-of-turn clippy turn_end If .rs files were touched during the turn, runs workspace clippy and surfaces errors via UI notification. Advisory only.

These implement the same safety goals as the bash hooks in vstack/hooks/, with Pi-specific mechanics where the in-process event loop needs different handling. In particular, the Pi pre-commit hook runs cargo checks via async child processes and first proves the commit targets the active project repo so unrelated fixture commits do not freeze the session. Any change to a hook script must land alongside the matching change in pi-hooks — see AGENTS.md.

Install

vstack add --pi-extension pi-hooks

Or as part of vstack add --all. Refresh with vstack refresh.

Via npm:

pi install npm:@vanillagreen/pi-hooks

Settings

Open /extensions:settings; settings appear under the Hooks tab.

Setting What it does
Enable hooks Master toggle. Disable to make the extension inert without uninstalling.
Block bare cd Toggle the bare-cd block hook.
Pre-commit fmt + clippy Toggle the pre-commit hook.
Post-edit clippy Toggle the post-edit advisory hook.
End-of-turn clippy Toggle the end-of-turn advisory hook.
Clippy timeout Max ms per clippy invocation. Advisory post-edit/end-of-turn clippy timeouts are abandoned so work can continue; blocking pre-commit fmt/clippy timeouts block the commit with a timeout reason. Pre-commit checks run asynchronously, so long checks may delay the commit gate without freezing the Pi TUI or bridge.