@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,388 @@
1
+ ---
2
+ name: resume
3
+ description: "Pick up where you left off. Restores context and suggests next action."
4
+ allowed-tools: Read, Write, Glob, Grep, AskUserQuestion
5
+ ---
6
+
7
+ # /pbr:resume — Resume Previous Session
8
+
9
+ You are running the **resume** skill. Your job is to find the last pause point, restore context for the user, and suggest the next action so they can continue seamlessly.
10
+
11
+ This skill runs **inline** (no Task delegation).
12
+
13
+ ---
14
+
15
+ ## Core Principle
16
+
17
+ **Get the user back to work in under 30 seconds.** Read the handoff, show what matters, and suggest the next command. Don't make them re-discover their own project state.
18
+
19
+ ---
20
+
21
+ ## Resumption Priority Hierarchy
22
+
23
+ When resuming, scan for conditions in this priority order. Handle the HIGHEST priority item first:
24
+
25
+ ```
26
+ 1. 🔴 UAT-BLOCKER (diagnosed) → Fix must come first
27
+ 2. 🟡 Interrupted agent → Resume agent from checkpoint
28
+ 3. 🟡 .continue-here checkpoint → Resume from checkpoint
29
+ 4. 🟡 Incomplete plan → Complete plan execution
30
+ 5. 🟢 Phase complete → Transition to next phase
31
+ 6. 🟢 Ready to plan/execute → Normal workflow
32
+ ```
33
+
34
+ ### Scanning for Priority Items
35
+
36
+ Before presenting the standard resume view, check:
37
+
38
+ 1. **UAT Blockers**: Search for VERIFICATION.md files with `status: gaps_found` in any phase. If found and gaps are marked as blocking, surface them first: "Phase {N} has {count} blocking verification gaps. These should be fixed before continuing."
39
+
40
+ 2. **Interrupted Agents**: Check for `.checkpoint-manifest.json` files in phase directories with `checkpoints_pending` entries. These indicate a build was interrupted mid-checkpoint.
41
+
42
+ 3. **Stale .continue-here.md**: If the file references commits that don't exist in git log, warn about state corruption.
43
+
44
+ ### Auto-Reconcile STATE.md Against Filesystem
45
+
46
+ On every resume, reconcile STATE.md claims against filesystem reality. This catches both corruption and drift from interrupted operations.
47
+
48
+ **Step 1: Detect discrepancies** — Compare STATE.md values against the filesystem:
49
+
50
+ | STATE.md Claim | Filesystem Check |
51
+ |----------------|------------------|
52
+ | Phase number | Does `.planning/phases/{NN}-*/` exist? |
53
+ | Plan count | Count `*-PLAN.md` files in the phase directory |
54
+ | Completed plans | Count `SUMMARY.md` files in the phase directory |
55
+ | Status "verified" | Does `VERIFICATION.md` with `status: passed` exist? |
56
+ | Status "building" | Are there PLAN.md files without SUMMARY.md? |
57
+ | Progress percentage | Recalculate from completed phases / total phases |
58
+
59
+ **Step 2: Classify** — If any discrepancy found:
60
+ - **Obvious corruption** (duplicate headers, impossible percentages, phase directory missing): flag as corruption
61
+ - **Stale data** (plan count wrong, status outdated): flag as drift
62
+
63
+ **Step 3: Repair** —
64
+ - For **corruption**: Present repair and ask for confirmation: "STATE.md appears corrupted. Based on the file system, you're at Phase {N} with {M}/{T} plans complete. Should I repair STATE.md?"
65
+ - For **drift**: Auto-repair silently and note: "Updated STATE.md to match filesystem (plan count {old}→{new}, status {old}→{new})."
66
+ - Log all repairs to `.planning/logs/events.jsonl` with category `state-reconcile`
67
+
68
+ ---
69
+
70
+ ## Flow
71
+
72
+ ### Step 1: Read STATE.md
73
+
74
+ Read `.planning/STATE.md` for the last known position.
75
+
76
+ **Extract:**
77
+ - Current phase and plan
78
+ - Session Continuity section (if exists):
79
+ - Last paused date
80
+ - Continue file location
81
+ - Suggested next action
82
+
83
+ **If STATE.md doesn't exist:**
84
+ - Go to **Recovery Flow** (Step 4)
85
+
86
+ ### Step 2: Search for .continue-here.md Files
87
+
88
+ Search for `.continue-here.md` files across all phase directories:
89
+
90
+ ```
91
+ .planning/phases/**/.continue-here.md
92
+ ```
93
+
94
+ **If exactly one found:**
95
+ - This is the resume point. Go to **Normal Resume** (Step 3a).
96
+
97
+ **If multiple found:**
98
+ Use the **pause-point-select** pattern (see `skills/shared/gate-prompts.md`):
99
+
100
+ Use AskUserQuestion:
101
+ question: "Found multiple pause points. Which would you like to resume?"
102
+ header: "Resume"
103
+ options:
104
+ - label: "Phase {A}" description: "Paused {date}, {brief context}"
105
+ - label: "Phase {B}" description: "Paused {date}, {brief context}"
106
+ - label: "Phase {C}" description: "Paused {date}, {brief context}"
107
+ - label: "Phase {D}" description: "Paused {date}, {brief context}"
108
+ multiSelect: false
109
+
110
+ Build options dynamically from discovered `.continue-here.md` files. Include phase name and pause date in each option. If more than 4 pause points exist, show the 4 most recent and replace the last option with:
111
+ - label: "Show earlier" description: "See older pause points"
112
+
113
+ When "Show earlier" is selected, re-prompt with the next batch of 4.
114
+
115
+ Use the selected pause point for the rest of the resume flow.
116
+
117
+ **If none found:**
118
+ - Check STATE.md for position info
119
+ - If STATE.md has position: go to **Inferred Resume** (Step 3b)
120
+ - If STATE.md has no position: go to **Recovery Flow** (Step 4)
121
+
122
+ ### Step 3a: Normal Resume (from .continue-here.md)
123
+
124
+ 1. Read the `.continue-here.md` file completely
125
+ 2. Parse all sections:
126
+ - Position (phase, plan, status)
127
+ - Completed work
128
+ - Remaining work
129
+ - Decisions
130
+ - Blockers
131
+ - Next steps
132
+
133
+ 3. Display the resume context using the branded banner:
134
+
135
+ ```
136
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
137
+ PLAN-BUILD-RUN ► SESSION RESTORED ✓
138
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
139
+
140
+ Resuming session from {pause date}
141
+
142
+ Position: Phase {N} -- {name}
143
+ Plan: {M} of {total}
144
+ Status: {status}
145
+
146
+ Completed last session:
147
+ {bulleted list of completed work}
148
+
149
+ Remaining in this phase:
150
+ {bulleted list of remaining plans}
151
+
152
+ {If decisions were made:}
153
+ Key decisions:
154
+ {bulleted list of decisions}
155
+
156
+ {If blockers exist:}
157
+ Blockers:
158
+ {bulleted list of blockers}
159
+ ```
160
+
161
+ 4. Validate the resume point:
162
+ - Check that the phase directory still exists
163
+ - Check that the plan files mentioned still exist
164
+ - Check git log to verify commits mentioned in completed work
165
+ - If anything is inconsistent, warn: "Some state has changed since the pause. {details}"
166
+
167
+ 5. Present the next action from the continue-here file.
168
+
169
+ **If only one clear next action exists**, present it with branded routing:
170
+ ```
171
+ ───────────────────────────────────────────────────────────────
172
+
173
+ ## ▶ Next Up
174
+
175
+ **{explanation from continue-here}**
176
+
177
+ `{suggested command}`
178
+
179
+ <sub>`/clear` first → fresh context window</sub>
180
+
181
+ ───────────────────────────────────────────────────────────────
182
+ ```
183
+
184
+ **If multiple reasonable actions exist** (e.g., the continue-here suggests one thing but the filesystem state suggests another), use the **action-routing** pattern (see `skills/shared/gate-prompts.md`):
185
+
186
+ Use AskUserQuestion:
187
+ question: "How would you like to proceed?"
188
+ header: "Next Step"
189
+ options:
190
+ - label: "{continue-here suggestion}" description: "Resume from pause point"
191
+ - label: "{filesystem-inferred action}" description: "Based on current state"
192
+ - label: "Show status" description: "Run /pbr:status for full overview"
193
+ - label: "Something else" description: "Enter a different command"
194
+ multiSelect: false
195
+
196
+ **After user selects an option:**
197
+ - Display "Run: `/dev:{action} {args}`" so the user can execute it
198
+ - This skill does not auto-execute — it suggests and the user acts
199
+
200
+ 6. Clean up:
201
+ - **DO NOT** delete the .continue-here.md file yet
202
+ - It will be naturally superseded when the next pause happens
203
+ - Or it can be manually removed after the user confirms they're back on track
204
+
205
+ ### Step 3b: Inferred Resume (from STATE.md only)
206
+
207
+ When there's no .continue-here.md but STATE.md has position info:
208
+
209
+ 1. Read STATE.md position
210
+ 2. Scan the current phase directory for plan and summary files
211
+ 3. Determine what's complete vs. remaining
212
+ 4. Present a reduced resume context:
213
+
214
+ ```
215
+ Resuming from STATE.md (no pause file found)
216
+
217
+ Position: Phase {N} -- {name}
218
+ Progress: {completed}/{total} plans complete
219
+
220
+ {Plans with summaries listed as complete}
221
+ {Plans without summaries listed as remaining}
222
+
223
+ Note: No detailed pause context available. Run `/pbr:status` for a full overview.
224
+ ```
225
+
226
+ 5. Suggest the next action based on phase state using the **action-routing** pattern:
227
+
228
+ Use AskUserQuestion:
229
+ question: "What would you like to do next?"
230
+ header: "Next Step"
231
+ options: (build dynamically from phase state)
232
+ - label: "/pbr:build {N}" description: "Continue building (plans remaining)"
233
+ - label: "/pbr:review {N}" description: "Review completed phase"
234
+ - label: "/pbr:plan {N} --gaps" description: "Fix verification gaps"
235
+ - label: "/pbr:plan {N+1}" description: "Plan the next phase"
236
+ multiSelect: false
237
+
238
+ Show only the options that apply to the current state (1-3 real options + "Something else").
239
+
240
+ ### Step 4: Recovery Flow
241
+
242
+ When neither .continue-here.md nor STATE.md position data exists:
243
+
244
+ 1. Check if `.planning/` directory exists at all
245
+ - If no, display:
246
+ ```
247
+ ╔══════════════════════════════════════════════════════════════╗
248
+ ║ ERROR ║
249
+ ╚══════════════════════════════════════════════════════════════╝
250
+
251
+ No Plan-Build-Run project found.
252
+
253
+ **To fix:** Run `/pbr:begin` to start a new project, or `/pbr:scan` to analyze an existing codebase.
254
+ ```
255
+ - Stop here.
256
+
257
+ 2. If `.planning/` exists, scan for any project state:
258
+ - Check for ROADMAP.md
259
+ - Check for any phase directories
260
+ - Check for any SUMMARY.md files
261
+ - Check for config.json
262
+
263
+ 3. If some state exists:
264
+
265
+ ```
266
+ Found a Plan-Build-Run project but no pause point.
267
+
268
+ Project has:
269
+ - {count} phases in ROADMAP.md
270
+ - {count} phase directories
271
+ - {count} completed plans (SUMMARY.md files)
272
+
273
+ Attempting to determine position...
274
+ ```
275
+
276
+ 4. Infer position:
277
+ - Find the last phase with SUMMARY.md files
278
+ - Check if all plans in that phase have summaries
279
+ - Determine the next action
280
+
281
+ 5. Present recovery status:
282
+
283
+ ```
284
+ Best guess for current position:
285
+
286
+ Phase {N}: {name}
287
+ - {X} of {Y} plans completed
288
+ - Last activity: {date from most recent SUMMARY.md or git log}
289
+
290
+ Suggested: Run `/pbr:status` for a full overview, then choose your next action.
291
+ ```
292
+
293
+ ---
294
+
295
+ ## Resume Routing
296
+
297
+ After displaying context, route to the appropriate action:
298
+
299
+ | Situation | Suggested Action |
300
+ |-----------|-----------------|
301
+ | Mid-phase, plans remaining | `/pbr:build {N}` (executor will skip completed plans) |
302
+ | Phase complete, not reviewed | `/pbr:review {N}` |
303
+ | Phase reviewed, has gaps | `/pbr:plan {N} --gaps` |
304
+ | Phase complete and verified | `/pbr:plan {N+1}` |
305
+ | Between milestones | `/pbr:milestone new` |
306
+ | Active debug session | `/pbr:debug` (will offer to resume) |
307
+ | Pending todos exist | Mention: "Also {count} pending todos. `/pbr:todo list`" |
308
+
309
+ ---
310
+
311
+ ## State Validation
312
+
313
+ When resuming, validate that the project state is consistent:
314
+
315
+ ### Git State Check
316
+
317
+ ```bash
318
+ git status --short
319
+ ```
320
+
321
+ If there are uncommitted changes:
322
+ - Warn: "There are uncommitted changes in the working directory."
323
+ - List the changed files
324
+ - Suggest: "These may be from an interrupted build. Review them before continuing."
325
+
326
+ ### Plan-Summary Consistency
327
+
328
+ For each plan file in the current phase:
329
+ - Check if SUMMARY.md exists
330
+ - If SUMMARY.md exists, check its status field
331
+ - If status is `partial` or `failed`, warn
332
+
333
+ ### Continuation Context Freshness
334
+
335
+ If .continue-here.md is more than 7 days old:
336
+ - Warn: "This pause point is {N} days old. The codebase may have changed."
337
+ - Suggest: "Run `/pbr:status` to verify the current state before continuing."
338
+
339
+ ---
340
+
341
+ ## Edge Cases
342
+
343
+ ### .continue-here.md references deleted files
344
+ - Warn about each missing file
345
+ - Attempt to find equivalent files (renamed, moved)
346
+ - If phase directory is gone: "Phase {N} directory was removed. This pause point is invalid."
347
+ - Suggest `/pbr:status` for recovery
348
+
349
+ ### Git history doesn't match .continue-here.md
350
+ - Commits referenced in the handoff may have been rebased, amended, or rolled back
351
+ - Warn: "Some commits referenced in the pause file couldn't be found in git history."
352
+ - Don't treat this as fatal — the file system state matters more than commit hashes
353
+
354
+ ### User made changes between sessions (outside Plan-Build-Run)
355
+ - The user may have manually edited files, committed changes, or modified configs
356
+ - These changes won't be reflected in .continue-here.md
357
+ - Check git log for commits not referenced in the handoff
358
+ - If found: "Found {N} commits since the last pause that aren't tracked in the handoff."
359
+
360
+ ### Multiple users / branches
361
+ - If git branch has changed since the pause:
362
+ - Warn: "You're on branch `{current}` but the pause was on `{paused-branch}`."
363
+ - Suggest switching branches or starting fresh
364
+
365
+ ### Empty project (just initialized)
366
+ - If `.planning/` exists but only has config.json, display:
367
+ ```
368
+ ╔══════════════════════════════════════════════════════════════╗
369
+ ║ ERROR ║
370
+ ╚══════════════════════════════════════════════════════════════╝
371
+
372
+ Project was initialized but no work has been done.
373
+
374
+ **To fix:** Run `/pbr:plan 1` to start planning, or `/pbr:discuss 1` to talk through the first phase.
375
+ ```
376
+
377
+ ---
378
+
379
+ ## Anti-Patterns
380
+
381
+ 1. **DO NOT** auto-execute the suggested next action — just suggest it
382
+ 2. **DO NOT** delete .continue-here.md during resume — let the next pause overwrite it
383
+ 3. **DO NOT** modify any project files — resume is read-only (except cleaning up stale state)
384
+ 4. **DO NOT** assume .continue-here.md is accurate — always validate against the file system
385
+ 5. **DO NOT** show overwhelming amounts of detail — focus on actionable information
386
+ 6. **DO NOT** ignore inconsistencies — surface them as warnings
387
+ 7. **DO NOT** skip the git state check — uncommitted changes are important to surface
388
+ 8. **DO NOT** suggest multiple actions without clear priority — one primary suggestion