@cheetahbyte/pi-snippets0.3.0
Pi extension that adds reusable text before or after your messages.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
Pi snippets
@cheetahbyte/pi-snippets adds reusable text before or after your messages. Open /snippets or press Ctrl+Alt+P to configure each snippet.
Install
pi install npm:@cheetahbyte/pi-snippets
This package is part of Pi kit. If you install the kit, don't install this package separately.
Choose when a snippet applies
Use Up and Down to select a snippet, then press Space to cycle its mode:
| Mode | Behavior |
|---|---|
| Off | Doesn't add the snippet. |
| Next message | Adds it to your next submitted message, then switches off. |
| First message | Adds it to the first submitted message of each new session. |
| Every message | Adds it to every message you send until you change the mode. |
Press Enter to save or Esc to discard your changes. Press Tab to preview the selected snippet; Tab or Esc returns to the list.
First-message and every-message settings persist across restarts and apply across projects. Next-message selections last only in the current extension runtime; restarting, reloading, or switching sessions clears them.
If you've already sent a message, a first-message selection waits for the next new session. The widget labels it next session. Resuming, forking, reloading, or navigating an existing conversation doesn't retrigger first-message snippets. Submitting your first message consumes eligibility even if no snippets are enabled.
Modes apply to user input, including RPC, steering, and queued follow-up messages, but not messages generated by extensions. Existing snippet placement and ordering remain unchanged.
Store snippets and settings
Snippet files are Markdown files read from two directories:
- this package's bundled
snippets/directory snippets/in Pi's agent directory (normally~/.pi/agent/snippets/)
A file in the agent directory with the same filename replaces the bundled one. Each file uses this format:
---
name: Concise
description: Keep responses short
placement: after
order: 100
---
Keep the response concise and direct.
Use before or after for placement. Lower order values come first within each
placement group.
Automatic modes are saved by snippet filename in snippets.json in Pi's agent
directory (normally ~/.pi/agent/snippets.json). The extension uses Pi's
configured agent directory. It doesn't modify snippet files or Pi's main
settings.json.
If settings can't be loaded, the extension reports the error and starts with
snippets off. For malformed JSON or invalid modes, saving from /snippets
offers Reset invalid snippet settings?. Confirm to back up the original
file to a unique .bak file and save your current menu selections. Declining
keeps the file and active selections unchanged. Filesystem errors, including
permission errors, remain visible and don't offer a reset. A failed backup
prevents replacement of the original file.
Concurrent menu saves use the last saved selection; already-running sessions keep their current selection until reload.