← Catalog

@jalaxy33/pi-permit

Permission gate for pi: command, path and workspace rules

Extension

Install

Install with PiG

pig install npm:@jalaxy33/pi-permit

Install with Pi

pi install npm:@jalaxy33/pi-permit
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.1.2 (README.md). PiG does not review it.

pi-permit

A permission gate for pi. Every tool call gets one of three answers: run it, ask the user, or block it.

It looks at three things, in this order:

  1. Protected paths — file tools and bash paths are matched against path rules. A match blocks, without asking.
  2. Writes outside the workspace — a write or delete outside the session cwd asks first, unless the path is on the allow list.
  3. Commands — each command in a bash string is matched against command rules. Text inside heredocs, quotes and comments is never matched.

Install

pi install npm:@jalaxy33/pi-permit

From the repository:

pi install git:github.com/jalaxy33/pi-permit

Then run /reload.

Keys

KeyAction
y / Enterallow once
aallow this rule with these flags, or this directory, for the rest of the session
n / Esc / Ctrl+Cdeny; the turn continues
sdeny and stop the turn
j / k / ↑ / ↓ · oscroll · expand the command view

Without a UI the gate fails closed: a command that would ask is blocked instead.

Commands

CommandAction
/permitshow the loaded rules, their sources, session grants and warnings
/permit:reloadre-read the config without restarting pi

Configuration

Two files are yours to edit:

FileScope
~/.pi/agent/permit.jsonall projects
<project>/.pi/permit.jsonone project, only after the project is trusted

Shipped rules apply first, then global, then project; a later rule with the same id replaces an earlier one.

{
  "commands": {
    "allow": [
      { "id": "git-add", "program": "git", "args": ["add"] },
      { "id": "git-commit", "program": "git", "args": ["commit"] }
    ]
  },
  "paths": [
    { "id": "my-env", "patterns": [".env"], "except": [".env.example"], "protection": "block" }
  ],
  "outsideCwd": { "allowPaths": ["~/work/shared/**"] }
}

Both allow rules reuse shipped ids, so they replace the strict set's asks for git add and git commit. A path rule blocks a file; allowPaths stops the out-of-workspace prompt for a folder. defaultRules switches a whole shipped set on or off.

Field-by-field reference and matching rules: docs/configuration.md.

Shipped rule sets

SetFileContents
denypolicy/deny.jsongit history rewriting, reflog expire, gc --prune=now
basicpolicy/basic.jsonrare but unrecoverable damage: rm -r, sudo, dd of=, mkfs*, wipefs, fdisk, shred, chmod -R 777, chown -R, privileged containers; plus .env and private key files
strictpolicy/strict.jsongit workflow, rsync --delete, bulk deletes, truncate, databases, terraform/kubectl/helm, docker volumes, publishing

For a quiet setup, turn off the strict set:

{ "defaultRules": ["-strict"] }

Limits

A guard, not a sandbox. It sees the command text and the paths in it, so anything a program resolves on its own is out of reach.

  • python -c "open('.env')" passes.
  • Shell aliases, functions and eval are not expanded.
  • Reads outside the workspace are not gated: a path rule is the only check on what the agent may read.

Development

bun test

pi-tui, pi-coding-agent and ajv come from symlinks in node_modules/. The first two are peer dependencies that pi provides at runtime.

Similar extensions