@diegopetrucci/pi-permission-gate

A pi extension that prompts before dangerous bash commands and protected file writes.

Packages

Package details

extension

Install @diegopetrucci/pi-permission-gate from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@diegopetrucci/pi-permission-gate
Package
@diegopetrucci/pi-permission-gate
Version
0.1.7
Published
Jul 14, 2026
Downloads
247/mo · 21/wk
Author
diegopetrucci
License
MIT
Types
extension
Size
7.9 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "index.ts"
  ]
}

Security note

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

README

permission-gate

A small pi extension that prompts for confirmation before running potentially dangerous bash commands or writing to protected paths.

This is adapted from the original permission-gate.ts example in earendil-works/pi-mono and kept basically the same.

What it checks

  • rm -rf
  • sudo
  • chmod / chown with 777
  • direct write / edit calls touching normalized protected paths:
    • exact .git path segments
    • exact node_modules path segments
    • secret-bearing .env files such as .env and .env.production

Safe .env templates/examples such as .env.example and .env.production.template are allowed.

If pi is running without an interactive UI, it blocks matching commands and protected path writes by default.

Install

Standalone npm package

pi install npm:@diegopetrucci/pi-permission-gate

Collection package

pi install npm:@diegopetrucci/pi-extensions

GitHub package

pi install git:github.com/diegopetrucci/pi-extensions

Then reload pi:

/reload

Notes

  • Hooks the tool_call event.
  • Inspects bash, write, and edit tool calls.
  • Normalizes relative/absolute paths before matching so traversal tricks do not bypass the guard.
  • Prompts with a simple Yes / No selector before allowing dangerous commands or protected path writes.