@sienklogic/plan-build-run 2.0.0 → 2.0.1

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 (225) hide show
  1. package/CHANGELOG.md +56 -56
  2. package/CLAUDE.md +149 -149
  3. package/LICENSE +21 -21
  4. package/README.md +247 -247
  5. package/dashboard/bin/cli.js +25 -25
  6. package/dashboard/package.json +34 -34
  7. package/dashboard/public/css/layout.css +406 -406
  8. package/dashboard/public/css/status-colors.css +98 -98
  9. package/dashboard/public/js/htmx-title.js +5 -5
  10. package/dashboard/public/js/sidebar-toggle.js +20 -20
  11. package/dashboard/src/app.js +78 -78
  12. package/dashboard/src/middleware/errorHandler.js +52 -52
  13. package/dashboard/src/middleware/notFoundHandler.js +9 -9
  14. package/dashboard/src/repositories/planning.repository.js +128 -128
  15. package/dashboard/src/routes/events.routes.js +40 -40
  16. package/dashboard/src/routes/index.routes.js +31 -31
  17. package/dashboard/src/routes/pages.routes.js +245 -195
  18. package/dashboard/src/server.js +42 -42
  19. package/dashboard/src/services/dashboard.service.js +222 -222
  20. package/dashboard/src/services/phase.service.js +220 -167
  21. package/dashboard/src/services/project.service.js +57 -57
  22. package/dashboard/src/services/roadmap.service.js +171 -171
  23. package/dashboard/src/services/sse.service.js +58 -58
  24. package/dashboard/src/services/todo.service.js +254 -254
  25. package/dashboard/src/services/watcher.service.js +48 -48
  26. package/dashboard/src/views/coming-soon.ejs +11 -11
  27. package/dashboard/src/views/error.ejs +13 -13
  28. package/dashboard/src/views/index.ejs +5 -5
  29. package/dashboard/src/views/layout.ejs +1 -1
  30. package/dashboard/src/views/partials/dashboard-content.ejs +77 -77
  31. package/dashboard/src/views/partials/footer.ejs +3 -3
  32. package/dashboard/src/views/partials/head.ejs +21 -21
  33. package/dashboard/src/views/partials/header.ejs +12 -12
  34. package/dashboard/src/views/partials/layout-bottom.ejs +15 -15
  35. package/dashboard/src/views/partials/layout-top.ejs +8 -8
  36. package/dashboard/src/views/partials/phase-content.ejs +188 -181
  37. package/dashboard/src/views/partials/phase-doc-content.ejs +38 -0
  38. package/dashboard/src/views/partials/phases-content.ejs +117 -117
  39. package/dashboard/src/views/partials/roadmap-content.ejs +142 -142
  40. package/dashboard/src/views/partials/sidebar.ejs +38 -38
  41. package/dashboard/src/views/partials/todo-create-content.ejs +53 -53
  42. package/dashboard/src/views/partials/todo-detail-content.ejs +38 -38
  43. package/dashboard/src/views/partials/todos-content.ejs +53 -53
  44. package/dashboard/src/views/phase-detail.ejs +5 -5
  45. package/dashboard/src/views/phase-doc.ejs +5 -0
  46. package/dashboard/src/views/phases.ejs +5 -5
  47. package/dashboard/src/views/roadmap.ejs +5 -5
  48. package/dashboard/src/views/todo-create.ejs +5 -5
  49. package/dashboard/src/views/todo-detail.ejs +5 -5
  50. package/dashboard/src/views/todos.ejs +5 -5
  51. package/package.json +57 -57
  52. package/plugins/pbr/.claude-plugin/plugin.json +13 -13
  53. package/plugins/pbr/UI-CONSISTENCY-GAPS.md +61 -61
  54. package/plugins/pbr/agents/codebase-mapper.md +279 -271
  55. package/plugins/pbr/agents/debugger.md +281 -281
  56. package/plugins/pbr/agents/executor.md +428 -407
  57. package/plugins/pbr/agents/general.md +164 -164
  58. package/plugins/pbr/agents/integration-checker.md +169 -141
  59. package/plugins/pbr/agents/plan-checker.md +296 -280
  60. package/plugins/pbr/agents/planner.md +358 -358
  61. package/plugins/pbr/agents/researcher.md +363 -363
  62. package/plugins/pbr/agents/synthesizer.md +230 -230
  63. package/plugins/pbr/agents/verifier.md +489 -454
  64. package/plugins/pbr/commands/begin.md +5 -5
  65. package/plugins/pbr/commands/build.md +5 -5
  66. package/plugins/pbr/commands/config.md +5 -5
  67. package/plugins/pbr/commands/continue.md +5 -5
  68. package/plugins/pbr/commands/debug.md +5 -5
  69. package/plugins/pbr/commands/discuss.md +5 -5
  70. package/plugins/pbr/commands/explore.md +5 -5
  71. package/plugins/pbr/commands/health.md +5 -5
  72. package/plugins/pbr/commands/help.md +5 -5
  73. package/plugins/pbr/commands/import.md +5 -5
  74. package/plugins/pbr/commands/milestone.md +5 -5
  75. package/plugins/pbr/commands/note.md +5 -5
  76. package/plugins/pbr/commands/pause.md +5 -5
  77. package/plugins/pbr/commands/plan.md +5 -5
  78. package/plugins/pbr/commands/quick.md +5 -5
  79. package/plugins/pbr/commands/resume.md +5 -5
  80. package/plugins/pbr/commands/review.md +5 -5
  81. package/plugins/pbr/commands/scan.md +5 -5
  82. package/plugins/pbr/commands/setup.md +5 -5
  83. package/plugins/pbr/commands/status.md +5 -5
  84. package/plugins/pbr/commands/todo.md +5 -5
  85. package/plugins/pbr/contexts/dev.md +27 -27
  86. package/plugins/pbr/contexts/research.md +28 -28
  87. package/plugins/pbr/contexts/review.md +36 -36
  88. package/plugins/pbr/hooks/hooks.json +183 -183
  89. package/plugins/pbr/references/agent-anti-patterns.md +24 -24
  90. package/plugins/pbr/references/agent-interactions.md +134 -134
  91. package/plugins/pbr/references/agent-teams.md +54 -54
  92. package/plugins/pbr/references/checkpoints.md +157 -157
  93. package/plugins/pbr/references/common-bug-patterns.md +13 -13
  94. package/plugins/pbr/references/config-reference.md +441 -0
  95. package/plugins/pbr/references/continuation-format.md +212 -212
  96. package/plugins/pbr/references/deviation-rules.md +112 -112
  97. package/plugins/pbr/references/git-integration.md +226 -226
  98. package/plugins/pbr/references/integration-patterns.md +117 -117
  99. package/plugins/pbr/references/model-profiles.md +99 -99
  100. package/plugins/pbr/references/model-selection.md +31 -31
  101. package/plugins/pbr/references/pbr-rules.md +193 -193
  102. package/plugins/pbr/references/plan-authoring.md +181 -181
  103. package/plugins/pbr/references/plan-format.md +287 -283
  104. package/plugins/pbr/references/planning-config.md +213 -213
  105. package/plugins/pbr/references/questioning.md +214 -214
  106. package/plugins/pbr/references/reading-verification.md +127 -127
  107. package/plugins/pbr/references/stub-patterns.md +160 -160
  108. package/plugins/pbr/references/subagent-coordination.md +119 -119
  109. package/plugins/pbr/references/ui-formatting.md +461 -399
  110. package/plugins/pbr/references/verification-patterns.md +198 -198
  111. package/plugins/pbr/references/wave-execution.md +95 -95
  112. package/plugins/pbr/scripts/auto-continue.js +80 -80
  113. package/plugins/pbr/scripts/check-dangerous-commands.js +136 -136
  114. package/plugins/pbr/scripts/check-doc-sprawl.js +102 -102
  115. package/plugins/pbr/scripts/check-phase-boundary.js +196 -196
  116. package/plugins/pbr/scripts/check-plan-format.js +270 -270
  117. package/plugins/pbr/scripts/check-roadmap-sync.js +322 -252
  118. package/plugins/pbr/scripts/check-skill-workflow.js +262 -262
  119. package/plugins/pbr/scripts/check-state-sync.js +476 -476
  120. package/plugins/pbr/scripts/check-subagent-output.js +144 -144
  121. package/plugins/pbr/scripts/config-schema.json +251 -251
  122. package/plugins/pbr/scripts/context-budget-check.js +287 -287
  123. package/plugins/pbr/scripts/event-handler.js +151 -151
  124. package/plugins/pbr/scripts/event-logger.js +92 -92
  125. package/plugins/pbr/scripts/hook-logger.js +80 -76
  126. package/plugins/pbr/scripts/hooks-schema.json +79 -79
  127. package/plugins/pbr/scripts/log-subagent.js +164 -152
  128. package/plugins/pbr/scripts/log-tool-failure.js +88 -88
  129. package/plugins/pbr/scripts/pbr-tools.js +1378 -1301
  130. package/plugins/pbr/scripts/post-write-dispatch.js +66 -66
  131. package/plugins/pbr/scripts/post-write-quality.js +207 -207
  132. package/plugins/pbr/scripts/pre-bash-dispatch.js +86 -56
  133. package/plugins/pbr/scripts/pre-write-dispatch.js +97 -62
  134. package/plugins/pbr/scripts/progress-tracker.js +281 -228
  135. package/plugins/pbr/scripts/run-hook.js +92 -0
  136. package/plugins/pbr/scripts/session-cleanup.js +254 -254
  137. package/plugins/pbr/scripts/status-line.js +288 -285
  138. package/plugins/pbr/scripts/suggest-compact.js +119 -119
  139. package/plugins/pbr/scripts/task-completed.js +45 -45
  140. package/plugins/pbr/scripts/track-context-budget.js +149 -119
  141. package/plugins/pbr/scripts/validate-commit.js +200 -200
  142. package/plugins/pbr/scripts/validate-plugin-structure.js +183 -172
  143. package/plugins/pbr/scripts/validate-task.js +106 -0
  144. package/plugins/pbr/skills/begin/SKILL.md +594 -545
  145. package/plugins/pbr/skills/begin/templates/PROJECT.md.tmpl +33 -33
  146. package/plugins/pbr/skills/begin/templates/REQUIREMENTS.md.tmpl +18 -18
  147. package/plugins/pbr/skills/begin/templates/STATE.md.tmpl +49 -49
  148. package/plugins/pbr/skills/begin/templates/config.json.tmpl +64 -63
  149. package/plugins/pbr/skills/begin/templates/researcher-prompt.md.tmpl +19 -19
  150. package/plugins/pbr/skills/begin/templates/roadmap-prompt.md.tmpl +30 -30
  151. package/plugins/pbr/skills/begin/templates/synthesis-prompt.md.tmpl +16 -16
  152. package/plugins/pbr/skills/build/SKILL.md +943 -962
  153. package/plugins/pbr/skills/config/SKILL.md +256 -241
  154. package/plugins/pbr/skills/continue/SKILL.md +164 -127
  155. package/plugins/pbr/skills/debug/SKILL.md +515 -489
  156. package/plugins/pbr/skills/debug/templates/continuation-prompt.md.tmpl +16 -16
  157. package/plugins/pbr/skills/debug/templates/initial-investigation-prompt.md.tmpl +27 -27
  158. package/plugins/pbr/skills/discuss/SKILL.md +347 -338
  159. package/plugins/pbr/skills/discuss/templates/CONTEXT.md.tmpl +61 -61
  160. package/plugins/pbr/skills/discuss/templates/decision-categories.md +9 -9
  161. package/plugins/pbr/skills/explore/SKILL.md +378 -362
  162. package/plugins/pbr/skills/health/SKILL.md +221 -186
  163. package/plugins/pbr/skills/health/templates/check-pattern.md.tmpl +30 -30
  164. package/plugins/pbr/skills/health/templates/output-format.md.tmpl +63 -63
  165. package/plugins/pbr/skills/help/SKILL.md +155 -140
  166. package/plugins/pbr/skills/import/SKILL.md +504 -490
  167. package/plugins/pbr/skills/milestone/SKILL.md +704 -673
  168. package/plugins/pbr/skills/milestone/templates/audit-report.md.tmpl +48 -48
  169. package/plugins/pbr/skills/milestone/templates/stats-file.md.tmpl +30 -30
  170. package/plugins/pbr/skills/note/SKILL.md +231 -212
  171. package/plugins/pbr/skills/pause/SKILL.md +249 -235
  172. package/plugins/pbr/skills/pause/templates/continue-here.md.tmpl +71 -71
  173. package/plugins/pbr/skills/plan/SKILL.md +685 -628
  174. package/plugins/pbr/skills/plan/decimal-phase-calc.md +98 -98
  175. package/plugins/pbr/skills/plan/templates/checker-prompt.md.tmpl +21 -21
  176. package/plugins/pbr/skills/plan/templates/gap-closure-prompt.md.tmpl +32 -32
  177. package/plugins/pbr/skills/plan/templates/planner-prompt.md.tmpl +38 -38
  178. package/plugins/pbr/skills/plan/templates/researcher-prompt.md.tmpl +19 -19
  179. package/plugins/pbr/skills/plan/templates/revision-prompt.md.tmpl +23 -23
  180. package/plugins/pbr/skills/quick/SKILL.md +354 -335
  181. package/plugins/pbr/skills/resume/SKILL.md +402 -388
  182. package/plugins/pbr/skills/review/SKILL.md +686 -652
  183. package/plugins/pbr/skills/review/templates/debugger-prompt.md.tmpl +60 -60
  184. package/plugins/pbr/skills/review/templates/gap-planner-prompt.md.tmpl +40 -40
  185. package/plugins/pbr/skills/review/templates/verifier-prompt.md.tmpl +115 -115
  186. package/plugins/pbr/skills/scan/SKILL.md +304 -269
  187. package/plugins/pbr/skills/scan/templates/mapper-prompt.md.tmpl +201 -201
  188. package/plugins/pbr/skills/setup/SKILL.md +253 -227
  189. package/plugins/pbr/skills/shared/commit-planning-docs.md +35 -35
  190. package/plugins/pbr/skills/shared/config-loading.md +102 -102
  191. package/plugins/pbr/skills/shared/context-budget.md +40 -40
  192. package/plugins/pbr/skills/shared/context-loader-task.md +86 -86
  193. package/plugins/pbr/skills/shared/digest-select.md +79 -79
  194. package/plugins/pbr/skills/shared/domain-probes.md +125 -125
  195. package/plugins/pbr/skills/shared/error-reporting.md +79 -79
  196. package/plugins/pbr/skills/shared/gate-prompts.md +388 -388
  197. package/plugins/pbr/skills/shared/phase-argument-parsing.md +45 -45
  198. package/plugins/pbr/skills/shared/progress-display.md +53 -53
  199. package/plugins/pbr/skills/shared/revision-loop.md +81 -81
  200. package/plugins/pbr/skills/shared/state-loading.md +62 -62
  201. package/plugins/pbr/skills/shared/state-update.md +161 -161
  202. package/plugins/pbr/skills/shared/universal-anti-patterns.md +33 -33
  203. package/plugins/pbr/skills/status/SKILL.md +367 -353
  204. package/plugins/pbr/skills/todo/SKILL.md +198 -181
  205. package/plugins/pbr/templates/CONTEXT.md.tmpl +52 -52
  206. package/plugins/pbr/templates/INTEGRATION-REPORT.md.tmpl +151 -151
  207. package/plugins/pbr/templates/RESEARCH-SUMMARY.md.tmpl +97 -97
  208. package/plugins/pbr/templates/ROADMAP.md.tmpl +40 -40
  209. package/plugins/pbr/templates/SUMMARY.md.tmpl +81 -81
  210. package/plugins/pbr/templates/VERIFICATION-DETAIL.md.tmpl +116 -116
  211. package/plugins/pbr/templates/codebase/ARCHITECTURE.md.tmpl +98 -98
  212. package/plugins/pbr/templates/codebase/CONCERNS.md.tmpl +93 -93
  213. package/plugins/pbr/templates/codebase/CONVENTIONS.md.tmpl +104 -104
  214. package/plugins/pbr/templates/codebase/INTEGRATIONS.md.tmpl +78 -78
  215. package/plugins/pbr/templates/codebase/STACK.md.tmpl +78 -78
  216. package/plugins/pbr/templates/codebase/STRUCTURE.md.tmpl +80 -80
  217. package/plugins/pbr/templates/codebase/TESTING.md.tmpl +107 -107
  218. package/plugins/pbr/templates/continue-here.md.tmpl +73 -73
  219. package/plugins/pbr/templates/prompt-partials/phase-project-context.md.tmpl +37 -37
  220. package/plugins/pbr/templates/research/ARCHITECTURE.md.tmpl +124 -124
  221. package/plugins/pbr/templates/research/STACK.md.tmpl +71 -71
  222. package/plugins/pbr/templates/research/SUMMARY.md.tmpl +112 -112
  223. package/plugins/pbr/templates/research-outputs/phase-research.md.tmpl +81 -81
  224. package/plugins/pbr/templates/research-outputs/project-research.md.tmpl +99 -99
  225. package/plugins/pbr/templates/research-outputs/synthesis.md.tmpl +36 -36
