@sienklogic/plan-build-run 2.0.2 → 2.2.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 (166) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +25 -6
  3. package/dashboard/src/routes/pages.routes.js +11 -4
  4. package/dashboard/src/services/dashboard.service.js +81 -17
  5. package/dashboard/src/services/phase.service.js +30 -24
  6. package/dashboard/src/services/roadmap.service.js +3 -3
  7. package/dashboard/src/views/partials/phase-content.ejs +5 -4
  8. package/package.json +1 -1
  9. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  10. package/plugins/cursor-pbr/CHANGELOG.md +15 -0
  11. package/plugins/cursor-pbr/README.md +118 -0
  12. package/plugins/cursor-pbr/agents/codebase-mapper.md +108 -0
  13. package/plugins/cursor-pbr/agents/debugger.md +168 -0
  14. package/plugins/cursor-pbr/agents/executor.md +236 -0
  15. package/plugins/cursor-pbr/agents/general.md +87 -0
  16. package/plugins/cursor-pbr/agents/integration-checker.md +87 -0
  17. package/plugins/cursor-pbr/agents/plan-checker.md +198 -0
  18. package/plugins/cursor-pbr/agents/planner.md +180 -0
  19. package/plugins/cursor-pbr/agents/researcher.md +162 -0
  20. package/plugins/cursor-pbr/agents/synthesizer.md +101 -0
  21. package/plugins/cursor-pbr/agents/verifier.md +193 -0
  22. package/plugins/cursor-pbr/assets/logo.svg +21 -0
  23. package/plugins/cursor-pbr/hooks/hooks.json +189 -7
  24. package/plugins/cursor-pbr/references/agent-anti-patterns.md +25 -0
  25. package/plugins/cursor-pbr/references/agent-interactions.md +135 -0
  26. package/plugins/cursor-pbr/references/agent-teams.md +55 -0
  27. package/plugins/cursor-pbr/references/checkpoints.md +158 -0
  28. package/plugins/cursor-pbr/references/common-bug-patterns.md +14 -0
  29. package/plugins/cursor-pbr/references/config-reference.md +442 -0
  30. package/plugins/cursor-pbr/references/continuation-format.md +213 -0
  31. package/plugins/cursor-pbr/references/deviation-rules.md +113 -0
  32. package/plugins/cursor-pbr/references/git-integration.md +227 -0
  33. package/plugins/cursor-pbr/references/integration-patterns.md +118 -0
  34. package/plugins/cursor-pbr/references/model-profiles.md +100 -0
  35. package/plugins/cursor-pbr/references/model-selection.md +32 -0
  36. package/plugins/cursor-pbr/references/pbr-rules.md +194 -0
  37. package/plugins/cursor-pbr/references/plan-authoring.md +182 -0
  38. package/plugins/cursor-pbr/references/plan-format.md +288 -0
  39. package/plugins/cursor-pbr/references/planning-config.md +214 -0
  40. package/plugins/cursor-pbr/references/questioning.md +215 -0
  41. package/plugins/cursor-pbr/references/reading-verification.md +128 -0
  42. package/plugins/cursor-pbr/references/stub-patterns.md +161 -0
  43. package/plugins/cursor-pbr/references/subagent-coordination.md +120 -0
  44. package/plugins/cursor-pbr/references/ui-formatting.md +462 -0
  45. package/plugins/cursor-pbr/references/verification-patterns.md +199 -0
  46. package/plugins/cursor-pbr/references/wave-execution.md +96 -0
  47. package/plugins/cursor-pbr/rules/pbr-workflow.mdc +48 -0
  48. package/plugins/cursor-pbr/setup.ps1 +78 -0
  49. package/plugins/cursor-pbr/setup.sh +83 -0
  50. package/plugins/cursor-pbr/skills/begin/SKILL.md +566 -0
  51. package/plugins/cursor-pbr/skills/begin/templates/PROJECT.md.tmpl +34 -0
  52. package/plugins/cursor-pbr/skills/begin/templates/REQUIREMENTS.md.tmpl +19 -0
  53. package/plugins/cursor-pbr/skills/begin/templates/STATE.md.tmpl +50 -0
  54. package/plugins/cursor-pbr/skills/begin/templates/config.json.tmpl +64 -0
  55. package/plugins/cursor-pbr/skills/begin/templates/researcher-prompt.md.tmpl +20 -0
  56. package/plugins/cursor-pbr/skills/begin/templates/roadmap-prompt.md.tmpl +31 -0
  57. package/plugins/cursor-pbr/skills/begin/templates/synthesis-prompt.md.tmpl +17 -0
  58. package/plugins/cursor-pbr/skills/build/SKILL.md +902 -0
  59. package/plugins/cursor-pbr/skills/config/SKILL.md +253 -0
  60. package/plugins/cursor-pbr/skills/continue/SKILL.md +159 -0
  61. package/plugins/cursor-pbr/skills/debug/SKILL.md +512 -0
  62. package/plugins/cursor-pbr/skills/debug/templates/continuation-prompt.md.tmpl +17 -0
  63. package/plugins/cursor-pbr/skills/debug/templates/initial-investigation-prompt.md.tmpl +28 -0
  64. package/plugins/cursor-pbr/skills/discuss/SKILL.md +344 -0
  65. package/plugins/cursor-pbr/skills/discuss/templates/CONTEXT.md.tmpl +62 -0
  66. package/plugins/cursor-pbr/skills/discuss/templates/decision-categories.md +10 -0
  67. package/plugins/cursor-pbr/skills/explore/SKILL.md +375 -0
  68. package/plugins/cursor-pbr/skills/health/SKILL.md +218 -0
  69. package/plugins/cursor-pbr/skills/health/templates/check-pattern.md.tmpl +31 -0
  70. package/plugins/cursor-pbr/skills/health/templates/output-format.md.tmpl +64 -0
  71. package/plugins/cursor-pbr/skills/help/SKILL.md +152 -0
  72. package/plugins/cursor-pbr/skills/import/SKILL.md +499 -0
  73. package/plugins/cursor-pbr/skills/milestone/SKILL.md +701 -0
  74. package/plugins/cursor-pbr/skills/milestone/templates/audit-report.md.tmpl +49 -0
  75. package/plugins/cursor-pbr/skills/milestone/templates/stats-file.md.tmpl +31 -0
  76. package/plugins/cursor-pbr/skills/note/SKILL.md +228 -0
  77. package/plugins/cursor-pbr/skills/pause/SKILL.md +246 -0
  78. package/plugins/cursor-pbr/skills/pause/templates/continue-here.md.tmpl +72 -0
  79. package/plugins/cursor-pbr/skills/plan/SKILL.md +648 -0
  80. package/plugins/cursor-pbr/skills/plan/templates/checker-prompt.md.tmpl +22 -0
  81. package/plugins/cursor-pbr/skills/plan/templates/gap-closure-prompt.md.tmpl +33 -0
  82. package/plugins/cursor-pbr/skills/plan/templates/planner-prompt.md.tmpl +39 -0
  83. package/plugins/cursor-pbr/skills/plan/templates/researcher-prompt.md.tmpl +20 -0
  84. package/plugins/cursor-pbr/skills/plan/templates/revision-prompt.md.tmpl +24 -0
  85. package/plugins/cursor-pbr/skills/quick/SKILL.md +351 -0
  86. package/plugins/cursor-pbr/skills/resume/SKILL.md +399 -0
  87. package/plugins/cursor-pbr/skills/review/SKILL.md +649 -0
  88. package/plugins/cursor-pbr/skills/review/templates/debugger-prompt.md.tmpl +61 -0
  89. package/plugins/cursor-pbr/skills/review/templates/gap-planner-prompt.md.tmpl +41 -0
  90. package/plugins/cursor-pbr/skills/review/templates/verifier-prompt.md.tmpl +116 -0
  91. package/plugins/cursor-pbr/skills/scan/SKILL.md +301 -0
  92. package/plugins/cursor-pbr/skills/scan/templates/mapper-prompt.md.tmpl +202 -0
  93. package/plugins/cursor-pbr/skills/setup/SKILL.md +250 -0
  94. package/plugins/cursor-pbr/skills/shared/commit-planning-docs.md +36 -0
  95. package/plugins/cursor-pbr/skills/shared/config-loading.md +103 -0
  96. package/plugins/cursor-pbr/skills/shared/context-budget.md +41 -0
  97. package/plugins/cursor-pbr/skills/shared/context-loader-task.md +87 -0
  98. package/plugins/cursor-pbr/skills/shared/digest-select.md +80 -0
  99. package/plugins/cursor-pbr/skills/shared/domain-probes.md +126 -0
  100. package/plugins/cursor-pbr/skills/shared/error-reporting.md +80 -0
  101. package/plugins/cursor-pbr/skills/shared/gate-prompts.md +389 -0
  102. package/plugins/cursor-pbr/skills/shared/phase-argument-parsing.md +46 -0
  103. package/plugins/cursor-pbr/skills/shared/progress-display.md +54 -0
  104. package/plugins/cursor-pbr/skills/shared/revision-loop.md +82 -0
  105. package/plugins/cursor-pbr/skills/shared/state-loading.md +63 -0
  106. package/plugins/cursor-pbr/skills/shared/state-update.md +162 -0
  107. package/plugins/cursor-pbr/skills/shared/universal-anti-patterns.md +34 -0
  108. package/plugins/cursor-pbr/skills/status/SKILL.md +362 -0
  109. package/plugins/cursor-pbr/skills/todo/SKILL.md +195 -0
  110. package/plugins/cursor-pbr/templates/CONTEXT.md.tmpl +53 -0
  111. package/plugins/cursor-pbr/templates/INTEGRATION-REPORT.md.tmpl +152 -0
  112. package/plugins/cursor-pbr/templates/RESEARCH-SUMMARY.md.tmpl +98 -0
  113. package/plugins/cursor-pbr/templates/ROADMAP.md.tmpl +41 -0
  114. package/plugins/cursor-pbr/templates/SUMMARY.md.tmpl +82 -0
  115. package/plugins/cursor-pbr/templates/VERIFICATION-DETAIL.md.tmpl +117 -0
  116. package/plugins/cursor-pbr/templates/continue-here.md.tmpl +74 -0
  117. package/plugins/cursor-pbr/templates/prompt-partials/phase-project-context.md.tmpl +38 -0
  118. package/plugins/pbr/agents/codebase-mapper.md +41 -206
  119. package/plugins/pbr/agents/debugger.md +65 -171
  120. package/plugins/pbr/agents/executor.md +90 -275
  121. package/plugins/pbr/agents/general.md +27 -97
  122. package/plugins/pbr/agents/integration-checker.md +35 -112
  123. package/plugins/pbr/agents/plan-checker.md +71 -164
  124. package/plugins/pbr/agents/planner.md +76 -245
  125. package/plugins/pbr/agents/researcher.md +63 -255
  126. package/plugins/pbr/agents/synthesizer.md +49 -174
  127. package/plugins/pbr/agents/verifier.md +75 -366
  128. package/plugins/pbr/hooks/hooks.json +14 -10
  129. package/plugins/pbr/references/ui-formatting.md +1 -1
  130. package/plugins/pbr/scripts/auto-continue.js +20 -4
  131. package/plugins/pbr/scripts/check-dangerous-commands.js +1 -1
  132. package/plugins/pbr/scripts/check-phase-boundary.js +1 -1
  133. package/plugins/pbr/scripts/check-plan-format.js +3 -3
  134. package/plugins/pbr/scripts/check-roadmap-sync.js +3 -3
  135. package/plugins/pbr/scripts/check-skill-workflow.js +1 -1
  136. package/plugins/pbr/scripts/check-state-sync.js +2 -2
  137. package/plugins/pbr/scripts/check-subagent-output.js +1 -1
  138. package/plugins/pbr/scripts/check-summary-gate.js +198 -0
  139. package/plugins/pbr/scripts/context-budget-check.js +1 -1
  140. package/plugins/pbr/scripts/event-handler.js +2 -2
  141. package/plugins/pbr/scripts/event-logger.js +1 -1
  142. package/plugins/pbr/scripts/log-subagent.js +1 -1
  143. package/plugins/pbr/scripts/pbr-tools.js +1 -1
  144. package/plugins/pbr/scripts/post-write-dispatch.js +1 -1
  145. package/plugins/pbr/scripts/post-write-quality.js +1 -1
  146. package/plugins/pbr/scripts/pre-bash-dispatch.js +1 -1
  147. package/plugins/pbr/scripts/pre-write-dispatch.js +16 -3
  148. package/plugins/pbr/scripts/session-cleanup.js +1 -1
  149. package/plugins/pbr/scripts/status-line.js +1 -1
  150. package/plugins/pbr/scripts/suggest-compact.js +1 -1
  151. package/plugins/pbr/scripts/task-completed.js +1 -1
  152. package/plugins/pbr/scripts/track-context-budget.js +11 -6
  153. package/plugins/pbr/scripts/validate-commit.js +1 -1
  154. package/plugins/pbr/scripts/validate-task.js +1 -1
  155. package/plugins/pbr/skills/begin/SKILL.md +4 -2
  156. package/plugins/pbr/skills/begin/templates/roadmap-prompt.md.tmpl +2 -0
  157. package/plugins/pbr/skills/build/SKILL.md +6 -4
  158. package/plugins/pbr/skills/continue/SKILL.md +2 -1
  159. package/plugins/pbr/skills/review/SKILL.md +4 -3
  160. package/plugins/pbr/skills/status/SKILL.md +5 -2
  161. package/plugins/pbr/templates/ROADMAP.md.tmpl +6 -1
  162. package/plugins/cursor-pbr/agents/.gitkeep +0 -0
  163. package/plugins/cursor-pbr/references/.gitkeep +0 -0
  164. package/plugins/cursor-pbr/rules/.gitkeep +0 -0
  165. package/plugins/cursor-pbr/skills/.gitkeep +0 -0
  166. package/plugins/cursor-pbr/templates/.gitkeep +0 -0
