@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,545 +1,594 @@
1
- ---
2
- name: begin
3
- description: "Start a new project. Deep questioning, research, requirements, and roadmap."
4
- allowed-tools: Read, Write, Bash, Glob, Grep, WebFetch, WebSearch, Task, AskUserQuestion
5
- ---
6
-
7
- # /pbr:begin Project Initialization
8
-
9
- You are the orchestrator for `/pbr:begin`. This skill initializes a new Plan-Build-Run project through deep questioning, optional research, requirements scoping, and roadmap generation. Your job is to stay lean delegate heavy work to Task() subagents and keep the user's main context window clean.
10
-
11
- ## Context Budget
12
-
13
- Reference: `skills/shared/context-budget.md` for the universal orchestrator rules.
14
-
15
- Additionally for this skill:
16
- - **Minimize** reading subagent output — read only summaries, not full research docs
17
- - **Delegate** all analysis work to subagents — the orchestrator routes, it doesn't analyze
18
-
19
- ## Prerequisites
20
-
21
- - Working directory should be the project root
22
- - No existing `.planning/` directory (or user confirms overwrite)
23
-
24
- ---
25
-
26
- ## Orchestration Flow
27
-
28
- Execute these steps in order. Each step specifies whether it runs inline (in your context) or is delegated to a subagent.
29
-
30
- ---
31
-
32
- ### Step 1: Detect Brownfield (inline)
33
-
34
- Check if the current directory has existing code:
35
-
36
- ```
37
- 1. Run: ls to check directory contents
38
- 2. Look for indicators of existing code:
39
- - package.json, requirements.txt, CMakeLists.txt, go.mod, Cargo.toml
40
- - src/, lib/, app/ directories
41
- - .git/ directory with commits
42
- 3. Check if .planning/ already exists
43
- ```
44
-
45
- **If existing code found:**
46
- Use the **yes-no** pattern from `skills/shared/gate-prompts.md`:
47
- question: "This looks like an existing codebase. Run /pbr:scan to analyze what's here first?"
48
- options:
49
- - label: "Yes, scan" description: "Run /pbr:scan first to analyze existing code"
50
- - label: "No, begin" description: "Proceed with /pbr:begin on top of existing code"
51
- - If user selects "Yes, scan": suggest `/pbr:scan` and stop
52
- - If user selects "No, begin": proceed to Step 2
53
-
54
- **If `.planning/` already exists:**
55
- Use the **yes-no** pattern from `skills/shared/gate-prompts.md`:
56
- question: "A .planning/ directory already exists. This will overwrite it. Continue?"
57
- options:
58
- - label: "Yes" description: "Overwrite existing planning directory"
59
- - label: "No" description: "Cancel — keep existing planning"
60
- - If user selects "No": stop
61
- - If user selects "Yes": proceed (existing directory will be overwritten during state initialization)
62
-
63
- ---
64
-
65
- ### Step 2: Deep Questioning (inline)
66
-
67
- **Reference**: Read `references/questioning.md` for technique details.
68
-
69
- Have a natural conversation to understand the user's vision. Do NOT present a form or checklist. Instead, have a flowing conversation that covers these areas organically:
70
-
71
- **Required context to gather:**
72
-
73
- 1. **What they want to build** — The core product/feature/system
74
- 2. **Problem being solved** Why does this need to exist? Who is it for?
75
- 3. **Success criteria**How will they know it works? What does "done" look like?
76
- 4. **Existing constraints** Technology choices already made, hosting, budget, timeline, team size
77
- 5. **Key decisions already made** — Framework, language, architecture preferences
78
- 6. **Edge cases and concerns** What worries them? What's the hardest part?
79
-
80
- **Conversation approach:**
81
- - Start broad: "What are you building?"
82
- - Go deeper on each answer: "What does that mean exactly?" "Show me an example."
83
- - Surface assumptions: "Why do you assume that?" "Have you considered X?"
84
- - Find edges: "What happens when...?" "What about...?"
85
- - Reveal motivation: "Why does that matter?"
86
- - Avoid leading questions — let the user define their vision
87
-
88
- **Keep going until you have:**
89
- - A clear, concrete understanding of what they want to build
90
- - At least 3 specific success criteria
91
- - Known constraints and decisions
92
- - A sense of complexity and scope
93
-
94
- **Anti-patterns:**
95
- - DO NOT present a bulleted checklist and ask them to fill it in
96
- - DO NOT ask all questions at once have a conversation
97
- - DO NOT assume technologieslet them tell you
98
- - DO NOT rushthis is the foundation for everything that follows
99
-
100
- ---
101
-
102
- ### Step 3: Workflow Preferences (inline)
103
-
104
- After understanding the project, configure the Plan-Build-Run workflow. Use AskUserQuestion for each preference below. Present them sequentially with conversational bridging (e.g., "Great. Next...") to keep the flow natural.
105
-
106
- **3a. Mode:**
107
- Use the **toggle-confirm** pattern from `skills/shared/gate-prompts.md`:
108
- question: "How do you want to work?"
109
- header: "Mode"
110
- options:
111
- - label: "Interactive" description: "Pause at key gates for your approval (default)"
112
- - label: "Autonomous" description: "Auto-proceed, only stop for critical decisions"
113
- - `interactive` (default) — confirm at gates (roadmap, plans, transitions)
114
- - `autonomous` — auto-proceed, only stop for critical decisions
115
-
116
- **3b. Depth:**
117
- Use the **depth-select** pattern from `skills/shared/gate-prompts.md`:
118
- question: "How thorough should planning be?"
119
- - `quick` — 3-5 phases, skip research, ~50% cheaper
120
- - `standard` (default) — 5-8 phases, includes research
121
- - `comprehensive` — 8-12 phases, full deep research, ~2x cost
122
-
123
- **3c. Parallelization:**
124
- Use the **toggle-confirm** pattern from `skills/shared/gate-prompts.md`:
125
- question: "Run multiple agents in parallel when plans are independent?"
126
- header: "Parallel"
127
- options:
128
- - label: "Enable" description: "Parallel execution of independent plans (default)"
129
- - label: "Disable" description: "Sequential execution only"
130
- - `enabled` (default) — parallel execution of independent plans
131
- - `disabled` sequential execution
132
-
133
- **3d. Git Branching:**
134
- Use the **git-strategy-select** pattern from `skills/shared/gate-prompts.md`:
135
- question: "Git branching strategy?"
136
- - `none` (default) — commit to current branch
137
- - `phase` create branch per phase
138
- - `milestone` create branch per milestone
139
-
140
- **3e. Commit Planning Docs:**
141
- Use the **yes-no** pattern from `skills/shared/gate-prompts.md`:
142
- question: "Should planning documents (.planning/ directory) be committed to git?"
143
- options:
144
- - label: "Yes" description: "Commit planning docs (default)"
145
- - label: "No" description: "Add .planning/ to .gitignore"
146
- - `yes` (default) — commit planning docs
147
- - `no` — add .planning/ to .gitignore
148
-
149
- **After gathering preferences:**
150
-
151
- 1. Read the config template from `skills/begin/templates/config.json.tmpl`
152
- 2. Apply the user's choices to the template
153
- 3. Create `.planning/` directory
154
- 4. Write `.planning/config.json` with the user's preferences
155
-
156
- **IMPORTANT**: This step MUST happen BEFORE research (Step 5) because depth controls how many researchers to spawn.
157
-
158
- ---
159
-
160
- ### Step 4: Research Decision (inline)
161
-
162
- Based on the depth setting from Step 3, determine the research approach:
163
-
164
- **Depth-to-Discovery mapping:**
165
-
166
- | Depth | Discovery Level | Researchers | Topics |
167
- |-------|----------------|-------------|--------|
168
- | quick | Level 0 | 0 | Skip research entirely |
169
- | standard | Level 1 | 2 | STACK.md, FEATURES.md |
170
- | standard + brownfield | Level 2 | 2-3 | STACK.md, FEATURES.md, + codebase mapping |
171
- | comprehensive | Level 3 | 4 | STACK.md, FEATURES.md, ARCHITECTURE.md, PITFALLS.md |
172
-
173
- **If depth is `quick`:**
174
- - Skip to Step 7 (Requirements Scoping)
175
- - Tell user: "Skipping research phase (depth: quick). Moving straight to requirements."
176
-
177
- **If depth is `standard` or `comprehensive`:**
178
- Use the **yes-no** pattern from `skills/shared/gate-prompts.md`:
179
- question: "I'd like to research the technology landscape before planning. This helps create better plans. Proceed with research?"
180
- options:
181
- - label: "Yes" description: "Run research agents (recommended for standard/comprehensive)"
182
- - label: "No" description: "Skip research, move straight to requirements"
183
- - If user selects "No": skip to Step 7
184
- - If user selects "Yes": proceed to Step 5
185
-
186
- ---
187
-
188
- ### Step 5: Research (delegated to subagents)
189
-
190
- Spawn parallel Task() subagents for research. Each researcher writes to `.planning/research/`.
191
-
192
- **Create `.planning/research/` directory first.**
193
-
194
- **For each research topic, spawn a Task():**
195
-
196
- ```
197
- Task({
198
- subagent_type: "pbr:researcher",
199
- prompt: <see researcher prompt template below>
200
- })
201
- ```
202
-
203
- **NOTE**: The `pbr:researcher` subagent type auto-loads the agent definition from `agents/researcher.md`. Do NOT inline the agent definition — it wastes main context.
204
-
205
- #### Researcher Prompt Template
206
-
207
- For each researcher, construct the prompt by reading the template and filling in placeholders:
208
-
209
- Read `skills/begin/templates/researcher-prompt.md.tmpl` for the prompt structure.
210
-
211
- **Placeholders to fill:**
212
- - `{project name from questioning}` — project name gathered in Step 2
213
- - `{2-3 sentence description from questioning}` — project description from Step 2
214
- - `{any locked technology choices}` technology constraints from Step 2
215
- - `{budget, timeline, skill level, etc.}` — user constraints from Step 2
216
- - `{topic}` — the research topic being assigned (e.g., "Technology Stack Analysis")
217
- - `{TOPIC}` — the output filename (e.g., STACK, FEATURES, ARCHITECTURE, PITFALLS)
218
- - `{topic-specific questions}` — see topic-specific questions below
219
-
220
- **Topic-specific questions:**
221
-
222
- **STACK.md** (Level 1+):
223
- - What is the standard technology stack for this type of project?
224
- - What are the current recommended versions?
225
- - What are the key dependencies and their compatibility?
226
- - What build tools and development workflow is standard?
227
-
228
- **FEATURES.md** (Level 1+):
229
- - How are similar features typically implemented in this stack?
230
- - What libraries/packages are commonly used for each feature area?
231
- - What are standard patterns for the key features described?
232
- - What third-party integrations are typically needed?
233
-
234
- **ARCHITECTURE.md** (Level 3 only):
235
- - What is the recommended architecture for this type of project?
236
- - How should the codebase be organized?
237
- - What are the standard patterns for data flow, state management, etc.?
238
- - How should components communicate?
239
-
240
- **PITFALLS.md** (Level 3 only):
241
- - What commonly goes wrong with this type of project?
242
- - What are the most common mistakes developers make?
243
- - What performance issues are typical?
244
- - What security concerns exist?
245
-
246
- **Parallelization:**
247
- - Spawn ALL researchers in parallel (multiple Task() calls in one response)
248
- - Use `run_in_background: true` for each researcher
249
- - Before spawning, display to the user: `◐ Spawning {N} researchers in parallel...`
250
- - While waiting, display progress to the user:
251
- - After spawning: list of topics being researched
252
- - Periodically (every ~30s): check `TaskOutput` with `block: false` for each agent and report status
253
- - When each completes: "✓ {topic} researcher complete ({duration})"
254
- - When all complete: "All {N} researchers finished. Proceeding to synthesis."
255
- - Wait for all to complete before proceeding
256
-
257
- ---
258
-
259
- ### Step 6: Synthesis (delegated to subagent)
260
-
261
- After all researchers complete, display to the user: `◐ Spawning synthesizer...`
262
-
263
- Spawn a synthesis agent:
264
-
265
- ```
266
- Task({
267
- subagent_type: "pbr:synthesizer",
268
- model: "haiku",
269
- prompt: <synthesis prompt>
270
- })
271
- ```
272
-
273
- **NOTE**: The `pbr:synthesizer` subagent type auto-loads the agent definition. Do NOT inline it. Use `model: "haiku"` synthesis is fast summarization work that doesn't need a large model.
274
-
275
- #### Synthesis Prompt Template
276
-
277
- Read `skills/begin/templates/synthesis-prompt.md.tmpl` for the prompt structure.
278
-
279
- **Placeholders to fill:**
280
- - `{List all .planning/research/*.md files that were created}` — list the research files produced in Step 5
281
-
282
- ---
283
-
284
- ### Step 7: Requirements Scoping (inline)
285
-
286
- Present research findings (if any) and interactively scope requirements with the user.
287
-
288
- **7a. Present findings:**
289
- If research was done, read `.planning/research/SUMMARY.md` and present key findings:
290
- - Recommended stack
291
- - Key architectural decisions
292
- - Notable pitfalls to be aware of
293
-
294
- **7b. Feature identification:**
295
- From the questioning session, list all features and capabilities discussed. Group them into categories.
296
-
297
- Example categories: Auth, UI, API, Data, Infrastructure, Testing, etc.
298
-
299
- **7c. Scope each category:**
300
- For each category, present the features and ask the user to classify each:
301
- - **v1 (committed)** — Will be built in this project
302
- - **v2 (deferred)** — Will be built later, not now
303
- - **Out of scope**Will NOT be built
304
-
305
- **7d. Assign REQ-IDs:**
306
- For each committed requirement, assign an ID in the format `{CATEGORY}-{NN}`:
307
- - `AUTH-01`: User can log in with Discord OAuth
308
- - `AUTH-02`: Protected routes redirect to login
309
- - `UI-01`: Dashboard shows player statistics
310
- - `UI-02`: Mobile-responsive layout
311
-
312
- Each requirement must be:
313
- - **User-centric** — describes a capability from the user's perspective
314
- - **Testable** you can verify whether it's met or not
315
- - **Specific** — not vague ("fast" is bad, "page loads in <2s" is good)
316
-
317
- **7e. Write REQUIREMENTS.md:**
318
- Read the template from `skills/begin/templates/REQUIREMENTS.md.tmpl` and write `.planning/REQUIREMENTS.md` with:
319
- - All v1 requirements grouped by category
320
- - All v2 requirements with deferral reasons
321
- - Out-of-scope items with rationale
322
- - Traceability table (all REQ-IDs, no phases assigned yet)
323
-
324
- ---
325
-
326
- ### Step 8: Roadmap Generation (delegated to subagent)
327
-
328
- Display to the user: `◐ Spawning planner (roadmap)...`
329
-
330
- Spawn the planner in roadmap mode:
331
-
332
- ```
333
- Task({
334
- subagent_type: "pbr:planner",
335
- prompt: <roadmap prompt>
336
- })
337
- ```
338
-
339
- **NOTE**: The `pbr:planner` subagent type auto-loads the agent definition. Do NOT inline it. The planner agent will read REQUIREMENTS.md and SUMMARY.md from disk — you only need to tell it what to do and where files are.
340
-
341
- #### Roadmap Prompt Template
342
-
343
- Read `skills/begin/templates/roadmap-prompt.md.tmpl` for the prompt structure.
344
-
345
- **Placeholders to fill:**
346
- - `{project name}` project name from Step 2
347
- - `{description}` project description from Step 2
348
- - `{quick|standard|comprehensive}` depth setting from Step 3
349
-
350
- **After the planner completes:**
351
- - Read `.planning/ROADMAP.md`
352
- - If `gates.confirm_roadmap` is true in config, use the **approve-revise-abort** pattern from `skills/shared/gate-prompts.md`:
353
- question: "Approve this roadmap?"
354
- options:
355
- - label: "Approve" description: "Proceed with this roadmap"
356
- - label: "Request changes" description: "Discuss adjustments before proceeding"
357
- - label: "Abort" description: "Cancel and start over"
358
- - If user selects "Request changes": edit the roadmap inline (small changes) or re-spawn planner
359
- - If user selects "Approve": proceed to Step 9
360
- - If user selects "Abort": stop execution
361
-
362
- ---
363
-
364
- ### Step 9: State Initialization (inline)
365
-
366
- Write the project state files from templates:
367
-
368
- **9a. Write PROJECT.md:**
369
- 1. Read `skills/begin/templates/PROJECT.md.tmpl`
370
- 2. Fill in:
371
- - `{project_name}` from questioning
372
- - `{2-3 sentences}` — project description from questioning
373
- - `{ONE sentence}` core value statement
374
- - Out-of-scope features
375
- - Technical context and constraints
376
- - Initial key decisions from the questioning conversation
377
- 3. Write to `.planning/PROJECT.md`
378
- 4. Ensure the `## Milestones` section is filled in with the project name and phase count from the roadmap
379
-
380
- **9b. Write STATE.md:**
381
- 1. Read `skills/begin/templates/STATE.md.tmpl`
382
- 2. Fill in:
383
- - `{date}` — today's date
384
- - `{total}` — total phase count from roadmap
385
- - `{Phase 1 name}` from roadmap
386
- - Core value one-liner
387
- - Decisions from initialization
388
- 3. Write to `.planning/STATE.md`
389
- 4. Fill in the `## Milestone` section with the project name and total phase count
390
- 5. **STATE.md size limit**: Follow size limit enforcement rules in `skills/shared/state-update.md` (150 lines max).
391
-
392
- **9c. Write CONTEXT.md:**
393
- Create `.planning/CONTEXT.md` from information gathered during questioning:
394
-
395
- ```markdown
396
- # Project Context
397
-
398
- ## Locked Decisions
399
- {Technology choices, architecture decisions, and constraints that are NON-NEGOTIABLE}
400
-
401
- | Decision | Rationale | Locked By |
402
- |----------|-----------|-----------|
403
- | {e.g., "Use TypeScript"} | {User preference, team skill} | User |
404
-
405
- ## User Constraints
406
- {Budget, timeline, skill level, hosting, team size}
407
-
408
- ## Deferred Ideas
409
- {Features explicitly moved to v2 or out-of-scope}
410
-
411
- | Idea | Reason Deferred |
412
- |------|----------------|
413
- | {feature} | {reason} |
414
- ```
415
-
416
- **9d. Create phase directories:**
417
- For each phase in the roadmap, create the directory structure:
418
- ```
419
- .planning/phases/01-{slug}/
420
- .planning/phases/02-{slug}/
421
- ...
422
- ```
423
-
424
- Where `{slug}` is the phase name in kebab-case (e.g., `project-setup`, `authentication`).
425
-
426
- ---
427
-
428
- ### Step 10: Git Setup (inline)
429
-
430
- Reference: `skills/shared/commit-planning-docs.md` for the standard commit pattern.
431
-
432
- **10a. Gitignore:**
433
- If `planning.commit_docs` is `false` in config:
434
- - Add `.planning/` to `.gitignore`
435
-
436
- If `planning.commit_docs` is `true`:
437
- - Add `.planning/research/` to `.gitignore` (research is always excluded — it's reference material, not project state)
438
-
439
- **10b. Initial commit (if desired):**
440
- If `gates.confirm_project` is true in config:
441
- - Present a summary of everything created:
442
- - Project: {name}
443
- - Core value: {one-liner}
444
- - Phases: {count} phases in roadmap
445
- - Requirements: {count} v1 requirements
446
- - Config: depth={depth}, mode={mode}
447
- - Use the **yes-no** pattern from `skills/shared/gate-prompts.md`:
448
- question: "Everything look good? Commit the planning docs?"
449
- options:
450
- - label: "Yes" description: "Stage and commit .planning/ files"
451
- - label: "No" description: "Let me review and adjust first"
452
- - If user selects "Yes" and `planning.commit_docs` is true:
453
- - Stage `.planning/` files (excluding research/ if gitignored)
454
- - Commit: `chore: initialize plan-build-run project planning`
455
- - If user selects "No": let user review and adjust
456
-
457
- ---
458
-
459
- ## Completion
460
-
461
- After all steps complete, present the final summary:
462
-
463
- Use the branded stage banner from `references/ui-formatting.md`:
464
-
465
- ```
466
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
467
- PLAN-BUILD-RUN ► PROJECT INITIALIZED ✓
468
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
469
-
470
- **{name}**
471
-
472
- {core value one-liner}
473
-
474
- Roadmap: {N} phases
475
- 1. {Phase 1 name}
476
- 2. {Phase 2 name}
477
- ...
478
-
479
- Requirements: {N} committed, {M} deferred, {K} out-of-scope
480
- ```
481
-
482
- Then use the "Next Up" routing block:
483
- ```
484
- ───────────────────────────────────────────────────────────────
485
-
486
- ## ▶ Next Up
487
-
488
- **Phase 1: {Name}** {one-line goal}
489
-
490
- `/pbr:explore`
491
-
492
- <sub>`/clear` first fresh context window</sub>
493
-
494
- ───────────────────────────────────────────────────────────────
495
-
496
- **Also available:**
497
- - `/pbr:discuss 1` — talk through Phase 1 details before planning
498
- - `/pbr:plan 1` jump straight to planning Phase 1
499
- - `/pbr:config` adjust workflow settings
500
-
501
- ───────────────────────────────────────────────────────────────
502
- ```
503
-
504
- ---
505
-
506
- ## Error Handling
507
-
508
- ### Research agent fails
509
- If a researcher Task() fails or times out:
510
- - Note which topic wasn't researched
511
- - Continue with available research
512
- - Display: `⚠ Research on {topic} failed. Proceeding without it. You can re-research during /pbr:plan.`
513
-
514
- ### User wants to restart
515
- If user says they want to start over mid-flow:
516
- - Confirm: "Start over from the beginning? Current progress will be lost."
517
- - If yes: restart from Step 2
518
-
519
- ### Config write fails
520
- If `.planning/` directory can't be created, display:
521
- ```
522
- ╔══════════════════════════════════════════════════════════════╗
523
- ERROR ║
524
- ╚══════════════════════════════════════════════════════════════╝
525
-
526
- Cannot create .planning/ directory.
527
-
528
- **To fix:** Check directory permissions or specify an alternative path.
529
- ```
530
-
531
- ---
532
-
533
- ## Files Created by /pbr:begin
534
-
535
- | File | Purpose | When |
536
- |------|---------|------|
537
- | `.planning/config.json` | Workflow configuration | Step 3 |
538
- | `.planning/research/*.md` | Research documents | Step 5 (if research enabled) |
539
- | `.planning/research/SUMMARY.md` | Research synthesis | Step 6 (if research enabled) |
540
- | `.planning/REQUIREMENTS.md` | Scoped requirements | Step 7 |
541
- | `.planning/ROADMAP.md` | Phase roadmap | Step 8 |
542
- | `.planning/PROJECT.md` | Project overview | Step 9 |
543
- | `.planning/STATE.md` | Current state tracker | Step 9 |
544
- | `.planning/CONTEXT.md` | Decisions and constraints | Step 9 |
545
- | `.planning/phases/NN-*/` | Phase directories | Step 9 |
1
+ ---
2
+ name: begin
3
+ description: "Start a new project. Deep questioning, research, requirements, and roadmap."
4
+ allowed-tools: Read, Write, Bash, Glob, Grep, WebFetch, WebSearch, Task, AskUserQuestion
5
+ ---
6
+
7
+ **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.**
8
+
9
+ # /pbr:begin — Project Initialization
10
+
11
+ You are the orchestrator for `/pbr:begin`. This skill initializes a new Plan-Build-Run project through deep questioning, optional research, requirements scoping, and roadmap generation. Your job is to stay lean — delegate heavy work to Task() subagents and keep the user's main context window clean.
12
+
13
+ ## Context Budget
14
+
15
+ Reference: `skills/shared/context-budget.md` for the universal orchestrator rules.
16
+
17
+ Additionally for this skill:
18
+ - **Minimize** reading subagent output — read only summaries, not full research docs
19
+ - **Delegate** all analysis work to subagents — the orchestrator routes, it doesn't analyze
20
+
21
+ ## Step 0 Immediate Output
22
+
23
+ **Before ANY tool calls**, display this banner:
24
+
25
+ ```
26
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
27
+ PLAN-BUILD-RUN ► STARTING PROJECT
28
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
29
+ ```
30
+
31
+ Then proceed to Step 1.
32
+
33
+ ## Prerequisites
34
+
35
+ - Working directory should be the project root
36
+ - No existing `.planning/` directory (or user confirms overwrite)
37
+
38
+ ---
39
+
40
+ ## Orchestration Flow
41
+
42
+ Execute these steps in order. Each step specifies whether it runs inline (in your context) or is delegated to a subagent.
43
+
44
+ ---
45
+
46
+ ### Step 1: Detect Brownfield (inline)
47
+
48
+ > **Cross-platform note**: Use the Glob tool (not Bash `ls` or `find`) for all file and directory discovery. Bash file commands fail on Windows due to path separator issues.
49
+
50
+ Check if the current directory has existing code:
51
+
52
+ ```
53
+ 1. Use Glob to check directory contents (e.g., pattern "*" at project root)
54
+ 2. Look for indicators of existing code:
55
+ - package.json, requirements.txt, CMakeLists.txt, go.mod, Cargo.toml
56
+ - src/, lib/, app/ directories
57
+ - .git/ directory with commits
58
+ 3. Use Glob to check if .planning/ already exists (e.g., pattern ".planning/*")
59
+ ```
60
+
61
+ **If existing code found:**
62
+ Use the **yes-no** pattern from `skills/shared/gate-prompts.md`:
63
+ question: "This looks like an existing codebase. Run /pbr:scan to analyze what's here first?"
64
+ options:
65
+ - label: "Yes, scan" description: "Run /pbr:scan first to analyze existing code"
66
+ - label: "No, begin" description: "Proceed with /pbr:begin on top of existing code"
67
+ - If user selects "Yes, scan": suggest `/pbr:scan` and stop
68
+ - If user selects "No, begin": proceed to Step 2
69
+
70
+ **If `.planning/` already exists:**
71
+ Use the **yes-no** pattern from `skills/shared/gate-prompts.md`:
72
+ question: "A .planning/ directory already exists. This will overwrite it. Continue?"
73
+ options:
74
+ - label: "Yes" description: "Overwrite existing planning directory"
75
+ - label: "No" description: "Cancel keep existing planning"
76
+ - If user selects "No": **STOP IMMEDIATELY. Do not ask again. Do not proceed to Step 2. End the skill with this message:**
77
+ ```
78
+ Keeping existing .planning/ directory. Use `/pbr:status` to see current project state, or `/pbr:plan` to continue planning.
79
+ ```
80
+ **Do NOT re-prompt the same question or any other question. The skill is finished.**
81
+ - If user selects "Yes": proceed (existing directory will be overwritten during state initialization)
82
+
83
+ ---
84
+
85
+ ### Step 2: Deep Questioning (inline)
86
+
87
+ **Reference**: Read `references/questioning.md` for technique details.
88
+
89
+ Have a natural conversation to understand the user's vision. Do NOT present a form or checklist. Instead, have a flowing conversation that covers these areas organically:
90
+
91
+ **Required context to gather:**
92
+
93
+ 1. **What they want to build** — The core product/feature/system
94
+ 2. **Problem being solved** — Why does this need to exist? Who is it for?
95
+ 3. **Success criteria** How will they know it works? What does "done" look like?
96
+ 4. **Existing constraints** Technology choices already made, hosting, budget, timeline, team size
97
+ 5. **Key decisions already made**Framework, language, architecture preferences
98
+ 6. **Edge cases and concerns** What worries them? What's the hardest part?
99
+
100
+ **Conversation approach:**
101
+ - Start broad: "What are you building?"
102
+ - Go deeper on each answer: "What does that mean exactly?" "Show me an example."
103
+ - Surface assumptions: "Why do you assume that?" "Have you considered X?"
104
+ - Find edges: "What happens when...?" "What about...?"
105
+ - Reveal motivation: "Why does that matter?"
106
+ - Avoid leading questions — let the user define their vision
107
+
108
+ **Keep going until you have:**
109
+ - A clear, concrete understanding of what they want to build
110
+ - At least 3 specific success criteria
111
+ - Known constraints and decisions
112
+ - A sense of complexity and scope
113
+
114
+ **Anti-patterns:**
115
+ - DO NOT present a bulleted checklist and ask them to fill it in
116
+ - DO NOT ask all questions at once — have a conversation
117
+ - DO NOT assume technologies — let them tell you
118
+ - DO NOT rush this is the foundation for everything that follows
119
+
120
+ ---
121
+
122
+ ### Step 3: Workflow Preferences (inline)
123
+
124
+ After understanding the project, configure the Plan-Build-Run workflow. Use AskUserQuestion for each preference below. Present them sequentially with conversational bridging (e.g., "Great. Next...") to keep the flow natural.
125
+
126
+ **3a. Mode:**
127
+ Use the **toggle-confirm** pattern from `skills/shared/gate-prompts.md`:
128
+ question: "How do you want to work?"
129
+ header: "Mode"
130
+ options:
131
+ - label: "Interactive" description: "Pause at key gates for your approval (default)"
132
+ - label: "Autonomous" description: "Auto-proceed, only stop for critical decisions"
133
+ - `interactive` (default) — confirm at gates (roadmap, plans, transitions)
134
+ - `autonomous` — auto-proceed, only stop for critical decisions
135
+
136
+ **3b. Depth:**
137
+ Use the **depth-select** pattern from `skills/shared/gate-prompts.md`:
138
+ question: "How thorough should planning be?"
139
+ - `quick` — 3-5 phases, skip research, ~50% cheaper
140
+ - `standard` (default) — 5-8 phases, includes research
141
+ - `comprehensive` — 8-12 phases, full deep research, ~2x cost
142
+
143
+ **3c. Parallelization:**
144
+ Use the **toggle-confirm** pattern from `skills/shared/gate-prompts.md`:
145
+ question: "Run multiple agents in parallel when plans are independent?"
146
+ header: "Parallel"
147
+ options:
148
+ - label: "Enable" description: "Parallel execution of independent plans (default)"
149
+ - label: "Disable" description: "Sequential execution only"
150
+ - `enabled` (default) — parallel execution of independent plans
151
+ - `disabled` sequential execution
152
+
153
+ **3d. Git Branching:**
154
+ Use the **git-strategy-select** pattern from `skills/shared/gate-prompts.md`:
155
+ question: "Git branching strategy?"
156
+ - `none` (default) commit to current branch
157
+ - `phase` — create branch per phase
158
+ - `milestone` — create branch per milestone
159
+
160
+ **3e. Commit Planning Docs:**
161
+ Use the **yes-no** pattern from `skills/shared/gate-prompts.md`:
162
+ question: "Should planning documents (.planning/ directory) be committed to git?"
163
+ options:
164
+ - label: "Yes" description: "Commit planning docs (default)"
165
+ - label: "No" description: "Add .planning/ to .gitignore"
166
+ - `yes` (default) commit planning docs
167
+ - `no` — add .planning/ to .gitignore
168
+
169
+ **After gathering preferences:**
170
+
171
+ 1. Read the config template from `skills/begin/templates/config.json.tmpl`
172
+ 2. Apply the user's choices to the template
173
+ 3. Create `.planning/` directory
174
+ 4. Write `.planning/config.json` with the user's preferences
175
+
176
+ **IMPORTANT**: This step MUST happen BEFORE research (Step 5) because depth controls how many researchers to spawn.
177
+
178
+ ---
179
+
180
+ ### Step 4: Research Decision (inline)
181
+
182
+ Based on the depth setting from Step 3, determine the research approach:
183
+
184
+ **Depth-to-Discovery mapping:**
185
+
186
+ | Depth | Discovery Level | Researchers | Topics |
187
+ |-------|----------------|-------------|--------|
188
+ | quick | Level 0 | 0 | Skip research entirely |
189
+ | standard | Level 1 | 2 | STACK.md, FEATURES.md |
190
+ | standard + brownfield | Level 2 | 2-3 | STACK.md, FEATURES.md, + codebase mapping |
191
+ | comprehensive | Level 3 | 4 | STACK.md, FEATURES.md, ARCHITECTURE.md, PITFALLS.md |
192
+
193
+ **If depth is `quick`:**
194
+ - Skip to Step 7 (Requirements Scoping)
195
+ - Tell user: "Skipping research phase (depth: quick). Moving straight to requirements."
196
+
197
+ **If depth is `standard` or `comprehensive`:**
198
+ Use the **yes-no** pattern from `skills/shared/gate-prompts.md`:
199
+ question: "I'd like to research the technology landscape before planning. This helps create better plans. Proceed with research?"
200
+ options:
201
+ - label: "Yes" description: "Run research agents (recommended for standard/comprehensive)"
202
+ - label: "No" description: "Skip research, move straight to requirements"
203
+ - If user selects "No": skip to Step 7
204
+ - If user selects "Yes": proceed to Step 5
205
+
206
+ ---
207
+
208
+ ### Step 5: Research (delegated to subagents)
209
+
210
+ Spawn parallel Task() subagents for research. Each researcher writes to `.planning/research/`.
211
+
212
+ **Create `.planning/research/` directory first.**
213
+
214
+ **For each research topic, spawn a Task():**
215
+
216
+ ```
217
+ Task({
218
+ subagent_type: "pbr:researcher",
219
+ prompt: <see researcher prompt template below>
220
+ })
221
+ ```
222
+
223
+ **NOTE**: The `pbr:researcher` subagent type auto-loads the agent definition from `agents/researcher.md`. Do NOT inline the agent definition it wastes main context.
224
+
225
+ **Path resolution**: Before constructing any agent prompt, resolve `${CLAUDE_PLUGIN_ROOT}` to its absolute path. Do not pass the variable literally in prompts — Task() contexts may not expand it. Use the resolved absolute path for any pbr-tools.js or template references included in the prompt.
226
+
227
+ #### Researcher Prompt Template
228
+
229
+ For each researcher, construct the prompt by reading the template and filling in placeholders:
230
+
231
+ Read `skills/begin/templates/researcher-prompt.md.tmpl` for the prompt structure.
232
+
233
+ **Placeholders to fill:**
234
+ - `{project name from questioning}` — project name gathered in Step 2
235
+ - `{2-3 sentence description from questioning}` project description from Step 2
236
+ - `{any locked technology choices}` technology constraints from Step 2
237
+ - `{budget, timeline, skill level, etc.}` user constraints from Step 2
238
+ - `{topic}` the research topic being assigned (e.g., "Technology Stack Analysis")
239
+ - `{TOPIC}` — the output filename (e.g., STACK, FEATURES, ARCHITECTURE, PITFALLS)
240
+ - `{topic-specific questions}` — see topic-specific questions below
241
+
242
+ **Topic-specific questions:**
243
+
244
+ **STACK.md** (Level 1+):
245
+ - What is the standard technology stack for this type of project?
246
+ - What are the current recommended versions?
247
+ - What are the key dependencies and their compatibility?
248
+ - What build tools and development workflow is standard?
249
+
250
+ **FEATURES.md** (Level 1+):
251
+ - How are similar features typically implemented in this stack?
252
+ - What libraries/packages are commonly used for each feature area?
253
+ - What are standard patterns for the key features described?
254
+ - What third-party integrations are typically needed?
255
+
256
+ **ARCHITECTURE.md** (Level 3 only):
257
+ - What is the recommended architecture for this type of project?
258
+ - How should the codebase be organized?
259
+ - What are the standard patterns for data flow, state management, etc.?
260
+ - How should components communicate?
261
+
262
+ **PITFALLS.md** (Level 3 only):
263
+ - What commonly goes wrong with this type of project?
264
+ - What are the most common mistakes developers make?
265
+ - What performance issues are typical?
266
+ - What security concerns exist?
267
+
268
+ **Parallelization:**
269
+ - Spawn ALL researchers in parallel (multiple Task() calls in one response)
270
+ - Use `run_in_background: true` for each researcher
271
+ - Before spawning, display to the user: `◐ Spawning {N} researchers in parallel...`
272
+ - While waiting, display progress to the user:
273
+ - After spawning: list of topics being researched
274
+ - Periodically (every ~30s): check `TaskOutput` with `block: false` for each agent and report status
275
+ - When each completes: "✓ {topic} researcher complete ({duration})"
276
+ - When all complete: "All {N} researchers finished. Proceeding to synthesis."
277
+ - Wait for all to complete before proceeding
278
+
279
+ ---
280
+
281
+ ### Step 6: Synthesis (delegated to subagent)
282
+
283
+ After all researchers complete, display to the user: `◐ Spawning synthesizer...`
284
+
285
+ Spawn a synthesis agent:
286
+
287
+ ```
288
+ Task({
289
+ subagent_type: "pbr:synthesizer",
290
+ prompt: <synthesis prompt>
291
+ })
292
+ ```
293
+
294
+ **NOTE**: The `pbr:synthesizer` subagent type auto-loads the agent definition. Do NOT inline it. The agent definition specifies `model: sonnet` — do not override it.
295
+
296
+ **Path resolution**: Before constructing the agent prompt, resolve `${CLAUDE_PLUGIN_ROOT}` to its absolute path. Do not pass the variable literally in prompts — Task() contexts may not expand it.
297
+
298
+ #### Synthesis Prompt Template
299
+
300
+ Read `skills/begin/templates/synthesis-prompt.md.tmpl` for the prompt structure.
301
+
302
+ **Placeholders to fill:**
303
+ - `{List all .planning/research/*.md files that were created}` list the research files produced in Step 5
304
+
305
+ **After the synthesizer completes**, display:
306
+ ```
307
+ Research synthesis complete see .planning/research/SUMMARY.md
308
+ ```
309
+
310
+ ---
311
+
312
+ ### Step 7: Requirements Scoping (inline)
313
+
314
+ Present research findings (if any) and interactively scope requirements with the user.
315
+
316
+ **7a. Present findings:**
317
+ If research was done, read `.planning/research/SUMMARY.md` and present key findings:
318
+ - Recommended stack
319
+ - Key architectural decisions
320
+ - Notable pitfalls to be aware of
321
+
322
+ **7b. Feature identification:**
323
+ From the questioning session, list all features and capabilities discussed. Group them into categories.
324
+
325
+ Example categories: Auth, UI, API, Data, Infrastructure, Testing, etc.
326
+
327
+ **7c. Scope each category:**
328
+ For each category, present the features and ask the user to classify each:
329
+ - **v1 (committed)** — Will be built in this project
330
+ - **v2 (deferred)** Will be built later, not now
331
+ - **Out of scope** — Will NOT be built
332
+
333
+ **7d. Assign REQ-IDs:**
334
+ For each committed requirement, assign an ID in the format `{CATEGORY}-{NN}`:
335
+ - `AUTH-01`: User can log in with Discord OAuth
336
+ - `AUTH-02`: Protected routes redirect to login
337
+ - `UI-01`: Dashboard shows player statistics
338
+ - `UI-02`: Mobile-responsive layout
339
+
340
+ Each requirement must be:
341
+ - **User-centric** describes a capability from the user's perspective
342
+ - **Testable** — you can verify whether it's met or not
343
+ - **Specific** not vague ("fast" is bad, "page loads in <2s" is good)
344
+
345
+ **7e. Write REQUIREMENTS.md:**
346
+ Read the template from `skills/begin/templates/REQUIREMENTS.md.tmpl` and write `.planning/REQUIREMENTS.md` with:
347
+ - All v1 requirements grouped by category
348
+ - All v2 requirements with deferral reasons
349
+ - Out-of-scope items with rationale
350
+ - Traceability table (all REQ-IDs, no phases assigned yet)
351
+
352
+ ---
353
+
354
+ ### Step 8: Roadmap Generation (delegated to subagent)
355
+
356
+ Display to the user: `◐ Spawning planner (roadmap)...`
357
+
358
+ Spawn the planner in roadmap mode:
359
+
360
+ ```
361
+ Task({
362
+ subagent_type: "pbr:planner",
363
+ prompt: <roadmap prompt>
364
+ })
365
+ ```
366
+
367
+ **NOTE**: The `pbr:planner` subagent type auto-loads the agent definition. Do NOT inline it. The planner agent will read REQUIREMENTS.md and SUMMARY.md from disk — you only need to tell it what to do and where files are.
368
+
369
+ **Path resolution**: Before constructing the agent prompt, resolve `${CLAUDE_PLUGIN_ROOT}` to its absolute path. Do not pass the variable literally in prompts — Task() contexts may not expand it.
370
+
371
+ #### Roadmap Prompt Template
372
+
373
+ Read `skills/begin/templates/roadmap-prompt.md.tmpl` for the prompt structure.
374
+
375
+ **Placeholders to fill:**
376
+ - `{project name}` project name from Step 2
377
+ - `{description}` project description from Step 2
378
+ - `{quick|standard|comprehensive}` depth setting from Step 3
379
+
380
+ **After the planner completes:**
381
+ - Read `.planning/ROADMAP.md`
382
+ - Count the phases and milestones from the roadmap content
383
+ - Display:
384
+ ```
385
+ Roadmap created — {N} phases across {M} milestones
386
+ ```
387
+ - If `gates.confirm_roadmap` is true in config, use the **approve-revise-abort** pattern from `skills/shared/gate-prompts.md`:
388
+ question: "Approve this roadmap?"
389
+ options:
390
+ - label: "Approve" description: "Proceed with this roadmap"
391
+ - label: "Request changes" description: "Discuss adjustments before proceeding"
392
+ - label: "Abort" description: "Cancel and start over"
393
+ - If user selects "Request changes": edit the roadmap inline (small changes) or re-spawn planner
394
+ - If user selects "Approve": proceed to Step 9
395
+ - If user selects "Abort": stop execution
396
+
397
+ ---
398
+
399
+ ### Step 9: State Initialization (inline)
400
+
401
+ Write the project state files from templates:
402
+
403
+ **9a. Write PROJECT.md:**
404
+ 1. Read `skills/begin/templates/PROJECT.md.tmpl`
405
+ 2. Fill in:
406
+ - `{project_name}` from questioning
407
+ - `{2-3 sentences}` — project description from questioning
408
+ - `{ONE sentence}` — core value statement
409
+ - Out-of-scope features
410
+ - Technical context and constraints
411
+ - Initial key decisions from the questioning conversation
412
+ 3. Write to `.planning/PROJECT.md`
413
+ 4. Ensure the `## Milestones` section is filled in with the project name and phase count from the roadmap
414
+
415
+ **9b. Write STATE.md:**
416
+ 1. Read `skills/begin/templates/STATE.md.tmpl`
417
+ 2. Fill in:
418
+ - `{date}` — today's date
419
+ - `{total}` — total phase count from roadmap
420
+ - `{Phase 1 name}` — from roadmap
421
+ - Core value one-liner
422
+ - Decisions from initialization
423
+ 3. Write to `.planning/STATE.md`
424
+ 4. Fill in the `## Milestone` section with the project name and total phase count
425
+ 5. **STATE.md size limit**: Follow size limit enforcement rules in `skills/shared/state-update.md` (150 lines max).
426
+
427
+ **9c. Write CONTEXT.md:**
428
+ Create `.planning/CONTEXT.md` from information gathered during questioning:
429
+
430
+ ```markdown
431
+ # Project Context
432
+
433
+ ## Locked Decisions
434
+ {Technology choices, architecture decisions, and constraints that are NON-NEGOTIABLE}
435
+
436
+ | Decision | Rationale | Locked By |
437
+ |----------|-----------|-----------|
438
+ | {e.g., "Use TypeScript"} | {User preference, team skill} | User |
439
+
440
+ ## User Constraints
441
+ {Budget, timeline, skill level, hosting, team size}
442
+
443
+ ## Deferred Ideas
444
+ {Features explicitly moved to v2 or out-of-scope}
445
+
446
+ | Idea | Reason Deferred |
447
+ |------|----------------|
448
+ | {feature} | {reason} |
449
+ ```
450
+
451
+ **9d. Write HISTORY.md:**
452
+ Create `.planning/HISTORY.md` with an initial entry:
453
+
454
+ ```markdown
455
+ # Project History
456
+
457
+ ## {date} — Project Created
458
+
459
+ - Initialized Plan-Build-Run project
460
+ - Depth: {depth}, Mode: {mode}
461
+ - Roadmap: {N} phases planned
462
+ ```
463
+
464
+ **9e. Create phase directories:**
465
+ For each phase in the roadmap, create the directory structure:
466
+ ```
467
+ .planning/phases/01-{slug}/
468
+ .planning/phases/02-{slug}/
469
+ ...
470
+ ```
471
+
472
+ Where `{slug}` is the phase name in kebab-case (e.g., `project-setup`, `authentication`).
473
+
474
+ ---
475
+
476
+ ### Step 10: Git Setup (inline)
477
+
478
+ Reference: `skills/shared/commit-planning-docs.md` for the standard commit pattern.
479
+
480
+ **10a. Gitignore:**
481
+ If `planning.commit_docs` is `false` in config:
482
+ - Add `.planning/` to `.gitignore`
483
+
484
+ If `planning.commit_docs` is `true`:
485
+ - Add `.planning/research/` to `.gitignore` (research is always excluded — it's reference material, not project state)
486
+
487
+ **10b. Initial commit (if desired):**
488
+ If `gates.confirm_project` is true in config:
489
+ - Present a summary of everything created:
490
+ - Project: {name}
491
+ - Core value: {one-liner}
492
+ - Phases: {count} phases in roadmap
493
+ - Requirements: {count} v1 requirements
494
+ - Config: depth={depth}, mode={mode}
495
+ - Use the **yes-no** pattern from `skills/shared/gate-prompts.md`:
496
+ question: "Everything look good? Commit the planning docs?"
497
+ options:
498
+ - label: "Yes" description: "Stage and commit .planning/ files"
499
+ - label: "No" description: "Let me review and adjust first"
500
+ - If user selects "Yes" and `planning.commit_docs` is true:
501
+ - Stage `.planning/` files (excluding research/ if gitignored)
502
+ - Commit: `chore: initialize plan-build-run project planning`
503
+ - If user selects "No": let user review and adjust
504
+
505
+ ---
506
+
507
+ ## Completion
508
+
509
+ After all steps complete, present the final summary:
510
+
511
+ Use the branded stage banner from `references/ui-formatting.md`:
512
+
513
+ ```
514
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
515
+ PLAN-BUILD-RUN PROJECT INITIALIZED
516
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
517
+
518
+ **{name}**
519
+
520
+ {core value one-liner}
521
+
522
+ Roadmap: {N} phases
523
+ 1. {Phase 1 name}
524
+ 2. {Phase 2 name}
525
+ ...
526
+
527
+ Requirements: {N} committed, {M} deferred, {K} out-of-scope
528
+ ```
529
+
530
+ Then use the "Next Up" routing block:
531
+ ```
532
+ ───────────────────────────────────────────────────────────────
533
+
534
+ ## ▶ Next Up
535
+
536
+ **Phase 1: {Name}** — {one-line goal}
537
+
538
+ `/pbr:discuss 1`
539
+
540
+ <sub>`/clear` first fresh context window</sub>
541
+
542
+ ───────────────────────────────────────────────────────────────
543
+
544
+ **Also available:**
545
+ - `/pbr:explore` open-ended exploration before planning
546
+ - `/pbr:plan 1` — jump straight to planning Phase 1
547
+ - `/pbr:config` — adjust workflow settings
548
+
549
+ ───────────────────────────────────────────────────────────────
550
+ ```
551
+
552
+ ---
553
+
554
+ ## Error Handling
555
+
556
+ ### Research agent fails
557
+ If a researcher Task() fails or times out:
558
+ - Note which topic wasn't researched
559
+ - Continue with available research
560
+ - Display: `⚠ Research on {topic} failed. Proceeding without it. You can re-research during /pbr:plan.`
561
+
562
+ ### User wants to restart
563
+ If user says they want to start over mid-flow:
564
+ - Confirm: "Start over from the beginning? Current progress will be lost."
565
+ - If yes: restart from Step 2
566
+
567
+ ### Config write fails
568
+ If `.planning/` directory can't be created, display:
569
+ ```
570
+ ╔══════════════════════════════════════════════════════════════╗
571
+ ║ ERROR ║
572
+ ╚══════════════════════════════════════════════════════════════╝
573
+
574
+ Cannot create .planning/ directory.
575
+
576
+ **To fix:** Check directory permissions or specify an alternative path.
577
+ ```
578
+
579
+ ---
580
+
581
+ ## Files Created by /pbr:begin
582
+
583
+ | File | Purpose | When |
584
+ |------|---------|------|
585
+ | `.planning/config.json` | Workflow configuration | Step 3 |
586
+ | `.planning/research/*.md` | Research documents | Step 5 (if research enabled) |
587
+ | `.planning/research/SUMMARY.md` | Research synthesis | Step 6 (if research enabled) |
588
+ | `.planning/REQUIREMENTS.md` | Scoped requirements | Step 7 |
589
+ | `.planning/ROADMAP.md` | Phase roadmap | Step 8 |
590
+ | `.planning/PROJECT.md` | Project overview | Step 9 |
591
+ | `.planning/STATE.md` | Current state tracker | Step 9 |
592
+ | `.planning/CONTEXT.md` | Decisions and constraints | Step 9 |
593
+ | `.planning/HISTORY.md` | Project history log | Step 9 |
594
+ | `.planning/phases/NN-*/` | Phase directories | Step 9 |