@sienklogic/plan-build-run 2.53.0 → 2.55.0

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.
Files changed (165) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/package.json +2 -2
  3. package/plugins/codex-pbr/agents/audit.md +223 -0
  4. package/plugins/codex-pbr/agents/codebase-mapper.md +196 -0
  5. package/plugins/codex-pbr/agents/debugger.md +245 -0
  6. package/plugins/codex-pbr/agents/dev-sync.md +142 -0
  7. package/plugins/codex-pbr/agents/executor.md +429 -0
  8. package/plugins/codex-pbr/agents/general.md +131 -0
  9. package/plugins/codex-pbr/agents/integration-checker.md +178 -0
  10. package/plugins/codex-pbr/agents/plan-checker.md +253 -0
  11. package/plugins/codex-pbr/agents/planner.md +343 -0
  12. package/plugins/codex-pbr/agents/researcher.md +253 -0
  13. package/plugins/codex-pbr/agents/synthesizer.md +183 -0
  14. package/plugins/codex-pbr/agents/verifier.md +352 -0
  15. package/plugins/codex-pbr/commands/audit.md +5 -0
  16. package/plugins/codex-pbr/commands/begin.md +5 -0
  17. package/plugins/codex-pbr/commands/build.md +5 -0
  18. package/plugins/codex-pbr/commands/config.md +5 -0
  19. package/plugins/codex-pbr/commands/continue.md +5 -0
  20. package/plugins/codex-pbr/commands/dashboard.md +5 -0
  21. package/plugins/codex-pbr/commands/debug.md +5 -0
  22. package/plugins/codex-pbr/commands/discuss.md +5 -0
  23. package/plugins/codex-pbr/commands/do.md +5 -0
  24. package/plugins/codex-pbr/commands/explore.md +5 -0
  25. package/plugins/codex-pbr/commands/health.md +5 -0
  26. package/plugins/codex-pbr/commands/help.md +5 -0
  27. package/plugins/codex-pbr/commands/import.md +5 -0
  28. package/plugins/codex-pbr/commands/milestone.md +5 -0
  29. package/plugins/codex-pbr/commands/note.md +5 -0
  30. package/plugins/codex-pbr/commands/pause.md +5 -0
  31. package/plugins/codex-pbr/commands/plan.md +5 -0
  32. package/plugins/codex-pbr/commands/quick.md +5 -0
  33. package/plugins/codex-pbr/commands/resume.md +5 -0
  34. package/plugins/codex-pbr/commands/review.md +5 -0
  35. package/plugins/codex-pbr/commands/scan.md +5 -0
  36. package/plugins/codex-pbr/commands/setup.md +5 -0
  37. package/plugins/codex-pbr/commands/status.md +5 -0
  38. package/plugins/codex-pbr/commands/statusline.md +5 -0
  39. package/plugins/codex-pbr/commands/test.md +5 -0
  40. package/plugins/codex-pbr/commands/todo.md +5 -0
  41. package/plugins/codex-pbr/commands/undo.md +5 -0
  42. package/plugins/codex-pbr/references/agent-contracts.md +324 -0
  43. package/plugins/codex-pbr/references/agent-teams.md +54 -0
  44. package/plugins/codex-pbr/references/common-bug-patterns.md +13 -0
  45. package/plugins/codex-pbr/references/config-reference.md +552 -0
  46. package/plugins/codex-pbr/references/continuation-format.md +212 -0
  47. package/plugins/codex-pbr/references/deviation-rules.md +112 -0
  48. package/plugins/codex-pbr/references/git-integration.md +256 -0
  49. package/plugins/codex-pbr/references/integration-patterns.md +117 -0
  50. package/plugins/codex-pbr/references/model-profiles.md +99 -0
  51. package/plugins/codex-pbr/references/model-selection.md +31 -0
  52. package/plugins/codex-pbr/references/pbr-tools-cli.md +400 -0
  53. package/plugins/codex-pbr/references/plan-authoring.md +246 -0
  54. package/plugins/codex-pbr/references/plan-format.md +313 -0
  55. package/plugins/codex-pbr/references/questioning.md +235 -0
  56. package/plugins/codex-pbr/references/reading-verification.md +127 -0
  57. package/plugins/codex-pbr/references/signal-files.md +41 -0
  58. package/plugins/codex-pbr/references/stub-patterns.md +160 -0
  59. package/plugins/codex-pbr/references/ui-formatting.md +444 -0
  60. package/plugins/codex-pbr/references/wave-execution.md +95 -0
  61. package/plugins/codex-pbr/skills/audit/SKILL.md +346 -0
  62. package/plugins/codex-pbr/skills/begin/SKILL.md +800 -0
  63. package/plugins/codex-pbr/skills/build/SKILL.md +958 -0
  64. package/plugins/codex-pbr/skills/config/SKILL.md +267 -0
  65. package/plugins/codex-pbr/skills/continue/SKILL.md +172 -0
  66. package/plugins/codex-pbr/skills/dashboard/SKILL.md +44 -0
  67. package/plugins/codex-pbr/skills/debug/SKILL.md +530 -0
  68. package/plugins/codex-pbr/skills/discuss/SKILL.md +355 -0
  69. package/plugins/codex-pbr/skills/do/SKILL.md +68 -0
  70. package/plugins/codex-pbr/skills/explore/SKILL.md +407 -0
  71. package/plugins/codex-pbr/skills/health/SKILL.md +300 -0
  72. package/plugins/codex-pbr/skills/help/SKILL.md +229 -0
  73. package/plugins/codex-pbr/skills/import/SKILL.md +538 -0
  74. package/plugins/codex-pbr/skills/milestone/SKILL.md +620 -0
  75. package/plugins/codex-pbr/skills/note/SKILL.md +215 -0
  76. package/plugins/codex-pbr/skills/pause/SKILL.md +258 -0
  77. package/plugins/codex-pbr/skills/plan/SKILL.md +650 -0
  78. package/plugins/codex-pbr/skills/quick/SKILL.md +417 -0
  79. package/plugins/codex-pbr/skills/resume/SKILL.md +403 -0
  80. package/plugins/codex-pbr/skills/review/SKILL.md +669 -0
  81. package/plugins/codex-pbr/skills/scan/SKILL.md +325 -0
  82. package/plugins/codex-pbr/skills/setup/SKILL.md +169 -0
  83. package/plugins/codex-pbr/skills/shared/commit-planning-docs.md +35 -0
  84. package/plugins/codex-pbr/skills/shared/config-loading.md +102 -0
  85. package/plugins/codex-pbr/skills/shared/context-budget.md +77 -0
  86. package/plugins/codex-pbr/skills/shared/context-loader-task.md +86 -0
  87. package/plugins/codex-pbr/skills/shared/digest-select.md +79 -0
  88. package/plugins/codex-pbr/skills/shared/domain-probes.md +125 -0
  89. package/plugins/codex-pbr/skills/shared/error-reporting.md +59 -0
  90. package/plugins/codex-pbr/skills/shared/gate-prompts.md +388 -0
  91. package/plugins/codex-pbr/skills/shared/phase-argument-parsing.md +45 -0
  92. package/plugins/codex-pbr/skills/shared/revision-loop.md +81 -0
  93. package/plugins/codex-pbr/skills/shared/state-update.md +169 -0
  94. package/plugins/codex-pbr/skills/shared/universal-anti-patterns.md +43 -0
  95. package/plugins/codex-pbr/skills/status/SKILL.md +449 -0
  96. package/plugins/codex-pbr/skills/statusline/SKILL.md +149 -0
  97. package/plugins/codex-pbr/skills/test/SKILL.md +210 -0
  98. package/plugins/codex-pbr/skills/todo/SKILL.md +281 -0
  99. package/plugins/codex-pbr/skills/undo/SKILL.md +172 -0
  100. package/plugins/codex-pbr/templates/CONTEXT.md.tmpl +52 -0
  101. package/plugins/codex-pbr/templates/INTEGRATION-REPORT.md.tmpl +167 -0
  102. package/plugins/codex-pbr/templates/RESEARCH-SUMMARY.md.tmpl +97 -0
  103. package/plugins/codex-pbr/templates/ROADMAP.md.tmpl +47 -0
  104. package/plugins/codex-pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  105. package/plugins/codex-pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
  106. package/plugins/codex-pbr/templates/SUMMARY.md.tmpl +81 -0
  107. package/plugins/codex-pbr/templates/VERIFICATION-DETAIL.md.tmpl +117 -0
  108. package/plugins/codex-pbr/templates/codebase/ARCHITECTURE.md.tmpl +98 -0
  109. package/plugins/codex-pbr/templates/codebase/CONCERNS.md.tmpl +93 -0
  110. package/plugins/codex-pbr/templates/codebase/CONVENTIONS.md.tmpl +104 -0
  111. package/plugins/codex-pbr/templates/codebase/INTEGRATIONS.md.tmpl +78 -0
  112. package/plugins/codex-pbr/templates/codebase/STACK.md.tmpl +78 -0
  113. package/plugins/codex-pbr/templates/codebase/STRUCTURE.md.tmpl +80 -0
  114. package/plugins/codex-pbr/templates/codebase/TESTING.md.tmpl +107 -0
  115. package/plugins/codex-pbr/templates/continue-here.md.tmpl +73 -0
  116. package/plugins/codex-pbr/templates/pr-body.md.tmpl +22 -0
  117. package/plugins/codex-pbr/templates/prompt-partials/phase-project-context.md.tmpl +37 -0
  118. package/plugins/codex-pbr/templates/research/ARCHITECTURE.md.tmpl +124 -0
  119. package/plugins/codex-pbr/templates/research/STACK.md.tmpl +71 -0
  120. package/plugins/codex-pbr/templates/research/SUMMARY.md.tmpl +112 -0
  121. package/plugins/codex-pbr/templates/research-outputs/phase-research.md.tmpl +81 -0
  122. package/plugins/codex-pbr/templates/research-outputs/project-research.md.tmpl +99 -0
  123. package/plugins/codex-pbr/templates/research-outputs/synthesis.md.tmpl +36 -0
  124. package/plugins/copilot-pbr/commands/setup.md +1 -1
  125. package/plugins/copilot-pbr/commands/undo.md +5 -0
  126. package/plugins/copilot-pbr/plugin.json +1 -1
  127. package/plugins/copilot-pbr/skills/begin/SKILL.md +170 -17
  128. package/plugins/copilot-pbr/skills/build/SKILL.md +73 -8
  129. package/plugins/copilot-pbr/skills/plan/SKILL.md +67 -17
  130. package/plugins/copilot-pbr/skills/review/SKILL.md +12 -1
  131. package/plugins/copilot-pbr/skills/setup/SKILL.md +66 -214
  132. package/plugins/copilot-pbr/skills/shared/context-budget.md +27 -0
  133. package/plugins/copilot-pbr/skills/status/SKILL.md +44 -2
  134. package/plugins/copilot-pbr/skills/undo/SKILL.md +172 -0
  135. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  136. package/plugins/cursor-pbr/commands/setup.md +1 -1
  137. package/plugins/cursor-pbr/commands/undo.md +5 -0
  138. package/plugins/cursor-pbr/skills/begin/SKILL.md +170 -17
  139. package/plugins/cursor-pbr/skills/build/SKILL.md +73 -8
  140. package/plugins/cursor-pbr/skills/plan/SKILL.md +67 -17
  141. package/plugins/cursor-pbr/skills/review/SKILL.md +12 -1
  142. package/plugins/cursor-pbr/skills/setup/SKILL.md +66 -214
  143. package/plugins/cursor-pbr/skills/shared/context-budget.md +27 -0
  144. package/plugins/cursor-pbr/skills/status/SKILL.md +44 -2
  145. package/plugins/cursor-pbr/skills/undo/SKILL.md +173 -0
  146. package/plugins/jules-pbr/AGENTS.md +600 -0
  147. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
  148. package/plugins/pbr/commands/setup.md +1 -1
  149. package/plugins/pbr/commands/undo.md +5 -0
  150. package/plugins/pbr/scripts/config-schema.json +5 -1
  151. package/plugins/pbr/scripts/lib/alternatives.js +203 -0
  152. package/plugins/pbr/scripts/lib/preview.js +174 -0
  153. package/plugins/pbr/scripts/lib/skill-section.js +99 -0
  154. package/plugins/pbr/scripts/lib/step-verify.js +149 -0
  155. package/plugins/pbr/scripts/pbr-tools.js +122 -2
  156. package/plugins/pbr/scripts/validate-commit.js +2 -2
  157. package/plugins/pbr/skills/begin/SKILL.md +170 -17
  158. package/plugins/pbr/skills/begin/templates/config.json.tmpl +5 -1
  159. package/plugins/pbr/skills/build/SKILL.md +73 -8
  160. package/plugins/pbr/skills/plan/SKILL.md +67 -17
  161. package/plugins/pbr/skills/review/SKILL.md +12 -1
  162. package/plugins/pbr/skills/setup/SKILL.md +66 -214
  163. package/plugins/pbr/skills/shared/context-budget.md +27 -0
  164. package/plugins/pbr/skills/status/SKILL.md +44 -2
  165. package/plugins/pbr/skills/undo/SKILL.md +174 -0
