Initial commit — pi-fence v0.1.0
Single-config sandbox extension for Pi, enforcing one shared
fence.jsonc across two layers:
1. Bash subprocesses, wrapped via the `fence` binary
(Seatbelt on macOS, bubblewrap+Landlock on Linux).
2. Pi's own file tools (read/write/edit/grep/find/ls), gated
by an in-process tool_call interceptor.
Both layers consume the same resolved config from `fence config show`
so they cannot disagree.
Features:
- Bash + user_bash wrapping with --no-fence escape hatch
- Footer status state machine (PLAN.md §12)
- Structured block payload back to the LLM (PLAN.md §6)
- Interactive grant prompt: [once / session / persist / deny]
with default-deny, realpath shown first, 500ms anti-fatfinger,
persist 2nd-confirmation
- Session grants persisted via pi.appendEntry, restored on
fork/resume
- Persist-to-disk grants edit-or-scaffold the project-root
fence.jsonc; jsonc-parser preserves comments, ajv 2020-12
validates, atomic write via tmp+rename, last-3 .bak rotation
- Mandatory denyWrite floor (PLAN.md §11) for ~/.pi/agent/{extensions,
skills,prompts}/**, ~/.config/fence/**, audit log, install dir
- Audit log at ~/.pi/agent/pi-fence.log with daily rotation,
7-day retention
- Per-turn rate limiter (3+ denials → batch confirm)
- Footgun lint: cwd===$HOME, secret canaries, top-level **,
brace expansion, bare ** segments
- Slash commands: /fence, /fence reload, /fence init, /fence log
See PLAN.md for the build contract and design decisions.
See README.md for usage and trade-offs.