@@ -1,490 +1,504 @@
1
- ---
2
- name: import
3
- description: "Import external plans. Validates context, detects conflicts, generates PLAN.md."
4
- allowed-tools: Read, Write, Bash, Glob, Grep, Task, AskUserQuestion
5
- argument-hint: "<phase-number> [--from <filepath>] [--skip-checker]"
6
- ---
7
-
8
- # /pbr:import Plan Import
9
-
10
- You are the orchestrator for `/pbr:import`. This skill imports an external plan document (design doc, RFC, AI-generated plan, etc.) into the Plan-Build-Run planning format. It validates the imported document against project context, detects conflicts with locked decisions and existing architecture, and generates properly formatted PLAN.md files. Your job is to stay lean, do conflict detection inline, and delegate only the plan checker to a Task() subagent.
11
-
12
- ## Context Budget
13
-
14
- Reference: `skills/shared/context-budget.md` for the universal orchestrator rules.
15
-
16
- Additionally for this skill:
17
- - **Minimize** reading subagent output — read only verdicts, not full reports
18
-
19
- ## Prerequisites
20
-
21
- - `.planning/config.json` exists (run `/pbr:begin` first)
22
- - `.planning/ROADMAP.md` exists with at least one phase
23
- - `.planning/REQUIREMENTS.md` exists
24
-
25
- ---
26
-
27
- ## Orchestration Flow
28
-
29
- Execute these steps in order.
30
-
31
- ---
32
-
33
- ### Step 1: Parse and Validate (inline)
34
-
35
- Reference: `skills/shared/config-loading.md` for the tooling shortcut and config field reference.
36
-
37
- 1. Parse `$ARGUMENTS` for phase number
38
- 2. Parse optional `--from <filepath>` flag (path to the external document to import)
39
- 3. Parse optional `--skip-checker` flag (skip plan validation step)
40
- 4. Validate:
41
- - Phase exists in ROADMAP.md
42
- - Phase directory exists at `.planning/phases/{NN}-{slug}/`
43
- 5. If no phase number given, read current phase from `.planning/STATE.md`
44
- 6. Check for existing plans in the phase directory (glob for `*-PLAN.md`)
45
- - If plans exist: ask user via AskUserQuestion: "Phase {N} already has plans. Replace them with imported plans?"
46
- - If yes: note that existing plans will be overwritten in Step 7
47
- - If no: stop
48
-
49
- ---
50
-
51
- ### Step 2: Load Full Project Context (inline)
52
-
53
- Read all relevant context files. This context is used for conflict detection in Step 4.
54
-
55
- ```
56
- 1. ROADMAP.md extract current phase goal, dependencies, requirements, success criteria
57
- 2. REQUIREMENTS.md extract REQ-IDs mapped to this phase
58
- 3. CONTEXT.md (project-level, if exists) extract locked decisions, deferred ideas, constraints
59
- 4. Phase CONTEXT.md (if exists at .planning/phases/{NN}-{slug}/CONTEXT.md) phase-specific locked decisions from /pbr:discuss
60
- 5. config.json extract feature flags, depth, model settings
61
- 6. Prior SUMMARY.md files — use digest-select depth per `skills/shared/digest-select.md` (direct deps: full body for conflict detection, transitive: frontmatter only, 2+ back: skip)
62
- 7. Research SUMMARY.md (if exists at .planning/research/SUMMARY.md)
63
- 8. Seeds — glob .planning/seeds/*.md, check trigger field for matches:
64
- - trigger equals the phase slug
65
- - trigger is a substring of the phase directory name
66
- - trigger equals the phase number as integer
67
- - trigger equals * (always matches)
68
- 9. Pending todos — scan .planning/todos/pending/ for items related to this phase
69
- 10. NOTES.md (if exists at .planning/NOTES.md) — check for related notes
70
- ```
71
-
72
- Collect all of this into a context bundle for use in Steps 4 and 5.
73
-
74
- ---
75
-
76
- ### Step 3: Read and Parse Imported Document (inline)
77
-
78
- **If `--from <filepath>` was provided:**
79
- - Read the file at the specified path
80
- - If the file does not exist: "File not found: {filepath}. Check the path and try again."
81
-
82
- **If no `--from` flag:**
83
- - Use AskUserQuestion to ask the user: "No --from path specified. Please describe or paste the plan you want to import."
84
- - Accept the user's response as the imported document
85
-
86
- **Parse the document into structured sections:**
87
- 1. Identify phases, steps, tasks, or sections in the document
88
- 2. Extract: scope, approach, files to create/modify, dependencies between steps, verification steps
89
- 3. Note the document's assumptions about tech stack, architecture, and project state
90
- 4. If the document is unstructured prose: extract actionable items and group them by subsystem
91
-
92
- ---
93
-
94
- ### Step 4: Conflict Detection (inline CRITICAL)
95
-
96
- Compare the imported plan against ALL loaded context from Step 2.
97
-
98
- <format_rules>
99
- HARD REQUIREMENTS FOR THIS STEP — violations are bugs:
100
-
101
- 1. Run ALL checks below (BLOCKER + WARNING + INFO) before presenting anything.
102
- 2. Use ONLY these three labels: `[BLOCKER]`, `[WARNING]`, `[INFO]`. Never CRITICAL, HIGH, MEDIUM, LOW, or any other label.
103
- 3. DO NOT use markdown tables for findings. Use the plain-text format shown below.
104
- 4. Present one consolidated "Conflict Detection Report" with three sections.
105
- 5. After the report, use AskUserQuestion if blockers exist.
106
-
107
- WRONG (never do this):
108
- | Area | Import | Project | Severity |
109
- |------|--------|---------|----------|
110
- | Framework | Fastify | Express | CRITICAL |
111
-
112
- RIGHT (always do this):
113
- [BLOCKER] Framework mismatch
114
- Found: Plan uses Fastify with @fastify/view
115
- Expected: Express 5.x (locked decision in CONTEXT.md)
116
- Replace Fastify with Express 5.x
117
- </format_rules>
118
-
119
- #### BLOCKER checks (must resolve before continuing):
120
- Run each of these checks. If any matches, record a `[BLOCKER]`:
121
-
122
- 1. **Locked decision conflict**: Does the plan contradict ANY locked decision in CONTEXT.md or phase CONTEXT.md? Check every locked decision row against the plan's tech choices, libraries, frameworks, and architecture.
123
- 2. **Deferred idea implementation**: Does the plan implement something explicitly listed in CONTEXT.md's "Deferred Ideas" section?
124
- 3. **Missing dependency phase**: Does the plan depend on a phase that does not exist in ROADMAP.md?
125
- 4. **Incomplete dependency phase**: Does the plan depend on a phase that is not complete (no SUMMARY.md with status: complete)?
126
- 5. **Architecture mismatch**: Do files referenced in the plan already exist with different architecture than the plan assumes?
127
- 6. **Tech stack mismatch**: Does the plan assume a library or framework not used by the project? Cross-check against config.json, prior SUMMARYs, RESEARCH.md files, and the codebase.
128
-
129
- #### WARNING checks (user should review):
130
- Run each of these checks. If any matches, record a `[WARNING]`:
131
-
132
- 1. **Requirement coverage gap**: Does the plan fail to cover all phase requirements from REQUIREMENTS.md? List each missing REQ-ID explicitly. This is mandatory — you must cross-reference every REQ-ID assigned to this phase against the plan's tasks.
133
- 2. **Task count exceeds limit**: Does any logical grouping in the plan contain more than 3 tasks? Plan-Build-Run plans are limited to 2-3 tasks each. Count the tasks in the imported document and flag if over 3.
134
- 3. **Scope exceeds file limit**: Does any logical grouping reference more than 8 files? Plan-Build-Run plans are limited to 5-8 files each.
135
- 4. **Stale dependencies**: Does the plan assume prior phase output that has changed since the plan was written?
136
- 5. **Todo overlap**: Does the plan scope overlap with a pending todo in `.planning/todos/pending/`?
137
- 6. **Naming convention mismatch**: Does the plan create files in unexpected locations that don't follow conventions from prior phases? Check directory structure patterns (e.g., routes/, services/, repositories/ vs components/, controllers/).
138
- 7. **Dependency ordering conflict**: Does the plan's task ordering conflict with the dependency graph implied by file dependencies?
139
-
140
- #### INFO checks (supplementary context):
141
- Run each of these checks. If any matches, record an `[INFO]`:
142
-
143
- 1. **Related notes**: Are there related notes in NOTES.md?
144
- 2. **Matching seeds**: Are there matching seeds in `.planning/seeds/` that could enhance the plan?
145
- 3. **Prior phase patterns**: What patterns from prior phases (from SUMMARY.md `patterns` fields) should the imported plan follow?
146
-
147
- #### Output format (MANDATORY do not deviate)
148
-
149
- Present ALL findings in a single report using this EXACT plain-text format. NEVER use markdown tables. NEVER change the labels. NEVER skip a section even if it has 0 findings:
150
-
151
- ```
152
- ## Conflict Detection Report
153
-
154
- ### BLOCKERS ({count})
155
-
156
- [BLOCKER] {Short title}
157
- Found: {what the imported plan says or does}
158
- Expected: {what the project context requires}
159
- {Specific action to resolve}
160
-
161
- [BLOCKER] {Short title}
162
- Found: ...
163
- Expected: ...
164
- → ...
165
-
166
- ### WARNINGS ({count})
167
-
168
- [WARNING] {Short title}
169
- Found: {what was detected}
170
- Impact: {what could go wrong if not addressed}
171
- {Suggested action}
172
-
173
- ### INFO ({count})
174
-
175
- [INFO] {Short title}
176
- Note: {relevant information or suggestion}
177
- ```
178
-
179
- #### After presenting the report
180
-
181
- **IMPORTANT: Always present ALL findings (blockers + warnings + info) together in one report before taking any action.**
182
-
183
- - If any BLOCKERS exist: after the report, ask user to resolve EACH blocker via AskUserQuestion. Do not proceed to Step 5 until all blockers are resolved or the user explicitly chooses to override.
184
- - If only WARNINGS and INFO: after the report, ask user: "Acknowledge these findings and continue with conversion?" via AskUserQuestion. If yes, continue. If no, discuss adjustments.
185
- - If no findings: "No conflicts detected. Proceeding with conversion."
186
-
187
- ---
188
-
189
- ### Step 5: Convert to PLAN.md Format (inline)
190
-
191
- Using the imported document (adjusted for any blocker resolutions from Step 4) and the loaded project context, generate PLAN.md content.
192
-
193
- **YAML frontmatter ALL required fields:**
194
- ```yaml
195
- ---
196
- phase: "{NN}-{slug}"
197
- plan: "{phase}-{plan_num}"
198
- type: "{task type: feature, refactor, config, test, docs}"
199
- wave: {wave number 1 for independent plans, 2+ for dependent plans}
200
- depends_on: [{list of plan IDs this plan depends on}]
201
- files_modified: [{list of files this plan creates or modifies}]
202
- autonomous: {true if no checkpoints needed, false if human input required}
203
- discovery:
204
- approach: "{brief description of what this plan accomplishes}"
205
- open_questions: [{any unresolved questions from the import}]
206
- must_haves:
207
- truths: [{core invariants this plan must satisfy}]
208
- artifacts: [{files that must exist after execution}]
209
- key_links: [{connections to other parts of the system}]
210
- provides: [{what downstream plans can depend on from this plan}]
211
- gap_closure: {false for standard plans, true if closing gaps}
212
- ---
213
- ```
214
-
215
- **Task XML for each task in the plan:**
216
- ```xml
217
- <task id="{plan_id}-T{N}">
218
- <name>{Imperative task name}</name>
219
- <files>{comma-separated list of files this task touches}</files>
220
- <action>
221
- {Step-by-step implementation instructions specific enough for an executor agent to follow mechanically.}
222
- {Include exact file paths, function signatures, import statements.}
223
- </action>
224
- <verify>
225
- {Concrete verification commands: test commands, grep checks, build commands.}
226
- {Each verify step must be runnable from the command line.}
227
- </verify>
228
- <done>{One-sentence definition of done for this task.}</done>
229
- </task>
230
- ```
231
-
232
- **Scope rules:**
233
- - 2-3 tasks per plan, 5-8 files per plan maximum
234
- - If the imported document is too large for a single plan: split by subsystem into multiple plans with wave ordering
235
- - If the imported document is vague on specifics: fill in details from the codebase (function signatures, file paths, import patterns) and flag inferences with HTML comments: `<!-- inferred from codebase: ... -->`
236
-
237
- **Wave assignment:**
238
- - Plans with no inter-dependencies: wave 1 (can run in parallel)
239
- - Plans that depend on wave 1 outputs: wave 2
240
- - Continue numbering for deeper dependency chains
241
-
242
- ---
243
-
244
- ### Step 6: Plan Checker (delegated, unless --skip-checker)
245
-
246
- **Skip this step if:**
247
- - `--skip-checker` flag is set
248
- - `features.plan_checking` is `false` in config
249
-
250
- **If validation is enabled:**
251
-
252
- Display to the user: `◐ Spawning plan checker...`
253
-
254
- Spawn the plan checker Task():
255
-
256
- ```
257
- Task({
258
- subagent_type: "pbr:plan-checker",
259
- prompt: <checker prompt>
260
- })
261
-
262
- NOTE: The pbr:plan-checker subagent type auto-loads the agent definition. Do NOT inline it.
263
- ```
264
-
265
- **Checker Prompt Template:**
266
- ```
267
- You are the plan-checker agent.
268
-
269
- <plans_to_check>
270
- {For each generated PLAN.md:}
271
- --- Plan File: {filename} ---
272
- [Inline the FULL content of each plan file]
273
- --- End Plan File ---
274
- </plans_to_check>
275
-
276
- <phase_context>
277
- Phase goal: {goal from roadmap}
278
- Phase requirements: {REQ-IDs}
279
- </phase_context>
280
-
281
- <context>
282
- {Inline .planning/CONTEXT.md if it exists — project-level locked decisions}
283
- {Inline .planning/phases/{NN}-{slug}/CONTEXT.md if it exists — phase-level locked decisions}
284
- </context>
285
-
286
- <import_note>
287
- These plans were imported from an external document, not generated by the standard planner.
288
- Pay extra attention to:
289
- - Consistency with project conventions
290
- - Completeness of verify steps
291
- - Accuracy of files_modified lists
292
- - Whether task actions are specific enough for mechanical execution
293
- </import_note>
294
-
295
- Run all verification dimensions on these plans. Return your structured report.
296
- Do NOT write any files. Return your findings as your response text.
297
- ```
298
-
299
- **Process checker results — revision loop:**
300
-
301
- Reference: `skills/shared/revision-loop.md` for the full Check-Revise-Escalate pattern (max 3 iterations).
302
-
303
- Follow the revision loop with:
304
- - **Producer**: orchestrator (inline plan revision)
305
- - **Checker**: plan-checker (re-run Step 6)
306
- - **Escalation**: present issues to user, offer "Proceed anyway" or "Adjust approach" (re-enter Step 5)
307
-
308
- ---
309
-
310
- ### Step 7: Write PLAN.md Files (inline)
311
-
312
- Write each plan to `.planning/phases/{NN}-{slug}/{phase}-{plan_num}-PLAN.md`.
313
-
314
- If existing plans are being replaced (user confirmed in Step 1):
315
- - Delete existing `*-PLAN.md` files in the phase directory before writing new ones
316
-
317
- ---
318
-
319
- ### Step 8: Update All State (inline)
320
-
321
- Perform all state updates in this order:
322
-
323
- **8a. Update ROADMAP.md Progress table** (REQUIRED — do this BEFORE updating STATE.md):
324
- 1. Open `.planning/ROADMAP.md`
325
- 2. Find the `## Progress` table
326
- 3. Locate the row matching this phase number
327
- 4. Update the `Plans Complete` column to `0/{N}` where N = number of plan files created
328
- 5. Update the `Status` column to `planned`
329
- 6. Save the file do NOT skip this step
330
-
331
- **8b. Update STATE.md:**
332
- - Set current phase plan status to "planned"
333
- - Note source: "imported from {filepath}" or "imported from user input"
334
- - Update plan count
335
-
336
- **8c. Generate dependency fingerprints:**
337
- For each dependency phase (phases that this phase depends on, per ROADMAP.md):
338
- 1. Find all SUMMARY.md files in the dependency phase directory
339
- 2. Compute a fingerprint for each: file byte length + last-modified timestamp
340
- 3. Add a `dependency_fingerprints` field to each plan's YAML frontmatter:
341
- ```yaml
342
- dependency_fingerprints:
343
- "01-01": "len:4856-mod:2025-02-08T09:40"
344
- "01-02": "len:4375-mod:2025-02-08T09:43"
345
- ```
346
-
347
- **8d. Update CONTEXT.md (conditional):**
348
- If the import process surfaced new locked decisions (from blocker resolutions in Step 4), append them to `.planning/CONTEXT.md` under the Decisions section.
349
-
350
- **8e. Emit workflow event (conditional):**
351
- If the event-logger script is available:
352
- ```bash
353
- node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js event workflow plan-import --phase {N} --plans {count} --source {filepath_or_user_input}
354
- ```
355
- Falls back silently if the command is not available.
356
-
357
- ---
358
-
359
- ### Step 9: Commit (if planning.commit_docs: true in config)
360
-
361
- Reference: `skills/shared/commit-planning-docs.md` for the standard commit pattern.
362
-
363
- Stage the new PLAN.md files and any updated state files:
364
- ```
365
- docs({phase}): import plans for phase {N} ({count} plans, {wave_count} waves)
366
- ```
367
-
368
- ---
369
-
370
- ### Step 10: Confirm (inline)
371
-
372
- Present a summary of the import using the branded banner:
373
-
374
- ```
375
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
376
- PLAN-BUILD-RUN ► IMPORT COMPLETE ✓
377
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
378
-
379
- **Phase {N}: {name}** {plan_count} plans imported
380
-
381
- Source: {filepath or "user input"}
382
- Conflicts resolved: {count of blockers resolved in Step 4}
383
- Warnings acknowledged: {count}
384
-
385
- Plans:
386
- {phase}-01: {plan name} (Wave {W}, {task_count} tasks)
387
- {phase}-02: {plan name} (Wave {W}, {task_count} tasks)
388
-
389
- Wave execution order:
390
- Wave 1: Plan 01, Plan 02 (parallel)
391
- Wave 2: Plan 03 (depends on 01, 02)
392
-
393
- Must-haves coverage: {count} truths across {plan_count} plans
394
- Requirements traced: {count}/{total} REQ-IDs covered
395
-
396
- ───────────────────────────────────────────────────────────────
397
-
398
- ## ▶ Next Up
399
-
400
- **Build Phase {N}** execute these imported plans
401
-
402
- `/pbr:build {N}`
403
-
404
- <sub>`/clear` first fresh context window</sub>
405
-
406
- ───────────────────────────────────────────────────────────────
407
-
408
- **Also available:**
409
- - `/pbr:plan {N}` — re-plan from scratch if import needs rework
410
- - `/pbr:discuss {N}` — talk through details before building
411
-
412
- ───────────────────────────────────────────────────────────────
413
- ```
414
-
415
- ---
416
-
417
- ## Error Handling
418
-
419
- ### Phase not found
420
- If the specified phase does not exist in ROADMAP.md, display:
421
- ```
422
- ╔══════════════════════════════════════════════════════════════╗
423
- ║ ERROR ║
424
- ╚══════════════════════════════════════════════════════════════╝
425
-
426
- Phase {N} not found.
427
-
428
- **To fix:** Run `/pbr:status` to see available phases.
429
- ```
430
-
431
- ### Missing prerequisites
432
- If REQUIREMENTS.md or ROADMAP.md do not exist, display:
433
- ```
434
- ╔══════════════════════════════════════════════════════════════╗
435
- ║ ERROR ║
436
- ╚══════════════════════════════════════════════════════════════╝
437
-
438
- Project not initialized.
439
-
440
- **To fix:** Run `/pbr:begin` first.
441
- ```
442
-
443
- ### Import file not found
444
- If `--from <filepath>` points to a nonexistent file, display:
445
- ```
446
- ╔══════════════════════════════════════════════════════════════╗
447
- ║ ERROR ║
448
- ╚══════════════════════════════════════════════════════════════╝
449
-
450
- File not found: {filepath}
451
-
452
- **To fix:** Check the path and try again.
453
- ```
454
-
455
- ### Import document too vague
456
- If the imported document contains no actionable tasks, display:
457
- ```
458
- ╔══════════════════════════════════════════════════════════════╗
459
- ║ ERROR ║
460
- ╚══════════════════════════════════════════════════════════════╝
461
-
462
- The imported document is too vague to convert into plans. No specific tasks, files, or implementation steps found.
463
-
464
- **To fix:** Provide a more detailed document, or use `/pbr:plan {N}` to generate plans from scratch.
465
- ```
466
-
467
- ### Checker loops without resolution
468
- After 3 revision iterations without passing, display:
469
- ```
470
- ╔══════════════════════════════════════════════════════════════╗
471
- ║ ERROR ║
472
- ╚══════════════════════════════════════════════════════════════╝
473
-
474
- Import plan checker failed to pass after 3 revision iterations.
475
-
476
- **To fix:** Review the remaining issues below and decide whether to proceed or revise manually.
477
- ```
478
-
479
- Present remaining issues and ask user to decide: proceed or intervene.
480
-
481
- ---
482
-
483
- ## Files Created/Modified by /pbr:import
484
-
485
- | File | Purpose | When |
486
- |------|---------|------|
487
- | `.planning/phases/{NN}-{slug}/{phase}-{NN}-PLAN.md` | Imported plan files | Step 7 |
488
- | `.planning/ROADMAP.md` | Plans Complete + Status updated to `planned` | Step 8a |
489
- | `.planning/STATE.md` | Updated with plan status and import source | Step 8b |
490
- | `.planning/CONTEXT.md` | Updated if blockers surfaced new locked decisions | Step 8d |
1
+ ---
2
+ name: import
3
+ description: "Import external plans. Validates context, detects conflicts, generates PLAN.md."
4
+ allowed-tools: Read, Write, Bash, Glob, Grep, Task, AskUserQuestion
5
+ argument-hint: "<phase-number> [--from <filepath>] [--skip-checker]"
6
+ ---
7
+
8
+ **STOPDO NOT READ THIS FILE. You are already reading it. This prompt was injected into your context by Claude Code's plugin system. Using the Read tool on this SKILL.md file wastes ~7,600 tokens. Begin executing Step 1 immediately.**
9
+
10
+ ## Step 0 Immediate Output
11
+
12
+ **Before ANY tool calls**, display this banner:
13
+
14
+ ```
15
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
16
+ PLAN-BUILD-RUN IMPORTING PLAN
17
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
18
+ ```
19
+
20
+ Then proceed to Step 1.
21
+
22
+ # /pbr:import Plan Import
23
+
24
+ You are the orchestrator for `/pbr:import`. This skill imports an external plan document (design doc, RFC, AI-generated plan, etc.) into the Plan-Build-Run planning format. It validates the imported document against project context, detects conflicts with locked decisions and existing architecture, and generates properly formatted PLAN.md files. Your job is to stay lean, do conflict detection inline, and delegate only the plan checker to a Task() subagent.
25
+
26
+ ## Context Budget
27
+
28
+ Reference: `skills/shared/context-budget.md` for the universal orchestrator rules.
29
+
30
+ Additionally for this skill:
31
+ - **Minimize** reading subagent output — read only verdicts, not full reports
32
+
33
+ ## Prerequisites
34
+
35
+ - `.planning/config.json` exists (run `/pbr:begin` first)
36
+ - `.planning/ROADMAP.md` exists with at least one phase
37
+ - `.planning/REQUIREMENTS.md` exists (optional if absent, skip requirement ID cross-referencing and warn the user: "No REQUIREMENTS.md found. Skipping REQ-ID validation.")
38
+
39
+ ---
40
+
41
+ ## Orchestration Flow
42
+
43
+ Execute these steps in order.
44
+
45
+ ---
46
+
47
+ ### Step 1: Parse and Validate (inline)
48
+
49
+ Reference: `skills/shared/config-loading.md` for the tooling shortcut and config field reference.
50
+
51
+ 1. Parse `$ARGUMENTS` for phase number
52
+ 2. Parse optional `--from <filepath>` flag (path to the external document to import)
53
+ 3. Parse optional `--skip-checker` flag (skip plan validation step)
54
+ 4. Validate:
55
+ - Phase exists in ROADMAP.md
56
+ - Phase directory exists at `.planning/phases/{NN}-{slug}/`
57
+ 5. If no phase number given, read current phase from `.planning/STATE.md`
58
+ 6. Check for existing plans in the phase directory (glob for `*-PLAN.md`)
59
+ - If plans exist: ask user via AskUserQuestion: "Phase {N} already has plans. Replace them with imported plans?"
60
+ - If yes: note that existing plans will be overwritten in Step 7
61
+ - If no: stop
62
+
63
+ ---
64
+
65
+ ### Step 2: Load Full Project Context (inline)
66
+
67
+ Read all relevant context files. This context is used for conflict detection in Step 4.
68
+
69
+ ```
70
+ 1. ROADMAP.md — extract current phase goal, dependencies, requirements, success criteria
71
+ 2. REQUIREMENTS.md — extract REQ-IDs mapped to this phase
72
+ 3. CONTEXT.md (project-level, if exists) extract locked decisions, deferred ideas, constraints
73
+ 4. Phase CONTEXT.md (if exists at .planning/phases/{NN}-{slug}/CONTEXT.md) — phase-specific locked decisions from /pbr:discuss
74
+ 5. config.json — extract feature flags, depth, model settings
75
+ 6. Prior SUMMARY.md files — use digest-select depth per `skills/shared/digest-select.md` (direct deps: full body for conflict detection, transitive: frontmatter only, 2+ back: skip)
76
+ 7. Research SUMMARY.md (if exists at .planning/research/SUMMARY.md)
77
+ 8. Seeds — glob .planning/seeds/*.md, check trigger field for matches:
78
+ - trigger equals the phase slug
79
+ - trigger is a substring of the phase directory name
80
+ - trigger equals the phase number as integer
81
+ - trigger equals * (always matches)
82
+ 9. Pending todos — scan .planning/todos/pending/ for items related to this phase
83
+ 10. NOTES.md (if exists at .planning/NOTES.md) check for related notes
84
+ ```
85
+
86
+ Collect all of this into a context bundle for use in Steps 4 and 5.
87
+
88
+ ---
89
+
90
+ ### Step 3: Read and Parse Imported Document (inline)
91
+
92
+ **If `--from <filepath>` was provided:**
93
+ - Read the file at the specified path
94
+ - If the file does not exist: "File not found: {filepath}. Check the path and try again."
95
+
96
+ **If no `--from` flag:**
97
+ - Use AskUserQuestion to ask the user: "No --from path specified. Please describe or paste the plan you want to import."
98
+ - Accept the user's response as the imported document
99
+
100
+ **Parse the document into structured sections:**
101
+ 1. Identify phases, steps, tasks, or sections in the document
102
+ 2. Extract: scope, approach, files to create/modify, dependencies between steps, verification steps
103
+ 3. Note the document's assumptions about tech stack, architecture, and project state
104
+ 4. If the document is unstructured prose: extract actionable items and group them by subsystem
105
+
106
+ ---
107
+
108
+ ### Step 4: Conflict Detection (inline CRITICAL)
109
+
110
+ Compare the imported plan against ALL loaded context from Step 2.
111
+
112
+ <format_rules>
113
+ HARD REQUIREMENTS FOR THIS STEP — violations are bugs:
114
+
115
+ 1. Run ALL checks below (BLOCKER + WARNING + INFO) before presenting anything.
116
+ 2. Use ONLY these three labels: `[BLOCKER]`, `[WARNING]`, `[INFO]`. Never CRITICAL, HIGH, MEDIUM, LOW, or any other label.
117
+ 3. DO NOT use markdown tables for findings. Use the plain-text format shown below.
118
+ 4. Present one consolidated "Conflict Detection Report" with three sections.
119
+ 5. After the report, use AskUserQuestion if blockers exist.
120
+
121
+ WRONG (never do this):
122
+ | Area | Import | Project | Severity |
123
+ |------|--------|---------|----------|
124
+ | Framework | Fastify | Express | CRITICAL |
125
+
126
+ RIGHT (always do this):
127
+ [BLOCKER] Framework mismatch
128
+ Found: Plan uses Fastify with @fastify/view
129
+ Expected: Express 5.x (locked decision in CONTEXT.md)
130
+ Replace Fastify with Express 5.x
131
+ </format_rules>
132
+
133
+ #### BLOCKER checks (must resolve before continuing):
134
+ Run each of these checks. If any matches, record a `[BLOCKER]`:
135
+
136
+ 1. **Locked decision conflict**: Does the plan contradict ANY locked decision in CONTEXT.md or phase CONTEXT.md? Check every locked decision row against the plan's tech choices, libraries, frameworks, and architecture.
137
+ 2. **Deferred idea implementation**: Does the plan implement something explicitly listed in CONTEXT.md's "Deferred Ideas" section?
138
+ 3. **Missing dependency phase**: Does the plan depend on a phase that does not exist in ROADMAP.md?
139
+ 4. **Incomplete dependency phase**: Does the plan depend on a phase that is not complete (no SUMMARY.md with status: complete)?
140
+ 5. **Architecture mismatch**: Do files referenced in the plan already exist with different architecture than the plan assumes?
141
+ 6. **Tech stack mismatch**: Does the plan assume a library or framework not used by the project? Cross-check against config.json, prior SUMMARYs, RESEARCH.md files, and the codebase.
142
+
143
+ #### WARNING checks (user should review):
144
+ Run each of these checks. If any matches, record a `[WARNING]`:
145
+
146
+ 1. **Requirement coverage gap**: Does the plan fail to cover all phase requirements from REQUIREMENTS.md? List each missing REQ-ID explicitly. This is mandatory — you must cross-reference every REQ-ID assigned to this phase against the plan's tasks. **Guard:** If REQUIREMENTS.md does not exist (as noted in Prerequisites), skip this check entirely and emit `[INFO] No REQUIREMENTS.md — REQ-ID coverage check skipped` instead.
147
+ 2. **Task count exceeds limit**: Does any logical grouping in the plan contain more than 3 tasks? Plan-Build-Run plans are limited to 2-3 tasks each. Count the tasks in the imported document and flag if over 3.
148
+ 3. **Scope exceeds file limit**: Does any logical grouping reference more than 8 files? Plan-Build-Run plans are limited to 5-8 files each.
149
+ 4. **Stale dependencies**: Does the plan assume prior phase output that has changed since the plan was written?
150
+ 5. **Todo overlap**: Does the plan scope overlap with a pending todo in `.planning/todos/pending/`?
151
+ 6. **Naming convention mismatch**: Does the plan create files in unexpected locations that don't follow conventions from prior phases? Check directory structure patterns (e.g., routes/, services/, repositories/ vs components/, controllers/).
152
+ 7. **Dependency ordering conflict**: Does the plan's task ordering conflict with the dependency graph implied by file dependencies?
153
+
154
+ #### INFO checks (supplementary context):
155
+ Run each of these checks. If any matches, record an `[INFO]`:
156
+
157
+ 1. **Related notes**: Are there related notes in NOTES.md?
158
+ 2. **Matching seeds**: Are there matching seeds in `.planning/seeds/` that could enhance the plan?
159
+ 3. **Prior phase patterns**: What patterns from prior phases (from SUMMARY.md `patterns` fields) should the imported plan follow?
160
+
161
+ #### Output format (MANDATORY — do not deviate)
162
+
163
+ Present ALL findings in a single report using this EXACT plain-text format. NEVER use markdown tables. NEVER change the labels. NEVER skip a section even if it has 0 findings:
164
+
165
+ ```
166
+ ## Conflict Detection Report
167
+
168
+ ### BLOCKERS ({count})
169
+
170
+ [BLOCKER] {Short title}
171
+ Found: {what the imported plan says or does}
172
+ Expected: {what the project context requires}
173
+ {Specific action to resolve}
174
+
175
+ [BLOCKER] {Short title}
176
+ Found: ...
177
+ Expected: ...
178
+ → ...
179
+
180
+ ### WARNINGS ({count})
181
+
182
+ [WARNING] {Short title}
183
+ Found: {what was detected}
184
+ Impact: {what could go wrong if not addressed}
185
+ {Suggested action}
186
+
187
+ ### INFO ({count})
188
+
189
+ [INFO] {Short title}
190
+ Note: {relevant information or suggestion}
191
+ ```
192
+
193
+ #### After presenting the report
194
+
195
+ **IMPORTANT: Always present ALL findings (blockers + warnings + info) together in one report before taking any action.**
196
+
197
+ - If any BLOCKERS exist: after the report, ask user to resolve EACH blocker via AskUserQuestion. Do not proceed to Step 5 until all blockers are resolved or the user explicitly chooses to override.
198
+ - If only WARNINGS and INFO: after the report, ask user: "Acknowledge these findings and continue with conversion?" via AskUserQuestion. If yes, continue. If no, discuss adjustments.
199
+ - If no findings: "No conflicts detected. Proceeding with conversion."
200
+
201
+ ---
202
+
203
+ ### Step 5: Convert to PLAN.md Format (inline)
204
+
205
+ Using the imported document (adjusted for any blocker resolutions from Step 4) and the loaded project context, generate PLAN.md content.
206
+
207
+ **YAML frontmatter ALL required fields:**
208
+ ```yaml
209
+ ---
210
+ phase: "{NN}-{slug}"
211
+ plan: "{phase}-{plan_num}"
212
+ type: "{task type: feature, refactor, config, test, docs}"
213
+ wave: {wave number — 1 for independent plans, 2+ for dependent plans}
214
+ depends_on: [{list of plan IDs this plan depends on}]
215
+ files_modified: [{list of files this plan creates or modifies}]
216
+ autonomous: {true if no checkpoints needed, false if human input required}
217
+ discovery:
218
+ approach: "{brief description of what this plan accomplishes}"
219
+ open_questions: [{any unresolved questions from the import}]
220
+ must_haves:
221
+ truths: [{core invariants this plan must satisfy}]
222
+ artifacts: [{files that must exist after execution}]
223
+ key_links: [{connections to other parts of the system}]
224
+ provides: [{what downstream plans can depend on from this plan}]
225
+ gap_closure: {false for standard plans, true if closing gaps}
226
+ ---
227
+ ```
228
+
229
+ **Task XML — for each task in the plan:**
230
+ ```xml
231
+ <task id="{plan_id}-T{N}">
232
+ <name>{Imperative task name}</name>
233
+ <files>{comma-separated list of files this task touches}</files>
234
+ <action>
235
+ {Step-by-step implementation instructions specific enough for an executor agent to follow mechanically.}
236
+ {Include exact file paths, function signatures, import statements.}
237
+ </action>
238
+ <verify>
239
+ {Concrete verification commands: test commands, grep checks, build commands.}
240
+ {Each verify step must be runnable from the command line.}
241
+ </verify>
242
+ <done>{One-sentence definition of done for this task.}</done>
243
+ </task>
244
+ ```
245
+
246
+ **Scope rules:**
247
+ - 2-3 tasks per plan, 5-8 files per plan maximum
248
+ - If the imported document is too large for a single plan: split by subsystem into multiple plans with wave ordering
249
+ - If the imported document is vague on specifics: fill in details from the codebase (function signatures, file paths, import patterns) and flag inferences with HTML comments: `<!-- inferred from codebase: ... -->`
250
+
251
+ **Wave assignment:**
252
+ - Plans with no inter-dependencies: wave 1 (can run in parallel)
253
+ - Plans that depend on wave 1 outputs: wave 2
254
+ - Continue numbering for deeper dependency chains
255
+
256
+ ---
257
+
258
+ ### Step 6: Plan Checker (delegated, unless --skip-checker)
259
+
260
+ **Skip this step if:**
261
+ - `--skip-checker` flag is set
262
+ - `features.plan_checking` is `false` in config
263
+
264
+ **If validation is enabled:**
265
+
266
+ Display to the user: `◐ Spawning plan checker...`
267
+
268
+ Spawn the plan checker Task():
269
+
270
+ ```
271
+ Task({
272
+ subagent_type: "pbr:plan-checker",
273
+ prompt: <checker prompt>
274
+ })
275
+
276
+ NOTE: The pbr:plan-checker subagent type auto-loads the agent definition. Do NOT inline it.
277
+ ```
278
+
279
+ **Checker Prompt Template:**
280
+ ```
281
+ You are the plan-checker agent.
282
+
283
+ <plans_to_check>
284
+ {For each generated PLAN.md:}
285
+ --- Plan File: {filename} ---
286
+ [Inline the FULL content of each plan file]
287
+ --- End Plan File ---
288
+ </plans_to_check>
289
+
290
+ <phase_context>
291
+ Phase goal: {goal from roadmap}
292
+ Phase requirements: {REQ-IDs}
293
+ </phase_context>
294
+
295
+ <context>
296
+ {Inline .planning/CONTEXT.md if it exists project-level locked decisions}
297
+ {Inline .planning/phases/{NN}-{slug}/CONTEXT.md if it exists — phase-level locked decisions}
298
+ </context>
299
+
300
+ <import_note>
301
+ These plans were imported from an external document, not generated by the standard planner.
302
+ Pay extra attention to:
303
+ - Consistency with project conventions
304
+ - Completeness of verify steps
305
+ - Accuracy of files_modified lists
306
+ - Whether task actions are specific enough for mechanical execution
307
+ </import_note>
308
+
309
+ Run all verification dimensions on these plans. Return your structured report.
310
+ Do NOT write any files. Return your findings as your response text.
311
+ ```
312
+
313
+ **Process checker results — revision loop:**
314
+
315
+ Reference: `skills/shared/revision-loop.md` for the full Check-Revise-Escalate pattern (max 3 iterations).
316
+
317
+ Follow the revision loop with:
318
+ - **Producer**: orchestrator (inline plan revision)
319
+ - **Checker**: plan-checker (re-run Step 6)
320
+ - **Escalation**: present issues to user, offer "Proceed anyway" or "Adjust approach" (re-enter Step 5)
321
+
322
+ ---
323
+
324
+ ### Step 7: Write PLAN.md Files (inline)
325
+
326
+ Write each plan to `.planning/phases/{NN}-{slug}/{phase}-{plan_num}-PLAN.md`.
327
+
328
+ If existing plans are being replaced (user confirmed in Step 1):
329
+ - Delete existing `*-PLAN.md` files in the phase directory before writing new ones
330
+
331
+ ---
332
+
333
+ ### Step 8: Update All State (inline)
334
+
335
+ Perform all state updates in this order:
336
+
337
+ **8a. Update ROADMAP.md Progress table** (REQUIRED do this BEFORE updating STATE.md):
338
+ 1. Open `.planning/ROADMAP.md`
339
+ 2. Find the `## Progress` table
340
+ 3. Locate the row matching this phase number
341
+ 4. Update the `Plans Complete` column to `0/{N}` where N = number of plan files created
342
+ 5. Update the `Status` column to `planned`
343
+ 6. Save the file — do NOT skip this step
344
+
345
+ **8b. Update STATE.md:**
346
+ - Set current phase plan status to "planned"
347
+ - Note source: "imported from {filepath}" or "imported from user input"
348
+ - Update plan count
349
+
350
+ **8c. Generate dependency fingerprints:**
351
+ For each dependency phase (phases that this phase depends on, per ROADMAP.md):
352
+ 1. Find all SUMMARY.md files in the dependency phase directory
353
+ 2. Compute a fingerprint for each: file byte length + last-modified timestamp
354
+ 3. Add a `dependency_fingerprints` field to each plan's YAML frontmatter:
355
+ ```yaml
356
+ dependency_fingerprints:
357
+ "01-01": "len:4856-mod:2025-02-08T09:40"
358
+ "01-02": "len:4375-mod:2025-02-08T09:43"
359
+ ```
360
+
361
+ **8d. Update CONTEXT.md (conditional):**
362
+ If the import process surfaced new locked decisions (from blocker resolutions in Step 4), append them to `.planning/CONTEXT.md` under the Decisions section.
363
+
364
+ **8e. Emit workflow event (conditional):**
365
+ If the event-logger script is available:
366
+ ```bash
367
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js event workflow plan-import --phase {N} --plans {count} --source {filepath_or_user_input}
368
+ ```
369
+ Falls back silently if the command is not available.
370
+
371
+ ---
372
+
373
+ ### Step 9: Commit (if planning.commit_docs: true in config)
374
+
375
+ Reference: `skills/shared/commit-planning-docs.md` for the standard commit pattern.
376
+
377
+ Stage the new PLAN.md files and any updated state files:
378
+ ```
379
+ docs({phase}): import plans for phase {N} ({count} plans, {wave_count} waves)
380
+ ```
381
+
382
+ ---
383
+
384
+ ### Step 10: Confirm (inline)
385
+
386
+ Present a summary of the import using the branded banner:
387
+
388
+ ```
389
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
390
+ PLAN-BUILD-RUN IMPORT COMPLETE
391
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
392
+
393
+ **Phase {N}: {name}** {plan_count} plans imported
394
+
395
+ Source: {filepath or "user input"}
396
+ Conflicts resolved: {count of blockers resolved in Step 4}
397
+ Warnings acknowledged: {count}
398
+
399
+ Plans:
400
+ {phase}-01: {plan name} (Wave {W}, {task_count} tasks)
401
+ {phase}-02: {plan name} (Wave {W}, {task_count} tasks)
402
+
403
+ Wave execution order:
404
+ Wave 1: Plan 01, Plan 02 (parallel)
405
+ Wave 2: Plan 03 (depends on 01, 02)
406
+
407
+ Must-haves coverage: {count} truths across {plan_count} plans
408
+ Requirements traced: {count}/{total} REQ-IDs covered
409
+
410
+ ───────────────────────────────────────────────────────────────
411
+
412
+ ## ▶ Next Up
413
+
414
+ **Build Phase {N}** — execute these imported plans
415
+
416
+ `/pbr:build {N}`
417
+
418
+ <sub>`/clear` first → fresh context window</sub>
419
+
420
+ ───────────────────────────────────────────────────────────────
421
+
422
+ **Also available:**
423
+ - `/pbr:plan {N}` — re-plan from scratch if import needs rework
424
+ - `/pbr:discuss {N}` — talk through details before building
425
+
426
+ ───────────────────────────────────────────────────────────────
427
+ ```
428
+
429
+ ---
430
+
431
+ ## Error Handling
432
+
433
+ ### Phase not found
434
+ If the specified phase does not exist in ROADMAP.md, display:
435
+ ```
436
+ ╔══════════════════════════════════════════════════════════════╗
437
+ ║ ERROR ║
438
+ ╚══════════════════════════════════════════════════════════════╝
439
+
440
+ Phase {N} not found.
441
+
442
+ **To fix:** Run `/pbr:status` to see available phases.
443
+ ```
444
+
445
+ ### Missing prerequisites
446
+ If REQUIREMENTS.md or ROADMAP.md do not exist, display:
447
+ ```
448
+ ╔══════════════════════════════════════════════════════════════╗
449
+ ║ ERROR ║
450
+ ╚══════════════════════════════════════════════════════════════╝
451
+
452
+ Project not initialized.
453
+
454
+ **To fix:** Run `/pbr:begin` first.
455
+ ```
456
+
457
+ ### Import file not found
458
+ If `--from <filepath>` points to a nonexistent file, display:
459
+ ```
460
+ ╔══════════════════════════════════════════════════════════════╗
461
+ ║ ERROR ║
462
+ ╚══════════════════════════════════════════════════════════════╝
463
+
464
+ File not found: {filepath}
465
+
466
+ **To fix:** Check the path and try again.
467
+ ```
468
+
469
+ ### Import document too vague
470
+ If the imported document contains no actionable tasks, display:
471
+ ```
472
+ ╔══════════════════════════════════════════════════════════════╗
473
+ ║ ERROR ║
474
+ ╚══════════════════════════════════════════════════════════════╝
475
+
476
+ The imported document is too vague to convert into plans. No specific tasks, files, or implementation steps found.
477
+
478
+ **To fix:** Provide a more detailed document, or use `/pbr:plan {N}` to generate plans from scratch.
479
+ ```
480
+
481
+ ### Checker loops without resolution
482
+ After 3 revision iterations without passing, display:
483
+ ```
484
+ ╔══════════════════════════════════════════════════════════════╗
485
+ ║ ERROR ║
486
+ ╚══════════════════════════════════════════════════════════════╝
487
+
488
+ Import plan checker failed to pass after 3 revision iterations.
489
+
490
+ **To fix:** Review the remaining issues below and decide whether to proceed or revise manually.
491
+ ```
492
+
493
+ Present remaining issues and ask user to decide: proceed or intervene.
494
+
495
+ ---
496
+
497
+ ## Files Created/Modified by /pbr:import
498
+
499
+ | File | Purpose | When |
500
+ |------|---------|------|
501
+ | `.planning/phases/{NN}-{slug}/{phase}-{NN}-PLAN.md` | Imported plan files | Step 7 |
502
+ | `.planning/ROADMAP.md` | Plans Complete + Status updated to `planned` | Step 8a |
503
+ | `.planning/STATE.md` | Updated with plan status and import source | Step 8b |
504
+ | `.planning/CONTEXT.md` | Updated if blockers surfaced new locked decisions | Step 8d |