One-command switch between your default pi package set and everything-on, for the pi coding agent.
/sw toggle: default ⇄ everything-on (auto /reload, no restart)
/sw save store the current package state as your default
Every installed pi package adds its tool schemas, skills, and prompt guidelines to every new conversation. On my machine the fixed baseline cost looked like this:
| State | Context baseline per conversation |
|---|---|
All packages on (incl. pi-subagents) |
~13.6K tokens |
pi-subagents off (default set) |
~6.9K tokens |
Heavy packages like pi-subagents are invaluable occasionally — and pure overhead the rest of the time. pi config toggles resources one checkbox at a time; pi-switch makes it a single keystroke.
From GitHub:
pi install git:github.com/new595/pi-switchOr from a local clone:
pi install /absolute/path/to/pi-switchAfter installing, set up your default once:
- Configure your packages the lean way you like (e.g. disable
pi-subagentsinpi config, or just keep the defaults). - Run
/sw save— this writes the snapshot~/.pi/agent/sw-default.json.
From then on /sw flips between that snapshot and everything-on. The switch persists: whichever state you leave is what every new session starts with.
- The snapshot is just the
packagesarray of~/.pi/agent/settings.json, stored verbatim. /swcompares the currentpackagesagainst the snapshot by state: a package counts as "on" when written as a plain string or with a filter key omitted, and "off" only when a resource type is an empty filter[]. Every other filter list (including pi's expanded per-file exclusions) is a distinct state of its own, so the toggle direction is always correct. If pi rewrote your config or you hand-tuned filters, the first/swreturns you to the saved default; the next one toggles to everything-on.- Direction rule: current config == snapshot → switch to everything-on; anything else → switch back to default (one-key home).
- Packages missing from the snapshot are kept as-is instead of being dropped.
When package resources are restricted, pi-switch adds one short model-side instruction to the system prompt—no tool schemas, skills, extra UI, or extra model turn. It asks the model to check with you before tool use only for clearly complex work that could materially benefit from disabled capabilities; ordinary Q&A and small edits proceed normally. If you choose full mode, run /sw until it reports everything on (use /sw save first if prompted), then say continue; the model cannot run slash commands itself. When everything is enabled, pi-switch injects nothing.
- Only global settings (
~/.pi/agent/settings.json) is managed; project-level.pi/settings.jsonis untouched. - Run
/sw saveagain after installing or removing packages, so the snapshot stays complete. - Zero dependencies, zero configuration files beyond the snapshot.
node scripts/test-sw.mjsRuns the extension in a sandboxed temp home against synthetic settings and covers snapshot handling, both switch directions, filter fingerprints, invalid input, new-package preservation, and the complex-task reminder guard.