nicobailon/pi-prompt-template-model
Pi extension: Add model frontmatter to prompt templates for automatic model switching
What it solves
This extension for the pi agent allows users to create specialized "agent modes" via slash commands. It eliminates the need to manually switch LLM models, thinking levels, or load specific skills (context) every time a user wants to perform a specific task, such as debugging Python or conducting a deep analysis.
How it works
It extends the prompt template system by adding metadata (frontmatter) to Markdown files. When a slash command is triggered, the extension reads this metadata to automatically:
- Switch Models: Change the active LLM (with support for provider-specific IDs and fallback lists).
- Set Thinking Levels: Adjust the model's reasoning depth (e.g., from
minimaltomax). - Inject Skills: Automatically load specific skill context into the prompt, bypassing the need for the agent to discover them manually.
- Manage Sessions: Restore the previous model and thinking level once the command is complete.
It also supports advanced execution flows, including looping, parallel delegation to subagents, and a "Best-of-N" comparison flow where multiple models generate candidates that are then reviewed and applied.
Who it’s for
Developers using the pi agent who want to automate their AI workflows by creating reusable, configurable prompt templates that act as specialized tools.
Highlights
- Dynamic Model Switching: Supports explicit providers (Anthropic, OpenAI, etc.) and automatic fallback lists.
- Subagent Delegation: Ability to hand off tasks to separate subagents with optional context forking (
inheritContext). - Best-of-N Comparison: A pipeline for running multiple worker models in parallel, reviewing their outputs, and applying the best result.
- Conditional Prompting: Use
<if-model>tags to render different instructions based on which model is actually executing the prompt. - Argument Substitution: Supports placeholders (like
$1,$@) to inject user arguments directly into the prompt body.
Related
- Project
- Project
- Project
- Project
- Project