pi-prompt-template-model 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.8.2] - 2026-04-21
6
+
7
+ ### Added
8
+ - Added the packaged `prompt-template-authoring` skill for creating and maintaining prompt templates with this extension.
9
+
10
+ ### Changed
11
+ - Tightened the shipped skill guide so it stays short, repo-specific, and aligned with the actual prompt-template runtime.
12
+
13
+ ### Fixed
14
+ - Corrected the shipped skill examples for model fallback vs rotation, argument substitution, deterministic handoff behavior, chain context wording, runtime flag syntax, and prompt discovery rules.
15
+ - Removed the emoji from the skill-loaded renderer so the UI copy matches the extension's plain-text style.
16
+
17
+ ## [0.8.1] - 2026-04-21
18
+
19
+ ### Added
20
+ - Added agent skill `prompt-template-authoring` for writing, managing, and running custom prompt templates. Registered in `package.json` under `pi.skills`.
21
+
5
22
  ## [0.8.0] - 2026-04-21
6
23
 
7
24
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-prompt-template-model",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
5
  "description": "Prompt template model selector extension for pi coding agent",
6
6
  "author": "Nico Bailon",
@@ -40,6 +40,7 @@
40
40
  "tool-manager.ts",
41
41
  "template-conditionals.ts",
42
42
  "examples",
43
+ "skills",
43
44
  "banner.png",
44
45
  "README.md",
45
46
  "CHANGELOG.md",
@@ -58,6 +59,9 @@
58
59
  "pi": {
59
60
  "extensions": [
60
61
  "./index.ts"
62
+ ],
63
+ "skills": [
64
+ "./skills"
61
65
  ]
62
66
  }
63
67
  }