@@ -0,0 +1,388 @@
1
+ # Gate Prompt Patterns
2
+
3
+ > Referenced by: plan, build, import, scan, review, milestone, config, status, resume, quick, begin, discuss, explore, debug skills
4
+ > Purpose: Reusable AskUserQuestion patterns for structured gate checks
5
+
6
+ These patterns provide consistent, structured prompts for user decision points. Skills reference these patterns by name to ensure all gate checks use the same format.
7
+
8
+ ## Rules
9
+
10
+ - `header` must be max 12 characters
11
+ - `multiSelect` is always `false` for gate checks
12
+ - Always handle the "Other" case (user typed a freeform response instead of selecting)
13
+
14
+ ---
15
+
16
+ ## Pattern: approve-revise-abort
17
+
18
+ 3-option gate for plan approval, gap-closure approval.
19
+
20
+ ```
21
+ Use AskUserQuestion:
22
+ question: "Approve these {noun}?"
23
+ header: "Approve?"
24
+ options:
25
+ - label: "Approve" description: "Proceed with {action}"
26
+ - label: "Request changes" description: "Discuss adjustments before proceeding"
27
+ - label: "Abort" description: "Cancel this operation"
28
+ multiSelect: false
29
+ ```
30
+
31
+ ---
32
+
33
+ ## Pattern: yes-no
34
+
35
+ Simple 2-option confirmation for re-planning, rebuild, replace plans, commit.
36
+
37
+ ```
38
+ Use AskUserQuestion:
39
+ question: "{Specific question about the action}"
40
+ header: "Confirm"
41
+ options:
42
+ - label: "Yes" description: "{What happens if yes}"
43
+ - label: "No" description: "{What happens if no}"
44
+ multiSelect: false
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Pattern: stale-continue
50
+
51
+ 2-option refresh gate for staleness warnings, timestamp freshness.
52
+
53
+ ```
54
+ Use AskUserQuestion:
55
+ question: "{Artifact} may be outdated. Refresh or continue?"
56
+ header: "Stale"
57
+ options:
58
+ - label: "Refresh" description: "Update before proceeding (recommended)"
59
+ - label: "Continue anyway" description: "Proceed with current version"
60
+ multiSelect: false
61
+ ```
62
+
63
+ ---
64
+
65
+ ## Pattern: yes-no-pick
66
+
67
+ 3-option selection for seed selection, item inclusion.
68
+
69
+ ```
70
+ Use AskUserQuestion:
71
+ question: "Include {items} in planning?"
72
+ header: "Include?"
73
+ options:
74
+ - label: "Yes, all" description: "Include all matching items"
75
+ - label: "Let me pick" description: "Choose which items to include"
76
+ - label: "No" description: "Proceed without these items"
77
+ multiSelect: false
78
+ ```
79
+
80
+ ---
81
+
82
+ ## Pattern: multi-option-failure
83
+
84
+ 4-option failure handler for build failures.
85
+
86
+ ```
87
+ Use AskUserQuestion:
88
+ question: "Plan {id} failed. How should we proceed?"
89
+ header: "Failed"
90
+ options:
91
+ - label: "Retry" description: "Re-run this plan's executor"
92
+ - label: "Skip" description: "Mark as skipped, continue to next wave"
93
+ - label: "Rollback" description: "Undo commits, revert to last good state"
94
+ - label: "Abort" description: "Stop the entire build"
95
+ multiSelect: false
96
+ ```
97
+
98
+ ---
99
+
100
+ ## Pattern: multi-option-escalation
101
+
102
+ 4-option escalation for review escalation (max AskUserQuestion supports).
103
+
104
+ ```
105
+ Use AskUserQuestion:
106
+ question: "Phase {N} has failed verification {attempt} times. How should we proceed?"
107
+ header: "Escalate"
108
+ options:
109
+ - label: "Accept gaps" description: "Mark as complete-with-gaps and move on"
110
+ - label: "Re-plan" description: "Go back to $pbr-plan with gap context"
111
+ - label: "Debug" description: "Spawn $pbr-debug to investigate root causes"
112
+ - label: "Retry" description: "Try one more verification cycle"
113
+ multiSelect: false
114
+ ```
115
+
116
+ Note: AskUserQuestion supports max 4 options. The original review escalation had 5 options (accept-gaps/re-plan/debug/override/retry). The "override" option is folded into the post-selection flow: if user selects "Accept gaps", offer a follow-up AskUserQuestion asking whether to accept all gaps or pick specific ones (the "override" behavior).
117
+
118
+ ---
119
+
120
+ ## Pattern: multi-option-gaps
121
+
122
+ 4-option gap handler for review gaps-found.
123
+
124
+ ```
125
+ Use AskUserQuestion:
126
+ question: "{count} verification gaps need attention. How should we proceed?"
127
+ header: "Gaps"
128
+ options:
129
+ - label: "Auto-fix" description: "Diagnose root causes and create fix plans (recommended)"
130
+ - label: "Override" description: "Accept specific gaps as false positives"
131
+ - label: "Manual" description: "I'll fix these myself"
132
+ - label: "Skip" description: "Save results for later"
133
+ multiSelect: false
134
+ ```
135
+
136
+ ---
137
+
138
+ ## Pattern: multi-option-priority
139
+
140
+ 4-option priority selection for milestone gap priority.
141
+
142
+ ```
143
+ Use AskUserQuestion:
144
+ question: "Which gaps should we address?"
145
+ header: "Priority"
146
+ options:
147
+ - label: "Must-fix only" description: "Address critical/high gaps only"
148
+ - label: "Must + should" description: "Address critical, high, and medium gaps"
149
+ - label: "Everything" description: "Address all gaps including low priority"
150
+ - label: "Let me pick" description: "Choose specific gaps to address"
151
+ multiSelect: false
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Pattern: settings-category-select
157
+
158
+ 4-option menu for configuration category selection (config skill).
159
+
160
+ ```
161
+ Use AskUserQuestion:
162
+ question: "What would you like to configure?"
163
+ header: "Configure"
164
+ options:
165
+ - label: "Depth" description: "quick/standard/comprehensive"
166
+ - label: "Model profile" description: "quality/balanced/budget/adaptive"
167
+ - label: "Features" description: "Toggle workflow features and gates"
168
+ - label: "Git settings" description: "branching strategy, commit mode"
169
+ multiSelect: false
170
+ ```
171
+
172
+ Note: Original 7 categories condensed to 4. "Models" (per-agent) merged into "Model profile". "Gates" and "Parallelization" merged into "Features". After selection, show a category-specific follow-up AskUserQuestion.
173
+
174
+ ---
175
+
176
+ ## Pattern: toggle-confirm
177
+
178
+ 2-option confirmation for enabling/disabling boolean features (config skill).
179
+
180
+ ```
181
+ Use AskUserQuestion:
182
+ question: "Enable {feature_name}?"
183
+ header: "Toggle"
184
+ options:
185
+ - label: "Enable" description: "Turn this feature on"
186
+ - label: "Disable" description: "Turn this feature off"
187
+ multiSelect: false
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Pattern: model-profile-select
193
+
194
+ 4-option selection for model profile presets (config skill).
195
+
196
+ ```
197
+ Use AskUserQuestion:
198
+ question: "Select model profile"
199
+ header: "Profile"
200
+ options:
201
+ - label: "Quality" description: "opus for all agents (highest cost)"
202
+ - label: "Balanced" description: "sonnet/inherit mix (default)"
203
+ - label: "Budget" description: "haiku for all agents (lowest cost)"
204
+ - label: "Adaptive" description: "sonnet planning, haiku execution"
205
+ multiSelect: false
206
+ ```
207
+
208
+ ---
209
+
210
+ ## Pattern: action-routing
211
+
212
+ Up to 4 suggested next actions with selection (status, resume skills).
213
+
214
+ ```
215
+ Use AskUserQuestion:
216
+ question: "What would you like to do next?"
217
+ header: "Next Step"
218
+ options:
219
+ - label: "{primary action}" description: "{explanation}"
220
+ - label: "{alternative 1}" description: "{explanation}"
221
+ - label: "{alternative 2}" description: "{explanation}"
222
+ - label: "Something else" description: "Enter a different command"
223
+ multiSelect: false
224
+ ```
225
+
226
+ Note: Dynamically generate options from workflow state. The "Something else" option allows freeform input. Build 1-3 real options + always include "Something else" as the last option. If only 1 real option exists, use the yes-no pattern instead.
227
+
228
+ ---
229
+
230
+ ## Pattern: pause-point-select
231
+
232
+ Select from multiple resume points (resume skill).
233
+
234
+ ```
235
+ Use AskUserQuestion:
236
+ question: "Found multiple pause points. Which would you like to resume?"
237
+ header: "Resume"
238
+ options:
239
+ - label: "Phase {A}" description: "Paused {date}"
240
+ - label: "Phase {B}" description: "Paused {date}"
241
+ - label: "Phase {C}" description: "Paused {date}"
242
+ - label: "Phase {D}" description: "Paused {date}"
243
+ multiSelect: false
244
+ ```
245
+
246
+ Note: If more than 4 pause points exist, show the 4 most recent. The oldest option becomes "Show earlier" which re-prompts with the next batch.
247
+
248
+ ---
249
+
250
+ ## Pattern: scope-confirm
251
+
252
+ 3-option confirmation for quick task scope validation (quick skill).
253
+
254
+ ```
255
+ Use AskUserQuestion:
256
+ question: "This task looks complex. Proceed as quick task or use full planning?"
257
+ header: "Scope"
258
+ options:
259
+ - label: "Quick task" description: "Execute as lightweight task"
260
+ - label: "Full plan" description: "Switch to $pbr-plan for proper planning"
261
+ - label: "Revise" description: "Let me rewrite the task description"
262
+ multiSelect: false
263
+ ```
264
+
265
+ ---
266
+
267
+ ## Pattern: depth-select
268
+
269
+ 3-option depth selection for begin skill workflow preferences.
270
+
271
+ ```
272
+ Use AskUserQuestion:
273
+ question: "How thorough should planning be?"
274
+ header: "Depth"
275
+ options:
276
+ - label: "Quick" description: "3-5 phases, skip research, ~50% cheaper"
277
+ - label: "Standard" description: "5-8 phases with research (default)"
278
+ - label: "Comprehensive" description: "8-12 phases, deep research, ~2x cost"
279
+ multiSelect: false
280
+ ```
281
+
282
+ ---
283
+
284
+ ## Pattern: git-strategy-select
285
+
286
+ 3-option git branching strategy for begin skill.
287
+
288
+ ```
289
+ Use AskUserQuestion:
290
+ question: "Git branching strategy?"
291
+ header: "Git"
292
+ options:
293
+ - label: "None" description: "Commit to current branch (default)"
294
+ - label: "Phase branches" description: "Create a branch per phase"
295
+ - label: "Milestone branches" description: "Create a branch per milestone"
296
+ multiSelect: false
297
+ ```
298
+
299
+ ---
300
+
301
+ ## Pattern: context-handling
302
+
303
+ 3-option handler for existing CONTEXT.md in discuss skill.
304
+
305
+ ```
306
+ Use AskUserQuestion:
307
+ question: "Phase {N} already has a CONTEXT.md. How should we handle it?"
308
+ header: "Context"
309
+ options:
310
+ - label: "Overwrite" description: "Replace with new decisions"
311
+ - label: "Append" description: "Add new decisions below existing ones"
312
+ - label: "Cancel" description: "Keep existing and stop"
313
+ multiSelect: false
314
+ ```
315
+
316
+ ---
317
+
318
+ ## Pattern: gray-area-option
319
+
320
+ Dynamic template for presenting gray area choices in discuss skill.
321
+
322
+ ```
323
+ Use AskUserQuestion:
324
+ question: "{Gray area title}"
325
+ header: "Decision"
326
+ options:
327
+ - label: "{Option 1}" description: "{Concrete approach 1}"
328
+ - label: "{Option 2}" description: "{Concrete approach 2}"
329
+ - label: "Let Claude decide" description: "Mark as Claude's Discretion"
330
+ multiSelect: false
331
+ ```
332
+
333
+ Note: Options are generated at runtime based on phase analysis. The pattern defines the structure; the skill fills in options per gray area. Always include "Let Claude decide" as the last option. If more than 4 options are identified, split into a 2-step flow (AskUserQuestion supports max 4 options).
334
+
335
+ ---
336
+
337
+ ## Pattern: output-routing
338
+
339
+ 4-option confirmation for explore skill output proposals.
340
+
341
+ ```
342
+ Use AskUserQuestion:
343
+ question: "How do you want to handle these proposed outputs?"
344
+ header: "Outputs"
345
+ options:
346
+ - label: "Approve all" description: "Create all suggested artifacts"
347
+ - label: "Adjust" description: "Modify the proposals before creating"
348
+ - label: "Add more" description: "I have additional outputs to capture"
349
+ - label: "Skip" description: "Don't create any artifacts from this session"
350
+ multiSelect: false
351
+ ```
352
+
353
+ ---
354
+
355
+ ## Pattern: debug-session-select
356
+
357
+ Dynamic template for debug session selection.
358
+
359
+ ```
360
+ Use AskUserQuestion:
361
+ question: "Found active debug sessions. Which would you like?"
362
+ header: "Debug"
363
+ options:
364
+ - label: "#{NNN}: {title}" description: "Started {date}, last: {hypothesis}"
365
+ - label: "#{NNN}: {title}" description: "Started {date}, last: {hypothesis}"
366
+ - label: "#{NNN}: {title}" description: "Started {date}, last: {hypothesis}"
367
+ - label: "New session" description: "Start a fresh debug investigation"
368
+ multiSelect: false
369
+ ```
370
+
371
+ Note: Options are generated at runtime from active debug sessions. If more than 3 active sessions exist, show the 3 most recent plus "New session" (max 4 options). Older sessions can be accessed by running `$pbr-debug` with the session number.
372
+
373
+ ---
374
+
375
+ ## Pattern: debug-checkpoint
376
+
377
+ 3-option checkpoint response during debug investigation.
378
+
379
+ ```
380
+ Use AskUserQuestion:
381
+ question: "Investigation has reached a checkpoint. How should we proceed?"
382
+ header: "Continue?"
383
+ options:
384
+ - label: "Continue" description: "Keep investigating with current findings"
385
+ - label: "More info" description: "I have additional context to share"
386
+ - label: "New approach" description: "Try a different investigation angle"
387
+ multiSelect: false
388
+ ```
@@ -0,0 +1,45 @@
1
+ # Phase Argument Parsing
2
+
3
+ How skills parse and validate phase number arguments from `$ARGUMENTS`.
4
+
5
+ ## Parsing Rules
6
+
7
+ 1. **Integer phases**: `3` → Phase 3 (standard phase)
8
+ 2. **Decimal phases**: `3.1` → Phase 3.1 (inserted phase)
9
+ 3. **Zero-padded**: `03` → Phase 3 (strip leading zeros for display, keep for file paths)
10
+ 4. **No argument**: Use current phase from STATE.md
11
+
12
+ ## Normalization
13
+
14
+ ```
15
+ Input → Normalized → Directory Name
16
+ "3" → 3 → 03-{slug}
17
+ "03" → 3 → 03-{slug}
18
+ "3.1" → 3.1 → 03.1-{slug}
19
+ "" → (current) → (read from STATE.md)
20
+ ```
21
+
22
+ ## Validation
23
+
24
+ 1. Phase number must be numeric (integer or decimal with one decimal place)
25
+ 2. Phase must exist in ROADMAP.md (or be a valid target for insert/add)
26
+ 3. Phase must be in the expected state for the operation:
27
+ - `$pbr-plan N` — phase must not already have plans (unless re-planning)
28
+ - `$pbr-build N` — phase must have plans
29
+ - `$pbr-review N` — phase must have been built (SUMMARY.md files exist)
30
+
31
+ ## Finding Phase Directory
32
+
33
+ ```
34
+ Given phase number N:
35
+ 1. List directories in .planning/phases/
36
+ 2. Find directory matching pattern: {NN}-* or {N.M}-*
37
+ 3. If not found, check ROADMAP.md for phase name
38
+ 4. If still not found, error: "Phase N not found"
39
+ ```
40
+
41
+ ## Error Messages
42
+
43
+ - No argument and no current phase: "Which phase? Specify a number or run $pbr-status to see where you are."
44
+ - Phase not found: "Phase {N} not found in .planning/phases/. Run $pbr-status to see available phases."
45
+ - Wrong state: "Phase {N} hasn't been planned yet. Run $pbr-plan {N} first."
@@ -0,0 +1,81 @@
1
+ # Revision Loop Pattern
2
+
3
+ Standard pattern for iterative agent revision with feedback. Used when a checker/validator finds issues and the producing agent needs to revise its output.
4
+
5
+ > Referenced by: plan, import, review skills
6
+
7
+ ---
8
+
9
+ ## Pattern: Check-Revise-Escalate (max 3 iterations)
10
+
11
+ This pattern applies whenever:
12
+ 1. An agent produces output (plans, imports, gap-closure plans)
13
+ 2. A checker/validator evaluates that output
14
+ 3. Issues are found that need revision
15
+
16
+ ### Flow
17
+
18
+ ```
19
+ iteration = 0
20
+
21
+ LOOP:
22
+ 1. Run checker/validator on current output
23
+ 2. Read checker results
24
+ 3. If PASSED or only INFO-level issues:
25
+ → Accept output, exit loop
26
+ 4. If BLOCKER or WARNING issues found:
27
+ a. iteration += 1
28
+ b. If iteration > 3:
29
+ → Escalate to user (see "After 3 Iterations" below)
30
+ c. Re-spawn the producing agent with checker feedback appended
31
+ d. After revision completes, go to LOOP
32
+ ```
33
+
34
+ ### Re-spawn Prompt Structure
35
+
36
+ When re-spawning the producing agent for revision, append the checker feedback:
37
+
38
+ ```
39
+ <checker_feedback>
40
+ {Inline the checker's issue report}
41
+ </checker_feedback>
42
+
43
+ <revision_instructions>
44
+ Address ALL BLOCKER and WARNING issues identified above.
45
+ - For each BLOCKER: make the required change
46
+ - For each WARNING: address or explain why it's acceptable
47
+ - Do NOT introduce new issues while fixing existing ones
48
+ - Preserve all content not flagged by the checker
49
+ </revision_instructions>
50
+ ```
51
+
52
+ ### After 3 Iterations
53
+
54
+ If issues persist after 3 revision cycles:
55
+
56
+ 1. Present remaining issues to the user
57
+ 2. Use AskUserQuestion (pattern: yes-no from `skills/shared/gate-prompts.md`):
58
+ question: "Issues remain after 3 revision attempts. Proceed with current output?"
59
+ header: "Proceed?"
60
+ options:
61
+ - label: "Proceed anyway" description: "Accept output with remaining issues"
62
+ - label: "Adjust approach" description: "Discuss a different approach"
63
+ 3. If "Proceed anyway": accept current output and continue
64
+ 4. If "Adjust approach" or "Other": discuss with user, then re-enter the producing step with updated context
65
+
66
+ ### Skill-Specific Variations
67
+
68
+ | Skill | Producer Agent | Checker Agent | Revision Template |
69
+ |-------|---------------|---------------|-------------------|
70
+ | plan | planner | plan-checker | `skills/plan/templates/revision-prompt.md.tmpl` |
71
+ | import | inline (orchestrator) | plan-checker | Inline revision by orchestrator |
72
+ | review (auto-fix) | planner (gap mode) | plan-checker | Same as plan |
73
+
74
+ ---
75
+
76
+ ## Important Notes
77
+
78
+ - **INFO-level issues are always acceptable** -- they don't trigger revision
79
+ - **Each iteration gets a fresh agent spawn** -- don't try to continue in the same context
80
+ - **Checker feedback must be inlined** -- the revision agent needs to see exactly what failed
81
+ - **Don't silently swallow issues** -- always present the final state to the user after exiting the loop
@@ -0,0 +1,169 @@
1
+ # STATE.md Update Pattern
2
+
3
+ Standard pattern for updating `.planning/STATE.md`. Include this fragment in skills that modify project state.
4
+
5
+ ---
6
+
7
+ **CRITICAL: STATE.md has TWO representations — YAML frontmatter AND markdown body. You MUST update BOTH when changing state. The status line reads frontmatter; humans and hooks read the body. If you only update frontmatter, the body goes stale and the status line shows wrong data. Do NOT skip body updates under any circumstances.**
8
+
9
+ ---
10
+
11
+ ## When to Update STATE.md
12
+
13
+ | Event | What to Update |
14
+ |-------|---------------|
15
+ | Phase status changes (planned, building, verified) | Frontmatter fields AND Current Position section |
16
+ | Plan completes or fails | Frontmatter fields AND Plan counter, status, last activity |
17
+ | Phase advances to next phase | Frontmatter fields AND Phase line, Status, Last activity, Progress bar |
18
+ | New decision made | Accumulated Context > Decisions |
19
+ | Blocker discovered or resolved | Accumulated Context > Blockers/Concerns |
20
+ | Session starts or ends | Session Continuity section |
21
+ | Milestone boundary | Milestone section |
22
+
23
+ ---
24
+
25
+ ## Section Format
26
+
27
+ STATE.md has 5 sections. Always preserve this order:
28
+
29
+ ### 1. Project Reference (lines 4-7)
30
+ ```
31
+ ## Project Reference
32
+ See: .planning/PROJECT.md (updated {date})
33
+ **Core value:** {one-liner from PROJECT.md}
34
+ **Current focus:** Phase {N} - {name}
35
+ ```
36
+ Update `Current focus` when phase changes.
37
+
38
+ ### 2. Current Position (lines 9-14)
39
+
40
+ **CRITICAL: This section MUST match the frontmatter fields above it. When you update `current_phase` or `status` in frontmatter, you MUST also update the corresponding lines below. A hook will auto-fix drift, but do not rely on it.**
41
+
42
+ ```
43
+ ## Current Position
44
+ Phase: {N} of {total} ({Phase name})
45
+ Plan: {completed} of {total_plans} in current phase
46
+ Status: {Ready to plan | Planning | Building | Reviewing | Verified}
47
+ Last activity: {YYYY-MM-DD} -- {brief description}
48
+ Progress: [{progress_bar}] {percent}%
49
+ ```
50
+
51
+ **Progress bar format:** 20 characters using `█` (done) and `░` (remaining).
52
+ ```
53
+ Phase 3 of 10 = 20% → [████░░░░░░░░░░░░░░░░] 20%
54
+ Phase 7 of 10 = 70% → [██████████████░░░░░░] 70%
55
+ ```
56
+ Calculation: `filled = Math.round((completed_phases / total_phases) * 20)`
57
+
58
+ ### 3. Accumulated Context (lines 16-25)
59
+ ```
60
+ ## Accumulated Context
61
+
62
+ ### Decisions
63
+ {Active decisions relevant to current work}
64
+
65
+ ### Pending Todos
66
+ {Outstanding items, or "None"}
67
+
68
+ ### Blockers/Concerns
69
+ {Active blockers, or "None"}
70
+ ```
71
+
72
+ ### 4. Milestone (lines 27-30)
73
+ ```
74
+ ## Milestone
75
+ Current: {project_name} {version}
76
+ Phases: {start}-{end}
77
+ Status: {In progress | Complete}
78
+ ```
79
+
80
+ ### 5. Session Continuity (lines 32-35)
81
+ ```
82
+ ## Session Continuity
83
+ Last session: {ISO timestamp}
84
+ Stopped at: {brief description of last action}
85
+ Resume file: {path or "None"}
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Size Limit Enforcement
91
+
92
+ **Hard limit: 150 lines.** After every STATE.md write, check the line count. If over 150 lines, compact:
93
+
94
+ 1. **Collapse completed phase entries** to one-liners:
95
+ ```
96
+ Phase 1: verified 2026-02-08
97
+ Phase 2: verified 2026-02-09
98
+ ```
99
+ 2. **Remove decisions already captured in CONTEXT.md** — avoid duplication between STATE.md and phase CONTEXT.md files
100
+ 3. **Remove old session entries** — keep only the current session's continuity data
101
+ 4. **Keep these always:** current phase detail, active blockers, core value statement, milestone info
102
+
103
+ If still over 150 lines after compaction, the Accumulated Context section has grown too large. Move non-critical decisions to the phase's CONTEXT.md file.
104
+
105
+ ---
106
+
107
+ ## HISTORY.md Archival
108
+
109
+ When a milestone completes or a phase is verified, archive historical context to `.planning/HISTORY.md` to keep STATE.md lean:
110
+
111
+ ### What to Archive
112
+
113
+ | Trigger | What moves to HISTORY.md |
114
+ |---------|-------------------------|
115
+ | Phase verified | One-liner summary: "Phase {N} ({name}): verified {date}" |
116
+ | Milestone complete | Full milestone record: name, phases covered, key decisions |
117
+ | Accumulated Context > 20 lines | Decisions from completed phases (keep only current-phase decisions in STATE.md) |
118
+
119
+ ### How to Archive
120
+
121
+ Use `pbr-tools.js history append`:
122
+ ```
123
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js history append phase "Phase 3 (Auth)" "Verified 2026-02-10. Key decisions: JWT + httpOnly cookies, Discord OAuth."
124
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js history append milestone "v1.0 User Auth" "Phases 1-4. All verified. Core auth flow complete."
125
+ ```
126
+
127
+ ### After Archiving
128
+
129
+ Remove the archived content from STATE.md. The Accumulated Context section should contain ONLY:
130
+ - Decisions relevant to the **current** phase
131
+ - Active (unresolved) blockers
132
+ - Pending todos for the current milestone
133
+
134
+ Historical decisions live in HISTORY.md and per-phase SUMMARY.md files.
135
+
136
+ ---
137
+
138
+ ## Common Update Scenarios
139
+
140
+ ### After build completes
141
+ ```
142
+ Plan: {N} of {total} in current phase
143
+ Status: Building → Reviewing (if all plans done) or Building (if more plans remain)
144
+ Last activity: {date} -- Built plan {plan_id}
145
+ ```
146
+
147
+ ### After review/verification passes
148
+ ```
149
+ Status: Verified
150
+ Last activity: {date} -- Phase {N} verified
151
+ Progress: [{updated bar}] {new percent}%
152
+ ```
153
+ Also update **Current focus** to point to the next phase.
154
+
155
+ ### After pause
156
+ ```
157
+ ## Session Continuity
158
+ Last session: {timestamp}
159
+ Stopped at: {what was in progress}
160
+ Resume file: .planning/.pause-state.json
161
+ ```
162
+
163
+ ### After milestone completion
164
+ ```
165
+ ## Milestone
166
+ Current: {project_name} {next_version}
167
+ Phases: {new_start}-{new_end}
168
+ Status: In progress
169
+ ```