pi-hooks
v1.0.3
Published
Collection of pi extensions (checkpoint, lsp, permission, ralph-loop, repeat)
Maintainers
Readme
pi-extensions
Minimal reference extensions for pi-coding-agent.
Quick Setup
Install the package:
pi install npm:pi-hooks
pi config # enable/disable extensionsDependencies are installed automatically during pi install.
To pull updates later:
pi update git:github.com/prateekmedia/pi-hooksIncluded Extensions
checkpoint/
Git-based checkpoint system for restoring code state when forking conversations.
- Captures repo state at the start of every turn (tracked, staged, and untracked files)
- Stores checkpoints as Git refs for persistence across sessions
- Offers restore options: files + conversation, conversation only, or files only
- Automatically saves current state before restoring past snapshots
lsp/
Language Server Protocol integration (hook + tool).
The package exports two extensions via package.json:
lsp-hook.ts- Auto-diagnostics (default at agent end)lsp-tool.ts- On-demand LSP queries
Hook (auto-diagnostics):
- Default: runs diagnostics once at agent end for touched files
- Optional: run after each
write/edit - Configure via
/lspto switch to per-edit or disabled - Supports web, Flutter, and common backend stacks
- Manages LSP server lifecycles per project root
Tool (on-demand queries):
- Definitions, references, hover, symbols, diagnostics, signatures
- Query by symbol name or line/column position
permission/
Layered permission control with four permission levels:
| Level | Description | What's allowed | |---------|-----------------------|-----------------------------------------------------| | Minimal | Read-only mode | Only read commands (ls, cat, git status, etc.) | | Low | File edits | + write/edit files | | Medium | Dev commands | + npm, git, make, cargo, etc. | | High | Full access | Everything (dangerous commands still prompt) |
On first run you pick a level; it's saved globally. Use /permission to change levels and /permission-mode to switch between ask/block prompts.
ralph-loop/
Looped subagent execution via the ralph_loop tool.
- Runs single or chain subagent tasks until a condition returns false
- Takes a prompt and exit condition (exit condition optional)
- Can supply max iterations and minimum delay between each
- Optionally supply model and thinking
- Supports
conditionCommand,maxIterations, andsleepMscontrols - Interactive steering/follow-up + pause/resume/stop commands in UI mode
- Defaults to the
workeragent and the last user prompt when omitted - No npm install required
Example prompt: "Use ralph loop to check the current time five times, sleeping 1s between iterations."
repeat/
Repeat past tool calls (bash/edit/write) from the current branch.
/repeatshows a picker of recent bash/edit/write tool calls with type-to-search filtering- Bash entries load as
!commandin the editor for tweak + run - Write entries open a temp editor (if
$EDITORis set) and apply only when you save - Edit entries can repeat the edit (may fail) or open
$EDITORat the first changed line; repeat uses a temp editor and applies on save
token-rate/
Shows the average output tokens per second (TPS) in the footer status line.
Usage
Install the package and enable extensions:
pi install npm:pi-hooks pi configSee inline comments in each extension for configuration options.
Testing
cd lsp && npm install
cd ../permission && npm install
cd ../checkpoint && npm test
cd ../lsp && npm run test:all
cd ../permission && npm testLicense
MIT
