← Catalog

pi-keeper

Permission modes for pi (default, auto and plan) with per-project allow, ask and deny rules and a plan you approve before any edit.

Extension

Install

Install with PiG

pig install npm:pi-keeper

Install with Pi

pi install npm:pi-keeper
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.

{
  "image": "https://raw.githubusercontent.com/DanielBlei/pi-packages/main/pi-keeper/assets/preview.png",
  "prompts": [
    "./prompt-templates"
  ],
  "extensions": [
    "./extensions/index.ts"
  ]
}

README

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

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.

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

ModeUse it forRuns without askingAsksBlocked
default (blue)everyday work: you approve changesreads, searches, read-only bash (loops and inline python included), anything your rules cover, read-only toolsedits, other bash, other toolssudo & co
auto (yellow)a trusted task you are watchingalmost everything, including deletes inside the projectdangerous or destructive commands, protected paths, writes outside the project, secrets, the first outside readsudo & co
plan (green)researching and writing a planreads, read-only bash, the plan file, the scratch dirother bashedits, other tools, dangerous commands, sudo & co

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

CommandWhat it does
Alt+M, Ctrl+Shift+MCycle default → auto → plan (Ctrl+Shift+M needs the kitty keyboard protocol)
/modePick a mode
/plan [prompt|open]Start plan mode, or open the plan
/permissionsList every rule with its source; remove the ones you pick
/approvalsOpen the permission asks that background subagents are waiting on
/rulesOpen 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 (default mode only). 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

PackageWhat it adds
pi-subagentschildren run in your mode, and background asks reach your dialog (Subagents)
pi-shell-highlightcolored 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; auto lets the most through. Prefer plan or default and 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) · Design (reasoning and 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.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.

License

Apache-2.0, see LICENSE and NOTICE.