@sienklogic/plan-build-run 2.0.2 → 2.1.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 (156) hide show
  1. package/dashboard/src/routes/pages.routes.js +11 -4
  2. package/dashboard/src/services/dashboard.service.js +81 -17
  3. package/dashboard/src/services/phase.service.js +30 -24
  4. package/dashboard/src/services/roadmap.service.js +3 -3
  5. package/dashboard/src/views/partials/phase-content.ejs +5 -4
  6. package/package.json +1 -1
  7. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  8. package/plugins/cursor-pbr/CHANGELOG.md +15 -0
  9. package/plugins/cursor-pbr/README.md +118 -0
  10. package/plugins/cursor-pbr/agents/codebase-mapper.md +108 -0
  11. package/plugins/cursor-pbr/agents/debugger.md +168 -0
  12. package/plugins/cursor-pbr/agents/executor.md +236 -0
  13. package/plugins/cursor-pbr/agents/general.md +87 -0
  14. package/plugins/cursor-pbr/agents/integration-checker.md +87 -0
  15. package/plugins/cursor-pbr/agents/plan-checker.md +198 -0
  16. package/plugins/cursor-pbr/agents/planner.md +180 -0
  17. package/plugins/cursor-pbr/agents/researcher.md +162 -0
  18. package/plugins/cursor-pbr/agents/synthesizer.md +101 -0
  19. package/plugins/cursor-pbr/agents/verifier.md +193 -0
  20. package/plugins/cursor-pbr/assets/logo.svg +21 -0
  21. package/plugins/cursor-pbr/hooks/hooks.json +189 -7
  22. package/plugins/cursor-pbr/references/agent-anti-patterns.md +25 -0
  23. package/plugins/cursor-pbr/references/agent-interactions.md +135 -0
  24. package/plugins/cursor-pbr/references/agent-teams.md +55 -0
  25. package/plugins/cursor-pbr/references/checkpoints.md +158 -0
  26. package/plugins/cursor-pbr/references/common-bug-patterns.md +14 -0
  27. package/plugins/cursor-pbr/references/config-reference.md +442 -0
  28. package/plugins/cursor-pbr/references/continuation-format.md +213 -0
  29. package/plugins/cursor-pbr/references/deviation-rules.md +113 -0
  30. package/plugins/cursor-pbr/references/git-integration.md +227 -0
  31. package/plugins/cursor-pbr/references/integration-patterns.md +118 -0
  32. package/plugins/cursor-pbr/references/model-profiles.md +100 -0
  33. package/plugins/cursor-pbr/references/model-selection.md +32 -0
  34. package/plugins/cursor-pbr/references/pbr-rules.md +194 -0
  35. package/plugins/cursor-pbr/references/plan-authoring.md +182 -0
  36. package/plugins/cursor-pbr/references/plan-format.md +288 -0
  37. package/plugins/cursor-pbr/references/planning-config.md +214 -0
  38. package/plugins/cursor-pbr/references/questioning.md +215 -0
  39. package/plugins/cursor-pbr/references/reading-verification.md +128 -0
  40. package/plugins/cursor-pbr/references/stub-patterns.md +161 -0
  41. package/plugins/cursor-pbr/references/subagent-coordination.md +120 -0
  42. package/plugins/cursor-pbr/references/ui-formatting.md +462 -0
  43. package/plugins/cursor-pbr/references/verification-patterns.md +199 -0
  44. package/plugins/cursor-pbr/references/wave-execution.md +96 -0
  45. package/plugins/cursor-pbr/rules/pbr-workflow.mdc +48 -0
  46. package/plugins/cursor-pbr/setup.ps1 +78 -0
  47. package/plugins/cursor-pbr/setup.sh +83 -0
  48. package/plugins/cursor-pbr/skills/begin/SKILL.md +566 -0
  49. package/plugins/cursor-pbr/skills/begin/templates/PROJECT.md.tmpl +34 -0
  50. package/plugins/cursor-pbr/skills/begin/templates/REQUIREMENTS.md.tmpl +19 -0
  51. package/plugins/cursor-pbr/skills/begin/templates/STATE.md.tmpl +50 -0
  52. package/plugins/cursor-pbr/skills/begin/templates/config.json.tmpl +64 -0
  53. package/plugins/cursor-pbr/skills/begin/templates/researcher-prompt.md.tmpl +20 -0
  54. package/plugins/cursor-pbr/skills/begin/templates/roadmap-prompt.md.tmpl +31 -0
  55. package/plugins/cursor-pbr/skills/begin/templates/synthesis-prompt.md.tmpl +17 -0
  56. package/plugins/cursor-pbr/skills/build/SKILL.md +902 -0
  57. package/plugins/cursor-pbr/skills/config/SKILL.md +253 -0
  58. package/plugins/cursor-pbr/skills/continue/SKILL.md +159 -0
  59. package/plugins/cursor-pbr/skills/debug/SKILL.md +512 -0
  60. package/plugins/cursor-pbr/skills/debug/templates/continuation-prompt.md.tmpl +17 -0
  61. package/plugins/cursor-pbr/skills/debug/templates/initial-investigation-prompt.md.tmpl +28 -0
  62. package/plugins/cursor-pbr/skills/discuss/SKILL.md +344 -0
  63. package/plugins/cursor-pbr/skills/discuss/templates/CONTEXT.md.tmpl +62 -0
  64. package/plugins/cursor-pbr/skills/discuss/templates/decision-categories.md +10 -0
  65. package/plugins/cursor-pbr/skills/explore/SKILL.md +375 -0
  66. package/plugins/cursor-pbr/skills/health/SKILL.md +218 -0
  67. package/plugins/cursor-pbr/skills/health/templates/check-pattern.md.tmpl +31 -0
  68. package/plugins/cursor-pbr/skills/health/templates/output-format.md.tmpl +64 -0
  69. package/plugins/cursor-pbr/skills/help/SKILL.md +152 -0
  70. package/plugins/cursor-pbr/skills/import/SKILL.md +499 -0
  71. package/plugins/cursor-pbr/skills/milestone/SKILL.md +701 -0
  72. package/plugins/cursor-pbr/skills/milestone/templates/audit-report.md.tmpl +49 -0
  73. package/plugins/cursor-pbr/skills/milestone/templates/stats-file.md.tmpl +31 -0
  74. package/plugins/cursor-pbr/skills/note/SKILL.md +228 -0
  75. package/plugins/cursor-pbr/skills/pause/SKILL.md +246 -0
  76. package/plugins/cursor-pbr/skills/pause/templates/continue-here.md.tmpl +72 -0
  77. package/plugins/cursor-pbr/skills/plan/SKILL.md +648 -0
  78. package/plugins/cursor-pbr/skills/plan/templates/checker-prompt.md.tmpl +22 -0
  79. package/plugins/cursor-pbr/skills/plan/templates/gap-closure-prompt.md.tmpl +33 -0
  80. package/plugins/cursor-pbr/skills/plan/templates/planner-prompt.md.tmpl +39 -0
  81. package/plugins/cursor-pbr/skills/plan/templates/researcher-prompt.md.tmpl +20 -0
  82. package/plugins/cursor-pbr/skills/plan/templates/revision-prompt.md.tmpl +24 -0
  83. package/plugins/cursor-pbr/skills/quick/SKILL.md +351 -0
  84. package/plugins/cursor-pbr/skills/resume/SKILL.md +399 -0
  85. package/plugins/cursor-pbr/skills/review/SKILL.md +649 -0
  86. package/plugins/cursor-pbr/skills/review/templates/debugger-prompt.md.tmpl +61 -0
  87. package/plugins/cursor-pbr/skills/review/templates/gap-planner-prompt.md.tmpl +41 -0
  88. package/plugins/cursor-pbr/skills/review/templates/verifier-prompt.md.tmpl +116 -0
  89. package/plugins/cursor-pbr/skills/scan/SKILL.md +301 -0
  90. package/plugins/cursor-pbr/skills/scan/templates/mapper-prompt.md.tmpl +202 -0
  91. package/plugins/cursor-pbr/skills/setup/SKILL.md +250 -0
  92. package/plugins/cursor-pbr/skills/shared/commit-planning-docs.md +36 -0
  93. package/plugins/cursor-pbr/skills/shared/config-loading.md +103 -0
  94. package/plugins/cursor-pbr/skills/shared/context-budget.md +41 -0
  95. package/plugins/cursor-pbr/skills/shared/context-loader-task.md +87 -0
  96. package/plugins/cursor-pbr/skills/shared/digest-select.md +80 -0
  97. package/plugins/cursor-pbr/skills/shared/domain-probes.md +126 -0
  98. package/plugins/cursor-pbr/skills/shared/error-reporting.md +80 -0
  99. package/plugins/cursor-pbr/skills/shared/gate-prompts.md +389 -0
  100. package/plugins/cursor-pbr/skills/shared/phase-argument-parsing.md +46 -0
  101. package/plugins/cursor-pbr/skills/shared/progress-display.md +54 -0
  102. package/plugins/cursor-pbr/skills/shared/revision-loop.md +82 -0
  103. package/plugins/cursor-pbr/skills/shared/state-loading.md +63 -0
  104. package/plugins/cursor-pbr/skills/shared/state-update.md +162 -0
  105. package/plugins/cursor-pbr/skills/shared/universal-anti-patterns.md +34 -0
  106. package/plugins/cursor-pbr/skills/status/SKILL.md +362 -0
  107. package/plugins/cursor-pbr/skills/todo/SKILL.md +195 -0
  108. package/plugins/cursor-pbr/templates/CONTEXT.md.tmpl +53 -0
  109. package/plugins/cursor-pbr/templates/INTEGRATION-REPORT.md.tmpl +152 -0
  110. package/plugins/cursor-pbr/templates/RESEARCH-SUMMARY.md.tmpl +98 -0
  111. package/plugins/cursor-pbr/templates/ROADMAP.md.tmpl +41 -0
  112. package/plugins/cursor-pbr/templates/SUMMARY.md.tmpl +82 -0
  113. package/plugins/cursor-pbr/templates/VERIFICATION-DETAIL.md.tmpl +117 -0
  114. package/plugins/cursor-pbr/templates/continue-here.md.tmpl +74 -0
  115. package/plugins/cursor-pbr/templates/prompt-partials/phase-project-context.md.tmpl +38 -0
  116. package/plugins/pbr/agents/codebase-mapper.md +41 -206
  117. package/plugins/pbr/agents/debugger.md +65 -171
  118. package/plugins/pbr/agents/executor.md +90 -275
  119. package/plugins/pbr/agents/general.md +27 -97
  120. package/plugins/pbr/agents/integration-checker.md +35 -112
  121. package/plugins/pbr/agents/plan-checker.md +71 -164
  122. package/plugins/pbr/agents/planner.md +75 -246
  123. package/plugins/pbr/agents/researcher.md +63 -255
  124. package/plugins/pbr/agents/synthesizer.md +49 -174
  125. package/plugins/pbr/agents/verifier.md +75 -366
  126. package/plugins/pbr/hooks/hooks.json +14 -10
  127. package/plugins/pbr/scripts/auto-continue.js +20 -4
  128. package/plugins/pbr/scripts/check-dangerous-commands.js +1 -1
  129. package/plugins/pbr/scripts/check-phase-boundary.js +1 -1
  130. package/plugins/pbr/scripts/check-plan-format.js +3 -3
  131. package/plugins/pbr/scripts/check-roadmap-sync.js +3 -3
  132. package/plugins/pbr/scripts/check-skill-workflow.js +1 -1
  133. package/plugins/pbr/scripts/check-state-sync.js +2 -2
  134. package/plugins/pbr/scripts/check-subagent-output.js +1 -1
  135. package/plugins/pbr/scripts/check-summary-gate.js +198 -0
  136. package/plugins/pbr/scripts/context-budget-check.js +1 -1
  137. package/plugins/pbr/scripts/event-handler.js +2 -2
  138. package/plugins/pbr/scripts/event-logger.js +1 -1
  139. package/plugins/pbr/scripts/log-subagent.js +1 -1
  140. package/plugins/pbr/scripts/pbr-tools.js +1 -1
  141. package/plugins/pbr/scripts/post-write-dispatch.js +1 -1
  142. package/plugins/pbr/scripts/post-write-quality.js +1 -1
  143. package/plugins/pbr/scripts/pre-bash-dispatch.js +1 -1
  144. package/plugins/pbr/scripts/pre-write-dispatch.js +16 -3
  145. package/plugins/pbr/scripts/session-cleanup.js +1 -1
  146. package/plugins/pbr/scripts/status-line.js +1 -1
  147. package/plugins/pbr/scripts/suggest-compact.js +1 -1
  148. package/plugins/pbr/scripts/task-completed.js +1 -1
  149. package/plugins/pbr/scripts/track-context-budget.js +11 -6
  150. package/plugins/pbr/scripts/validate-commit.js +1 -1
  151. package/plugins/pbr/scripts/validate-task.js +1 -1
  152. package/plugins/cursor-pbr/agents/.gitkeep +0 -0
  153. package/plugins/cursor-pbr/references/.gitkeep +0 -0
  154. package/plugins/cursor-pbr/rules/.gitkeep +0 -0
  155. package/plugins/cursor-pbr/skills/.gitkeep +0 -0
  156. package/plugins/cursor-pbr/templates/.gitkeep +0 -0
