Pi: The Reusable Prompt Template
Turn a prompt you retype into a permanent Pi slash command.
Run this workflow
CI-verified, 4/4 fixtures passing.
Build this with your agent
One copy-paste hands Claude Code, Codex, or Cursor the full recipe, steps included, nothing to fetch.
Intended Use
Anyone who runs the same prompt more than twice (commit messages, release notes, PR descriptions) and wants it as a one-time markdown file Pi expands as a slash command or via @-include.
Not for
- One-off prompts you'll never reuse
- Anyone unwilling to bring their own model key/subscription
The Stack
Tested Against
pi@0.74node@20.xSide effects & data flow
- Network
- your model provider, only in the non-CI run step
- Writes
- <pi config dir>/prompts/commitmsg.md
- Credentials
- model API key/subscription, for the run step only
Data privacy
- your model provider, only in the non-CI run step ← the staged diff you pipe in (retention: per that provider's API policy)
Prerequisites
- Pi (MIT): `npm install -g --ignore-scripts @earendil-works/pi-coding-agent`
- A model key/subscription (only needed to run the template)
Steps
- 1
Scaffold the template at Pi's prompt-discovery path
CI writes the commit-message template to Pi's documented prompts directory (`<config>/prompts/commitmsg.md`, default `~/.pi/agent/prompts/`) and confirms it lands non-empty and that Pi's print mode flag exists — the deterministic half of 'a file becomes a permanent command.'
export PI_CODING_AGENT_DIR="$PWD/.pi" pi --version >/dev/null || { echo "pi missing"; exit 1; } mkdir -p "$PI_CODING_AGENT_DIR/prompts" cat > "$PI_CODING_AGENT_DIR/prompts/commitmsg.md" <<'EOF' Write a Conventional Commits message for the staged diff below. Output only the commit message, nothing else. EOF test -s "$PI_CODING_AGENT_DIR/prompts/commitmsg.md" && echo "template scaffolded: prompts/commitmsg.md" test -r "$PI_CODING_AGENT_DIR/prompts/commitmsg.md" && echo "template path resolves for: git diff --staged | pi -p @prompts/commitmsg.md" pi --help 2>&1 | grep -q -- "--print" && echo "pi supports -p print mode" - 2
Use it (the model step, not checked by CI)
Interactively type `/commitmsg`, or non-interactively `git diff --staged | pi -p @~/.pi/agent/prompts/commitmsg.md`. Templates also support `{{variables}}`. The text it generates is the model's job, so CI doesn't run it.
Eval, 4 fixtures
Last passed: verified todaytemplate-scaffoldedcontainstimeout 60s · max $0Expected:
template scaffolded: prompts/commitmsg.mdpath-resolvescontainstimeout 60s · max $0Expected:
template path resolves for:pi-printcontainstimeout 60s · max $0Expected:
pi supports -p print modeclean-exitexit_codetimeout 60s · max $0Expected:
0
Results
Stop retyping the same instruction, from the WebAfterAI guide.
Did this work for you?
Our CI checks the setup runs. You tell us if the whole thing worked. Tell us straight.
Related workflows
- One AGENTS.md, no drift: prove CLAUDE.md is a real symlink and the generated files are in sync
- Self-host CodeWiki on private code: validate the config before you spend tokens
- Run GLM-5.2 for the bulk, escalate the hard turns to Opus 4.8
- codebase-memory-mcp: wire the knowledge graph, stop re-reading files
- OrcaRouter for coding: judge by passing tests, not by vibes
- Kilo Code: add an MCP tool and bind it to one mode
Liked this workflow?
Get new verified workflows in WebAfterAI, three issues a week (Tue, Thu, Sat).