pi-prompt-template-model plugin
A Pi extension that turns prompt templates into slash commands that pick the model, the skill and the thinking level on their own
- 322 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- A deterministic step runs a script from the template frontmatter and passes its output to the model
- Loops and parallel subagents spend tokens, and the `worktree` field creates separate git worktrees
Install
Manual install
pi install npm:pi-prompt-template-modelRestart Pi after installing.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- A deterministic step runs a script from the template frontmatter and passes its output to the model
- Loops and parallel subagents spend tokens, and the `worktree` field creates separate git worktrees
This is third-party code. Review the repository files before installing.
What it does
The extension adds `model`, `skill` and `thinking` fields to Pi prompt templates. Each template becomes a slash command with a ready-made working mode: `/debug-python`, for example, switches the session to Claude Sonnet, loads the tmux skill and starts the reply. When the command finishes, the extension restores the previous model and thinking level. The `model` field takes one identifier, a `provider/model` pair or a comma-separated list: if the first model is unavailable or has no key, the next one is used. Templates then combine into workflows. The `--loop` flag repeats a template up to 999 times and by default stops when an iteration changes no files. The `chain` field links templates into a pipeline such as `double-check --loop 2 -> deslop --loop 2`, and `parallel(...)` runs steps at once. A deterministic step first runs one script and shows a card with the exit code, and the model sees the result only afterwards. The `subagent` field hands execution to a subagent, but that needs the separate `pi-subagents` extension. The agent can call templates itself through the `run-prompt` tool, which `/prompt-tool on` enables.
Who it is for. Pi users with recurring tasks such as debugging, review or code cleanup who are tired of switching models by hand for each one.
Good fit when
- A quick debugging run goes to a cheap model with the right skill, and the session returns to the main model afterwards
- A fix has to go through several rounds: `/deslop --loop 5` repeats the template while files keep changing
- Review and cleanup run as a two-template pipeline in one command
- A script, such as a test run, has to execute before the model request and its result lands in the prompt
Not a fit when
- The agent is not Pi: the templates, the `~/.pi/agent/prompts` folder and `pi install` exist only there
- You have no use for templates and switch the model once a day: manual switching is enough
- You want subagents without installing a second extension: the `subagent` field without `pi-subagents` fails fast
Example request
/debug-python the tests fail only in CI, work it out and restore my main model after the replyLimitations
- The extension picks up new template files at session start and after any of its own commands. A file added mid-session shows up after `/chain-prompts`, a new session or a Pi reload.
- The state used to restore the model lives in memory. If you close Pi mid-response, the previous model does not return.
- Chain steps without a `model` field take the model from the start of the chain, not from the previous step.
- Deterministic steps work only in single templates: chains, subagents, `parallel` and loops reject them.
- The `run-prompt` tool stays off until you enter `/prompt-tool on`.
How to disable. Remove the pi-prompt-template-model package from Pi's installed extensions (the README gives no removal command, so check the `pi` help) and restart Pi. Your templates stay in their folders and work as ordinary Pi commands without the extra fields. `/prompt-tool off` disables the `run-prompt` tool.
FAQ
How do I install pi-prompt-template-model?
Run `pi install npm:pi-prompt-template-model` and restart Pi. For the `subagent` field also run `pi install npm:pi-subagents`; the other features work without it.
Where do the templates the extension reads live?
In `~/.pi/agent/prompts/` and the project's `.pi/prompts/`, plus the paths from `prompts` in Pi's `settings.json`. Project settings win, then the project folder, user settings and the user folder. One file loads once.
What happens if the first model in the list is unavailable?
The extension takes the next one on the list. If the session already runs on a listed model, it stays without switching. When none fits, Pi prints a single error listing the attempts.
How do I stop a loop that does not converge?
A loop stops by itself when an iteration changes no files; `--no-converge` or `converge: false` turns that exit off. The hard cap is 999 iterations. The `--fresh` mode compresses history between rounds so the loop does not balloon the token count.
Can the agent run templates by itself?
Yes, through the `run-prompt` tool, which is off by default. `/prompt-tool on` enables it and `/prompt-tool guidance` sets a hint for the agent. The setting lives in `~/.pi/agent/prompt-template-model.json`.
Discussion
No questions or reviews yet.
Related
PluginsA minimal terminal coding agent extended with skills, prompt templates and TypeScript packages
An extension for the Pi agent (pi.dev): subagents and orchestration in the Claude Code style, a widget and JavaScript scripts. Not for Claude Code
shitty-extensions adds fifteen extensions to the Pi agent: second opinions, plan mode, cost tracking and test loops.
A skill that scores a prompt on five criteria, picks one of 31 frameworks and rewrites the request after clarifying questions
Personal Pi agent setup with four commands for plan, todos, execution and review, passing state through Markdown session files.
An extension for the Pi agent that sorts models into quick, general and frontier tiers and picks a healthy one per turn, no proxy
README in short
The README explains the idea through `/debug-python`, then lists frontmatter fields in tables: core, execution control and delegation. Model formats, skill lookup rules, argument substitution, loops, chains, best-of-N comparison and a limitations section follow.