@sienklogic/plan-build-run 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/CLAUDE.md +149 -0
  3. package/LICENSE +21 -0
  4. package/README.md +247 -0
  5. package/dashboard/bin/cli.js +25 -0
  6. package/dashboard/package.json +34 -0
  7. package/dashboard/public/.gitkeep +0 -0
  8. package/dashboard/public/css/layout.css +406 -0
  9. package/dashboard/public/css/status-colors.css +98 -0
  10. package/dashboard/public/js/htmx-title.js +5 -0
  11. package/dashboard/public/js/sidebar-toggle.js +20 -0
  12. package/dashboard/src/app.js +78 -0
  13. package/dashboard/src/middleware/errorHandler.js +52 -0
  14. package/dashboard/src/middleware/notFoundHandler.js +9 -0
  15. package/dashboard/src/repositories/planning.repository.js +128 -0
  16. package/dashboard/src/routes/events.routes.js +40 -0
  17. package/dashboard/src/routes/index.routes.js +31 -0
  18. package/dashboard/src/routes/pages.routes.js +195 -0
  19. package/dashboard/src/server.js +42 -0
  20. package/dashboard/src/services/dashboard.service.js +222 -0
  21. package/dashboard/src/services/phase.service.js +167 -0
  22. package/dashboard/src/services/project.service.js +57 -0
  23. package/dashboard/src/services/roadmap.service.js +171 -0
  24. package/dashboard/src/services/sse.service.js +58 -0
  25. package/dashboard/src/services/todo.service.js +254 -0
  26. package/dashboard/src/services/watcher.service.js +48 -0
  27. package/dashboard/src/views/coming-soon.ejs +11 -0
  28. package/dashboard/src/views/error.ejs +13 -0
  29. package/dashboard/src/views/index.ejs +5 -0
  30. package/dashboard/src/views/layout.ejs +1 -0
  31. package/dashboard/src/views/partials/dashboard-content.ejs +77 -0
  32. package/dashboard/src/views/partials/footer.ejs +3 -0
  33. package/dashboard/src/views/partials/head.ejs +21 -0
  34. package/dashboard/src/views/partials/header.ejs +12 -0
  35. package/dashboard/src/views/partials/layout-bottom.ejs +15 -0
  36. package/dashboard/src/views/partials/layout-top.ejs +8 -0
  37. package/dashboard/src/views/partials/phase-content.ejs +181 -0
  38. package/dashboard/src/views/partials/phases-content.ejs +117 -0
  39. package/dashboard/src/views/partials/roadmap-content.ejs +142 -0
  40. package/dashboard/src/views/partials/sidebar.ejs +38 -0
  41. package/dashboard/src/views/partials/todo-create-content.ejs +53 -0
  42. package/dashboard/src/views/partials/todo-detail-content.ejs +38 -0
  43. package/dashboard/src/views/partials/todos-content.ejs +53 -0
  44. package/dashboard/src/views/phase-detail.ejs +5 -0
  45. package/dashboard/src/views/phases.ejs +5 -0
  46. package/dashboard/src/views/roadmap.ejs +5 -0
  47. package/dashboard/src/views/todo-create.ejs +5 -0
  48. package/dashboard/src/views/todo-detail.ejs +5 -0
  49. package/dashboard/src/views/todos.ejs +5 -0
  50. package/package.json +57 -0
  51. package/plugins/pbr/.claude-plugin/plugin.json +13 -0
  52. package/plugins/pbr/UI-CONSISTENCY-GAPS.md +61 -0
  53. package/plugins/pbr/agents/codebase-mapper.md +271 -0
  54. package/plugins/pbr/agents/debugger.md +281 -0
  55. package/plugins/pbr/agents/executor.md +407 -0
  56. package/plugins/pbr/agents/general.md +164 -0
  57. package/plugins/pbr/agents/integration-checker.md +141 -0
  58. package/plugins/pbr/agents/plan-checker.md +280 -0
  59. package/plugins/pbr/agents/planner.md +358 -0
  60. package/plugins/pbr/agents/researcher.md +363 -0
  61. package/plugins/pbr/agents/synthesizer.md +230 -0
  62. package/plugins/pbr/agents/verifier.md +454 -0
  63. package/plugins/pbr/commands/begin.md +5 -0
  64. package/plugins/pbr/commands/build.md +5 -0
  65. package/plugins/pbr/commands/config.md +5 -0
  66. package/plugins/pbr/commands/continue.md +5 -0
  67. package/plugins/pbr/commands/debug.md +5 -0
  68. package/plugins/pbr/commands/discuss.md +5 -0
  69. package/plugins/pbr/commands/explore.md +5 -0
  70. package/plugins/pbr/commands/health.md +5 -0
  71. package/plugins/pbr/commands/help.md +5 -0
  72. package/plugins/pbr/commands/import.md +5 -0
  73. package/plugins/pbr/commands/milestone.md +5 -0
  74. package/plugins/pbr/commands/note.md +5 -0
  75. package/plugins/pbr/commands/pause.md +5 -0
  76. package/plugins/pbr/commands/plan.md +5 -0
  77. package/plugins/pbr/commands/quick.md +5 -0
  78. package/plugins/pbr/commands/resume.md +5 -0
  79. package/plugins/pbr/commands/review.md +5 -0
  80. package/plugins/pbr/commands/scan.md +5 -0
  81. package/plugins/pbr/commands/setup.md +5 -0
  82. package/plugins/pbr/commands/status.md +5 -0
  83. package/plugins/pbr/commands/todo.md +5 -0
  84. package/plugins/pbr/contexts/dev.md +27 -0
  85. package/plugins/pbr/contexts/research.md +28 -0
  86. package/plugins/pbr/contexts/review.md +36 -0
  87. package/plugins/pbr/hooks/hooks.json +183 -0
  88. package/plugins/pbr/references/agent-anti-patterns.md +24 -0
  89. package/plugins/pbr/references/agent-interactions.md +134 -0
  90. package/plugins/pbr/references/agent-teams.md +54 -0
  91. package/plugins/pbr/references/checkpoints.md +157 -0
  92. package/plugins/pbr/references/common-bug-patterns.md +13 -0
  93. package/plugins/pbr/references/continuation-format.md +212 -0
  94. package/plugins/pbr/references/deviation-rules.md +112 -0
  95. package/plugins/pbr/references/git-integration.md +226 -0
  96. package/plugins/pbr/references/integration-patterns.md +117 -0
  97. package/plugins/pbr/references/model-profiles.md +99 -0
  98. package/plugins/pbr/references/model-selection.md +31 -0
  99. package/plugins/pbr/references/pbr-rules.md +193 -0
  100. package/plugins/pbr/references/plan-authoring.md +181 -0
  101. package/plugins/pbr/references/plan-format.md +283 -0
  102. package/plugins/pbr/references/planning-config.md +213 -0
  103. package/plugins/pbr/references/questioning.md +214 -0
  104. package/plugins/pbr/references/reading-verification.md +127 -0
  105. package/plugins/pbr/references/stub-patterns.md +160 -0
  106. package/plugins/pbr/references/subagent-coordination.md +119 -0
  107. package/plugins/pbr/references/ui-formatting.md +399 -0
  108. package/plugins/pbr/references/verification-patterns.md +198 -0
  109. package/plugins/pbr/references/wave-execution.md +95 -0
  110. package/plugins/pbr/scripts/auto-continue.js +80 -0
  111. package/plugins/pbr/scripts/check-dangerous-commands.js +136 -0
  112. package/plugins/pbr/scripts/check-doc-sprawl.js +102 -0
  113. package/plugins/pbr/scripts/check-phase-boundary.js +196 -0
  114. package/plugins/pbr/scripts/check-plan-format.js +270 -0
  115. package/plugins/pbr/scripts/check-roadmap-sync.js +252 -0
  116. package/plugins/pbr/scripts/check-skill-workflow.js +262 -0
  117. package/plugins/pbr/scripts/check-state-sync.js +476 -0
  118. package/plugins/pbr/scripts/check-subagent-output.js +144 -0
  119. package/plugins/pbr/scripts/config-schema.json +251 -0
  120. package/plugins/pbr/scripts/context-budget-check.js +287 -0
  121. package/plugins/pbr/scripts/event-handler.js +151 -0
  122. package/plugins/pbr/scripts/event-logger.js +92 -0
  123. package/plugins/pbr/scripts/hook-logger.js +76 -0
  124. package/plugins/pbr/scripts/hooks-schema.json +79 -0
  125. package/plugins/pbr/scripts/log-subagent.js +152 -0
  126. package/plugins/pbr/scripts/log-tool-failure.js +88 -0
  127. package/plugins/pbr/scripts/pbr-tools.js +1301 -0
  128. package/plugins/pbr/scripts/post-write-dispatch.js +66 -0
  129. package/plugins/pbr/scripts/post-write-quality.js +207 -0
  130. package/plugins/pbr/scripts/pre-bash-dispatch.js +56 -0
  131. package/plugins/pbr/scripts/pre-write-dispatch.js +62 -0
  132. package/plugins/pbr/scripts/progress-tracker.js +228 -0
  133. package/plugins/pbr/scripts/session-cleanup.js +254 -0
  134. package/plugins/pbr/scripts/status-line.js +285 -0
  135. package/plugins/pbr/scripts/suggest-compact.js +119 -0
  136. package/plugins/pbr/scripts/task-completed.js +45 -0
  137. package/plugins/pbr/scripts/track-context-budget.js +119 -0
  138. package/plugins/pbr/scripts/validate-commit.js +200 -0
  139. package/plugins/pbr/scripts/validate-plugin-structure.js +172 -0
  140. package/plugins/pbr/skills/begin/SKILL.md +545 -0
  141. package/plugins/pbr/skills/begin/templates/PROJECT.md.tmpl +33 -0
  142. package/plugins/pbr/skills/begin/templates/REQUIREMENTS.md.tmpl +18 -0
  143. package/plugins/pbr/skills/begin/templates/STATE.md.tmpl +49 -0
  144. package/plugins/pbr/skills/begin/templates/config.json.tmpl +63 -0
  145. package/plugins/pbr/skills/begin/templates/researcher-prompt.md.tmpl +19 -0
  146. package/plugins/pbr/skills/begin/templates/roadmap-prompt.md.tmpl +30 -0
  147. package/plugins/pbr/skills/begin/templates/synthesis-prompt.md.tmpl +16 -0
  148. package/plugins/pbr/skills/build/SKILL.md +962 -0
  149. package/plugins/pbr/skills/config/SKILL.md +241 -0
  150. package/plugins/pbr/skills/continue/SKILL.md +127 -0
  151. package/plugins/pbr/skills/debug/SKILL.md +489 -0
  152. package/plugins/pbr/skills/debug/templates/continuation-prompt.md.tmpl +16 -0
  153. package/plugins/pbr/skills/debug/templates/initial-investigation-prompt.md.tmpl +27 -0
  154. package/plugins/pbr/skills/discuss/SKILL.md +338 -0
  155. package/plugins/pbr/skills/discuss/templates/CONTEXT.md.tmpl +61 -0
  156. package/plugins/pbr/skills/discuss/templates/decision-categories.md +9 -0
  157. package/plugins/pbr/skills/explore/SKILL.md +362 -0
  158. package/plugins/pbr/skills/health/SKILL.md +186 -0
  159. package/plugins/pbr/skills/health/templates/check-pattern.md.tmpl +30 -0
  160. package/plugins/pbr/skills/health/templates/output-format.md.tmpl +63 -0
  161. package/plugins/pbr/skills/help/SKILL.md +140 -0
  162. package/plugins/pbr/skills/import/SKILL.md +490 -0
  163. package/plugins/pbr/skills/milestone/SKILL.md +673 -0
  164. package/plugins/pbr/skills/milestone/templates/audit-report.md.tmpl +48 -0
  165. package/plugins/pbr/skills/milestone/templates/stats-file.md.tmpl +30 -0
  166. package/plugins/pbr/skills/note/SKILL.md +212 -0
  167. package/plugins/pbr/skills/pause/SKILL.md +235 -0
  168. package/plugins/pbr/skills/pause/templates/continue-here.md.tmpl +71 -0
  169. package/plugins/pbr/skills/plan/SKILL.md +628 -0
  170. package/plugins/pbr/skills/plan/decimal-phase-calc.md +98 -0
  171. package/plugins/pbr/skills/plan/templates/checker-prompt.md.tmpl +21 -0
  172. package/plugins/pbr/skills/plan/templates/gap-closure-prompt.md.tmpl +32 -0
  173. package/plugins/pbr/skills/plan/templates/planner-prompt.md.tmpl +38 -0
  174. package/plugins/pbr/skills/plan/templates/researcher-prompt.md.tmpl +19 -0
  175. package/plugins/pbr/skills/plan/templates/revision-prompt.md.tmpl +23 -0
  176. package/plugins/pbr/skills/quick/SKILL.md +335 -0
  177. package/plugins/pbr/skills/resume/SKILL.md +388 -0
  178. package/plugins/pbr/skills/review/SKILL.md +652 -0
  179. package/plugins/pbr/skills/review/templates/debugger-prompt.md.tmpl +60 -0
  180. package/plugins/pbr/skills/review/templates/gap-planner-prompt.md.tmpl +40 -0
  181. package/plugins/pbr/skills/review/templates/verifier-prompt.md.tmpl +115 -0
  182. package/plugins/pbr/skills/scan/SKILL.md +269 -0
  183. package/plugins/pbr/skills/scan/templates/mapper-prompt.md.tmpl +201 -0
  184. package/plugins/pbr/skills/setup/SKILL.md +227 -0
  185. package/plugins/pbr/skills/shared/commit-planning-docs.md +35 -0
  186. package/plugins/pbr/skills/shared/config-loading.md +102 -0
  187. package/plugins/pbr/skills/shared/context-budget.md +40 -0
  188. package/plugins/pbr/skills/shared/context-loader-task.md +86 -0
  189. package/plugins/pbr/skills/shared/digest-select.md +79 -0
  190. package/plugins/pbr/skills/shared/domain-probes.md +125 -0
  191. package/plugins/pbr/skills/shared/error-reporting.md +79 -0
  192. package/plugins/pbr/skills/shared/gate-prompts.md +388 -0
  193. package/plugins/pbr/skills/shared/phase-argument-parsing.md +45 -0
  194. package/plugins/pbr/skills/shared/progress-display.md +53 -0
  195. package/plugins/pbr/skills/shared/revision-loop.md +81 -0
  196. package/plugins/pbr/skills/shared/state-loading.md +62 -0
  197. package/plugins/pbr/skills/shared/state-update.md +161 -0
  198. package/plugins/pbr/skills/shared/universal-anti-patterns.md +33 -0
  199. package/plugins/pbr/skills/status/SKILL.md +353 -0
  200. package/plugins/pbr/skills/todo/SKILL.md +181 -0
  201. package/plugins/pbr/templates/CONTEXT.md.tmpl +52 -0
  202. package/plugins/pbr/templates/INTEGRATION-REPORT.md.tmpl +151 -0
  203. package/plugins/pbr/templates/RESEARCH-SUMMARY.md.tmpl +97 -0
  204. package/plugins/pbr/templates/ROADMAP.md.tmpl +40 -0
  205. package/plugins/pbr/templates/SUMMARY.md.tmpl +81 -0
  206. package/plugins/pbr/templates/VERIFICATION-DETAIL.md.tmpl +116 -0
  207. package/plugins/pbr/templates/codebase/ARCHITECTURE.md.tmpl +98 -0
  208. package/plugins/pbr/templates/codebase/CONCERNS.md.tmpl +93 -0
  209. package/plugins/pbr/templates/codebase/CONVENTIONS.md.tmpl +104 -0
  210. package/plugins/pbr/templates/codebase/INTEGRATIONS.md.tmpl +78 -0
  211. package/plugins/pbr/templates/codebase/STACK.md.tmpl +78 -0
  212. package/plugins/pbr/templates/codebase/STRUCTURE.md.tmpl +80 -0
  213. package/plugins/pbr/templates/codebase/TESTING.md.tmpl +107 -0
  214. package/plugins/pbr/templates/continue-here.md.tmpl +73 -0
  215. package/plugins/pbr/templates/prompt-partials/phase-project-context.md.tmpl +37 -0
  216. package/plugins/pbr/templates/research/ARCHITECTURE.md.tmpl +124 -0
  217. package/plugins/pbr/templates/research/STACK.md.tmpl +71 -0
  218. package/plugins/pbr/templates/research/SUMMARY.md.tmpl +112 -0
  219. package/plugins/pbr/templates/research-outputs/phase-research.md.tmpl +81 -0
  220. package/plugins/pbr/templates/research-outputs/project-research.md.tmpl +99 -0
  221. package/plugins/pbr/templates/research-outputs/synthesis.md.tmpl +36 -0
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: help
3
+ description: "Command reference and workflow guide for Plan-Build-Run."
4
+ allowed-tools: Read
5
+ ---
6
+
7
+ # /pbr:help — Plan-Build-Run Command Reference
8
+
9
+ ## Contextual Help
10
+
11
+ 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.
12
+
13
+ Examples:
14
+ - `/pbr:help plan` → Show only the plan command and its flags (--assumptions, --skip-research, --gaps, add, insert, remove)
15
+ - `/pbr:help build` → Show only the build command and its flags (--gaps-only, --team)
16
+ - `/pbr:help` → Show the full reference below
17
+
18
+ ## Full Reference
19
+
20
+ Display the following reference to the user:
21
+
22
+ ---
23
+
24
+ ## Plan-Build-Run Commands
25
+
26
+ ### Core Workflow (the main loop)
27
+
28
+ | Command | Description | Cost |
29
+ |---------|-------------|------|
30
+ | `/pbr:begin` | Start a new project. Deep questioning, research, requirements, roadmap. | High (4-6 agents) |
31
+ | `/pbr:plan <N>` | Plan a phase. Research, create plans, verify before building. | Medium (2-3 agents) |
32
+ | `/pbr:build <N>` | Build a phase. Execute plans in parallel waves, verify results. | High (2-4 agents) |
33
+ | `/pbr:review <N>` | Review what was built. Automated verification + walkthrough with you. | Low (1 agent) |
34
+
35
+ ### Planning & Discovery
36
+
37
+ | Command | Description |
38
+ |---------|-------------|
39
+ | `/pbr:explore [topic]` | Explore ideas, think through approaches. No phase number needed. |
40
+ | `/pbr:discuss <N>` | Talk through a phase before planning. Captures decisions. |
41
+ | `/pbr:plan <N> --assumptions` | Surface Claude's assumptions before planning. Zero cost. |
42
+ | `/pbr:plan <N> --skip-research` | Plan without research phase. Faster. |
43
+ | `/pbr:plan <N> --gaps` | Create gap-closure plans from verification failures. |
44
+ | `/pbr:plan add` | Append a new phase to the roadmap. |
45
+ | `/pbr:plan insert <N>` | Insert a phase using decimal numbering. |
46
+ | `/pbr:plan remove <N>` | Remove a future phase and renumber. |
47
+
48
+ ### Execution
49
+
50
+ | Command | Description |
51
+ |---------|-------------|
52
+ | `/pbr:build <N>` | Execute all plans in a phase. |
53
+ | `/pbr:build <N> --gaps-only` | Execute only gap-closure plans. |
54
+ | `/pbr:build <N> --team` | Use Agent Teams for complex inter-agent coordination. |
55
+ | `/pbr:quick` | Quick ad-hoc task with atomic commit. Low cost. |
56
+ | `/pbr:continue` | Execute the next logical step automatically. No prompts. |
57
+
58
+ ### Verification & Debugging
59
+
60
+ | Command | Description |
61
+ |---------|-------------|
62
+ | `/pbr:review <N>` | Verify phase + conversational UAT. |
63
+ | `/pbr:review <N> --auto-fix` | Auto-diagnose and fix verification failures. |
64
+ | `/pbr:debug` | Systematic debugging with hypothesis testing. |
65
+ | `/pbr:scan` | Analyze existing codebase (brownfield). |
66
+
67
+ ### Session Management
68
+
69
+ | Command | Description |
70
+ |---------|-------------|
71
+ | `/pbr:status` | Where am I? Shows progress and suggests next action. |
72
+ | `/pbr:health` | Check planning directory integrity. Find and fix corrupted state. |
73
+ | `/pbr:pause` | Save session state for later. |
74
+ | `/pbr:resume` | Pick up where you left off. |
75
+
76
+ ### Project Management
77
+
78
+ | Command | Description |
79
+ |---------|-------------|
80
+ | `/pbr:milestone new` | Start a new milestone cycle. |
81
+ | `/pbr:milestone complete` | Archive completed milestone. |
82
+ | `/pbr:milestone audit` | Verify milestone completion. |
83
+ | `/pbr:milestone gaps` | Create phases to close audit gaps. |
84
+ | `/pbr:todo add\|list\|done` | Persistent file-based todos. |
85
+ | `/pbr:note <text>\|list\|promote` | Zero-friction idea capture. Quick notes that persist across sessions. |
86
+ | `/pbr:config` | Configure workflow settings. |
87
+ | `/pbr:setup` | Interactive onboarding wizard for new projects. |
88
+
89
+ ## Typical Workflow
90
+
91
+ ```
92
+ /pbr:begin ← Start project, define requirements, create roadmap
93
+ /pbr:discuss 1 ← (optional) Talk through phase details
94
+ /pbr:plan 1 ← Plan the first phase
95
+ /pbr:build 1 ← Build it
96
+ /pbr:review 1 ← Verify it works
97
+ /pbr:plan 2 ← Plan the next phase
98
+ ... ← Repeat plan → build → review
99
+ /pbr:milestone complete ← Archive when done
100
+ ```
101
+
102
+ ## Quick Reference
103
+
104
+ - **Context strategy**: `aggressive` (delegate everything) | `balanced` | `minimal` (run inline)
105
+ - **Depth**: `quick` (skip research, ~50% cheaper) | `standard` | `comprehensive` (~2x cost)
106
+ - **State files**: `.planning/STATE.md` (position), `.planning/ROADMAP.md` (phases), `.planning/config.json` (settings)
107
+ - **Configure**: `/pbr:config` to change depth, models, gates, parallelization
108
+ - **Tip**: Use `/pbr:quick` for creative/visual work where structured planning adds overhead without benefit.
109
+ - **PR hygiene**: When creating PRs from a Plan-Build-Run project, `.planning/` commits can be filtered using phase branching (`git.branching_strategy: phase`) which squash-merges code-only changes to main.
110
+ - **Seeds**: `/pbr:explore` can create seed files (`.planning/seeds/`) with trigger conditions. Seeds auto-inject into planning when their trigger phase is reached.
111
+
112
+ ## Behavioral Contexts
113
+
114
+ Plan-Build-Run includes three behavioral contexts in `contexts/` that adjust how Claude operates:
115
+
116
+ - **dev** — Active development: write code first, low verbosity, medium risk tolerance
117
+ - **research** — Exploration mode: read widely, no code writing, high verbosity, evidence-based
118
+ - **review** — Code review: read thoroughly, prioritize by severity, report don't fix
119
+
120
+ Skills automatically activate the appropriate context: `/pbr:build` uses dev context, `/pbr:discuss` uses research context, `/pbr:review` uses review context.
121
+
122
+ ## Getting Started
123
+
124
+ ```
125
+ ───────────────────────────────────────────────────────────────
126
+
127
+ ## ▶ Next Up
128
+
129
+ → `/pbr:begin` — start a new project
130
+ → `/pbr:status` — check current project status
131
+ → `/pbr:config` — configure workflow settings
132
+ → `/pbr:help <command>` — detailed help for a specific command
133
+
134
+ ───────────────────────────────────────────────────────────────
135
+ ```
136
+
137
+ ## Getting Help
138
+
139
+ - GitHub Issues: https://github.com/SienkLogic/plan-build-run/issues
140
+ - README: https://github.com/SienkLogic/plan-build-run
@@ -0,0 +1,490 @@
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 |