← Catalog

system-prompt-switch

Pi and OMP extension to manage custom system prompts per session: switch, stack, and edit prompts from a modal, with CRUD slash commands

Extension

Install

Install with PiG

pig install npm:system-prompt-switch

Install with Pi

pi install npm:system-prompt-switch
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "image": "https://raw.githubusercontent.com/plantaeart/system-prompt-switch/master/assets/logo/cover.png",
  "extensions": [
    "./extensions/pi.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.14.3 (README.md). PiG does not review it.

SPS logo

system-prompt-switch

npm version npm downloads CI license hosts

Pick, stack, edit, and forget : system prompts that follow you from Pi to OMP without re-explaining yourself.

A Pi / OMP extension that manages custom system prompts per session: interactive modals, cumulative stacking, two scopes (local repo + global home), CRUD commands, and an above-editor banner that always shows what's active.

Active prompt banner

Contents: Why · Install · Screenshots · What it does · Commands · How prompts live · Environment variables · Developers

Why not just edit AGENTS.md?

(blank)AGENTS.md / one system filesystem-prompt-switch
Switch behaviorEdit the file, restart or reload/sps-select, same session
Several at onceMerge by handStack with /sps-inject
Per sessionSame for every session in the repoBound to the session ID
Repo vs personalOne file[local] committable + [global] in your home
What is activeOpen the fileBanner above the editor, /sps-info

Install

OMP

omp install npm:system-prompt-switch

PI

pi install npm:system-prompt-switch

That's it. The extension registers on next session start. Works in both Pi and OMP.

Quick start

  1. Start Pi or OMP. The startup modal opens.
  2. Run /sps-new, name a prompt, write it, then save it with Ctrl+Q.
  3. Run /sps-select to switch prompts, or /sps-inject to stack several for the next message.

Screenshots

Startup modal - pick a prompt or create one (Space/Enter ticks, Ctrl+S saves, Esc skips):

Startup session modal

Tick several prompts to stack them, or press Tab to preview one:

Several prompts ticked Tab preview of a prompt

The banner above the input always shows what is active, local and global stacked:

Stacked prompts in the banner

/sps-select with names skips the picker; /sps-inject stacks prompts for the next message only:

/sps-select with names /sps-inject list /sps-inject result

/sps-new: name, destination, then the editor (the key hints are drawn under the text; Esc cancels):

/sps-new file name /sps-new destination /sps-new editor

/sps-edit: pick a prompt (Ctrl+N renames it), edit it; saving an emptied prompt asks first:

/sps-edit picker /sps-edit editor Save empty prompt confirmation

/sps-delete and /sps-move:

/sps-delete confirmation /sps-move destination

/sps-mode, /sps-info, /sps-path and /sps-logs:

/sps-mode replace /sps-info /sps-path /sps-logs

If a project default points at a deleted file, it is dropped with a warning and the modal shows again:

Missing default prompt

Demo GIFs:

1. Select / Create system prompt when new session

Select or create a system prompt for a new session

2. Update system prompt (local or global)

Update an existing system prompt

3. Inject one or several system prompts for next message

Cumulative inject for the next message

4. Get information or logs

Get current session prompt info

5. Delete a system prompt

Delete a system prompt with confirmation


What it does

  • Per-session prompts - your active prompt is bound to the session ID, never leaks between concurrent or sequential sessions.
  • Two scopes, one mental model - [local] lives in your repo (.agents/system-prompts-switch/, committable), [global] lives in your home (~/.pi or ~/.omp/agent/system-prompts-switch/). Same file can exist in both; local wins for the repo session.
  • Stack multiple prompts - /sps-select a.md b.md (or the checkbox list) keeps several prompts active for the session and the project default; /sps-inject adds prompts for the next message only. [global] <system-prompt-name>.md + [local] project-rules.md is a valid active state.
  • Above-editor banner - the active prompt is rendered directly above your input prompt so you never forget which one is loaded.
  • Self-describing extension context - every resolved prompt includes a leading block that tells the LLM what this extension is, where prompt files live, and how to inspect/change them. The block is loaded from assets/templates/extension-context.md so you can tweak the wording without touching code.
  • Per-project default - your last choice in a project (startup modal, /sps-select, or a prompt just created with /sps-new, one or several prompts, including (None)) becomes that project's default. New sessions there apply it silently, with no startup modal. Pick another with /sps-select to change it. If a default's file is gone it is dropped, and if none is left it is forgotten and the modal shows again. Dismissing the modal does not set a default.
  • Startup modal - on terminal launch, a checkbox list: Space/Enter ticks prompts, Ctrl+S saves (nothing ticked = (None)), Esc skips without setting a default; you can also create a prompt from it. Enabled by default; set promptOnStartup to false to skip it while retaining /sps-select and other commands:
    • OMP: ~/.omp/agent/config.yml
      systemPromptSwitch:
        promptOnStartup: false
      
    • Pi: ~/.pi/agent/extensions/system-prompt-switch.json
      { "promptOnStartup": false }
      
  • Merge modes - append (default, safe) keeps base instructions; replace uses your prompt as the base while preserving tools, skills, and project context.
  • Live logging to ~/.pi/agent/logs/system-prompt-switch.log / ~/.omp/agent/logs/system-prompt-switch.log, with /sps-logs [lines] inside the session.

Commands

CommandWhat it does
/sps-select [none|[sps name 1] [sps name 2] [sps name N]]Pick the active prompt(s) from a checkbox list (Space/Enter toggles, Ctrl+S saves); with names it selects them directly, no picker. A name may be prefixed with [local|omp|pi]; none clears
/sps-injectStack or toggle multiple prompts for this session
/sps-newCreate a new .md prompt (choose local vs global)
/sps-edit [sps name]Edit a prompt in the built-in editor: pick it from a list (Ctrl+N renames it) or pass its name to skip the picker. A rename updates this session and the project default; other open sessions that used the old name need a new /sps-select
/sps-pathPrint absolute paths for the active prompt and all local/global files
/sps-deleteDelete a prompt file (resets session if it was active)
/sps-moveMove a prompt file to another scope (local, global pi, or global omp)
/sps-mode [append|replace]Toggle or set the merge mode
/sps-infoShow host, active prompts, mode, session ID, and directories
/sps-logs [lines]Tail the session log

How prompts live

ScopeDefault locationOverride env
Local (repo)<cwd>/.agents/system-prompts-switch/SPS_LOCAL_PROMPT_DIR
Global~/.omp/agent/system-prompts-switch/ (OMP) or ~/.pi/agent/system-prompts-switch/ (Pi)SPS_PROMPT_DIR or SYSTEM_PROMPT_DIR
Session state~/.<host>/agent/state/system-prompt-switch/sessions.jsonSPS_STATE_PATH
Project default promptdefaults.json beside the session state filefollows SPS_STATE_PATH

Legacy prompts in ~/.pi/agent/system-prompts/ are auto-migrated on first run.

Reading the active prompt from another app

sessions.json is a public contract for clients (for example a chat UI driving omp over ACP): one entry per session ID, fields are only ever added.

{
  "<sessionId>": {
    "activePrompts": [{ "name": "reviewer.md", "scope": "global-omp" }],
    "mode": "append",
    "enabled": true,
    "decided": true
  }
}

scope is local, global-omp or global-pi; mode is append or replace. To change it, send /sps-select <name> or /sps-mode append|replace as a prompt in that session.

Over ACP the startup modal does not block: the client may send the first message before the user picks, so that message runs without the prompt. A client that picks the prompt itself starts the host with SPS_START_PICKER=0: no startup modal, then it sends /sps-select <name> before the first message. Unset (the default, e.g. the terminal) keeps the modal.


Environment variables

All optional. Set them in the shell that launches Pi or OMP.

VariableEffect
SPS_LOCAL_PROMPT_DIRLocal (repo) prompt directory instead of <cwd>/.agents/system-prompts-switch/
SPS_PROMPT_DIR / SYSTEM_PROMPT_DIRGlobal prompt directory instead of the host default
SPS_STATE_PATHSession state file (sessions.json); defaults.json follows it
SPS_LOG_PATHLog file path
SPS_START_PICKER=0Skip the startup modal (for clients that pick the prompt themselves)
SPS_HOST=pi|ompForce host detection when it is wrong

The startup modal can also be turned off with the promptOnStartup setting, see What it does.


Editor shortcut note

/sps-new and /sps-edit open the same editor on Pi and OMP: Ctrl+Q or Ctrl+S saves, Esc cancels, Enter adds a line, Ctrl+Z undoes (never past the text the editor opened with) and Ctrl+G opens $VISUAL / $EDITOR. The key hints are drawn under the editor. Saving an emptied prompt asks for confirmation first.


For developers

Architecture, build, test, and contribution guide: see README.dev.md.

License

MIT