@@ -0,0 +1,375 @@
1
+ ---
2
+ name: explore
3
+ description: "Explore ideas, think through approaches, and route insights to the right artifacts."
4
+ argument-hint: "[topic]"
5
+ ---
6
+
7
+ ## Step 0 — Immediate Output
8
+
9
+ **Before ANY tool calls**, display this banner:
10
+
11
+ ```
12
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
13
+ PLAN-BUILD-RUN ► EXPLORING
14
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
15
+ ```
16
+
17
+ Then proceed to Step 1.
18
+
19
+ # /pbr:explore — Idea Exploration
20
+
21
+ You are running the **explore** skill. Your job is to help the user think through ideas that might become a todo, requirement, phase, decision, or nothing yet. This is Socratic conversation, not requirements gathering. No phase number is needed.
22
+
23
+ This skill runs **inline** (no Task delegation), with optional Task() spawns for context loading and mid-conversation research.
24
+
25
+ ---
26
+
27
+ ## Context Budget
28
+
29
+ Reference: `skills/shared/context-budget.md` for the universal orchestrator rules.
30
+
31
+ Additionally for this skill:
32
+ - **Minimize** file reads — this is a thinking skill, not a code analysis skill
33
+ - **Delegate** deep research to a researcher subagent if investigation exceeds 3-4 file reads
34
+
35
+ ---
36
+
37
+ ## How /pbr:explore Differs from /pbr:discuss
38
+
39
+ | | /pbr:discuss | /pbr:explore |
40
+ |---|---|---|
41
+ | Purpose | Make decisions for a phase | Discover what you actually want |
42
+ | Structure | Pre-computed gray areas with options | Open-ended Socratic conversation |
43
+ | Requires | Phase number | Nothing |
44
+ | Output | CONTEXT.md (locked decisions) | Routes to the right artifact |
45
+ | Feels like | Making decisions | Thinking with a partner |
46
+
47
+ ---
48
+
49
+ ## Invocation
50
+
51
+ - `/pbr:explore` — Open-ended: "I have an idea"
52
+ - `/pbr:explore auth` — Topic-specific exploration
53
+ - `/pbr:explore "should we add caching?"` — Specific question
54
+
55
+ Parse `$ARGUMENTS` for an optional topic. If provided, use it to seed the opening question. If empty, start fully open-ended.
56
+
57
+ ---
58
+
59
+ ## Pre-Conversation Context Loader
60
+
61
+ Reference: `skills/shared/context-loader-task.md` for the full briefing Task() pattern.
62
+
63
+ **Only runs if `.planning/` directory exists.** Fresh explores with no project skip this entirely.
64
+
65
+ When a project exists, spawn a briefing Task() per the context-loader-task pattern with `skill_purpose` = "exploring new ideas". If a topic was provided, use the topic-scoped variation with that topic.
66
+
67
+ Use the briefing to inform your conversation — reference existing decisions, avoid re-litigating settled questions, and connect new ideas to the existing project structure.
68
+
69
+ ---
70
+
71
+ ## Conversation Design
72
+
73
+ The conversation is Socratic, not extractive. You are a thinking partner, not an interviewer.
74
+
75
+ ### Principles
76
+
77
+ 1. **Open with curiosity.** Start with "What are you thinking about?" or "What's on your mind?" — not "Please describe the feature you want."
78
+
79
+ 2. **Follow their energy.** Dig into what excites or concerns them. If they light up about a technical approach, explore it. If they hesitate, probe why.
80
+
81
+ 3. **Surface implications.** "If you go with X, that usually means Y and Z. Is that intentional?" Connect their idea to downstream consequences they may not see yet.
82
+
83
+ 4. **Challenge with alternatives.** "You mentioned X, but have you considered Y?" Don't be adversarial — offer genuine alternatives that might fit better.
84
+
85
+ 5. **Present trade-offs, not options.** "A gives you speed but locks you into a vendor. B is slower but keeps options open." Frame choices as trade-offs with real consequences, not a menu.
86
+
87
+ 6. **Know when to research.** "I'm not sure about the best approach here. Want me to research it?" Don't fake knowledge — admit gaps and offer to investigate.
88
+
89
+ 7. **Don't rush to outputs.** Explore until understanding is genuinely deep. The user will know when they're ready to wrap up.
90
+
91
+ ### Domain-Aware Probing
92
+
93
+ Reference `skills/shared/domain-probes.md` for technology-specific follow-up questions. When the user mentions a domain (auth, caching, search, etc.), pick the 2-3 most relevant probes from that domain's table. Do NOT run through the table as a checklist.
94
+
95
+ ### Conversation Starters by Invocation
96
+
97
+ | Invocation | Opening |
98
+ |---|---|
99
+ | `/pbr:explore` | "What are you thinking about?" |
100
+ | `/pbr:explore auth` | "What's your thinking on auth? Are you starting from scratch or rethinking something?" |
101
+ | `/pbr:explore "should we add caching?"` | "Caching for what specifically? What's feeling slow or what do you expect to be slow?" |
102
+
103
+ ---
104
+
105
+ ## Mid-Conversation Research
106
+
107
+ When a knowledge gap emerges during the conversation — you're unsure about a library, pattern, or approach — surface it explicitly.
108
+
109
+ **Ask the user** using the **yes-no** pattern from `skills/shared/gate-prompts.md`:
110
+ question: "I'm not sure about the best approach for {topic}. Research it now?"
111
+ options:
112
+ - label: "Research now" description: "Spawn a researcher agent to investigate"
113
+ - label: "Save for later" description: "Add as a research question for future investigation"
114
+
115
+ **If research now:**
116
+
117
+ Display to the user: `◐ Spawning researcher...`
118
+
119
+ ```
120
+ Task({
121
+ subagent_type: "pbr:researcher",
122
+ prompt: "<research_assignment>
123
+ Topic: {specific research question}
124
+ Output file: .planning/research/{topic-slug}.md
125
+ Mode: project-research
126
+
127
+ Research this specific question: {the question}
128
+
129
+ Write findings to the output file.
130
+ </research_assignment>"
131
+ })
132
+ ```
133
+
134
+ After the researcher completes, display: `✓ Research complete — results in .planning/research/{topic-slug}.md`
135
+
136
+ Then:
137
+ - Read ONLY the frontmatter and summary section of the research file (not the full document)
138
+ - Incorporate the 2-3 key findings into the conversation
139
+ - Main context gets ~200 tokens of research insight, not the full document
140
+
141
+ **If save for later:**
142
+ - Note it as a research question to include in output routing
143
+
144
+ ---
145
+
146
+ ## Context Pressure Awareness
147
+
148
+ After approximately 10 exchanges or when the conversation has been substantial, mention:
149
+
150
+ "We've been exploring for a while. Want to wrap up with outputs, or keep going?"
151
+
152
+ Don't force a conclusion — some explorations legitimately need extended conversation. But surface the option so the user can choose.
153
+
154
+ ---
155
+
156
+ ## Output Routing
157
+
158
+ This is the key innovation of `/pbr:explore`. At conversation end, the agent summarizes key insights and routes them to the right artifacts.
159
+
160
+ ### Step 1: Summarize
161
+
162
+ Provide a concise summary of the key insights from the conversation:
163
+ - What was the core idea or question?
164
+ - What did we discover or decide?
165
+ - What remains uncertain?
166
+
167
+ ### Step 2: Propose Outputs
168
+
169
+ Suggest specific outputs with reasoning. Present no more than 4 suggestions — focus on what matters most.
170
+
171
+ | Output Type | When to Suggest | Where It Goes |
172
+ |---|---|---|
173
+ | Todo | Small, actionable item discovered | `.planning/todos/pending/{id}.md` |
174
+ | Requirement | New project feature identified | Append to `REQUIREMENTS.md` with REQ-ID |
175
+ | Phase decision | Clarifies an existing phase | Write/append to phase `CONTEXT.md` |
176
+ | Research question | Needs deeper investigation | `.planning/research/questions.md` |
177
+ | New phase | Big enough for its own phase | Append to `ROADMAP.md` |
178
+ | Note | Not actionable yet, worth remembering | `.planning/notes/{slug}.md` |
179
+ | Quick capture | One-liner idea, no context needed | Suggest `/pbr:note <text>` to the user |
180
+ | Seed | Idea with trigger conditions | `.planning/seeds/SEED-{NNN}-{slug}.md` |
181
+
182
+ **Format for proposals:**
183
+
184
+ ```
185
+ Based on our conversation, here's what I'd suggest capturing:
186
+
187
+ 1. **Todo**: "{title}" — {why this is a todo and not something bigger}
188
+ 2. **Seed**: "{title}" — {why this should wait for a trigger condition}
189
+ 3. **Research question**: "{question}" — {why we need to investigate this}
190
+
191
+ Want to adjust, add, or remove any of these?
192
+ ```
193
+
194
+ ### Step 3: Confirm
195
+
196
+ Use the **output-routing** pattern from `skills/shared/gate-prompts.md`:
197
+ question: "How do you want to handle these proposed outputs?"
198
+
199
+ Handle responses:
200
+ - "Approve all": Create all suggested artifacts (proceed to Step 4)
201
+ - "Adjust": The user wants to modify proposals. Have a freeform conversation to adjust, then re-present with another AskUserQuestion.
202
+ - "Add more": The user has additional outputs. Gather them conversationally, add to the list, then re-present.
203
+ - "Skip": End the session without creating artifacts. This is fine — sometimes exploring is enough.
204
+
205
+ Do NOT create any artifacts until the user selects "Approve all" on the final set.
206
+
207
+ ### Step 4: Create Artifacts
208
+
209
+ **Directory creation:** Before writing any artifact, ensure the target directory exists. Create `.planning/notes/`, `.planning/seeds/`, `.planning/research/`, or `.planning/todos/pending/` as needed if they don't already exist.
210
+
211
+ Create only the approved artifacts. A single explore session can produce multiple outputs across different types.
212
+
213
+ ### Step 5: Completion
214
+
215
+ After creating artifacts (or if user chose "Skip"), display:
216
+
217
+ ```
218
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
219
+ PLAN-BUILD-RUN ► EXPLORATION CAPTURED ✓
220
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
221
+
222
+ {count} artifacts created: {list of artifact types}
223
+
224
+ ───────────────────────────────────────────────────────────────
225
+
226
+ ## ▶ Next Up
227
+
228
+ **{Primary route based on what was created}**
229
+
230
+ {Smart routing — pick the most relevant primary command:}
231
+ - If a todo was created: **Manage tasks** → `/pbr:todo`
232
+ - If a phase decision was captured: **Plan the phase** → `/pbr:plan {N}`
233
+ - If a new phase was added: **Discuss the new phase** → `/pbr:discuss {N}`
234
+ - If research questions were logged: **Plan with research** → `/pbr:plan {N}`
235
+ - Default: **See project status** → `/pbr:status`
236
+
237
+ `{primary command}`
238
+
239
+ <sub>`/clear` first → fresh context window</sub>
240
+
241
+ ───────────────────────────────────────────────────────────────
242
+
243
+ **Also available:**
244
+ - `/pbr:status` — see project status
245
+ - `/pbr:continue` — execute next logical step
246
+
247
+ ───────────────────────────────────────────────────────────────
248
+ ```
249
+
250
+ ---
251
+
252
+ ## Output Formats
253
+
254
+ ### Todo
255
+
256
+ Write to `.planning/todos/pending/{NNN}-{slug}.md` where NNN is a zero-padded 3-digit sequential number (001, 002, 003...). Scan both `.planning/todos/pending/` and `.planning/todos/done/` for the highest existing number, increment by 1, and zero-pad. Follow the format used by the existing todo skill.
257
+
258
+ ### Requirement
259
+
260
+ Append to `.planning/REQUIREMENTS.md` with the next available REQ-ID in the appropriate category. If the category doesn't exist, create it.
261
+
262
+ ### Phase Decision
263
+
264
+ Append to `.planning/phases/{NN}-{slug}/CONTEXT.md`. If CONTEXT.md doesn't exist for that phase, create it with the standard header. Mark the decision as coming from `/pbr:explore`.
265
+
266
+ ### Research Question
267
+
268
+ Append to `.planning/research/questions.md`. Create the file if it doesn't exist:
269
+
270
+ ```markdown
271
+ # Research Questions
272
+
273
+ Questions identified during exploration that need deeper investigation.
274
+
275
+ ## Open
276
+
277
+ - [ ] {Question} — Source: /pbr:explore session ({date})
278
+
279
+ ## Answered
280
+
281
+ (none yet)
282
+ ```
283
+
284
+ ### New Phase
285
+
286
+ Append to `.planning/ROADMAP.md` following the existing phase format. Assign the next available phase number.
287
+
288
+ ### Note
289
+
290
+ Write to `.planning/notes/{NNN}-{slug}.md` where NNN is a zero-padded 3-digit sequential number (001, 002, 003...). Scan `.planning/notes/` for the highest existing number prefix, increment by 1, and zero-pad.
291
+
292
+ ```markdown
293
+ ---
294
+ created: {ISO date}
295
+ source: "/pbr:explore session"
296
+ topic: "{topic}"
297
+ ---
298
+ # {Title}
299
+
300
+ {Content from the conversation — key insights, reasoning, context}
301
+ ```
302
+
303
+ ### Seed
304
+
305
+ Write to `.planning/seeds/SEED-{NNN}-{slug}.md` where NNN is a zero-padded 3-digit sequential number (001, 002, 003...). Scan `.planning/seeds/` for the highest existing SEED number, increment by 1, and zero-pad.
306
+
307
+ ```markdown
308
+ ---
309
+ id: SEED-{NNN}
310
+ status: dormant
311
+ planted: {ISO date}
312
+ trigger: "{phase-slug}"
313
+ scope_estimate: "small|medium|large"
314
+ source: "/pbr:explore session"
315
+ ---
316
+ # {Title}
317
+
318
+ ## Context
319
+ {Why this idea came up}
320
+
321
+ ## Breadcrumbs
322
+ {Related phases, technologies, user preferences}
323
+ ```
324
+
325
+ ---
326
+
327
+ ## Git Integration
328
+
329
+ Reference: `skills/shared/commit-planning-docs.md` for the standard commit pattern.
330
+
331
+ If `planning.commit_docs: true` in config.json, commit created artifacts:
332
+
333
+ ```
334
+ docs(planning): capture explore session outputs
335
+ ```
336
+
337
+ Stage only the files created during this session. Do not stage unrelated changes.
338
+
339
+ ---
340
+
341
+ ## Error Handling
342
+
343
+ ### Researcher agent fails
344
+ If a mid-conversation researcher Task() fails, display:
345
+ ```
346
+ ╔══════════════════════════════════════════════════════════════╗
347
+ ║ ERROR ║
348
+ ╚══════════════════════════════════════════════════════════════╝
349
+
350
+ Research agent failed for topic: {topic}.
351
+
352
+ **To fix:** Continue the conversation without research, or try `/pbr:explore` again with a more specific topic.
353
+ ```
354
+
355
+ ### Context loader fails
356
+ If the briefing Task() fails:
357
+ - Display: `⚠ Context loading failed. Proceeding without project context.`
358
+ - Continue with the exploration — the conversation can still be valuable without project context.
359
+
360
+ ---
361
+
362
+ ## Anti-Patterns
363
+
364
+ Reference: `skills/shared/universal-anti-patterns.md` for rules that apply to ALL skills.
365
+
366
+ Additionally for this skill:
367
+
368
+ 1. **DO NOT** act like an interviewer — be a thinking partner
369
+ 2. **DO NOT** cycle through a checklist of questions
370
+ 3. **DO NOT** rush to outputs before understanding is deep
371
+ 4. **DO NOT** auto-research without asking (unless config mode is autonomous)
372
+ 5. **DO NOT** present more than 4 output suggestions — focus on what matters
373
+ 6. **DO NOT** create artifacts the user didn't approve
374
+ 7. **DO NOT** re-litigate decisions that are already locked in CONTEXT.md
375
+ 8. **DO NOT** force the user to produce outputs — sometimes exploring is enough
@@ -0,0 +1,218 @@
1
+ ---
2
+ name: health
3
+ description: "Check planning directory integrity. Find and fix corrupted state."
4
+ ---
5
+
6
+ ## Step 0 — Immediate Output
7
+
8
+ **Before ANY tool calls**, display this banner:
9
+
10
+ ```
11
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
12
+ PLAN-BUILD-RUN ► HEALTH CHECK
13
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
14
+ ```
15
+
16
+ Then proceed to Step 1.
17
+
18
+ # /pbr:health — Planning Directory Diagnostics
19
+
20
+ You are running the **health** skill. Your job is to validate the integrity of the `.planning/` directory, report problems, and suggest targeted fixes. You never auto-repair anything.
21
+
22
+ This skill runs **inline** and is **read-only** — it never modifies any files.
23
+
24
+ ---
25
+
26
+ ## How Checks Work
27
+
28
+ Each check follows the common pattern. Read `skills/health/templates/check-pattern.md.tmpl` for the shared execution flow: target files, validate against rules, classify as PASS/FAIL/WARN/INFO, and record the result with a fix suggestion for any failures.
29
+
30
+ Read `skills/health/templates/output-format.md.tmpl` for the output format: summary table, status indicators, issues list, optional recent decisions, and final result line.
31
+
32
+ ---
33
+
34
+ ## Checks
35
+
36
+ Run all 10 checks in order. Collect results and present them together at the end.
37
+
38
+ ### Check 1: Structure
39
+
40
+ Validate `.planning/` exists with required scaffolding: `STATE.md`, `config.json`, `ROADMAP.md`.
41
+
42
+ - If `.planning/` is missing: FAIL the entire health check immediately. Display:
43
+ ```
44
+ ╔══════════════════════════════════════════════════════════════╗
45
+ ║ ERROR ║
46
+ ╚══════════════════════════════════════════════════════════════╝
47
+
48
+ No .planning/ directory found.
49
+
50
+ **To fix:** Run `/pbr:begin` to initialize.
51
+ ```
52
+ Stop all further checks.
53
+ - PASS: All three required files exist
54
+ - FAIL: List each missing file — "Run `/pbr:begin` to re-initialize, or create the file manually."
55
+
56
+ ### Check 2: Config Validity
57
+
58
+ Parse `.planning/config.json` as JSON. Check required fields: `version`, `depth`. Check recommended fields: `features`, `models`.
59
+
60
+ - PASS: Valid JSON with all required fields
61
+ - FAIL (parse error): Report the parse error message — "Open the file and correct the syntax."
62
+ - FAIL (missing required field): Report which field — "Add the field to config.json."
63
+ - WARN (missing recommended field): Report which field — "This may cause issues with some skills."
64
+
65
+ ### Check 3: Phase Consistency
66
+
67
+ Compare directories in `.planning/phases/` against phases defined in `ROADMAP.md`.
68
+
69
+ - PASS: Every directory matches a ROADMAP.md phase; no started phases are missing directories
70
+ - FAIL (orphan directory): Directory exists but not in ROADMAP.md — "Add to ROADMAP.md or remove the directory."
71
+ - FAIL (missing directory): ROADMAP.md lists phase as in-progress but directory missing — "Create the directory or update ROADMAP.md."
72
+ - Note: Future phases without directories are normal (not a failure).
73
+
74
+ ### Check 4: Plan/Summary Pairing
75
+
76
+ Glob all `PLAN*.md` and `SUMMARY*.md` in `.planning/phases/`. Match by plan number. A PLAN without SUMMARY is normal unless the phase is marked complete.
77
+
78
+ - PASS: All pairings valid, no orphaned summaries
79
+ - FAIL (orphaned summary): SUMMARY has no matching PLAN — "Verify and remove or re-pair."
80
+ - WARN (missing summary in complete phase): Phase marked complete but plan has no SUMMARY — "Execute with `/pbr:build` or mark phase incomplete."
81
+
82
+ ### Check 5: STATE.md Accuracy
83
+
84
+ Extract current phase, plan identifier, and progress percentage from `STATE.md`. Verify each against the file system.
85
+
86
+ - PASS: All STATE.md references match the file system
87
+ - FAIL (stale phase): Referenced phase directory does not exist — "Update STATE.md to reflect the actual current phase."
88
+ - FAIL (stale plan): Referenced plan file does not exist — "Update STATE.md to the correct current plan."
89
+ - FAIL (wrong progress): Stated progress does not match actual plan/summary counts — "Update the progress in STATE.md."
90
+ - WARN (no position): No current phase or plan specified — "Fine for new projects but may indicate lost state."
91
+
92
+ ### Check 6: Frontmatter Validity
93
+
94
+ Glob all `PLAN*.md` and `SUMMARY*.md` in `.planning/phases/`. Each file must start with `---`, have a closing `---`, contain valid YAML, and include required fields: `title`, `status`.
95
+
96
+ - PASS: All files have valid frontmatter with required fields
97
+ - FAIL (no frontmatter): "Add frontmatter block starting with `---` at the top of the file."
98
+ - FAIL (malformed): Report the YAML error — "Correct the YAML syntax between the `---` delimiters."
99
+ - FAIL (missing field): Report which field — "Add `{field}: {suggested value}` to the frontmatter."
100
+
101
+ ### Check 7: ROADMAP/STATE Sync
102
+
103
+ Compare ROADMAP.md phase statuses against STATE.md current position. Flag if ROADMAP says a phase is "verified" but STATE says it is "building", or if phases after current are marked complete.
104
+
105
+ - PASS: ROADMAP and STATE are consistent
106
+ - FAIL (mismatch): Report both statuses — "Update STATE.md to match ROADMAP.md, or vice versa."
107
+ - WARN (drift): Current phase in STATE.md is behind phases marked complete in ROADMAP.md.
108
+
109
+ ### Check 8: Hook Execution Log
110
+
111
+ Check if `.planning/logs/hooks.jsonl` exists. Also check the legacy path `.planning/.hook-log` (the logger migrates this automatically, but it may still exist if hooks haven't fired since the migration was added). Use whichever file exists (prefer `hooks.jsonl`). If found, scan last 20 entries for `decision: "error"` or `decision: "unlink-failed"`.
112
+
113
+ - PASS: Log exists with no recent errors
114
+ - WARN (errors found): Report error count and most recent error description — "Hooks may not be firing correctly."
115
+ - INFO (no log): "No hook log found. Normal if no hooks have fired yet."
116
+
117
+ ### Check 9: Config Completeness
118
+
119
+ Read `.planning/config.json` and check for fields referenced by skills:
120
+ - `features.auto_continue` (build skill, auto-continue.js hook)
121
+ - `features.team_discussions` (config skill)
122
+ - `features.goal_verification` (build, review skills)
123
+ - `features.integration_verification` (review skill)
124
+ - `git.mode` (config skill)
125
+ - `planning.commit_docs` (import, discuss, quick skills) — must be a boolean; validate that the value is strictly `true` or `false`, not a string or number
126
+
127
+ - PASS: All expected fields present with correct types
128
+ - WARN (missing fields): Report each missing field and which skill uses it — "Run `/pbr:config` to set all options."
129
+
130
+ ### Check 10: Orphaned Crash Recovery Files
131
+
132
+ The executor creates `.PROGRESS-{plan_id}` files as crash recovery breadcrumbs during builds and deletes them after `SUMMARY.md` is written. Similarly, `.checkpoint-manifest.json` files track checkpoint state during execution. If the executor crashes mid-build, these files remain and could confuse future runs.
133
+
134
+ Glob for `.planning/phases/**/.PROGRESS-*` and `.planning/phases/**/.checkpoint-manifest.json`.
135
+
136
+ - PASS: No orphaned files found
137
+ - WARN (orphaned progress files): List each file with its parent phase directory:
138
+ ```
139
+ Orphaned progress files detected:
140
+ - .planning/phases/02-auth/.PROGRESS-02-01 (executor may have crashed)
141
+ ```
142
+ Fix suggestion: "These are crash recovery breadcrumbs from interrupted builds. Safe to delete if no `/pbr:build` is currently running. Remove with `rm <path>`."
143
+ - WARN (orphaned checkpoint manifests): List each file:
144
+ ```
145
+ Orphaned checkpoint manifests detected:
146
+ - .planning/phases/02-auth/.checkpoint-manifest.json (stale build checkpoint)
147
+ ```
148
+ Fix suggestion: "Checkpoint manifests are leftover from interrupted builds. Safe to delete if no `/pbr:build` is currently running. Remove with `rm <path>`."
149
+
150
+ ---
151
+
152
+ ## Bonus: Recent Decisions
153
+
154
+ After all checks, look for `.planning/logs/decisions.jsonl`. If it exists, display the last 5 entries as `- {date}: {summary} (phase {N})`. If it does not exist, skip silently.
155
+
156
+ ---
157
+
158
+ ## Completion
159
+
160
+ After all checks complete, display the branded result:
161
+
162
+ **If all checks passed (0 failures):**
163
+ ```
164
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
165
+ PLAN-BUILD-RUN ► HEALTH CHECK PASSED ✓
166
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
167
+
168
+ {N} checks passed, {M} warnings
169
+
170
+ ───────────────────────────────────────────────────────────────
171
+
172
+ ## ▶ Next Up
173
+
174
+ **Continue your workflow** — planning directory is healthy
175
+
176
+ `/pbr:status`
177
+
178
+ <sub>`/clear` first → fresh context window</sub>
179
+
180
+ ───────────────────────────────────────────────────────────────
181
+
182
+ **Also available:**
183
+ - `/pbr:continue` — execute next logical step
184
+ - `/pbr:config` — adjust settings
185
+
186
+ ───────────────────────────────────────────────────────────────
187
+ ```
188
+
189
+ **If failures found:**
190
+ ```
191
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
192
+ PLAN-BUILD-RUN ► HEALTH CHECK FAILED ⚠
193
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
194
+
195
+ {N} checks passed, {F} failures, {M} warnings
196
+
197
+ ───────────────────────────────────────────────────────────────
198
+
199
+ ## ▶ Next Up
200
+
201
+ **Fix the failures** listed above, then re-run
202
+
203
+ `/pbr:health`
204
+
205
+ ───────────────────────────────────────────────────────────────
206
+ ```
207
+
208
+ ---
209
+
210
+ ## Anti-Patterns
211
+
212
+ 1. **DO NOT** modify any files — this is strictly read-only
213
+ 2. **DO NOT** auto-repair anything — present fixes and let the user decide
214
+ 3. **DO NOT** skip checks that depend on missing files — report the dependency failure and continue
215
+ 4. **DO NOT** treat warnings as failures in the summary count — only count FAIL items
216
+ 5. **DO NOT** read full plan/summary contents — frontmatter and existence checks are sufficient
217
+ 6. **DO NOT** fail silently — every check must produce an explicit PASS, WARN, or FAIL
218
+ 7. **DO NOT** suggest running destructive commands — fixes should be safe, targeted edits
@@ -0,0 +1,31 @@
1
+ <\!-- canonical: ../../../../pbr/skills/health/templates/check-pattern.md.tmpl -->
2
+ # Health Check Execution Pattern
3
+
4
+ Each of the 9 checks follows this common pattern. The check-specific details (what to read, what to validate, what constitutes PASS/FAIL) are defined in SKILL.md — this template describes only the shared execution flow.
5
+
6
+ ## Pattern
7
+
8
+ ```
9
+ For check {check_number} ({check_name}):
10
+
11
+ 1. READ — Read the target file(s): {target_files}
12
+ 2. VALIDATE — Apply the check-specific rules: {validation_rules}
13
+ 3. CLASSIFY — Determine result:
14
+ - PASS: Validation succeeded, no issues found
15
+ - FAIL: A required condition is violated (counts toward issue total)
16
+ - WARN: A recommended condition is violated (does NOT count toward issue total)
17
+ - INFO: Informational note, not a problem
18
+ 4. RECORD — Store the result with:
19
+ - Status: [PASS], [FAIL], [WARN], or [INFO]
20
+ - Check name (short label)
21
+ - One-line summary of finding
22
+ - For FAIL/WARN: the specific file, the problem, and a concrete fix suggestion
23
+ ```
24
+
25
+ ## Rules
26
+
27
+ - Every check MUST produce exactly one status line (PASS, FAIL, WARN, or INFO)
28
+ - FAIL results MUST include: file path, problem description, and fix suggestion
29
+ - Multiple failures within a single check produce multiple entries in the "Issues Found" section
30
+ - Checks never auto-repair — they report only
31
+ - If a check depends on a prior check's file (e.g., Check 2 needs config.json which Check 1 validates exists), and that file is missing, report the dependency failure and move on
@@ -0,0 +1,64 @@
1
+ <\!-- canonical: ../../../../pbr/skills/health/templates/output-format.md.tmpl -->
2
+ # Health Check Output Format
3
+
4
+ Present results as a single report after all checks complete.
5
+
6
+ ## Summary Table
7
+
8
+ ```
9
+ Planning Health Check
10
+ =====================
11
+
12
+ [PASS] Structure .planning/ exists, all required files present
13
+ [FAIL] Config config.json missing required field `depth`
14
+ [PASS] Phase consistency Directories match ROADMAP.md phases
15
+ [PASS] Plan/Summary All pairings valid
16
+ [FAIL] STATE.md accuracy Phase reference is stale
17
+ [PASS] Frontmatter All PLAN/SUMMARY files have valid frontmatter
18
+ [PASS] ROADMAP/STATE sync ROADMAP and STATE phase statuses are consistent
19
+ [PASS] Hook log No recent hook errors
20
+ [PASS] Config completeness All expected fields present
21
+ ```
22
+
23
+ ## Status Indicators
24
+
25
+ | Indicator | Meaning | Counts as Issue? |
26
+ |-----------|---------|-----------------|
27
+ | `[PASS]` | Check passed, no problems | No |
28
+ | `[FAIL]` | Required condition violated | **Yes** |
29
+ | `[WARN]` | Recommended condition violated | No |
30
+ | `[INFO]` | Informational note | No |
31
+
32
+ ## Issues Section
33
+
34
+ Only shown when at least one FAIL exists:
35
+
36
+ ```
37
+ Issues Found: {count}
38
+ ---------------
39
+
40
+ 1. {problem description}
41
+ File: {file path}
42
+ Fix: {concrete fix suggestion}
43
+
44
+ 2. {problem description}
45
+ File: {file path}
46
+ Fix: {concrete fix suggestion}
47
+ ```
48
+
49
+ ## Recent Decisions (Bonus)
50
+
51
+ If `.planning/logs/decisions.jsonl` exists, show the last 5 entries:
52
+
53
+ ```
54
+ Recent Decisions:
55
+ - {date}: {summary} (phase {N})
56
+ - {date}: {summary} (phase {N})
57
+ ```
58
+
59
+ If the file does not exist, skip silently.
60
+
61
+ ## Final Line
62
+
63
+ - With issues: `Result: {N} issues found. Review and apply fixes manually.`
64
+ - All passed: `Result: All checks passed. Planning directory is healthy.`