@@ -25,7 +25,7 @@ export function renderSkillLoaded(
25
25
  container.addChild(new Spacer(1));
26
26
 
27
27
  const box = new Box(1, 1, (text: string) => theme.bg("toolSuccessBg", text));
28
- box.addChild(new Text(theme.fg("toolTitle", theme.bold(`⚡ Skill loaded: ${skillName}`)), 0, 0));
28
+ box.addChild(new Text(theme.fg("toolTitle", theme.bold(`Skill loaded: ${skillName}`)), 0, 0));
29
29
  box.addChild(new Text(theme.fg("toolOutput", ` ${skillPath}`), 0, 0));
30
30
  box.addChild(new Spacer(1));
31
31
 
@@ -0,0 +1,189 @@
1
+ ---
2
+ name: prompt-template-authoring
3
+ description: |
4
+ Write and run custom Pi prompt templates (slash commands) for this extension.
5
+ Use when creating templates with model selection, deterministic pre-steps,
6
+ loops, chains, subagents, or best-of-N compare flows.
7
+ ---
8
+
9
+ # Prompt Template Authoring
10
+
11
+ Use this skill when working on prompt templates for `pi-prompt-template-model`.
12
+ Templates are markdown files that register as slash commands.
13
+
14
+ ## Where Templates Live
15
+
16
+ - `~/.pi/agent/prompts/` — user prompts (highest priority)
17
+ - `.pi/prompts/` inside a project — project-specific prompts
18
+
19
+ Extension `examples/` are reference files only. Copy them to a prompt directory to register them.
20
+
21
+ ## Minimal Template
22
+
23
+ ```markdown
24
+ ---
25
+ model: claude-sonnet-4-20250514
26
+ ---
27
+ Your prompt body here.
28
+ ```
29
+
30
+ Save as `my-command.md`, restart Pi, run `/my-command`. Use `description:` for autocomplete text.
31
+
32
+ ## Model Selection
33
+
34
+ Omit `model:` to inherit the current session model. Otherwise:
35
+
36
+ - `model: claude-sonnet-4-20250514` — specific model
37
+ - `model: claude-opus-4, gpt-5.4` — fallback order (tries first, falls back to second if unavailable)
38
+ - `model: claude-opus-4, gpt-5.4` + `rotate: true` — cycle through list on each loop iteration
39
+
40
+ ## Argument Substitution
41
+
42
+ The prompt body can use placeholders:
43
+
44
+ - `$@` — all arguments passed to the command
45
+ - `$1`, `$2` — specific positional arguments
46
+ - `${@:1}` — argument 1 and everything after
47
+
48
+ ## Deterministic Steps (Pre-LLM Execution)
49
+
50
+ Run a command or script before the LLM turn. The model only sees the output if you want it to.
51
+
52
+ Two equivalent forms. Don't mix them in the same prompt.
53
+
54
+ **Shorthand form** — top-level keys:
55
+
56
+ ```yaml
57
+ ---
58
+ run: git status --short
59
+ handoff: always
60
+ ---
61
+ Summarize the repo state.
62
+ ```
63
+
64
+ **Nested form** — under `deterministic:`:
65
+
66
+ ```yaml
67
+ ---
68
+ deterministic:
69
+ run: ./scripts/ship.sh
70
+ handoff: on-failure
71
+ timeout: 60000
72
+ ---
73
+ Diagnose the failure and suggest a fix.
74
+ ```
75
+
76
+ **Handoff controls when the LLM sees the result:**
77
+
78
+ - `never` — run, show result, done (no LLM turn)
79
+ - `always` — always hand result to model
80
+ - `on-failure` — only hand off if command exits non-zero
81
+ - `on-success` — only hand off if command exits zero
82
+
83
+ **Execution forms:**
84
+
85
+ - `run: command string` — runs via `/bin/bash -lc`
86
+ - `run: {command: git, args: [status], shell: false}` — explicit args, optional shell
87
+ - `script: ./script.sh` or `script: {path: ./script.sh, args: [--fast]}` — run a file
88
+
89
+ **Constraints:**
90
+ - Only single prompt templates (no `chain`, `loop`, `subagent`, or `parallel`)
91
+ - Runtime flags `--loop`, `--subagent`, `--fork` are rejected for deterministic prompts
92
+
93
+ ## Subagent Delegation
94
+
95
+ Delegate to another Pi agent instead of running inline:
96
+
97
+ ```yaml
98
+ ---
99
+ model: claude-sonnet-4-20250514
100
+ subagent: delegate # or true, or a specific agent name
101
+ inheritContext: true # fork conversation context (optional)
102
+ cwd: /absolute/path # working directory for the subagent (optional)
103
+ parallel: 3 # run 3 copies in parallel (optional)
104
+ ---
105
+ $@
106
+ ```
107
+
108
+ Requires [pi-subagents](https://github.com/nicobailon/pi-subagents/) to be installed.
109
+
110
+ ## Loops
111
+
112
+ Run the prompt multiple times:
113
+
114
+ ```yaml
115
+ ---
116
+ model: claude-sonnet-4-20250514
117
+ loop: 5 # run exactly 5 times
118
+ converge: true # stop early if no changes (default)
119
+ fresh: true # collapse context between iterations
120
+ ---
121
+ $@
122
+ ```
123
+
124
+ Or at runtime: `/command --loop 5`, `/command --loop` (unlimited), or `/command --loop=5 --fresh`.
125
+
126
+ ## Chains
127
+
128
+ Chain templates declare a reusable pipeline:
129
+
130
+ ```yaml
131
+ ---
132
+ chain: analyze -> fix -> test
133
+ chainContext: summary # pass step summaries to later delegated steps
134
+ ---
135
+ $@
136
+ ```
137
+
138
+ Or use `/chain-prompts analyze -> fix -> test` at runtime. Chain templates ignore the body and `model:` field.
139
+
140
+ ## Model Conditionals
141
+
142
+ Show different content based on which model runs:
143
+
144
+ ```markdown
145
+ <if-model is="anthropic/*">
146
+ Use Claude-specific instructions.
147
+ <else>
148
+ Use default instructions.
149
+ </if-model>
150
+ ```
151
+
152
+ Supports exact IDs, `provider/model-id` pairs, wildcards (`anthropic/*`), and comma-separated combinations.
153
+
154
+ ## Best-of-N Compare
155
+
156
+ Run multiple workers, aggregate with reviewers, optionally apply final changes:
157
+
158
+ ```yaml
159
+ ---
160
+ description: Best-of-N code review
161
+ bestOfN:
162
+ worktree: true # required if using finalApplier
163
+ workers:
164
+ - model: openai-codex/gpt-5.4-mini:low
165
+ count: 2
166
+ reviewers:
167
+ - model: anthropic/claude-sonnet-4-20250514:medium
168
+ finalApplier:
169
+ agent: delegate
170
+ model: anthropic/claude-sonnet-4-20250514:high
171
+ ---
172
+ $@
173
+ ```
174
+
175
+ ## Runtime Flags
176
+
177
+ Override frontmatter at invocation:
178
+
179
+ - `--model=provider/model-id` — use this model instead
180
+ - `--subagent` / `--subagent=<name>` / `--subagent:<name>` — force delegation
181
+ - `--fork` — force delegation with context fork
182
+ - `--loop N` / `--loop=N` / `--loop` — override loop count (unlimited if bare)
183
+ - `--fresh` — collapse context between iterations
184
+ - `--no-converge` — run all iterations even if no changes
185
+ - `--cwd=/absolute/path` — working directory override when the prompt supports `cwd`
186
+ - `--chain-context` — pass summaries to later delegated chain steps
187
+ - `--worktree` — use git worktrees for parallel delegated work
188
+
189
+ When stuck, check `README.md` and `examples/best-of-n.md` in this extension.