docs: replace prompt templates with smart-router docs, update commands
This commit is contained in:
@@ -37,6 +37,7 @@ aliases: []
|
|||||||
| **plannotator** | `~/.agents` | Interactive plan review with browser UI, annotations, code review |
|
| **plannotator** | `~/.agents` | Interactive plan review with browser UI, annotations, code review |
|
||||||
| **caveman** | `~/.agents` | Ultra-compressed communication mode |
|
| **caveman** | `~/.agents` | Ultra-compressed communication mode |
|
||||||
| **markitdown** | `~/.agents` | Convert files (PDF, Word, Excel, PPTX, images, HTML, etc.) to Markdown. Image analysis via Qwen 2.5 VL 72B on OpenRouter. |
|
| **markitdown** | `~/.agents` | Convert files (PDF, Word, Excel, PPTX, images, HTML, etc.) to Markdown. Image analysis via Qwen 2.5 VL 72B on OpenRouter. |
|
||||||
|
| **smart-router** | `~/.agents` | Dynamic prompt routing — analyzes intent and routes to optimal model. `/lock-model` and `/unlock-model` for manual override. |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -158,67 +159,59 @@ The **npm-security** skill instructs the Pi agent to follow this workflow before
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Prompt Templates
|
## Smart Router
|
||||||
|
|
||||||
Prompt templates are `.md` files in `~/.pi/agent/prompts/` with YAML frontmatter. Each defines a slash command that auto-switches model, thinking level, and injects skills — then restores your previous model when done.
|
The smart-router extension (`~/.agents/extensions/smart-router/`) is a **prompt interceptor** that analyzes every incoming prompt and dynamically routes it to the most appropriate model based on intent. It replaces the old `/do-*` prompt templates with automatic, invisible routing.
|
||||||
|
|
||||||
### Installed Templates
|
### How it works
|
||||||
|
|
||||||
| Command | Tier | Model | Use |
|
1. Every prompt is intercepted before the agent loop starts
|
||||||
| ------------ | -------- | ------------------------ | ---------------------------------------------------------- |
|
2. A free model (`openrouter/owl-alpha`) analyzes the intent
|
||||||
| `/do-quick` | ⚡ flash | deepseek-v4-flash (opencode-go) | General everyday tasks |
|
3. The prompt is classified into one of 10 tags (read, discuss, search, devops-low, devops-high, code-analysis-low, code-analysis-high, codewrite-low, codewrite-high)
|
||||||
| `/do-think` | 🧠 ultra | openrouter/deepseek/deepseek-v4-pro | Deep thinking, hard problems |
|
4. The router selects the optimal model based on tag + language
|
||||||
| `/do-check` | 🔷 pro | opencode-go/deepseek-v4-pro | Code review, quality checks |
|
5. The selected model is set via `pi.setModel()`
|
||||||
| `/do-nix-check` | ⚡ flash | deepseek-v4-flash (opencode-go) | Nix flake checks, config debug |
|
6. Routing decisions appear in the **footer status bar** (e.g. `🎯 devops-low → qwen/qwen3.6-flash`)
|
||||||
| `/do-note` | ⚡ flash | deepseek-v4-flash (opencode-go) | Create Obsidian .md with frontmatter |
|
|
||||||
| `/do-sort` | 🔷 pro | opencode-go/deepseek-v4-pro | Classify files, suggest Obsidian folder |
|
|
||||||
| `/do-read` | ⚡ flash | deepseek-v4-flash (opencode-go) | Batch read and synthesize many files |
|
|
||||||
| `/do-debug` | 🧠 ultra | openrouter/deepseek/deepseek-v4-pro | Complex NixOS/infra debugging |
|
|
||||||
| `/do-vault` | 🔷 pro | opencode-go/deepseek-v4-pro | Obsidian vault setup and management |
|
|
||||||
| `/do-chat` | ⚡ flash | deepseek-v4-flash (opencode-go) | Chat with automatic web search |
|
|
||||||
| `/do-img` | 🧠 ultra | openrouter/deepseek/deepseek-v4-pro | Image analysis and description |
|
|
||||||
| `/do-make-img` | ⚡ flash | deepseek-v4-flash (opencode-go) | Generate images via OpenRouter (GPT/Image Mini, Gemini) |
|
|
||||||
|
|
||||||
> **Audio/Voice note:** Pi runs in a text-based terminal (TUI) with no microphone access or audio playback. Qwen supports audio processing, but it's not practical in Pi's current architecture regardless of model.
|
### Routing table
|
||||||
|
|
||||||
### How to use
|
| Tag | Model | Use case |
|
||||||
|
|-----|-------|----------|
|
||||||
|
| `read`, `discuss`, `search` | `openrouter/owl-alpha` | Reading docs, general chat, web search |
|
||||||
|
| `devops-low` | `qwen/qwen3.6-flash` | Simple YAML, Docker, bash |
|
||||||
|
| `devops-high` | `qwen/qwen-2.5-72b-instruct` | Complex multi-container, server crashes |
|
||||||
|
| `code-analysis-low` | `openrouter/owl-alpha` | Finding bugs in short files |
|
||||||
|
| `code-analysis-high` | `moonshotai/kimi-k2.6` | Refactoring large codebases (262K context) |
|
||||||
|
| `codewrite-low` | `deepseek/deepseek-v4-flash` | Boilerplate, simple functions |
|
||||||
|
| `codewrite-high` (React) | `qwen/qwen3-coder-plus` | Complex React/JS |
|
||||||
|
| `codewrite-high` (other) | `deepseek/deepseek-v4-pro` | Complex PHP, dense logic |
|
||||||
|
| Short prompts (<15 chars) | `openrouter/owl-alpha` | Quick responses, greetings |
|
||||||
|
|
||||||
|
### Manual override
|
||||||
|
|
||||||
```
|
```
|
||||||
/do-quick what's the weather?
|
# Lock to a specific model (disables routing)
|
||||||
/do-think design the architecture for this feature
|
/lock-model openrouter/anthropic/claude-3.5-sonnet
|
||||||
/do-check review the changes in this file
|
|
||||||
/do-nix-check analyze the nix flake check output
|
# Re-enable dynamic routing
|
||||||
/do-note document the new service setup
|
/unlock-model
|
||||||
/do-sort read this config file and tell me where it goes
|
|
||||||
/do-read skim these three config files and compare them
|
|
||||||
/do-debug why is my NixOS build failing?
|
|
||||||
/do-vault set up a template for daily notes
|
|
||||||
/do-chat what's new in NixOS 25.11?
|
|
||||||
/do-img what's wrong in this screenshot?
|
|
||||||
/do-make-img a futuristic cityscape with neon lights
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Template format
|
When locked, all prompts go directly to the specified model until `/unlock-model` is called.
|
||||||
|
|
||||||
```yaml
|
### What about `/do-*` commands?
|
||||||
---
|
|
||||||
description: Quick task — fast model, minimal thinking
|
|
||||||
model: openrouter/deepseek-v4-flash
|
|
||||||
restore: true
|
|
||||||
---
|
|
||||||
$@
|
|
||||||
```
|
|
||||||
|
|
||||||
Key frontmatter fields:
|
The `/do-*` prompt templates are **no longer needed** for model selection. The smart-router handles all routing automatically. However, `/do-img` and `/do-make-img` are still available for image analysis/generation since those use specialized tool calls rather than just model selection.
|
||||||
- **`model`** — provider/model-id or comma-separated fallback list
|
|
||||||
- **`thinking`** — off, minimal, low, medium, high, xhigh
|
|
||||||
- **`restore`** — (default true) restore previous model when done
|
|
||||||
- **`skill`** — auto-inject a skill
|
|
||||||
- **`deterministic`** — run a command/script before the LLM turn (e.g. `nix eval .#checks`)
|
|
||||||
|
|
||||||
### Adding new templates
|
### Configuration
|
||||||
|
|
||||||
Create a new `.md` file in `~/.pi/agent/prompts/` with frontmatter. The filename becomes the command name. Restart Pi or run any extension command to pick them up.
|
Model mappings are defined in `~/.agents/extensions/smart-router/index.ts`. To change which model a tag routes to, edit the `MODELS` table and run `/reload`.
|
||||||
|
|
||||||
|
### Files
|
||||||
|
|
||||||
|
| File | Purpose |
|
||||||
|
|------|---------|
|
||||||
|
| `~/.agents/extensions/smart-router/index.ts` | Extension source |
|
||||||
|
| `~/.pi/agent/extensions/smart-router/index.ts` | Synced copy (Gitea backup) |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -274,18 +267,8 @@ pi-mcp-adapter connects Pi to external services via the Model Context Protocol.
|
|||||||
|
|
||||||
| Command | What it does |
|
| Command | What it does |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `/do-quick <task>` | ⚡ Fast model for everyday tasks |
|
| `/lock-model <id>` | Lock routing to a specific model (e.g. `openrouter/anthropic/claude-3.5-sonnet`) |
|
||||||
| `/do-think <task>` | 🧠 Ultra model for deep analysis |
|
| `/unlock-model` | Re-enable dynamic prompt routing |
|
||||||
| `/do-check <path>` | 🔷 Pro model for code review |
|
|
||||||
| `/do-nix-check <task>` | ⚡ Nix-specific analysis |
|
|
||||||
| `/do-note <description>` | ⚡ Create Obsidian note with frontmatter |
|
|
||||||
| `/do-sort <path>` | 🔷 Classify file, suggest Obsidian folder |
|
|
||||||
| `/do-read <paths>` | ⚡ Batch read and synthesize files |
|
|
||||||
| `/do-debug <issue>` | 🧠 Complex NixOS/infra debugging |
|
|
||||||
| `/do-vault <task>` | 🔷 Obsidian vault setup and management |
|
|
||||||
| `/do-chat <topic>` | ⚡ Conversation with web search |
|
|
||||||
| `/do-img <prompt>` | 🧠 Image analysis and description |
|
|
||||||
| `/do-make-img <prompt>` | ⚡ Generate image via OpenRouter (GPT/Image Mini, Gemini) |
|
|
||||||
| `/config-setup` | One-shot: creates `.pi/`, `settings.json`, memory vault in current folder |
|
| `/config-setup` | One-shot: creates `.pi/`, `settings.json`, memory vault in current folder |
|
||||||
| `/config-add ext <name>` | Activate an extension from `~/.agents` |
|
| `/config-add ext <name>` | Activate an extension from `~/.agents` |
|
||||||
| `/config-add skill <name>` | Activate a skill from `~/.agents` |
|
| `/config-add skill <name>` | Activate a skill from `~/.agents` |
|
||||||
@@ -323,4 +306,5 @@ pi-mcp-adapter connects Pi to external services via the Model Context Protocol.
|
|||||||
- [ ] Add more prompt templates to `~/.pi/agent/prompts/` as needed
|
- [ ] Add more prompt templates to `~/.pi/agent/prompts/` as needed
|
||||||
- [ ] Verify video-extract works with Gemini
|
- [ ] Verify video-extract works with Gemini
|
||||||
- [x] Add markitdown skill to Obsidian skills page
|
- [x] Add markitdown skill to Obsidian skills page
|
||||||
|
- [x] Add smart-router extension and update Obsidian docs
|
||||||
- [ ] Clean up workspace-map.json entries for any stale memory packs
|
- [ ] Clean up workspace-map.json entries for any stale memory packs
|
||||||
|
|||||||
Reference in New Issue
Block a user