# pi-system-prompt-switcher

[![npm version](https://img.shields.io/npm/v/pi-system-prompt-switcher.svg)](https://www.npmjs.com/package/pi-system-prompt-switcher)

Switch Pi's active system prompt from files in `~/.pi/agent/systems/`.

This package does one thing: `/system-prompt` picks a prompt file, persists that choice, then reloads Pi so the next turn uses it. There is no file watcher. Editing a prompt file takes effect after a reload or after selecting it again.

## Install

```bash
pi install npm:pi-system-prompt-switcher
```

## Prompt files

Put prompt files directly in:

```text
~/.pi/agent/systems/
```

Example:

```text
~/.pi/agent/systems/default.md
~/.pi/agent/systems/reviewer.md
~/.pi/agent/systems/prototype.md
```

Hidden files and subdirectories are ignored. Symlinks are ignored so selections cannot escape the systems directory.

## Usage

Interactive picker:

```text
/system-prompt
```

Direct switch:

```text
/system-prompt reviewer.md
```

Selection is stored in:

```text
~/.pi/agent/system-prompt-switcher.json
```

On interactive startup, Pi lists the active prompt filename in a `[System Prompt]` section.

After a successful switch, the extension calls Pi's reload flow. The selected prompt is appended to Pi's effective system prompt under an `Active system prompt` heading, preserving Pi's generated tool guidance, skills, project context, date, and cwd.

## Development

```bash
bun install
bun test
bun run typecheck
bun run check
bun pm pack --dry-run
PI_OFFLINE=1 bunx --bun pi --no-extensions -e . --list-models >/tmp/pi-system-prompt-switcher-pi-load.out
```
