omp packages

@jalaxy33/pi-permission0.5.2

Permission gate for pi: command, path and workspace rules

jalaxy33 Published 1 day ago MIT ~0 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-permission

A permission gate for pi. Every tool call is allowed, asks, or is blocked, checked in this order:

  1. Path rules — file tools and bash paths, by operation: read, write, delete.
  2. Outside the workspace — writes and deletes outside the session cwd.
  3. Commands — every command in a bash string.

Unmatched calls fall to defaultPermission, allow by default.

Install

pi install npm:@jalaxy33/pi-permission
pi install git:github.com/jalaxy33/pi-permission

Then run /reload.

Keys

Key Action
y / Enter allow once
a allow this rule with these flags, this rule and operation, or this path, for the rest of the session
n / Esc / Ctrl+C deny; the turn continues
s deny and stop the turn
j / k / ↑ / ↓ · o scroll · expand the command

Without a UI, a call that would ask is blocked.

Commands

Command Action
/permission active preset, rulesets, defaults, sources, warnings
/permission:reload re-read the config without restarting pi

Configuration

File Scope
~/.pi/agent/permission.json all projects
<project>/.pi/permission.json one project, after the project is trusted
{
  "preset": { "id": "cautious", "remove": ["bulk-delete"] },
  "include": ["git-local", { "id": "publish", "remove": ["gh-delete"] }],
  "defaultPermission": { "commands": "allow", "paths": "allow" },
  "outsideCwd": { "mode": "ask", "allowPaths": ["~/work/shared/**"] },
  "rulesets": { "local": "./rules/local.json" },
  "commands": {
    "allow": [{ "id": "git-push", "program": "git", "args": ["push"] }]
  },
  "paths": [
    { "id": "prod-config", "patterns": ["config/prod*.yml"], "action": "ask" }
  ]
}

Presets

Preset Includes
minimal irreversible, secrets, dynamic-exec
standard minimal + privilege
cautious standard + bulk-delete, database, infra, git-remote, publish
paranoid cautious + git-local

The default is standard.

Rulesets

Ruleset Guards
irreversible git history rewrites, dd of=, mkfs*, wipefs, blkdiscard, fdisk, shred
secrets .env files and private keys
privilege sudo, doas, pkexec, privileged containers, recursive chmod 777/chown
bulk-delete rm -r, find -delete, xargs rm, truncate, rsync --delete, git clean, stash drop, worktree remove
git-local git add, commit, merge, reset --hard, discard, branch and tag delete
git-remote git push; --force-with-lease stays allowed
publish package publishing, gh delete
database dropdb, SQL DROP/TRUNCATE, Redis FLUSH
infra terraform, kubectl delete/drain, helm uninstall, docker prune
dynamic-exec commands whose real program cannot be read: env -S, xargs, find -exec, eval, source, python -c, node -e, pwsh, busybox

Limits

A guard, not a sandbox: it reads the command text, and a program's own behaviour is out of reach.

  • Not covered: code downloaded and run later (npx, at, cron), remote execution (ssh host '…', docker exec), project scripts (make, npm run), rm without -r.
  • A script on stdin (curl … | bash) asks and cannot be granted. python job.py asks once per script file; a changed file asks again.
  • Reads outside the workspace pass; only a path rule stops them.
  • Only bash, powershell and the file tools are inspected.

Development

bun test

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

Similar extensions