@@ -0,0 +1,152 @@
1
+ ---
2
+ name: help
3
+ description: "Command reference and workflow guide for Plan-Build-Run."
4
+ ---
5
+
6
+ ## Step 0 — Immediate Output
7
+
8
+ **Before ANY tool calls**, display this banner:
9
+
10
+ ```
11
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
12
+ PLAN-BUILD-RUN ► COMMAND REFERENCE
13
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
14
+ ```
15
+
16
+ Then proceed to Step 1.
17
+
18
+ # /pbr:help — Plan-Build-Run Command Reference
19
+
20
+ ## Contextual Help
21
+
22
+ If `$ARGUMENTS` contains a command name (e.g., `plan`, `build`, `review`, `config`, `quick`), show detailed help for just that command instead of the full reference. Match the argument against the command tables below and display only the matching section with its subcommands and flags. If the argument doesn't match any command, show the full reference.
23
+
24
+ Examples:
25
+ - `/pbr:help plan` → Show only the plan command and its flags (--assumptions, --skip-research, --gaps, add, insert, remove)
26
+ - `/pbr:help build` → Show only the build command and its flags (--gaps-only, --team)
27
+ - `/pbr:help` → Show the full reference below
28
+
29
+ ## Full Reference
30
+
31
+ Display the following reference to the user:
32
+
33
+ ---
34
+
35
+ ## Plan-Build-Run Commands
36
+
37
+ ### Core Workflow (the main loop)
38
+
39
+ | Command | Description | Cost |
40
+ |---------|-------------|------|
41
+ | `/pbr:begin` | Start a new project. Deep questioning, research, requirements, roadmap. | High (4-6 agents) |
42
+ | `/pbr:plan <N>` | Plan a phase. Research, create plans, verify before building. | Medium (2-3 agents) |
43
+ | `/pbr:build <N>` | Build a phase. Execute plans in parallel waves, verify results. | High (2-4 agents) |
44
+ | `/pbr:review <N>` | Review what was built. Automated verification + walkthrough with you. | Low (1 agent) |
45
+
46
+ ### Planning & Discovery
47
+
48
+ | Command | Description |
49
+ |---------|-------------|
50
+ | `/pbr:explore [topic]` | Explore ideas, think through approaches. No phase number needed. |
51
+ | `/pbr:discuss <N>` | Talk through a phase before planning. Captures decisions. |
52
+ | `/pbr:plan <N> --assumptions` | Surface Claude's assumptions before planning. Zero cost. |
53
+ | `/pbr:plan <N> --skip-research` | Plan without research phase. Faster. |
54
+ | `/pbr:plan <N> --gaps` | Create gap-closure plans from verification failures. |
55
+ | `/pbr:plan add` | Append a new phase to the roadmap. |
56
+ | `/pbr:plan insert <N>` | Insert a phase using decimal numbering. |
57
+ | `/pbr:plan remove <N>` | Remove a future phase and renumber. |
58
+
59
+ ### Execution
60
+
61
+ | Command | Description |
62
+ |---------|-------------|
63
+ | `/pbr:build <N>` | Execute all plans in a phase. |
64
+ | `/pbr:build <N> --gaps-only` | Execute only gap-closure plans. |
65
+ | `/pbr:build <N> --team` | Use Agent Teams for complex inter-agent coordination. |
66
+ | `/pbr:quick` | Quick ad-hoc task with atomic commit. Low cost. |
67
+ | `/pbr:continue` | Execute the next logical step automatically. No prompts. |
68
+
69
+ ### Verification & Debugging
70
+
71
+ | Command | Description |
72
+ |---------|-------------|
73
+ | `/pbr:review <N>` | Verify phase + conversational UAT. |
74
+ | `/pbr:review <N> --auto-fix` | Auto-diagnose and fix verification failures. |
75
+ | `/pbr:debug` | Systematic debugging with hypothesis testing. |
76
+ | `/pbr:scan` | Analyze existing codebase (brownfield). |
77
+
78
+ ### Session Management
79
+
80
+ | Command | Description |
81
+ |---------|-------------|
82
+ | `/pbr:status` | Where am I? Shows progress and suggests next action. |
83
+ | `/pbr:health` | Check planning directory integrity. Find and fix corrupted state. |
84
+ | `/pbr:pause` | Save session state for later. |
85
+ | `/pbr:resume` | Pick up where you left off. |
86
+
87
+ ### Project Management
88
+
89
+ | Command | Description |
90
+ |---------|-------------|
91
+ | `/pbr:milestone new` | Start a new milestone cycle. |
92
+ | `/pbr:milestone complete` | Archive completed milestone. |
93
+ | `/pbr:milestone audit` | Verify milestone completion. |
94
+ | `/pbr:milestone gaps` | Create phases to close audit gaps. |
95
+ | `/pbr:todo add\|list\|done` | Persistent file-based todos. |
96
+ | `/pbr:note <text>\|list\|promote` | Zero-friction idea capture. Quick notes that persist across sessions. |
97
+ | `/pbr:config` | Configure workflow settings. |
98
+ | `/pbr:import <N>` | Import external plans (design docs, RFCs) into PBR format. |
99
+ | `/pbr:setup` | Interactive onboarding wizard for new projects. |
100
+
101
+ ## Typical Workflow
102
+
103
+ ```
104
+ /pbr:begin ← Start project, define requirements, create roadmap
105
+ /pbr:discuss 1 ← (optional) Talk through phase details
106
+ /pbr:plan 1 ← Plan the first phase
107
+ /pbr:build 1 ← Build it
108
+ /pbr:review 1 ← Verify it works
109
+ /pbr:plan 2 ← Plan the next phase
110
+ ... ← Repeat plan → build → review
111
+ /pbr:milestone complete ← Archive when done
112
+ ```
113
+
114
+ ## Quick Reference
115
+
116
+ - **Context strategy**: `aggressive` (delegate everything) | `balanced` | `minimal` (run inline)
117
+ - **Depth**: `quick` (skip research, ~50% cheaper) | `standard` | `comprehensive` (~2x cost)
118
+ - **State files**: `.planning/STATE.md` (position), `.planning/ROADMAP.md` (phases), `.planning/config.json` (settings)
119
+ - **Configure**: `/pbr:config` to change depth, models, gates, parallelization
120
+ - **Tip**: Use `/pbr:quick` for creative/visual work where structured planning adds overhead without benefit.
121
+ - **PR hygiene**: When creating PRs from a Plan-Build-Run project, `.planning/` commits can be filtered using phase branching (`git.branching: phase`) which squash-merges code-only changes to main.
122
+ - **Seeds**: `/pbr:explore` can create seed files (`.planning/seeds/`) with trigger conditions. Seeds auto-inject into planning when their trigger phase is reached.
123
+
124
+ ## Behavioral Contexts
125
+
126
+ Plan-Build-Run includes three behavioral contexts in `contexts/` that adjust how Claude operates:
127
+
128
+ - **dev** — Active development: write code first, low verbosity, medium risk tolerance
129
+ - **research** — Exploration mode: read widely, no code writing, high verbosity, evidence-based
130
+ - **review** — Code review: read thoroughly, prioritize by severity, report don't fix
131
+
132
+ Skills automatically activate the appropriate context: `/pbr:build` uses dev context, `/pbr:discuss` uses research context, `/pbr:review` uses review context.
133
+
134
+ ## Getting Started
135
+
136
+ ```
137
+ ───────────────────────────────────────────────────────────────
138
+
139
+ ## ▶ Next Up
140
+
141
+ → `/pbr:begin` — start a new project
142
+ → `/pbr:status` — check current project status
143
+ → `/pbr:config` — configure workflow settings
144
+ → `/pbr:help <command>` — detailed help for a specific command
145
+
146
+ ───────────────────────────────────────────────────────────────
147
+ ```
148
+
149
+ ## Getting Help
150
+
151
+ - GitHub Issues: https://github.com/SienkLogic/plan-build-run/issues
152
+ - README: https://github.com/SienkLogic/plan-build-run
@@ -0,0 +1,499 @@
1
+ ---
2
+ name: import
3
+ description: "Import external plans. Validates context, detects conflicts, generates PLAN.md."
4
+ argument-hint: "<phase-number> [--from <filepath>] [--skip-checker]"
5
+ ---
6
+
7
+ ## Step 0 — Immediate Output
8
+
9
+ **Before ANY tool calls**, display this banner:
10
+
11
+ ```
12
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
13
+ PLAN-BUILD-RUN ► IMPORTING PLAN
14
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
15
+ ```
16
+
17
+ Then proceed to Step 1.
18
+
19
+ # /pbr:import — Plan Import
20
+
21
+ 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.
22
+
23
+ ## Context Budget
24
+
25
+ Reference: `skills/shared/context-budget.md` for the universal orchestrator rules.
26
+
27
+ Additionally for this skill:
28
+ - **Minimize** reading subagent output — read only verdicts, not full reports
29
+
30
+ ## Prerequisites
31
+
32
+ - `.planning/config.json` exists (run `/pbr:begin` first)
33
+ - `.planning/ROADMAP.md` exists with at least one phase
34
+ - `.planning/REQUIREMENTS.md` exists (optional — if absent, skip requirement ID cross-referencing and warn the user: "No REQUIREMENTS.md found. Skipping REQ-ID validation.")
35
+
36
+ ---
37
+
38
+ ## Orchestration Flow
39
+
40
+ Execute these steps in order.
41
+
42
+ ---
43
+
44
+ ### Step 1: Parse and Validate (inline)
45
+
46
+ Reference: `skills/shared/config-loading.md` for the tooling shortcut and config field reference.
47
+
48
+ 1. Parse `$ARGUMENTS` for phase number
49
+ 2. Parse optional `--from <filepath>` flag (path to the external document to import)
50
+ 3. Parse optional `--skip-checker` flag (skip plan validation step)
51
+ 4. Validate:
52
+ - Phase exists in ROADMAP.md
53
+ - Phase directory exists at `.planning/phases/{NN}-{slug}/`
54
+ 5. If no phase number given, read current phase from `.planning/STATE.md`
55
+ 6. Check for existing plans in the phase directory (glob for `*-PLAN.md`)
56
+ - If plans exist: ask user via AskUserQuestion: "Phase {N} already has plans. Replace them with imported plans?"
57
+ - If yes: note that existing plans will be overwritten in Step 7
58
+ - If no: stop
59
+
60
+ ---
61
+
62
+ ### Step 2: Load Full Project Context (inline)
63
+
64
+ Read all relevant context files. This context is used for conflict detection in Step 4.
65
+
66
+ ```
67
+ 1. ROADMAP.md — extract current phase goal, dependencies, requirements, success criteria
68
+ 2. REQUIREMENTS.md — extract REQ-IDs mapped to this phase
69
+ 3. CONTEXT.md (project-level, if exists) — extract locked decisions, deferred ideas, constraints
70
+ 4. Phase CONTEXT.md (if exists at .planning/phases/{NN}-{slug}/CONTEXT.md) — phase-specific locked decisions from /pbr:discuss
71
+ 5. config.json — extract feature flags, depth, model settings
72
+ 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)
73
+ 7. Research SUMMARY.md (if exists at .planning/research/SUMMARY.md)
74
+ 8. Seeds — glob .planning/seeds/*.md, check trigger field for matches:
75
+ - trigger equals the phase slug
76
+ - trigger is a substring of the phase directory name
77
+ - trigger equals the phase number as integer
78
+ - trigger equals * (always matches)
79
+ 9. Pending todos — scan .planning/todos/pending/ for items related to this phase
80
+ 10. NOTES.md (if exists at .planning/NOTES.md) — check for related notes
81
+ ```
82
+
83
+ Collect all of this into a context bundle for use in Steps 4 and 5.
84
+
85
+ ---
86
+
87
+ ### Step 3: Read and Parse Imported Document (inline)
88
+
89
+ **If `--from <filepath>` was provided:**
90
+ - Read the file at the specified path
91
+ - If the file does not exist: "File not found: {filepath}. Check the path and try again."
92
+
93
+ **If no `--from` flag:**
94
+ - Use AskUserQuestion to ask the user: "No --from path specified. Please describe or paste the plan you want to import."
95
+ - Accept the user's response as the imported document
96
+
97
+ **Parse the document into structured sections:**
98
+ 1. Identify phases, steps, tasks, or sections in the document
99
+ 2. Extract: scope, approach, files to create/modify, dependencies between steps, verification steps
100
+ 3. Note the document's assumptions about tech stack, architecture, and project state
101
+ 4. If the document is unstructured prose: extract actionable items and group them by subsystem
102
+
103
+ ---
104
+
105
+ ### Step 4: Conflict Detection (inline — CRITICAL)
106
+
107
+ Compare the imported plan against ALL loaded context from Step 2.
108
+
109
+ <format_rules>
110
+ HARD REQUIREMENTS FOR THIS STEP — violations are bugs:
111
+
112
+ 1. Run ALL checks below (BLOCKER + WARNING + INFO) before presenting anything.
113
+ 2. Use ONLY these three labels: `[BLOCKER]`, `[WARNING]`, `[INFO]`. Never CRITICAL, HIGH, MEDIUM, LOW, or any other label.
114
+ 3. DO NOT use markdown tables for findings. Use the plain-text format shown below.
115
+ 4. Present one consolidated "Conflict Detection Report" with three sections.
116
+ 5. After the report, use AskUserQuestion if blockers exist.
117
+
118
+ WRONG (never do this):
119
+ | Area | Import | Project | Severity |
120
+ |------|--------|---------|----------|
121
+ | Framework | Fastify | Express | CRITICAL |
122
+
123
+ RIGHT (always do this):
124
+ [BLOCKER] Framework mismatch
125
+ Found: Plan uses Fastify with @fastify/view
126
+ Expected: Express 5.x (locked decision in CONTEXT.md)
127
+ → Replace Fastify with Express 5.x
128
+ </format_rules>
129
+
130
+ #### BLOCKER checks (must resolve before continuing):
131
+ Run each of these checks. If any matches, record a `[BLOCKER]`:
132
+
133
+ 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.
134
+ 2. **Deferred idea implementation**: Does the plan implement something explicitly listed in CONTEXT.md's "Deferred Ideas" section?
135
+ 3. **Missing dependency phase**: Does the plan depend on a phase that does not exist in ROADMAP.md?
136
+ 4. **Incomplete dependency phase**: Does the plan depend on a phase that is not complete (no SUMMARY.md with status: complete)?
137
+ 5. **Architecture mismatch**: Do files referenced in the plan already exist with different architecture than the plan assumes?
138
+ 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.
139
+
140
+ #### WARNING checks (user should review):
141
+ Run each of these checks. If any matches, record a `[WARNING]`:
142
+
143
+ 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.
144
+ 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.
145
+ 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.
146
+ 4. **Stale dependencies**: Does the plan assume prior phase output that has changed since the plan was written?
147
+ 5. **Todo overlap**: Does the plan scope overlap with a pending todo in `.planning/todos/pending/`?
148
+ 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/).
149
+ 7. **Dependency ordering conflict**: Does the plan's task ordering conflict with the dependency graph implied by file dependencies?
150
+
151
+ #### INFO checks (supplementary context):
152
+ Run each of these checks. If any matches, record an `[INFO]`:
153
+
154
+ 1. **Related notes**: Are there related notes in NOTES.md?
155
+ 2. **Matching seeds**: Are there matching seeds in `.planning/seeds/` that could enhance the plan?
156
+ 3. **Prior phase patterns**: What patterns from prior phases (from SUMMARY.md `patterns` fields) should the imported plan follow?
157
+
158
+ #### Output format (MANDATORY — do not deviate)
159
+
160
+ 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:
161
+
162
+ ```
163
+ ## Conflict Detection Report
164
+
165
+ ### BLOCKERS ({count})
166
+
167
+ [BLOCKER] {Short title}
168
+ Found: {what the imported plan says or does}
169
+ Expected: {what the project context requires}
170
+ → {Specific action to resolve}
171
+
172
+ [BLOCKER] {Short title}
173
+ Found: ...
174
+ Expected: ...
175
+ → ...
176
+
177
+ ### WARNINGS ({count})
178
+
179
+ [WARNING] {Short title}
180
+ Found: {what was detected}
181
+ Impact: {what could go wrong if not addressed}
182
+ → {Suggested action}
183
+
184
+ ### INFO ({count})
185
+
186
+ [INFO] {Short title}
187
+ Note: {relevant information or suggestion}
188
+ ```
189
+
190
+ #### After presenting the report
191
+
192
+ **IMPORTANT: Always present ALL findings (blockers + warnings + info) together in one report before taking any action.**
193
+
194
+ - 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.
195
+ - 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.
196
+ - If no findings: "No conflicts detected. Proceeding with conversion."
197
+
198
+ ---
199
+
200
+ ### Step 5: Convert to PLAN.md Format (inline)
201
+
202
+ Using the imported document (adjusted for any blocker resolutions from Step 4) and the loaded project context, generate PLAN.md content.
203
+
204
+ **YAML frontmatter — ALL required fields:**
205
+ ```yaml
206
+ ---
207
+ phase: "{NN}-{slug}"
208
+ plan: "{phase}-{plan_num}"
209
+ type: "{task type: feature, refactor, config, test, docs}"
210
+ wave: {wave number — 1 for independent plans, 2+ for dependent plans}
211
+ depends_on: [{list of plan IDs this plan depends on}]
212
+ files_modified: [{list of files this plan creates or modifies}]
213
+ autonomous: {true if no checkpoints needed, false if human input required}
214
+ discovery:
215
+ approach: "{brief description of what this plan accomplishes}"
216
+ open_questions: [{any unresolved questions from the import}]
217
+ must_haves:
218
+ truths: [{core invariants this plan must satisfy}]
219
+ artifacts: [{files that must exist after execution}]
220
+ key_links: [{connections to other parts of the system}]
221
+ provides: [{what downstream plans can depend on from this plan}]
222
+ gap_closure: {false for standard plans, true if closing gaps}
223
+ ---
224
+ ```
225
+
226
+ **Task XML — for each task in the plan:**
227
+ ```xml
228
+ <task id="{plan_id}-T{N}">
229
+ <name>{Imperative task name}</name>
230
+ <files>{comma-separated list of files this task touches}</files>
231
+ <action>
232
+ {Step-by-step implementation instructions — specific enough for an executor agent to follow mechanically.}
233
+ {Include exact file paths, function signatures, import statements.}
234
+ </action>
235
+ <verify>
236
+ {Concrete verification commands: test commands, grep checks, build commands.}
237
+ {Each verify step must be runnable from the command line.}
238
+ </verify>
239
+ <done>{One-sentence definition of done for this task.}</done>
240
+ </task>
241
+ ```
242
+
243
+ **Scope rules:**
244
+ - 2-3 tasks per plan, 5-8 files per plan maximum
245
+ - If the imported document is too large for a single plan: split by subsystem into multiple plans with wave ordering
246
+ - 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: ... -->`
247
+
248
+ **Wave assignment:**
249
+ - Plans with no inter-dependencies: wave 1 (can run in parallel)
250
+ - Plans that depend on wave 1 outputs: wave 2
251
+ - Continue numbering for deeper dependency chains
252
+
253
+ ---
254
+
255
+ ### Step 6: Plan Checker (delegated, unless --skip-checker)
256
+
257
+ **Skip this step if:**
258
+ - `--skip-checker` flag is set
259
+ - `features.plan_checking` is `false` in config
260
+
261
+ **If validation is enabled:**
262
+
263
+ Display to the user: `◐ Spawning plan checker...`
264
+
265
+ Spawn the plan checker Task():
266
+
267
+ ```
268
+ Task({
269
+ subagent_type: "pbr:plan-checker",
270
+ prompt: <checker prompt>
271
+ })
272
+ ```
273
+
274
+ **Checker Prompt Template:**
275
+ ```
276
+ You are the plan-checker agent.
277
+
278
+ <plans_to_check>
279
+ {For each generated PLAN.md:}
280
+ --- Plan File: {filename} ---
281
+ [Inline the FULL content of each plan file]
282
+ --- End Plan File ---
283
+ </plans_to_check>
284
+
285
+ <phase_context>
286
+ Phase goal: {goal from roadmap}
287
+ Phase requirements: {REQ-IDs}
288
+ </phase_context>
289
+
290
+ <context>
291
+ {Inline .planning/CONTEXT.md if it exists — project-level locked decisions}
292
+ {Inline .planning/phases/{NN}-{slug}/CONTEXT.md if it exists — phase-level locked decisions}
293
+ </context>
294
+
295
+ <import_note>
296
+ These plans were imported from an external document, not generated by the standard planner.
297
+ Pay extra attention to:
298
+ - Consistency with project conventions
299
+ - Completeness of verify steps
300
+ - Accuracy of files_modified lists
301
+ - Whether task actions are specific enough for mechanical execution
302
+ </import_note>
303
+
304
+ Run all verification dimensions on these plans. Return your structured report.
305
+ Do NOT write any files. Return your findings as your response text.
306
+ ```
307
+
308
+ **Process checker results — revision loop:**
309
+
310
+ Reference: `skills/shared/revision-loop.md` for the full Check-Revise-Escalate pattern (max 3 iterations).
311
+
312
+ Follow the revision loop with:
313
+ - **Producer**: orchestrator (inline plan revision)
314
+ - **Checker**: plan-checker (re-run Step 6)
315
+ - **Escalation**: present issues to user, offer "Proceed anyway" or "Adjust approach" (re-enter Step 5)
316
+
317
+ ---
318
+
319
+ ### Step 7: Write PLAN.md Files (inline)
320
+
321
+ Write each plan to `.planning/phases/{NN}-{slug}/{phase}-{plan_num}-PLAN.md`.
322
+
323
+ If existing plans are being replaced (user confirmed in Step 1):
324
+ - Delete existing `*-PLAN.md` files in the phase directory before writing new ones
325
+
326
+ ---
327
+
328
+ ### Step 8: Update All State (inline)
329
+
330
+ Perform all state updates in this order:
331
+
332
+ **8a. Update ROADMAP.md Progress table** (REQUIRED — do this BEFORE updating STATE.md):
333
+ 1. Open `.planning/ROADMAP.md`
334
+ 2. Find the `## Progress` table
335
+ 3. Locate the row matching this phase number
336
+ 4. Update the `Plans Complete` column to `0/{N}` where N = number of plan files created
337
+ 5. Update the `Status` column to `planned`
338
+ 6. Save the file — do NOT skip this step
339
+
340
+ **8b. Update STATE.md:**
341
+ - Set current phase plan status to "planned"
342
+ - Note source: "imported from {filepath}" or "imported from user input"
343
+ - Update plan count
344
+
345
+ **8c. Generate dependency fingerprints:**
346
+ For each dependency phase (phases that this phase depends on, per ROADMAP.md):
347
+ 1. Find all SUMMARY.md files in the dependency phase directory
348
+ 2. Compute a fingerprint for each: file byte length + last-modified timestamp
349
+ 3. Add a `dependency_fingerprints` field to each plan's YAML frontmatter:
350
+ ```yaml
351
+ dependency_fingerprints:
352
+ "01-01": "len:4856-mod:2025-02-08T09:40"
353
+ "01-02": "len:4375-mod:2025-02-08T09:43"
354
+ ```
355
+
356
+ **8d. Update CONTEXT.md (conditional):**
357
+ If the import process surfaced new locked decisions (from blocker resolutions in Step 4), append them to `.planning/CONTEXT.md` under the Decisions section.
358
+
359
+ **8e. Emit workflow event (conditional):**
360
+ If the event-logger script is available:
361
+ ```bash
362
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js event workflow plan-import --phase {N} --plans {count} --source {filepath_or_user_input}
363
+ ```
364
+ Falls back silently if the command is not available.
365
+
366
+ ---
367
+
368
+ ### Step 9: Commit (if planning.commit_docs: true in config)
369
+
370
+ Reference: `skills/shared/commit-planning-docs.md` for the standard commit pattern.
371
+
372
+ Stage the new PLAN.md files and any updated state files:
373
+ ```
374
+ docs({phase}): import plans for phase {N} ({count} plans, {wave_count} waves)
375
+ ```
376
+
377
+ ---
378
+
379
+ ### Step 10: Confirm (inline)
380
+
381
+ Present a summary of the import using the branded banner:
382
+
383
+ ```
384
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
385
+ PLAN-BUILD-RUN ► IMPORT COMPLETE ✓
386
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
387
+
388
+ **Phase {N}: {name}** — {plan_count} plans imported
389
+
390
+ Source: {filepath or "user input"}
391
+ Conflicts resolved: {count of blockers resolved in Step 4}
392
+ Warnings acknowledged: {count}
393
+
394
+ Plans:
395
+ {phase}-01: {plan name} (Wave {W}, {task_count} tasks)
396
+ {phase}-02: {plan name} (Wave {W}, {task_count} tasks)
397
+
398
+ Wave execution order:
399
+ Wave 1: Plan 01, Plan 02 (parallel)
400
+ Wave 2: Plan 03 (depends on 01, 02)
401
+
402
+ Must-haves coverage: {count} truths across {plan_count} plans
403
+ Requirements traced: {count}/{total} REQ-IDs covered
404
+
405
+ ───────────────────────────────────────────────────────────────
406
+
407
+ ## ▶ Next Up
408
+
409
+ **Build Phase {N}** — execute these imported plans
410
+
411
+ `/pbr:build {N}`
412
+
413
+ <sub>`/clear` first → fresh context window</sub>
414
+
415
+ ───────────────────────────────────────────────────────────────
416
+
417
+ **Also available:**
418
+ - `/pbr:plan {N}` — re-plan from scratch if import needs rework
419
+ - `/pbr:discuss {N}` — talk through details before building
420
+
421
+ ───────────────────────────────────────────────────────────────
422
+ ```
423
+
424
+ ---
425
+
426
+ ## Error Handling
427
+
428
+ ### Phase not found
429
+ If the specified phase does not exist in ROADMAP.md, display:
430
+ ```
431
+ ╔══════════════════════════════════════════════════════════════╗
432
+ ║ ERROR ║
433
+ ╚══════════════════════════════════════════════════════════════╝
434
+
435
+ Phase {N} not found.
436
+
437
+ **To fix:** Run `/pbr:status` to see available phases.
438
+ ```
439
+
440
+ ### Missing prerequisites
441
+ If REQUIREMENTS.md or ROADMAP.md do not exist, display:
442
+ ```
443
+ ╔══════════════════════════════════════════════════════════════╗
444
+ ║ ERROR ║
445
+ ╚══════════════════════════════════════════════════════════════╝
446
+
447
+ Project not initialized.
448
+
449
+ **To fix:** Run `/pbr:begin` first.
450
+ ```
451
+
452
+ ### Import file not found
453
+ If `--from <filepath>` points to a nonexistent file, display:
454
+ ```
455
+ ╔══════════════════════════════════════════════════════════════╗
456
+ ║ ERROR ║
457
+ ╚══════════════════════════════════════════════════════════════╝
458
+
459
+ File not found: {filepath}
460
+
461
+ **To fix:** Check the path and try again.
462
+ ```
463
+
464
+ ### Import document too vague
465
+ If the imported document contains no actionable tasks, display:
466
+ ```
467
+ ╔══════════════════════════════════════════════════════════════╗
468
+ ║ ERROR ║
469
+ ╚══════════════════════════════════════════════════════════════╝
470
+
471
+ The imported document is too vague to convert into plans. No specific tasks, files, or implementation steps found.
472
+
473
+ **To fix:** Provide a more detailed document, or use `/pbr:plan {N}` to generate plans from scratch.
474
+ ```
475
+
476
+ ### Checker loops without resolution
477
+ After 3 revision iterations without passing, display:
478
+ ```
479
+ ╔══════════════════════════════════════════════════════════════╗
480
+ ║ ERROR ║
481
+ ╚══════════════════════════════════════════════════════════════╝
482
+
483
+ Import plan checker failed to pass after 3 revision iterations.
484
+
485
+ **To fix:** Review the remaining issues below and decide whether to proceed or revise manually.
486
+ ```
487
+
488
+ Present remaining issues and ask user to decide: proceed or intervene.
489
+
490
+ ---
491
+
492
+ ## Files Created/Modified by /pbr:import
493
+
494
+ | File | Purpose | When |
495
+ |------|---------|------|
496
+ | `.planning/phases/{NN}-{slug}/{phase}-{NN}-PLAN.md` | Imported plan files | Step 7 |
497
+ | `.planning/ROADMAP.md` | Plans Complete + Status updated to `planned` | Step 8a |
498
+ | `.planning/STATE.md` | Updated with plan status and import source | Step 8b |
499
+ | `.planning/CONTEXT.md` | Updated if blockers surfaced new locked decisions | Step 8d |