@sienklogic/plan-build-run 2.0.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 (221) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/CLAUDE.md +149 -0
  3. package/LICENSE +21 -0
  4. package/README.md +247 -0
  5. package/dashboard/bin/cli.js +25 -0
  6. package/dashboard/package.json +34 -0
  7. package/dashboard/public/.gitkeep +0 -0
  8. package/dashboard/public/css/layout.css +406 -0
  9. package/dashboard/public/css/status-colors.css +98 -0
  10. package/dashboard/public/js/htmx-title.js +5 -0
  11. package/dashboard/public/js/sidebar-toggle.js +20 -0
  12. package/dashboard/src/app.js +78 -0
  13. package/dashboard/src/middleware/errorHandler.js +52 -0
  14. package/dashboard/src/middleware/notFoundHandler.js +9 -0
  15. package/dashboard/src/repositories/planning.repository.js +128 -0
  16. package/dashboard/src/routes/events.routes.js +40 -0
  17. package/dashboard/src/routes/index.routes.js +31 -0
  18. package/dashboard/src/routes/pages.routes.js +195 -0
  19. package/dashboard/src/server.js +42 -0
  20. package/dashboard/src/services/dashboard.service.js +222 -0
  21. package/dashboard/src/services/phase.service.js +167 -0
  22. package/dashboard/src/services/project.service.js +57 -0
  23. package/dashboard/src/services/roadmap.service.js +171 -0
  24. package/dashboard/src/services/sse.service.js +58 -0
  25. package/dashboard/src/services/todo.service.js +254 -0
  26. package/dashboard/src/services/watcher.service.js +48 -0
  27. package/dashboard/src/views/coming-soon.ejs +11 -0
  28. package/dashboard/src/views/error.ejs +13 -0
  29. package/dashboard/src/views/index.ejs +5 -0
  30. package/dashboard/src/views/layout.ejs +1 -0
  31. package/dashboard/src/views/partials/dashboard-content.ejs +77 -0
  32. package/dashboard/src/views/partials/footer.ejs +3 -0
  33. package/dashboard/src/views/partials/head.ejs +21 -0
  34. package/dashboard/src/views/partials/header.ejs +12 -0
  35. package/dashboard/src/views/partials/layout-bottom.ejs +15 -0
  36. package/dashboard/src/views/partials/layout-top.ejs +8 -0
  37. package/dashboard/src/views/partials/phase-content.ejs +181 -0
  38. package/dashboard/src/views/partials/phases-content.ejs +117 -0
  39. package/dashboard/src/views/partials/roadmap-content.ejs +142 -0
  40. package/dashboard/src/views/partials/sidebar.ejs +38 -0
  41. package/dashboard/src/views/partials/todo-create-content.ejs +53 -0
  42. package/dashboard/src/views/partials/todo-detail-content.ejs +38 -0
  43. package/dashboard/src/views/partials/todos-content.ejs +53 -0
  44. package/dashboard/src/views/phase-detail.ejs +5 -0
  45. package/dashboard/src/views/phases.ejs +5 -0
  46. package/dashboard/src/views/roadmap.ejs +5 -0
  47. package/dashboard/src/views/todo-create.ejs +5 -0
  48. package/dashboard/src/views/todo-detail.ejs +5 -0
  49. package/dashboard/src/views/todos.ejs +5 -0
  50. package/package.json +57 -0
  51. package/plugins/pbr/.claude-plugin/plugin.json +13 -0
  52. package/plugins/pbr/UI-CONSISTENCY-GAPS.md +61 -0
  53. package/plugins/pbr/agents/codebase-mapper.md +271 -0
  54. package/plugins/pbr/agents/debugger.md +281 -0
  55. package/plugins/pbr/agents/executor.md +407 -0
  56. package/plugins/pbr/agents/general.md +164 -0
  57. package/plugins/pbr/agents/integration-checker.md +141 -0
  58. package/plugins/pbr/agents/plan-checker.md +280 -0
  59. package/plugins/pbr/agents/planner.md +358 -0
  60. package/plugins/pbr/agents/researcher.md +363 -0
  61. package/plugins/pbr/agents/synthesizer.md +230 -0
  62. package/plugins/pbr/agents/verifier.md +454 -0
  63. package/plugins/pbr/commands/begin.md +5 -0
  64. package/plugins/pbr/commands/build.md +5 -0
  65. package/plugins/pbr/commands/config.md +5 -0
  66. package/plugins/pbr/commands/continue.md +5 -0
  67. package/plugins/pbr/commands/debug.md +5 -0
  68. package/plugins/pbr/commands/discuss.md +5 -0
  69. package/plugins/pbr/commands/explore.md +5 -0
  70. package/plugins/pbr/commands/health.md +5 -0
  71. package/plugins/pbr/commands/help.md +5 -0
  72. package/plugins/pbr/commands/import.md +5 -0
  73. package/plugins/pbr/commands/milestone.md +5 -0
  74. package/plugins/pbr/commands/note.md +5 -0
  75. package/plugins/pbr/commands/pause.md +5 -0
  76. package/plugins/pbr/commands/plan.md +5 -0
  77. package/plugins/pbr/commands/quick.md +5 -0
  78. package/plugins/pbr/commands/resume.md +5 -0
  79. package/plugins/pbr/commands/review.md +5 -0
  80. package/plugins/pbr/commands/scan.md +5 -0
  81. package/plugins/pbr/commands/setup.md +5 -0
  82. package/plugins/pbr/commands/status.md +5 -0
  83. package/plugins/pbr/commands/todo.md +5 -0
  84. package/plugins/pbr/contexts/dev.md +27 -0
  85. package/plugins/pbr/contexts/research.md +28 -0
  86. package/plugins/pbr/contexts/review.md +36 -0
  87. package/plugins/pbr/hooks/hooks.json +183 -0
  88. package/plugins/pbr/references/agent-anti-patterns.md +24 -0
  89. package/plugins/pbr/references/agent-interactions.md +134 -0
  90. package/plugins/pbr/references/agent-teams.md +54 -0
  91. package/plugins/pbr/references/checkpoints.md +157 -0
  92. package/plugins/pbr/references/common-bug-patterns.md +13 -0
  93. package/plugins/pbr/references/continuation-format.md +212 -0
  94. package/plugins/pbr/references/deviation-rules.md +112 -0
  95. package/plugins/pbr/references/git-integration.md +226 -0
  96. package/plugins/pbr/references/integration-patterns.md +117 -0
  97. package/plugins/pbr/references/model-profiles.md +99 -0
  98. package/plugins/pbr/references/model-selection.md +31 -0
  99. package/plugins/pbr/references/pbr-rules.md +193 -0
  100. package/plugins/pbr/references/plan-authoring.md +181 -0
  101. package/plugins/pbr/references/plan-format.md +283 -0
  102. package/plugins/pbr/references/planning-config.md +213 -0
  103. package/plugins/pbr/references/questioning.md +214 -0
  104. package/plugins/pbr/references/reading-verification.md +127 -0
  105. package/plugins/pbr/references/stub-patterns.md +160 -0
  106. package/plugins/pbr/references/subagent-coordination.md +119 -0
  107. package/plugins/pbr/references/ui-formatting.md +399 -0
  108. package/plugins/pbr/references/verification-patterns.md +198 -0
  109. package/plugins/pbr/references/wave-execution.md +95 -0
  110. package/plugins/pbr/scripts/auto-continue.js +80 -0
  111. package/plugins/pbr/scripts/check-dangerous-commands.js +136 -0
  112. package/plugins/pbr/scripts/check-doc-sprawl.js +102 -0
  113. package/plugins/pbr/scripts/check-phase-boundary.js +196 -0
  114. package/plugins/pbr/scripts/check-plan-format.js +270 -0
  115. package/plugins/pbr/scripts/check-roadmap-sync.js +252 -0
  116. package/plugins/pbr/scripts/check-skill-workflow.js +262 -0
  117. package/plugins/pbr/scripts/check-state-sync.js +476 -0
  118. package/plugins/pbr/scripts/check-subagent-output.js +144 -0
  119. package/plugins/pbr/scripts/config-schema.json +251 -0
  120. package/plugins/pbr/scripts/context-budget-check.js +287 -0
  121. package/plugins/pbr/scripts/event-handler.js +151 -0
  122. package/plugins/pbr/scripts/event-logger.js +92 -0
  123. package/plugins/pbr/scripts/hook-logger.js +76 -0
  124. package/plugins/pbr/scripts/hooks-schema.json +79 -0
  125. package/plugins/pbr/scripts/log-subagent.js +152 -0
  126. package/plugins/pbr/scripts/log-tool-failure.js +88 -0
  127. package/plugins/pbr/scripts/pbr-tools.js +1301 -0
  128. package/plugins/pbr/scripts/post-write-dispatch.js +66 -0
  129. package/plugins/pbr/scripts/post-write-quality.js +207 -0
  130. package/plugins/pbr/scripts/pre-bash-dispatch.js +56 -0
  131. package/plugins/pbr/scripts/pre-write-dispatch.js +62 -0
  132. package/plugins/pbr/scripts/progress-tracker.js +228 -0
  133. package/plugins/pbr/scripts/session-cleanup.js +254 -0
  134. package/plugins/pbr/scripts/status-line.js +285 -0
  135. package/plugins/pbr/scripts/suggest-compact.js +119 -0
  136. package/plugins/pbr/scripts/task-completed.js +45 -0
  137. package/plugins/pbr/scripts/track-context-budget.js +119 -0
  138. package/plugins/pbr/scripts/validate-commit.js +200 -0
  139. package/plugins/pbr/scripts/validate-plugin-structure.js +172 -0
  140. package/plugins/pbr/skills/begin/SKILL.md +545 -0
  141. package/plugins/pbr/skills/begin/templates/PROJECT.md.tmpl +33 -0
  142. package/plugins/pbr/skills/begin/templates/REQUIREMENTS.md.tmpl +18 -0
  143. package/plugins/pbr/skills/begin/templates/STATE.md.tmpl +49 -0
  144. package/plugins/pbr/skills/begin/templates/config.json.tmpl +63 -0
  145. package/plugins/pbr/skills/begin/templates/researcher-prompt.md.tmpl +19 -0
  146. package/plugins/pbr/skills/begin/templates/roadmap-prompt.md.tmpl +30 -0
  147. package/plugins/pbr/skills/begin/templates/synthesis-prompt.md.tmpl +16 -0
  148. package/plugins/pbr/skills/build/SKILL.md +962 -0
  149. package/plugins/pbr/skills/config/SKILL.md +241 -0
  150. package/plugins/pbr/skills/continue/SKILL.md +127 -0
  151. package/plugins/pbr/skills/debug/SKILL.md +489 -0
  152. package/plugins/pbr/skills/debug/templates/continuation-prompt.md.tmpl +16 -0
  153. package/plugins/pbr/skills/debug/templates/initial-investigation-prompt.md.tmpl +27 -0
  154. package/plugins/pbr/skills/discuss/SKILL.md +338 -0
  155. package/plugins/pbr/skills/discuss/templates/CONTEXT.md.tmpl +61 -0
  156. package/plugins/pbr/skills/discuss/templates/decision-categories.md +9 -0
  157. package/plugins/pbr/skills/explore/SKILL.md +362 -0
  158. package/plugins/pbr/skills/health/SKILL.md +186 -0
  159. package/plugins/pbr/skills/health/templates/check-pattern.md.tmpl +30 -0
  160. package/plugins/pbr/skills/health/templates/output-format.md.tmpl +63 -0
  161. package/plugins/pbr/skills/help/SKILL.md +140 -0
  162. package/plugins/pbr/skills/import/SKILL.md +490 -0
  163. package/plugins/pbr/skills/milestone/SKILL.md +673 -0
  164. package/plugins/pbr/skills/milestone/templates/audit-report.md.tmpl +48 -0
  165. package/plugins/pbr/skills/milestone/templates/stats-file.md.tmpl +30 -0
  166. package/plugins/pbr/skills/note/SKILL.md +212 -0
  167. package/plugins/pbr/skills/pause/SKILL.md +235 -0
  168. package/plugins/pbr/skills/pause/templates/continue-here.md.tmpl +71 -0
  169. package/plugins/pbr/skills/plan/SKILL.md +628 -0
  170. package/plugins/pbr/skills/plan/decimal-phase-calc.md +98 -0
  171. package/plugins/pbr/skills/plan/templates/checker-prompt.md.tmpl +21 -0
  172. package/plugins/pbr/skills/plan/templates/gap-closure-prompt.md.tmpl +32 -0
  173. package/plugins/pbr/skills/plan/templates/planner-prompt.md.tmpl +38 -0
  174. package/plugins/pbr/skills/plan/templates/researcher-prompt.md.tmpl +19 -0
  175. package/plugins/pbr/skills/plan/templates/revision-prompt.md.tmpl +23 -0
  176. package/plugins/pbr/skills/quick/SKILL.md +335 -0
  177. package/plugins/pbr/skills/resume/SKILL.md +388 -0
  178. package/plugins/pbr/skills/review/SKILL.md +652 -0
  179. package/plugins/pbr/skills/review/templates/debugger-prompt.md.tmpl +60 -0
  180. package/plugins/pbr/skills/review/templates/gap-planner-prompt.md.tmpl +40 -0
  181. package/plugins/pbr/skills/review/templates/verifier-prompt.md.tmpl +115 -0
  182. package/plugins/pbr/skills/scan/SKILL.md +269 -0
  183. package/plugins/pbr/skills/scan/templates/mapper-prompt.md.tmpl +201 -0
  184. package/plugins/pbr/skills/setup/SKILL.md +227 -0
  185. package/plugins/pbr/skills/shared/commit-planning-docs.md +35 -0
  186. package/plugins/pbr/skills/shared/config-loading.md +102 -0
  187. package/plugins/pbr/skills/shared/context-budget.md +40 -0
  188. package/plugins/pbr/skills/shared/context-loader-task.md +86 -0
  189. package/plugins/pbr/skills/shared/digest-select.md +79 -0
  190. package/plugins/pbr/skills/shared/domain-probes.md +125 -0
  191. package/plugins/pbr/skills/shared/error-reporting.md +79 -0
  192. package/plugins/pbr/skills/shared/gate-prompts.md +388 -0
  193. package/plugins/pbr/skills/shared/phase-argument-parsing.md +45 -0
  194. package/plugins/pbr/skills/shared/progress-display.md +53 -0
  195. package/plugins/pbr/skills/shared/revision-loop.md +81 -0
  196. package/plugins/pbr/skills/shared/state-loading.md +62 -0
  197. package/plugins/pbr/skills/shared/state-update.md +161 -0
  198. package/plugins/pbr/skills/shared/universal-anti-patterns.md +33 -0
  199. package/plugins/pbr/skills/status/SKILL.md +353 -0
  200. package/plugins/pbr/skills/todo/SKILL.md +181 -0
  201. package/plugins/pbr/templates/CONTEXT.md.tmpl +52 -0
  202. package/plugins/pbr/templates/INTEGRATION-REPORT.md.tmpl +151 -0
  203. package/plugins/pbr/templates/RESEARCH-SUMMARY.md.tmpl +97 -0
  204. package/plugins/pbr/templates/ROADMAP.md.tmpl +40 -0
  205. package/plugins/pbr/templates/SUMMARY.md.tmpl +81 -0
  206. package/plugins/pbr/templates/VERIFICATION-DETAIL.md.tmpl +116 -0
  207. package/plugins/pbr/templates/codebase/ARCHITECTURE.md.tmpl +98 -0
  208. package/plugins/pbr/templates/codebase/CONCERNS.md.tmpl +93 -0
  209. package/plugins/pbr/templates/codebase/CONVENTIONS.md.tmpl +104 -0
  210. package/plugins/pbr/templates/codebase/INTEGRATIONS.md.tmpl +78 -0
  211. package/plugins/pbr/templates/codebase/STACK.md.tmpl +78 -0
  212. package/plugins/pbr/templates/codebase/STRUCTURE.md.tmpl +80 -0
  213. package/plugins/pbr/templates/codebase/TESTING.md.tmpl +107 -0
  214. package/plugins/pbr/templates/continue-here.md.tmpl +73 -0
  215. package/plugins/pbr/templates/prompt-partials/phase-project-context.md.tmpl +37 -0
  216. package/plugins/pbr/templates/research/ARCHITECTURE.md.tmpl +124 -0
  217. package/plugins/pbr/templates/research/STACK.md.tmpl +71 -0
  218. package/plugins/pbr/templates/research/SUMMARY.md.tmpl +112 -0
  219. package/plugins/pbr/templates/research-outputs/phase-research.md.tmpl +81 -0
  220. package/plugins/pbr/templates/research-outputs/project-research.md.tmpl +99 -0
  221. package/plugins/pbr/templates/research-outputs/synthesis.md.tmpl +36 -0
