Snippets
PiSovereign includes a Snippet system for reusable text blocks. Snippets are Markdown-formatted templates that you can manage via the web UI and instantly insert into chat messages using the /snippet trigger.
Features
- Reusable Text Blocks: Save frequently used instructions, prompts, or templates as named snippets
- Markdown Support: Full Markdown formatting in snippet content
/snippetChat Trigger: Type/snippetin the chat input to search and insert snippets inline- Nested Resolution: Snippets can reference other snippets via
/snippet Title— all references are resolved recursively at insertion time - Cycle Detection: Circular snippet references are detected and prevented (max depth: 10 levels)
- Full-Text Search: Search snippets by title via the UI or API
Managing Snippets
Web UI
Navigate to Snippets in the sidebar (code brackets icon). The Snippets page provides full CRUD:
- Create: Click “New Snippet”, enter a unique title and Markdown content, then save
- Edit: Click on any snippet row to open the edit form
- Search: Use the search bar to filter snippets by title
- Delete: Click the delete button on a snippet row (with confirmation)
REST API
All snippet operations are also available via the REST API under /v1/snippets. See the API Reference for full endpoint documentation.
# List all snippets
curl -H "Authorization: Bearer sk-..." http://localhost:3000/v1/snippets
# Create a snippet
curl -X POST -H "Authorization: Bearer sk-..." \
-H "Content-Type: application/json" \
-d '{"title": "Meeting Follow-up", "content": "## Action Items\n\n- [ ] ..."}' \
http://localhost:3000/v1/snippets
# Get resolved content (nested references expanded)
curl -H "Authorization: Bearer sk-..." \
http://localhost:3000/v1/snippets/{id}/resolved
Using Snippets in Chat
The /snippet Trigger
In the chat input, type /snippet followed by a space to open the snippet picker:
/snippet Meeting
A dropdown appears showing matching snippets filtered by title. Select one to replace the /snippet ... text with the resolved snippet content.
Nested Snippet Resolution
Snippets can embed other snippets by including /snippet Title in their Markdown content. When you insert a snippet (via chat or API), all nested references are resolved recursively.
Example:
Snippet “Task List”:
## Aufgaben
1. Analysiere alle gesammelten Informationen
2. Erstelle eine priorisierte Taskliste
3. Speichere als Erinnerungen im System
Snippet “Calendar Entries”:
## Kalendereinträge
1. Erstelle Kalendereinträge für alle Termine
2. Verknüpfe relevante Tasks mit Terminen
3. Setze Erinnerungen für kritische Deadlines
Snippet “Meeting Follow-up Complete”:
# Meeting-Nachbereitung
/snippet Task List
/snippet Calendar Entries
When you insert “Meeting Follow-up Complete”, the /snippet Task List and /snippet Calendar Entries references are automatically replaced with their respective content — producing a single, fully expanded document.
Limits
| Setting | Value |
|---|---|
| Maximum title length | 200 characters |
| Maximum content length | 50,000 characters |
| Maximum nesting depth | 10 levels |
| Title uniqueness | Enforced (case-insensitive) |
Use Cases
- AI Prompt Templates: Save complex AI instructions as snippets and insert them into chat with a single command
- Meeting Workflows: Combine task creation, calendar entries, and reminders into a composite snippet
- Research Templates: Standard web research instructions with documentation format
- Knowledge Graph Queries: Reusable analysis prompts for the knowledge graph
Tips
- Keep snippet titles short and descriptive — they are used for search in the
/snippetpicker - Use nested snippets to compose complex workflows from simpler building blocks
- The
/snippettrigger works with partial title matches, so you don’t need to type the full title