---
slug: "pi-extension-selector"
source_type: "readme"
source_url: "https://cdn.jsdelivr.net/gh/PanCodeInventory/pi-extension-selector@main/README.md"
repo: "https://github.com/PanCodeInventory/pi-extension-selector"
source_file: "README.md"
branch: "main"
---
# Pi Extension Selector

[![npm](https://img.shields.io/npm/v/pi-extension-selector)](https://www.npmjs.com/package/pi-extension-selector)
[![license](https://img.shields.io/npm/l/pi-extension-selector)](./LICENSE)

Switch Pi extensions without leaving Pi. `pi-extension-selector` adds an interactive `/extensions` screen for enabling installed package extensions, managing local extensions, and saving reusable profiles.

## Install

Install it as a standard Pi package:

```bash
pi install npm:pi-extension-selector
```

Restart Pi or run `/reload`, then open the selector:

```text
/extensions
```

Use Enter or Space to toggle an extension. Press Escape to save the selection and reload Pi with the new extension set.

## Features

- Discovers extension resources from npm packages already configured in Pi.
- Keeps non-extension package resources, such as skills and themes, loaded when an extension is disabled.
- Supports standalone `.ts`/`.js` extensions and Pi package directories in a local extension pool.
- Saves named profiles so different coding workflows can use different extension sets.
- Preserves unrelated entries in `~/.pi/agent/settings.json`.
- Keeps the selector itself permanently loaded, so it cannot disable its own recovery UI.

## Profiles

Pass a profile name to create or switch extension sets:

```text
/extensions coding
/extensions review
/extensions minimal
```

The active profile and its enabled extensions are stored in `~/.pi/agent/extension-selector.json`. Applying a profile updates Pi's package extension filters and calls Pi's native reload lifecycle, so commands, tools, event handlers, and providers are rebuilt cleanly.

## Local extension pool

For extensions that are not installed as npm packages, place them under `~/.pi/agent/extension-pool`:

```text
~/.pi/agent/extension-pool/
├── permission-gate.ts
├── subagent/
│   └── index.ts
└── my-package/
    ├── package.json
    └── src/index.ts
```

Package directories can declare one or more entry points with the standard Pi manifest:

```json
{
  "pi": {
    "extensions": ["./src/index.ts"]
  }
}
```

The pool is intentionally outside `~/.pi/agent/extensions`, because Pi automatically loads everything in that directory before the selector can apply a profile. To use another location, set `poolDir` in `~/.pi/agent/extension-selector.json`; absolute paths, `~/...`, and paths relative to `~/.pi/agent` are supported.

## How package switching works

Pi package objects accept a resource filter for each resource type. The selector disables only extension resources:

```json
{
  "source": "npm:example-package",
  "extensions": []
}
```

When the package is enabled again, its previous configuration is restored. Skills, prompts, and themes from the same package are not removed.

## Development

```bash
git clone https://github.com/PanCodeInventory/pi-extension-selector.git
cd pi-extension-selector
npm install
npm test
npm run typecheck
```

To load the checkout directly while developing:

```bash
mkdir -p ~/.pi/agent/extensions ~/.pi/agent/extension-pool
ln -s "$PWD" ~/.pi/agent/extensions/pi-extension-selector
```

The project targets Pi `0.80.6` or newer and Node.js `22.19.0` or newer.

## License

MIT
