@kky42/pi-sandbox
Pi-compatible sandbox extension for filesystem-aware bash and tool enforcement
Package details
Install @kky42/pi-sandbox from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@kky42/pi-sandbox- Package
@kky42/pi-sandbox- Version
1.0.2- Published
- May 14, 2026
- Downloads
- 57/mo · 6/wk
- Author
- kky42
- License
- MIT
- Types
- extension
- Size
- 21.6 KB
- Dependencies
- 1 dependency · 1 peer
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@kky42/pi-sandbox
Pi-compatible sandbox extension for filesystem-aware bash and tool enforcement.
Install
pi install npm:@kky42/pi-sandbox
Built-in Choices
read-only- sandboxed bash, no writesworkspace-write- sandboxed bash with workspace writes by defaultdanger-full-access- no sandbox enforcement
When installed, the extension defaults to workspace-write, so a normal pi run starts with sandboxed workspace writes.
CLI:
pi --sandbox read-only
pi --sandbox workspace-write
pi --sandbox danger-full-access
Slash command:
/sandbox read-only
/sandbox workspace-write
/sandbox danger-full-access
Custom config
Pass a JSON config explicitly to use a custom sandbox policy:
pi --sandbox-config ./sandbox.json
--sandbox-config <path> loads one complete policy and makes config the active sandbox choice. If both --sandbox and --sandbox-config are passed, the custom config is used and --sandbox is ignored.
Custom config is not auto-discovered. The extension does not read <cwd>/.pi/sandbox.json or ~/.pi/sandbox.json.
During a session:
/sandbox config
restores the startup --sandbox-config policy. Built-in choices selected with /sandbox read-only, /sandbox workspace-write, or /sandbox danger-full-access use the built-in policy and do not merge custom config values.
allowWrite paths are resolved against the current workspace, so . means the folder you started Pi in.
Custom config must include explicit filesystem.denyRead, filesystem.allowWrite, and filesystem.denyWrite arrays. Invalid or incomplete config warns and falls back to built-in workspace-write.
Use sandbox.example.json as the starting shape.