@@ -0,0 +1,673 @@
1
+ ---
2
+ name: milestone
3
+ description: "Manage milestones: new, complete, audit, gaps."
4
+ allowed-tools: Read, Write, Bash, Glob, Grep, Task, AskUserQuestion
5
+ argument-hint: "new|complete|audit|gaps [version]"
6
+ ---
7
+
8
+ # /pbr:milestone — Milestone Management
9
+
10
+ You are running the **milestone** skill. Milestones represent significant project checkpoints — a set of phases that together deliver a cohesive chunk of functionality. This skill handles the full milestone lifecycle: creation, completion, auditing, and gap analysis.
11
+
12
+ This skill runs **inline** for most subcommands, but spawns agents for `audit`.
13
+
14
+ ---
15
+
16
+ ## Context Budget
17
+
18
+ Reference: `skills/shared/context-budget.md` for the universal orchestrator rules.
19
+
20
+ Additionally for this skill:
21
+ - **Never** perform integration checks yourself — delegate to the integration-checker subagent
22
+ - **Minimize** reading audit and verification outputs — read only frontmatter and status fields
23
+ - **Delegate** all cross-phase integration analysis to the integration-checker subagent
24
+
25
+ ---
26
+
27
+ ## Core Principle
28
+
29
+ **Milestones are the rhythm of the project.** They force you to step back, verify everything works together, and create a clean snapshot before moving on. Never skip the audit — integration issues hide at milestone boundaries.
30
+
31
+ ---
32
+
33
+ ## Argument Parsing
34
+
35
+ Parse `$ARGUMENTS` for the subcommand and optional version:
36
+
37
+ ```
38
+ $ARGUMENTS format: {subcommand} [{version/name}]
39
+
40
+ Examples:
41
+ "new" → subcommand=new, arg=none
42
+ "new User Auth" → subcommand=new, arg="User Auth"
43
+ "complete v1.0" → subcommand=complete, arg="v1.0"
44
+ "complete 1.0" → subcommand=complete, arg="v1.0" (auto-prefix v)
45
+ "audit v1.0" → subcommand=audit, arg="v1.0"
46
+ "audit" → subcommand=audit, arg=current milestone
47
+ "gaps" → subcommand=gaps, arg=most recent audit
48
+ ```
49
+
50
+ **If no subcommand recognized:** Show usage:
51
+ ```
52
+ Usage: /pbr:milestone <subcommand> [version]
53
+
54
+ Subcommands:
55
+ new [name] — Start a new milestone cycle
56
+ complete [ver] — Archive completed milestone
57
+ audit [ver] — Verify milestone completion
58
+ gaps — Create phases to close audit gaps
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Subcommand: `new`
64
+
65
+ Start a new milestone cycle with new phases.
66
+
67
+ ### Flow
68
+
69
+ 1. **Read current state:**
70
+ - Read ROADMAP.md to see existing phases
71
+ - Read STATE.md for current position
72
+ - Read PROJECT.md if it exists (milestone history)
73
+
74
+ 2. **Get milestone details** via AskUserQuestion:
75
+ - "What's the name/goal for this new milestone?"
76
+ - "What are the major features or capabilities it should deliver?"
77
+ - If the user provided a name in `$ARGUMENTS`, use it and skip the name question
78
+
79
+ 3. **Determine phase numbering:**
80
+ - Find the highest phase number in the current ROADMAP.md
81
+ - New phases start at highest + 1
82
+ - Example: if phases 1-5 exist, new milestone starts at phase 6
83
+
84
+ 4. **Mini roadmap session:**
85
+ Run a condensed version of the `/pbr:begin` questioning flow:
86
+
87
+ a. Ask about major components needed (via AskUserQuestion):
88
+ - "What are the 2-5 major areas of work for this milestone?"
89
+
90
+ b. For each area, ask:
91
+ - "Any specific requirements or constraints for {area}?"
92
+
93
+ c. Generate phases from the areas:
94
+ - Each major area becomes a phase
95
+ - Order by dependency (foundations first)
96
+ - Include brief description and success criteria
97
+
98
+ 5. **Update ROADMAP.md:**
99
+ Append new milestone section:
100
+
101
+ ```markdown
102
+ ---
103
+
104
+ ## Milestone: {name}
105
+
106
+ **Goal:** {goal statement}
107
+ **Phases:** {start_num} - {end_num}
108
+
109
+ ### Phase {N}: {name}
110
+ **Goal:** {goal}
111
+ **Requirements:** {list}
112
+ **Success criteria:** {criteria}
113
+ **Depends on:** {prior phases}
114
+
115
+ ### Phase {N+1}: {name}
116
+ ...
117
+ ```
118
+
119
+ 6. **Create phase directories:**
120
+ For each new phase:
121
+ ```
122
+ .planning/phases/{NN}-{slug}/
123
+ ```
124
+
125
+ 7. **Update PROJECT.md** (create if needed):
126
+ Add milestone to the active milestones list:
127
+
128
+ ```markdown
129
+ ## Active Milestones
130
+
131
+ ### {name}
132
+ - **Phases:** {start} - {end}
133
+ - **Created:** {date}
134
+ - **Status:** In progress
135
+ ```
136
+
137
+ 8. **Update STATE.md:**
138
+ - Set current phase to the first new phase
139
+ - Update milestone info
140
+
141
+ 9. **Commit** if `planning.commit_docs: true`:
142
+ ```
143
+ docs(planning): start milestone "{name}" (phases {start}-{end})
144
+ ```
145
+
146
+ 10. **Confirm** with branded output:
147
+ ```
148
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
149
+ PLAN-BUILD-RUN ► MILESTONE CREATED ✓
150
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
151
+
152
+ **Milestone: {name}** — {count} phases
153
+
154
+ Phases:
155
+ {N}. {name}
156
+ {N+1}. {name}
157
+ ...
158
+
159
+ ───────────────────────────────────────────────────────────────
160
+
161
+ ## ▶ Next Up
162
+
163
+ **Phase {N}: {name}** — start with discussion or planning
164
+
165
+ `/pbr:discuss {N}`
166
+
167
+ <sub>`/clear` first → fresh context window</sub>
168
+
169
+ ───────────────────────────────────────────────────────────────
170
+
171
+ **Also available:**
172
+ - `/pbr:plan {N}` — skip discussion, plan directly
173
+ - `/pbr:status` — see project status
174
+
175
+ ───────────────────────────────────────────────────────────────
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Subcommand: `complete`
181
+
182
+ Archive a completed milestone and prepare for the next one.
183
+
184
+ ### Flow
185
+
186
+ 1. **Determine version:**
187
+ - If provided in `$ARGUMENTS`: use it (auto-prefix `v` if missing)
188
+ - If not provided: ask via AskUserQuestion: "What version number for this milestone? (e.g., v1.0)"
189
+
190
+ 2. **Verify all phases are complete:**
191
+ - Read ROADMAP.md to find milestone phases
192
+ - For each phase, check for VERIFICATION.md
193
+ - If any phase lacks VERIFICATION.md:
194
+
195
+ Present the warning context:
196
+ Unverified phases:
197
+ - Phase {N}: {name}
198
+ - Phase {M}: {name}
199
+
200
+ Use AskUserQuestion (pattern: yes-no from `skills/shared/gate-prompts.md`):
201
+ question: "{count} phases haven't been verified. Continue with milestone completion?"
202
+ header: "Unverified"
203
+ options:
204
+ - label: "Continue anyway" description: "Proceed despite unverified phases (not recommended)"
205
+ - label: "Stop and review" description: "Run /pbr:review for unverified phases first"
206
+ - If "Stop and review" or "Other": stop and suggest the review commands for each unverified phase
207
+ - If "Continue anyway": proceed with warning noted
208
+
209
+ **Timestamp freshness check:**
210
+ For each phase that has a VERIFICATION.md, compare its `checked_at` frontmatter timestamp against the most recent SUMMARY.md file modification date in that phase directory (use `ls -t` or file stats).
211
+ If any SUMMARY.md is newer than its VERIFICATION.md `checked_at`:
212
+ - Warn: "Phase {N} ({name}) was modified after verification. The VERIFICATION.md may not reflect the current code state."
213
+ - List affected phases with their freshness details
214
+
215
+ Use AskUserQuestion (pattern: stale-continue from `skills/shared/gate-prompts.md`):
216
+ question: "{count} phases were modified after verification. Re-verify or continue?"
217
+ header: "Stale"
218
+ options:
219
+ - label: "Re-verify" description: "Run /pbr:review for affected phases (recommended)"
220
+ - label: "Continue anyway" description: "Proceed with potentially outdated verification"
221
+ - If "Re-verify" or "Other": suggest the review commands for affected phases and stop
222
+ - If "Continue anyway": proceed with warning noted
223
+
224
+ 3. **Gather milestone stats:**
225
+
226
+ ```bash
227
+ # Get commit range for this milestone's phases
228
+ git log --oneline --since="{milestone start date}" --until="now"
229
+
230
+ # Count files changed
231
+ git diff --stat {first_milestone_commit}..HEAD
232
+ ```
233
+
234
+ Collect:
235
+ - Total commits in milestone
236
+ - Total files changed
237
+ - Lines added / removed
238
+ - Duration (start date to now)
239
+ - Number of phases completed
240
+ - Number of plans executed
241
+ - Number of quick tasks
242
+
243
+ 4. **Extract accomplishments:**
244
+ Read all SUMMARY.md files for milestone phases:
245
+ - Collect `provides` fields (what was built)
246
+ - Collect `key_decisions` fields
247
+ - Collect `patterns` fields
248
+ - Collect `tech_stack` union
249
+
250
+ 5. **Archive milestone documents:**
251
+
252
+ Copy/create archive files:
253
+ - `.planning/milestones/{version}-ROADMAP.md` — snapshot of ROADMAP.md at completion
254
+ - `.planning/milestones/{version}-REQUIREMENTS.md` — snapshot of REQUIREMENTS.md
255
+ - `.planning/milestones/{version}-STATS.md` — milestone statistics
256
+
257
+ **Stats file content:**
258
+
259
+ Read `skills/milestone/templates/stats-file.md.tmpl` for the stats file format. Fill in all `{variable}` placeholders with actual data gathered in Steps 3-4.
260
+
261
+ 6. **Update PROJECT.md:**
262
+ - Move milestone from "Active" to "Completed"
263
+ - Add completion date and version tag
264
+
265
+ ```markdown
266
+ ## Completed Milestones
267
+
268
+ ### {name} ({version})
269
+ - **Completed:** {date}
270
+ - **Phases:** {start} - {end}
271
+ - **Key deliverables:** {summary}
272
+ ```
273
+
274
+ - Move validated requirements from active to completed section
275
+
276
+ 7. **Collapse completed phases in ROADMAP.md:**
277
+ Replace detailed phase entries with collapsed summaries:
278
+
279
+ ```markdown
280
+ ## Milestone: {name} ({version}) -- COMPLETED
281
+
282
+ Phases {start}-{end} completed on {date}. See `.planning/milestones/{version}-ROADMAP.md` for details.
283
+
284
+ | Phase | Status |
285
+ |-------|--------|
286
+ | {N}. {name} | Completed |
287
+ | {N+1}. {name} | Completed |
288
+ ```
289
+
290
+ 8. **Git tag:**
291
+ ```bash
292
+ git tag -a {version} -m "Milestone: {name}"
293
+ ```
294
+
295
+ 9. **Commit:**
296
+ ```bash
297
+ git add .planning/milestones/ .planning/ROADMAP.md .planning/PROJECT.md .planning/STATE.md
298
+ git commit -m "docs(planning): complete milestone {version}"
299
+ ```
300
+
301
+ 10. **Confirm** with branded output:
302
+ ```
303
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
304
+ PLAN-BUILD-RUN ► MILESTONE COMPLETE 🎉
305
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
306
+
307
+ **{version}**
308
+
309
+ Stats:
310
+ - {count} phases, {count} plans
311
+ - {count} commits, {lines} lines of code
312
+ - {duration} days
313
+
314
+ Archived to: .planning/milestones/{version}-*
315
+ Git tag: {version}
316
+
317
+ ───────────────────────────────────────────────────────────────
318
+
319
+ ## ▶ Next Up
320
+
321
+ **Start the next milestone** — plan new features
322
+
323
+ `/pbr:milestone new`
324
+
325
+ <sub>`/clear` first → fresh context window</sub>
326
+
327
+ ───────────────────────────────────────────────────────────────
328
+
329
+ **Also available:**
330
+ - `/pbr:status` — see project status
331
+ - `/pbr:help` — see all commands
332
+
333
+ ───────────────────────────────────────────────────────────────
334
+ ```
335
+
336
+ ---
337
+
338
+ ## Subcommand: `audit`
339
+
340
+ Verify milestone completion with cross-phase integration checks.
341
+
342
+ ### Flow
343
+
344
+ 1. **Determine target:**
345
+ - If version provided: audit that specific milestone
346
+ - If no version: audit the current milestone (most recent active)
347
+
348
+ 2. **Read all VERIFICATION.md files** for milestone phases:
349
+ - Collect verification results
350
+ - Note any `gaps_found` statuses
351
+ - Note any phases without verification
352
+
353
+ 3. **Spawn integration checker:**
354
+
355
+ Display to the user: `◐ Spawning integration checker...`
356
+
357
+ Spawn `Task(subagent_type: "pbr:integration-checker")` with:
358
+
359
+ ```
360
+ You are integration-checker. Perform cross-phase integration verification.
361
+
362
+ Milestone: {version or "current"}
363
+ Phases to check: {list of phase directories}
364
+
365
+ Instructions:
366
+ 1. Read all SUMMARY.md files for the milestone phases
367
+ 2. Build a dependency graph from provides/affects/requires fields
368
+ 3. Verify integration points:
369
+ a. Every "requires" in a later phase is "provided" by an earlier phase
370
+ b. Every "affects" target still exists and hasn't been broken
371
+ c. No circular dependencies
372
+ d. No orphaned provides (things built but never consumed)
373
+ 4. Check for:
374
+ - Broken imports/references between phases
375
+ - API contract mismatches
376
+ - Missing error handling at integration points
377
+ - Configuration inconsistencies
378
+ 5. Return findings as a structured report
379
+ ```
380
+
381
+ 4. **Check requirements coverage:**
382
+ - Read REQUIREMENTS.md
383
+ - For each requirement tagged for this milestone:
384
+ - Search VERIFICATION.md files for coverage
385
+ - Search SUMMARY.md `provides` fields
386
+ - Flag uncovered requirements
387
+
388
+ 5. **Write audit report:**
389
+
390
+ Create `.planning/{version}-MILESTONE-AUDIT.md` using the template:
391
+
392
+ Read `skills/milestone/templates/audit-report.md.tmpl` for the audit report format. Fill in all `{variable}` placeholders with actual data from the audit.
393
+
394
+ 6. **Report to user** using branded banners:
395
+
396
+ **If PASSED:**
397
+ ```
398
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
399
+ PLAN-BUILD-RUN ► MILESTONE AUDIT PASSED ✓
400
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
401
+
402
+ All phases verified, integration checks passed, requirements covered.
403
+
404
+ ───────────────────────────────────────────────────────────────
405
+
406
+ ## ▶ Next Up
407
+
408
+ **Complete the milestone** — archive and tag
409
+
410
+ `/pbr:milestone complete {version}`
411
+
412
+ <sub>`/clear` first → fresh context window</sub>
413
+
414
+ ───────────────────────────────────────────────────────────────
415
+
416
+ **Also available:**
417
+ - `/pbr:milestone gaps` — address any minor issues first
418
+ - `/pbr:status` — see project status
419
+
420
+ ───────────────────────────────────────────────────────────────
421
+ ```
422
+
423
+ **If GAPS FOUND:**
424
+ ```
425
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
426
+ PLAN-BUILD-RUN ► MILESTONE AUDIT — GAPS FOUND ⚠
427
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
428
+
429
+ Found {count} gaps:
430
+ - {gap 1}
431
+ - {gap 2}
432
+
433
+ ───────────────────────────────────────────────────────────────
434
+
435
+ ## ▶ Next Up
436
+
437
+ **Close the gaps** — create fix phases
438
+
439
+ `/pbr:milestone gaps`
440
+
441
+ <sub>`/clear` first → fresh context window</sub>
442
+
443
+ ───────────────────────────────────────────────────────────────
444
+
445
+ **Also available:**
446
+ - `/pbr:milestone complete` — proceed despite gaps
447
+ - `/pbr:status` — see project status
448
+
449
+ ───────────────────────────────────────────────────────────────
450
+ ```
451
+
452
+ **If TECH DEBT:**
453
+ ```
454
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
455
+ PLAN-BUILD-RUN ► MILESTONE AUDIT — TECH DEBT ⚠
456
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
457
+
458
+ Milestone functional but has {count} tech debt items.
459
+
460
+ ───────────────────────────────────────────────────────────────
461
+
462
+ ## ▶ Next Up
463
+
464
+ **Address tech debt or proceed**
465
+
466
+ `/pbr:milestone gaps` — create cleanup phases
467
+ `/pbr:milestone complete` — proceed as-is
468
+
469
+ <sub>`/clear` first → fresh context window</sub>
470
+
471
+ ───────────────────────────────────────────────────────────────
472
+ ```
473
+
474
+ ---
475
+
476
+ ## Subcommand: `gaps`
477
+
478
+ Create phases to close gaps found during an audit.
479
+
480
+ ### Flow
481
+
482
+ 1. **Find most recent audit:**
483
+ - Search for `*-MILESTONE-AUDIT.md` in `.planning/`
484
+ - If multiple, use the most recent
485
+ - If none: "No audit found. Run `/pbr:milestone audit` first."
486
+
487
+ 2. **Read audit report:**
488
+ - Extract all gaps and tech debt items
489
+ - Parse severity levels
490
+
491
+ 3. **Prioritize gaps:**
492
+
493
+ Group by priority:
494
+ - **Must fix** (critical/high): Blocking issues, broken integration, uncovered requirements
495
+ - **Should fix** (medium): Non-critical integration issues, important tech debt
496
+ - **Nice to fix** (low): Minor tech debt, optimization opportunities
497
+
498
+ 4. **Present to user:**
499
+
500
+ ```
501
+ Gaps from milestone audit:
502
+
503
+ Must fix ({count}):
504
+ - {gap}: {description}
505
+
506
+ Should fix ({count}):
507
+ - {gap}: {description}
508
+
509
+ Nice to fix ({count}):
510
+ - {gap}: {description}
511
+
512
+ Use AskUserQuestion (pattern: multi-option-priority from `skills/shared/gate-prompts.md`):
513
+ question: "Which gaps should we address? ({must_count} must-fix, {should_count} should-fix, {nice_count} nice-to-fix)"
514
+ header: "Priority"
515
+ options:
516
+ - label: "Must-fix only" description: "Address {must_count} critical/high gaps"
517
+ - label: "Must + should" description: "Address {must_count + should_count} critical through medium gaps"
518
+ - label: "Everything" description: "Address all {total_count} gaps including low priority"
519
+ - label: "Let me pick" description: "Choose specific gaps to address"
520
+ - If "Must-fix only": filter to must-fix gaps for phase creation
521
+ - If "Must + should": filter to must-fix + should-fix gaps
522
+ - If "Everything": include all gaps
523
+ - If "Let me pick" or "Other": present individual gaps for selection
524
+
525
+ 5. **Group into logical phases:**
526
+ - Group related gaps together (same subsystem, same files)
527
+ - Each group becomes a phase
528
+ - Name phases descriptively: "{N+1}. Fix {area} integration" or "{N+1}. Address {component} gaps"
529
+
530
+ 6. **Update ROADMAP.md:**
531
+ Add gap-closure phases after the current milestone phases:
532
+
533
+ ```markdown
534
+ ### Phase {N}: Fix {area} (gap closure)
535
+ **Goal:** Address gaps found in milestone audit
536
+ **Gaps addressed:**
537
+ - {gap 1}
538
+ - {gap 2}
539
+ **Success criteria:** All addressed gaps pass verification
540
+ ```
541
+
542
+ 7. **Create phase directories:**
543
+ ```
544
+ .planning/phases/{NN}-fix-{slug}/
545
+ ```
546
+
547
+ 8. **Commit:**
548
+ ```
549
+ docs(planning): add gap-closure phases from milestone audit
550
+ ```
551
+
552
+ 9. **Confirm** with branded output:
553
+ ```
554
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
555
+ PLAN-BUILD-RUN ► GAP PHASES CREATED ✓
556
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
557
+
558
+ Created {count} gap-closure phase(s):
559
+ - Phase {N}: {name}
560
+ - Phase {N+1}: {name}
561
+
562
+ ───────────────────────────────────────────────────────────────
563
+
564
+ ## ▶ Next Up
565
+
566
+ **Plan the first gap-closure phase**
567
+
568
+ `/pbr:plan {N}`
569
+
570
+ <sub>`/clear` first → fresh context window</sub>
571
+
572
+ ───────────────────────────────────────────────────────────────
573
+
574
+ **Also available:**
575
+ - `/pbr:status` — see project status
576
+
577
+ ───────────────────────────────────────────────────────────────
578
+ ```
579
+
580
+ ---
581
+
582
+ ## State Integration
583
+
584
+ All subcommands update STATE.md:
585
+ - `new`: Sets current milestone, resets phase
586
+ - `complete`: Clears current milestone, updates history
587
+ - `audit`: Notes audit status and date
588
+ - `gaps`: Updates phase count and roadmap info
589
+
590
+ ---
591
+
592
+ ## Git Integration
593
+
594
+ Reference: `skills/shared/commit-planning-docs.md` for the standard commit pattern.
595
+
596
+ All subcommands commit if `planning.commit_docs: true`:
597
+ - `new`: `docs(planning): start milestone "{name}" (phases {start}-{end})`
598
+ - `complete`: `docs(planning): complete milestone {version}`
599
+ - `audit`: `docs(planning): audit milestone {version} - {status}`
600
+ - `gaps`: `docs(planning): add gap-closure phases from milestone audit`
601
+
602
+ Tags (complete only):
603
+ - `git tag -a {version} -m "Milestone: {name}"`
604
+
605
+ ---
606
+
607
+ ## Edge Cases
608
+
609
+ ### No ROADMAP.md exists
610
+ - For `new`: Create one from scratch (this is a fresh start)
611
+ - For others, display:
612
+ ```
613
+ ╔══════════════════════════════════════════════════════════════╗
614
+ ║ ERROR ║
615
+ ╚══════════════════════════════════════════════════════════════╝
616
+
617
+ No roadmap found.
618
+
619
+ **To fix:** Run `/pbr:begin` or `/pbr:milestone new` first.
620
+ ```
621
+
622
+ ### Milestone has no phases
623
+ Display:
624
+ ```
625
+ ╔══════════════════════════════════════════════════════════════╗
626
+ ║ ERROR ║
627
+ ╚══════════════════════════════════════════════════════════════╝
628
+
629
+ No phases found for this milestone.
630
+
631
+ **To fix:**
632
+ - For `complete`: Nothing to complete — add phases first.
633
+ - For `audit`: Nothing to audit — build phases first.
634
+ ```
635
+
636
+ ### Audit finds no gaps
637
+ - Status: PASSED
638
+ - Skip the recommendations section
639
+ - Suggest proceeding to complete
640
+
641
+ ### Version already exists (tag collision)
642
+ Display:
643
+ ```
644
+ ╔══════════════════════════════════════════════════════════════╗
645
+ ║ ERROR ║
646
+ ╚══════════════════════════════════════════════════════════════╝
647
+
648
+ Git tag {version} already exists.
649
+
650
+ **To fix:** Use a different version number (e.g., {version}.1).
651
+ ```
652
+ Ask for alternative via AskUserQuestion.
653
+
654
+ ### Partially verified milestone
655
+ - `complete` warns but allows proceeding with user confirmation
656
+ - `audit` treats unverified phases as gaps
657
+
658
+ ### Large milestone (8+ phases)
659
+ - `audit` may take longer due to integration checking
660
+ - Warn: "This milestone has {count} phases. The audit may take a few minutes."
661
+
662
+ ---
663
+
664
+ ## Anti-Patterns
665
+
666
+ 1. **DO NOT** skip the audit before completing — integration issues hide at boundaries
667
+ 2. **DO NOT** auto-complete milestones without user confirmation
668
+ 3. **DO NOT** create gap phases without user approval of priorities
669
+ 4. **DO NOT** delete audit reports — they're historical records
670
+ 5. **DO NOT** reuse version numbers — each milestone gets a unique version
671
+ 6. **DO NOT** modify code during milestone operations — this is project management only
672
+ 7. **DO NOT** collapse phases in ROADMAP.md before archiving — archive first, collapse second
673
+ 8. **DO NOT** skip the git tag — tags make milestone boundaries findable