pi-keeper0.2.1
Permission modes for pi (default, auto and plan) with per-project allow, ask and deny rules and a plan you approve before any edit.
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.
Reports 0
No reports yet.
Readme
pi-keeper
Permission modes and a project rulebook for pi: default, auto and plan, per-project rules, and a plan → execute handoff. Each mode decides which tool calls run, which ask you, and which are blocked.
Mission: keep a well-meaning agent inside what you handed it: ask before it loses, leaks, reaches or disarms something you did not hand over, and otherwise stay out of the way (why).
The exact rules for every mode and for subagents, and the reasons behind them, are in the decision records.
A personal project, shared as is. pi-keeper reduces accidental damage by asking before risky actions. It is not a sandbox or a security boundary. Run untrusted work in a container or a VM.
Install
pi install npm:pi-keeper
pi update --extensions picks up new releases. From a checkout, see Working from a checkout.
Modes
| Mode | Use it for | Runs without asking | Asks | Blocked |
|---|---|---|---|---|
default (blue) |
everyday work: you approve changes | reads, searches, read-only bash (loops and inline python included), anything your rules cover, read-only tools | edits, other bash, other tools | sudo & co |
auto (yellow) |
a trusted task you are watching | almost everything, including deletes inside the project (its git repository) and temp the session created | dangerous commands, protected paths, writes, deletes and runs elsewhere, secrets, the first outside read | sudo & co |
plan (green) |
researching and writing a plan | reads, read-only bash, the plan file, the scratch dir | other bash | edits, other tools, dangerous commands, sudo & co |
In default and auto, creating and writing under a /tmp/pi-keeper-* dir runs without asking, for the agent and its subagents, when the dir is yours, not group or world writable and reached through no link. Deleting inside the session's own scratch dir also runs (the dir itself is never removed). Removals and moves in other such dirs, secret files and protected names still ask: see temp dirs.
In plan mode the agent writes a plan file and calls exit_plan_mode; you then pick auto, or default with approval for each edit. The guide has the full action-by-action matrix.
Commands
| Command | What it does |
|---|---|
| Alt+M, Ctrl+Shift+M | Cycle default → auto → plan (Ctrl+Shift+M needs the kitty keyboard protocol) |
/mode |
Pick a mode |
/plan [prompt|open] |
Start plan mode, or open the plan |
/permissions |
List every rule with its source; remove the ones you pick |
/approvals |
Open the permission asks that background subagents are waiting on |
/rules |
Open the rulebook: rules that fire when the model slips |
/keeper [setting value] |
Settings panel, or set one directly |
Dialogs offer Yes once, Don't ask again this session, or Always allow … in this project, for commands as well as MCP and other tools. Project rules are saved to .pi/settings.local.json (allow rules count in default mode, Read(<dir>/**) rules in every mode). Session answers reach every subagent. ask and deny rules apply in every mode; allow rules load after you review the file once. Details: Managing rules, The dialogs, /keeper.
Optional companions
| Package | What it adds |
|---|---|
| pi-subagents | children run in your mode, and background asks reach your dialog (Subagents) |
| pi-shell-highlight | colored command names and heredocs in the permission dialog |
Without them pi-keeper works standalone.
Security and limitations
pi-keeper decides from the command text and tool arguments. A shell is too flexible for that to be complete, so it does not guarantee a harmful command is caught.
- No mode is bulletproof;
autolets the most through. Preferplanordefaultand add the narrowest rule that works. - Read each dialog before you approve it, and review changes before you commit, push or deploy.
- For untrusted code or unattended runs, isolate with a container, a VM or a separate user without your credentials.
Use at your own risk. Provided "AS IS", without warranties; see sections 7 and 8 of the LICENSE. Full text: guide.
Compatibility
Tested with pi 1.5.2, pi-subagents 0.89.0 and pi-cc-extensions 1.0.20. pi-cc-extensions can hide the plan row: list exit_plan_mode under excludeRenderers in its settings, or pi-keeper asks once per session. More in the guide.
More
Guide (every mode, dialog, rule and setting) · Decisions (the rules, why, and the threat model) · Architecture · Rulebook · Development
Acknowledgements
Rule spellings such as Bash(git add:*) and WebFetch(domain:<host>) are read for compatibility with the settings format Claude Code documents. The modes, the plan flow and everything else are written from scratch; nothing here comes from Claude Code's code or prompts. The command arity table in extensions/modes/command-names.ts is adapted from OpenCode (MIT, see NOTICE). The rulebook's file shape is an idea from oh-my-pi; no code was taken. Built on pi. Not affiliated with or endorsed by Anthropic, OpenCode, oh-my-pi or the pi project; their names are used only to say what this works with or credits.