@sienklogic/plan-build-run 2.59.0 → 2.61.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 (79) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/package.json +1 -1
  3. package/plugins/codex-pbr/agents/executor.md +8 -0
  4. package/plugins/codex-pbr/agents/plan-checker.md +5 -3
  5. package/plugins/codex-pbr/agents/planner.md +13 -7
  6. package/plugins/codex-pbr/agents/verifier.md +10 -1
  7. package/plugins/codex-pbr/references/plan-format.md +46 -8
  8. package/plugins/codex-pbr/skills/begin/SKILL.md +11 -27
  9. package/plugins/codex-pbr/skills/discuss/SKILL.md +52 -2
  10. package/plugins/codex-pbr/skills/health/SKILL.md +13 -0
  11. package/plugins/codex-pbr/skills/import/SKILL.md +275 -0
  12. package/plugins/codex-pbr/skills/plan/SKILL.md +11 -1
  13. package/plugins/codex-pbr/skills/shared/context-loader-task.md +2 -0
  14. package/plugins/codex-pbr/skills/status/SKILL.md +17 -0
  15. package/plugins/codex-pbr/templates/PROJECT.md.tmpl +41 -0
  16. package/plugins/codex-pbr/templates/REQUIREMENTS.md.tmpl +52 -0
  17. package/plugins/codex-pbr/templates/VERIFICATION-DETAIL.md.tmpl +5 -0
  18. package/plugins/codex-pbr/templates/project-CONTEXT.md.tmpl +43 -0
  19. package/plugins/copilot-pbr/agents/executor.agent.md +8 -0
  20. package/plugins/copilot-pbr/agents/plan-checker.agent.md +5 -3
  21. package/plugins/copilot-pbr/agents/planner.agent.md +13 -7
  22. package/plugins/copilot-pbr/agents/verifier.agent.md +10 -1
  23. package/plugins/copilot-pbr/hooks/hooks.json +1 -0
  24. package/plugins/copilot-pbr/plugin.json +1 -1
  25. package/plugins/copilot-pbr/references/plan-format.md +46 -8
  26. package/plugins/copilot-pbr/skills/begin/SKILL.md +11 -27
  27. package/plugins/copilot-pbr/skills/discuss/SKILL.md +52 -2
  28. package/plugins/copilot-pbr/skills/health/SKILL.md +13 -0
  29. package/plugins/copilot-pbr/skills/import/SKILL.md +275 -0
  30. package/plugins/copilot-pbr/skills/plan/SKILL.md +11 -1
  31. package/plugins/copilot-pbr/skills/shared/context-loader-task.md +2 -0
  32. package/plugins/copilot-pbr/skills/status/SKILL.md +17 -0
  33. package/plugins/copilot-pbr/templates/PROJECT.md.tmpl +41 -0
  34. package/plugins/copilot-pbr/templates/REQUIREMENTS.md.tmpl +52 -0
  35. package/plugins/copilot-pbr/templates/VERIFICATION-DETAIL.md.tmpl +5 -0
  36. package/plugins/copilot-pbr/templates/project-CONTEXT.md.tmpl +43 -0
  37. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  38. package/plugins/cursor-pbr/agents/executor.md +8 -0
  39. package/plugins/cursor-pbr/agents/plan-checker.md +5 -3
  40. package/plugins/cursor-pbr/agents/planner.md +13 -7
  41. package/plugins/cursor-pbr/agents/verifier.md +10 -1
  42. package/plugins/cursor-pbr/hooks/hooks.json +1 -0
  43. package/plugins/cursor-pbr/references/plan-format.md +46 -8
  44. package/plugins/cursor-pbr/skills/begin/SKILL.md +11 -27
  45. package/plugins/cursor-pbr/skills/discuss/SKILL.md +53 -3
  46. package/plugins/cursor-pbr/skills/health/SKILL.md +13 -0
  47. package/plugins/cursor-pbr/skills/import/SKILL.md +276 -1
  48. package/plugins/cursor-pbr/skills/plan/SKILL.md +11 -1
  49. package/plugins/cursor-pbr/skills/shared/context-loader-task.md +2 -0
  50. package/plugins/cursor-pbr/skills/status/SKILL.md +17 -0
  51. package/plugins/cursor-pbr/templates/PROJECT.md.tmpl +41 -0
  52. package/plugins/cursor-pbr/templates/REQUIREMENTS.md.tmpl +52 -0
  53. package/plugins/cursor-pbr/templates/VERIFICATION-DETAIL.md.tmpl +5 -0
  54. package/plugins/cursor-pbr/templates/project-CONTEXT.md.tmpl +43 -0
  55. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
  56. package/plugins/pbr/agents/executor.md +8 -0
  57. package/plugins/pbr/agents/plan-checker.md +5 -3
  58. package/plugins/pbr/agents/planner.md +13 -7
  59. package/plugins/pbr/agents/verifier.md +10 -1
  60. package/plugins/pbr/hooks/hooks.json +1 -0
  61. package/plugins/pbr/references/plan-format.md +46 -8
  62. package/plugins/pbr/scripts/check-plan-format.js +29 -0
  63. package/plugins/pbr/scripts/config-schema.json +14 -1
  64. package/plugins/pbr/scripts/context-bridge.js +1 -1
  65. package/plugins/pbr/scripts/lib/gates/doc-existence.js +46 -0
  66. package/plugins/pbr/scripts/post-write-dispatch.js +22 -2
  67. package/plugins/pbr/scripts/sync-context-to-claude.js +100 -0
  68. package/plugins/pbr/scripts/validate-task.js +14 -1
  69. package/plugins/pbr/skills/begin/SKILL.md +11 -27
  70. package/plugins/pbr/skills/discuss/SKILL.md +53 -3
  71. package/plugins/pbr/skills/health/SKILL.md +13 -0
  72. package/plugins/pbr/skills/import/SKILL.md +276 -1
  73. package/plugins/pbr/skills/plan/SKILL.md +11 -1
  74. package/plugins/pbr/skills/shared/context-loader-task.md +2 -0
  75. package/plugins/pbr/skills/status/SKILL.md +17 -0
  76. package/plugins/pbr/templates/PROJECT.md.tmpl +41 -0
  77. package/plugins/pbr/templates/REQUIREMENTS.md.tmpl +52 -0
  78. package/plugins/pbr/templates/VERIFICATION-DETAIL.md.tmpl +5 -0
  79. package/plugins/pbr/templates/project-CONTEXT.md.tmpl +43 -0
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: import
3
3
  description: "Import external plans. Validates context, detects conflicts, generates PLAN.md."
4
- argument-hint: "<phase-number> [--from <filepath>] [--skip-checker]"
4
+ argument-hint: "<phase-number> [--from <filepath>] [--skip-checker] | --prd <filepath>"
5
5
  ---
6
6
 
7
7
  **STOP — DO 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.**
@@ -50,7 +50,15 @@ Reference: `skills/shared/config-loading.md` for the tooling shortcut and config
50
50
  1. Parse `$ARGUMENTS` for phase number
51
51
  2. Parse optional `--from <filepath>` flag (path to the external document to import)
52
52
  3. Parse optional `--skip-checker` flag (skip plan validation step)
53
+ 3b. Parse optional `--prd <filepath>` flag.
54
+ - If `--prd` is present: **branch into PRD Import Flow (Steps A–G below)** immediately after writing `.active-skill`.
55
+ - Do NOT proceed to Step 2 (standard import flow). The --prd branch is a completely separate execution path.
56
+ - If both `--prd` and `--from` are present: treat `--prd` as the primary flag; `--from` is ignored with an [INFO] note.
57
+ - If `--prd` is present but no filepath follows: display error "Missing filepath for --prd flag." and stop.
53
58
  4. **CRITICAL: Write .active-skill NOW.** Write the text "import" to `.planning/.active-skill` using the Write tool.
59
+
60
+ **→ If --prd flag was set: jump to PRD Import Flow (Step A). Do not continue to Step 2.**
61
+
54
62
  5. Validate:
55
63
  - Phase exists in ROADMAP.md
56
64
  - Phase directory exists at `.planning/phases/{NN}-{slug}/`
@@ -62,6 +70,253 @@ Reference: `skills/shared/config-loading.md` for the tooling shortcut and config
62
70
 
63
71
  ---
64
72
 
73
+ ## PRD Import Flow
74
+
75
+ > **Entered when `--prd <filepath>` is present in $ARGUMENTS. Steps A–G replace Steps 2–11 entirely for this path.**
76
+
77
+ ---
78
+
79
+ ### Step A: Read and Validate PRD File
80
+
81
+ 1. Read the file at the `--prd <filepath>` path.
82
+ 2. If the file does not exist: display the "Import file not found" error from the Error Handling section and stop.
83
+ 3. If the file is empty or < 100 characters: display error "PRD file appears empty or too short to extract meaningful content." and stop.
84
+ 4. Store the full PRD content for use in Steps B–E.
85
+
86
+ ---
87
+
88
+ ### Step B: Gap Detection — Identify Missing Sections (inline)
89
+
90
+ Analyze the PRD content for the presence of these six required sections:
91
+
92
+ | Section | What to look for |
93
+ |---------|-----------------|
94
+ | Project name / title | A clear product name or title |
95
+ | Problem statement | What problem the product solves, who it's for |
96
+ | Goals / success criteria | Measurable outcomes, KPIs, or acceptance tests |
97
+ | Functional requirements | Feature list, user stories, or capabilities |
98
+ | Non-functional requirements | Performance, security, reliability constraints |
99
+ | Out of scope / deferred | Explicitly excluded features |
100
+
101
+ For each section that is **absent or ambiguous**, record it as a gap.
102
+
103
+ **If 1–3 gaps found:** Batch all gaps into ≤ 3 AskUserQuestion calls (max 4 options each). Ask the user to supply the missing info:
104
+
105
+ - If 1 gap: one AskUserQuestion with a freeform prompt.
106
+ - If 2–3 gaps: group into 2 AskUserQuestion calls of related topics (e.g., "Requirements" and "Constraints/Scope").
107
+ - If > 3 gaps: group all into exactly 3 AskUserQuestion calls. Do NOT exceed 3 calls.
108
+
109
+ Example AskUserQuestion for missing requirements:
110
+
111
+ ```
112
+ Use AskUserQuestion:
113
+ question: "The PRD doesn't clearly specify functional requirements. Please describe the main features or capabilities this product must have."
114
+ header: "Fill Gap"
115
+ options: [] ← freeform (no options means free text input)
116
+ multiSelect: false
117
+ ```
118
+
119
+ **If 0 gaps:** proceed directly to Step C with no prompts.
120
+
121
+ Incorporate user answers into the extraction context used in Step C.
122
+
123
+ ---
124
+
125
+ ### Step C: Extract 3 Files Inline (PROJECT.md, REQUIREMENTS.md, CONTEXT.md)
126
+
127
+ Using the PRD content (plus any gap-fill answers from Step B), generate the content for three files. Do this inline in your context — no agents for these three files.
128
+
129
+ **C1. Generate PROJECT.md content** using `templates/PROJECT.md.tmpl` as the structure:
130
+
131
+ - `{project_name}`: extract from PRD title/header
132
+ - `{ONE sentence core value statement}`: extract from problem statement / vision
133
+ - Vision section: 2-3 sentences from PRD problem statement
134
+ - Scope — In Scope: features from functional requirements section
135
+ - Scope — Out of Scope: features from "out of scope" section (or mark "None specified" if absent)
136
+ - Success Criteria: from goals/KPIs section
137
+ - Stakeholders: extract if present; default to "Primary user: end users of the product"
138
+ - Milestones line: leave as "Planned in {N} phases across 1 milestone — see .planning/ROADMAP.md"
139
+
140
+ **C2. Generate REQUIREMENTS.md content** using `templates/REQUIREMENTS.md.tmpl` as the structure:
141
+
142
+ - Functional Requirements: each feature/capability from PRD becomes one REQ-F-xxx row
143
+ - Number from REQ-F-001 sequentially
144
+ - Priority: "Must" for core features, "Should" for nice-to-haves (infer from PRD language)
145
+ - Non-Functional Requirements: from performance/security/reliability section if present
146
+ - Deferred Requirements: items from "out of scope" section
147
+ - Traceability table: leave "Implemented In" and "Verified In" columns as "—"
148
+
149
+ **C3. Generate CONTEXT.md content** using `templates/project-CONTEXT.md.tmpl` as the structure:
150
+
151
+ - Locked Decisions: extract any explicit technology choices or constraints from PRD
152
+ - User Constraints: extract deployment, team size, budget, timeline if mentioned
153
+ - Deferred Ideas: items from "out of scope" section
154
+ - Claude's Discretion Areas: leave empty (executor will fill as they work)
155
+
156
+ ---
157
+
158
+ ### Step D: Confirmation Gate
159
+
160
+ **Check config:** Read `.planning/config.json`. If `prd.auto_extract` is `true`, skip this step entirely and proceed directly to Step E.
161
+
162
+ **If prd.auto_extract is false (default):**
163
+
164
+ Display a preview of the three generated files (show first 10 lines of each with a `...` truncation).
165
+
166
+ Then present the confirmation gate using the **approve-revise-abort** pattern from `skills/shared/gate-prompts.md`:
167
+
168
+ ```
169
+ Use AskUserQuestion:
170
+ question: "Approve these extracted files? (PROJECT.md, REQUIREMENTS.md, CONTEXT.md — ROADMAP.md will be generated next)"
171
+ header: "Approve?"
172
+ options:
173
+ - label: "Approve" description: "Write files and generate ROADMAP.md"
174
+ - label: "Request changes" description: "Describe what to adjust before writing"
175
+ - label: "Abort" description: "Cancel PRD import"
176
+ multiSelect: false
177
+ ```
178
+
179
+ - **Approve**: proceed to Step E.
180
+ - **Request changes**: ask user what to change (AskUserQuestion freeform), revise the affected file(s) inline, and re-display the gate. Repeat until Approve or Abort.
181
+ - **Abort**: delete `.planning/.active-skill` and stop with message: "PRD import cancelled."
182
+
183
+ ---
184
+
185
+ ### Step E: Check for Existing Files and Write PROJECT.md, REQUIREMENTS.md, CONTEXT.md
186
+
187
+ For each of the three files (`PROJECT.md`, `REQUIREMENTS.md`, `CONTEXT.md` in `.planning/`):
188
+
189
+ 1. Check if the file already exists (Glob `.planning/PROJECT.md`, etc.).
190
+ 2. If it exists: use AskUserQuestion yes-no pattern:
191
+ ```
192
+ question: ".planning/{filename} already exists. Overwrite it?"
193
+ header: "Overwrite?"
194
+ options:
195
+ - label: "Yes" description: "Replace existing file"
196
+ - label: "No" description: "Keep existing, skip this file"
197
+ ```
198
+ - If No: skip writing that file.
199
+ 3. Write approved content to:
200
+ - `.planning/PROJECT.md`
201
+ - `.planning/REQUIREMENTS.md`
202
+ - `.planning/CONTEXT.md`
203
+
204
+ ---
205
+
206
+ ### Step F: Delegate ROADMAP.md Generation to pbr:planner
207
+
208
+ Display: `◐ Generating ROADMAP.md via planner...`
209
+
210
+ Spawn the planner subagent:
211
+
212
+ ```
213
+ Task({
214
+ subagent_type: "pbr:planner",
215
+ prompt: "
216
+ You are the planner agent in Roadmap Mode.
217
+
218
+ <files_to_read>
219
+ CRITICAL: Read these files BEFORE any other action:
220
+ 1. .planning/PROJECT.md
221
+ 2. .planning/REQUIREMENTS.md
222
+ 3. .planning/CONTEXT.md
223
+ </files_to_read>
224
+
225
+ Generate `.planning/ROADMAP.md` from the project files above.
226
+
227
+ Use the roadmap template at `${PLUGIN_ROOT}/templates/ROADMAP.md.tmpl`.
228
+ Apply Requirement Coverage Validation: every requirement in REQUIREMENTS.md must appear in at least one phase.
229
+ Apply the Dual Format requirement: Quick-scan checklist at top + detailed phase descriptions.
230
+ Wrap all phases in a Milestone section named after the project.
231
+
232
+ Write ROADMAP.md to `.planning/ROADMAP.md`.
233
+ Output your completion marker when done: ## PLANNING COMPLETE
234
+ "
235
+ })
236
+ ```
237
+
238
+ After the Task() completes:
239
+
240
+ - Confirm `.planning/ROADMAP.md` exists (Glob check).
241
+ - If missing: display error "Planner failed to generate ROADMAP.md. Run /pbr:plan to retry." and proceed to Step G anyway (the other 3 files are already written).
242
+
243
+ ---
244
+
245
+ ### Step G: State Updates, Commit, and Summary
246
+
247
+ **G1. Initialize STATE.md** (if it does not already exist):
248
+
249
+ - Run: `node ${PLUGIN_ROOT}/scripts/pbr-tools.js state load`
250
+ - If STATE.md does not exist: create `.planning/STATE.md` with frontmatter fields:
251
+ ```
252
+ project: {project_name from PROJECT.md}
253
+ current_phase: 1
254
+ status: planning
255
+ source: prd-import
256
+ prd_file: {filepath}
257
+ ```
258
+
259
+ **G2. Update STATE.md** with PRD import status:
260
+
261
+ - Set `status: planning`
262
+ - Note `source: prd-import` and `prd_file: {filepath}`
263
+
264
+ **G3. Commit (if planning.commit_docs is true in config):**
265
+
266
+ Reference: `skills/shared/commit-planning-docs.md` for the standard commit pattern.
267
+
268
+ ```
269
+ docs(planning): init project docs from PRD import
270
+ ```
271
+
272
+ Stage: `.planning/PROJECT.md`, `.planning/REQUIREMENTS.md`, `.planning/CONTEXT.md`, `.planning/ROADMAP.md` (if generated), `.planning/STATE.md`.
273
+
274
+ **G4. Delete `.planning/.active-skill`.**
275
+
276
+ **G5. Display completion banner:**
277
+
278
+ ```
279
+ ╔══════════════════════════════════════════════════════════════╗
280
+ ║ PLAN-BUILD-RUN ► PRD IMPORT COMPLETE ✓ ║
281
+ ╚══════════════════════════════════════════════════════════════╝
282
+
283
+ **Project**: {project_name}
284
+ **Source**: {prd_filepath}
285
+
286
+ Files generated:
287
+ ✓ .planning/PROJECT.md
288
+ ✓ .planning/REQUIREMENTS.md
289
+ ✓ .planning/CONTEXT.md
290
+ {✓ or ✗} .planning/ROADMAP.md
291
+
292
+ Requirements extracted: {count} REQ-IDs
293
+ Gaps filled: {count} (via interactive prompts)
294
+
295
+
296
+
297
+ ╔══════════════════════════════════════════════════════════════╗
298
+ ║ ▶ NEXT UP ║
299
+ ╚══════════════════════════════════════════════════════════════╝
300
+
301
+ **Plan Phase 1** — generate execution plans for the first phase
302
+
303
+ `/pbr:plan 1`
304
+
305
+ <sub>`/clear` first → fresh context window</sub>
306
+
307
+
308
+
309
+ **Also available:**
310
+ - `/pbr:discuss` — review and refine decisions before planning
311
+ - `/pbr:status` — see full project overview
312
+ ```
313
+
314
+ ---
315
+
316
+ > **End of PRD Import Flow. Steps 2–11 below apply only to the standard --from flow.**
317
+
318
+ ---
319
+
65
320
  ### Step 2: Load Full Project Context (inline)
66
321
 
67
322
  Read all relevant context files. This context is used for conflict detection in Step 4.
@@ -501,6 +756,22 @@ File not found: {filepath}
501
756
  **To fix:** Check the path and try again.
502
757
  ```
503
758
 
759
+ ### PRD file too short
760
+ If the PRD file is < 100 characters:
761
+ ```
762
+ ╔══════════════════════════════════════════════════════════════╗
763
+ ║ ERROR ║
764
+ ╚══════════════════════════════════════════════════════════════╝
765
+
766
+ PRD file appears empty or too short to extract meaningful content.
767
+
768
+ **To fix:** Provide a more complete PRD document (minimum ~100 characters).
769
+ ```
770
+
771
+ ### PRD import cancelled
772
+ If user selects "Abort" at the confirmation gate (Step D):
773
+ Display: "PRD import cancelled." and delete `.planning/.active-skill`.
774
+
504
775
  ### Import document too vague
505
776
  If the imported document contains no actionable tasks, display:
506
777
  ```
@@ -537,3 +808,7 @@ Present remaining issues and ask user to decide: proceed or intervene.
537
808
  | `.planning/ROADMAP.md` | Plans Complete + Status updated to `planned` | Step 8a |
538
809
  | `.planning/STATE.md` | Updated with plan status and import source | Step 8b |
539
810
  | `.planning/CONTEXT.md` | Updated if blockers surfaced new locked decisions | Step 8d |
811
+ | `.planning/PROJECT.md` | Generated from PRD | Step E (PRD flow) |
812
+ | `.planning/REQUIREMENTS.md` | Generated from PRD | Step E (PRD flow) |
813
+ | `.planning/CONTEXT.md` | Generated from PRD | Step E (PRD flow) |
814
+ | `.planning/ROADMAP.md` | Generated by planner subagent | Step F (PRD flow) |
@@ -485,7 +485,17 @@ Use AskUserQuestion (pattern: approve-revise-abort from `skills/shared/gate-prom
485
485
  - Or make small inline edits to plan files directly
486
486
 
487
487
  **If user selects 'Approve':**
488
- - **CONTEXT.md compliance reporting**: If `.planning/CONTEXT.md` exists, compare all locked decisions against the generated plans. Print: "CONTEXT.md compliance: {M}/{N} locked decisions mapped to tasks" where M = locked decisions that are reflected in at least one task, N = total locked decisions. If any locked decisions are unmapped, list them as warnings.
488
+ - **CONTEXT.md compliance reporting**: Check locked decisions from BOTH sources:
489
+ a. Project-level: `.planning/CONTEXT.md` (if exists) — cross-cutting decisions for all phases
490
+ b. Phase-level: `.planning/phases/{NN}-{slug}/CONTEXT.md` (if exists) — phase-specific decisions
491
+ Phase-level decisions override project-level for the same decision area.
492
+
493
+ Collect ALL locked decisions from both files (deduplicate identical decision text).
494
+ Compare against the generated plan tasks. Print:
495
+ `CONTEXT.md compliance: {M}/{N} locked decisions mapped to tasks`
496
+ where M = locked decisions reflected in at least one task action, N = total unique locked decisions.
497
+ If any locked decisions are unmapped, list them as warnings.
498
+ If neither CONTEXT.md exists: skip this check silently.
489
499
  - **Dependency fingerprinting**: For each dependency phase (phases that this phase depends on, per ROADMAP.md):
490
500
  1. Find all SUMMARY.md files in the dependency phase directory
491
501
  2. Compute a fingerprint string for each: `"len:{bytes}-mod:{mtime}"` and add as a `dependency_fingerprints` map in each plan's YAML frontmatter — this allows the build skill to detect stale plans if dependencies were rebuilt.
@@ -28,6 +28,7 @@ Task({
28
28
  - .planning/STATE.md
29
29
  - .planning/ROADMAP.md
30
30
  - .planning/REQUIREMENTS.md
31
+ - .planning/PROJECT.md (if exists — project vision and scope)
31
32
  - .planning/CONTEXT.md
32
33
  - Any .planning/phases/*/CONTEXT.md files
33
34
  - .planning/research/SUMMARY.md (if exists)
@@ -65,6 +66,7 @@ Task({
65
66
  - .planning/STATE.md
66
67
  - .planning/ROADMAP.md
67
68
  - .planning/REQUIREMENTS.md
69
+ - .planning/PROJECT.md (if exists — project vision and scope)
68
70
  - .planning/CONTEXT.md
69
71
  - Any .planning/phases/*/CONTEXT.md files
70
72
  - .planning/HISTORY.md (if exists — scan for decisions relevant to '{topic}' only, do NOT summarize all history)
@@ -111,6 +111,16 @@ Parse the JSON response. Capture:
111
111
 
112
112
  Store these for use in Step 4 display and Step 5 routing.
113
113
 
114
+ 6. **`.planning/CONTEXT.md`** (project-level, if exists)
115
+ - Note: project-level locked decisions file
116
+
117
+ ### Step 1d: Check Project Documents
118
+
119
+ Check existence of the three project-level documents and record their status for Step 4 display:
120
+ - `.planning/PROJECT.md` — exists or not
121
+ - `.planning/REQUIREMENTS.md` — exists or not
122
+ - `.planning/CONTEXT.md` — exists or not
123
+
114
124
  ### Step 2: Scan Phase Directories
115
125
 
116
126
  For each phase listed in ROADMAP.md:
@@ -221,6 +231,13 @@ Phase Status:
221
231
  | 2. {name} | {status indicator} {status text} | {completed}/{total} | {percentage}% |
222
232
  | ...
223
233
 
234
+ **Project documents:**
235
+ | File | Status |
236
+ |------|--------|
237
+ | PROJECT.md | {exists / not found — run /pbr:begin} |
238
+ | REQUIREMENTS.md | {exists / not found — run /pbr:begin} |
239
+ | CONTEXT.md | {exists / not found — run /pbr:discuss --project} |
240
+
224
241
  {If context tier is DEGRADING, POOR, or CRITICAL:}
225
242
  ⚠ Context: {percentage}% used ({tier}) — {recommendation_text}
226
243
  Run `/compact` to reclaim context before spawning more agents.
@@ -0,0 +1,41 @@
1
+ # {project_name}
2
+
3
+ > {ONE sentence core value statement}
4
+
5
+ ## Vision
6
+
7
+ {2-3 sentences describing the product and problem it solves. Who is it for? What does it replace or improve?}
8
+
9
+ ## Scope
10
+
11
+ ### In Scope (v1)
12
+
13
+ {Bulleted list of features and capabilities committed for this project.}
14
+
15
+ - {Feature area}: {brief description}
16
+
17
+ ### Out of Scope
18
+
19
+ {Features explicitly excluded from this project.}
20
+
21
+ - {Feature}: {brief reason why excluded}
22
+
23
+ ## Success Criteria
24
+
25
+ {Observable conditions that define project success. Each must be testable.}
26
+
27
+ - {Criterion 1 — specific and measurable}
28
+ - {Criterion 2 — specific and measurable}
29
+ - {Criterion 3 — specific and measurable}
30
+
31
+ ## Stakeholders
32
+
33
+ {Who cares about this project and why.}
34
+
35
+ - **Primary user**: {description}
36
+ - **Team**: {description}
37
+
38
+ ## Milestones
39
+
40
+ {project_name} planned in {phase_count} phases across {milestone_count} milestone(s).
41
+ See `.planning/ROADMAP.md` for phase details.
@@ -0,0 +1,52 @@
1
+ # Requirements
2
+
3
+ > Living document. Generated by `/pbr:begin`, updated via `/pbr:discuss`.
4
+ > All requirements flow from here into plans via `implements:[]` in PLAN.md frontmatter.
5
+
6
+ ## Functional Requirements
7
+
8
+ Capabilities the system must provide from the user's perspective.
9
+
10
+ ### {Category} (e.g., Authentication, API, UI)
11
+
12
+ | ID | Requirement | Priority | Status |
13
+ |----|-------------|----------|--------|
14
+ | REQ-F-001 | {User-centric, testable statement of capability} | Must | Open |
15
+ | REQ-F-002 | {User-centric, testable statement of capability} | Should | Open |
16
+
17
+ ### {Category 2}
18
+
19
+ | ID | Requirement | Priority | Status |
20
+ |----|-------------|----------|--------|
21
+ | REQ-F-010 | {User-centric, testable statement of capability} | Must | Open |
22
+
23
+ ## Non-Functional Requirements
24
+
25
+ Quality attributes and constraints the system must satisfy.
26
+
27
+ | ID | Requirement | Category | Priority |
28
+ |----|-------------|----------|----------|
29
+ | REQ-NF-001 | {Observable quality statement — e.g., "Page loads in <2s on 4G"} | Performance | Must |
30
+ | REQ-NF-002 | {Observable quality statement} | Security | Must |
31
+ | REQ-NF-003 | {Observable quality statement} | Reliability | Should |
32
+
33
+ ## Deferred Requirements (v2+)
34
+
35
+ Requirements explicitly out of scope for v1.
36
+
37
+ | ID | Requirement | Deferred Reason |
38
+ |----|-------------|----------------|
39
+ | REQ-F-099 | {requirement} | {reason — e.g., "Phase 2 priority"} |
40
+
41
+ ## Out of Scope
42
+
43
+ Features explicitly excluded. These must NOT appear in any plan.
44
+
45
+ - {Feature}: {brief rationale}
46
+
47
+ ## Traceability
48
+
49
+ | REQ-ID | Implemented In | Verified In |
50
+ |--------|---------------|------------|
51
+ | REQ-F-001 | Phase 01 PLAN-01 | Phase 01 VERIFICATION.md |
52
+ | REQ-F-002 | — | — |
@@ -23,6 +23,11 @@ anti_patterns:
23
23
  console_logs: {count}
24
24
  skipped_tests: {count}
25
25
  hardcoded_secrets: {count}
26
+ # populated by verifier from implements:[] in plan frontmatter
27
+ satisfied:
28
+ - "REQ-F-001" # REQ-IDs confirmed verified in this phase
29
+ unsatisfied:
30
+ - "REQ-F-002" # REQ-IDs that failed verification
26
31
  ---
27
32
 
28
33
  # Phase Verification: {phase_name}
@@ -0,0 +1,43 @@
1
+ # Project Context
2
+
3
+ > Cross-cutting decisions that ALL phases must honor.
4
+ > Updated via `/pbr:discuss --project`. Auto-synced to CLAUDE.md on write.
5
+ > Phase-level CONTEXT.md (in phase directories) overrides project-level for that phase.
6
+ >
7
+ > PLANNER NOTE: Embed each locked decision directly into the relevant task's action block.
8
+ > Executors NEVER read this file — PLAN.md is self-contained.
9
+
10
+ ## Locked Decisions
11
+
12
+ Technology choices, architecture decisions, and constraints that are NON-NEGOTIABLE across ALL phases.
13
+ The planner embeds these into PLAN.md task actions. Executors never read this file directly.
14
+
15
+ | Decision | Rationale | Locked By |
16
+ |----------|-----------|-----------|
17
+ | {e.g., "Use TypeScript strict mode"} | {User preference, team skill} | User |
18
+ | {e.g., "PostgreSQL via Supabase"} | {Existing infrastructure} | User |
19
+
20
+ ## User Constraints
21
+
22
+ Budget, timeline, skill level, hosting, team size — factors that shape ALL planning decisions.
23
+
24
+ - {e.g., "Solo developer, no team"}
25
+ - {e.g., "Deploy to Hetzner VPS"}
26
+ - {e.g., "Must work offline"}
27
+
28
+ ## Deferred Ideas
29
+
30
+ Ideas explicitly moved to v2 or ruled out. Plans at ANY phase MUST NOT include these.
31
+
32
+ | Idea | Reason Deferred |
33
+ |------|----------------|
34
+ | {feature} | {reason — e.g., "Post-launch priority"} |
35
+
36
+ ## Claude's Discretion Areas
37
+
38
+ Areas where planners can make implementation choices without asking the user.
39
+ Document the choice made and rationale when exercised.
40
+
41
+ | Area | Choice Made | Rationale |
42
+ |------|------------|-----------|
43
+ | {e.g., "Logging library"} | {e.g., "pino"} | {e.g., "Lightweight, structured output"} |
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pbr",
3
- "version": "2.59.0",
3
+ "version": "2.61.0",
4
4
  "description": "Plan-Build-Run — Structured development workflow for Claude Code. Solves context rot through disciplined subagent delegation, structured planning, atomic execution, and goal-backward verification.",
5
5
  "author": {
6
6
  "name": "SienkLogic",
@@ -43,6 +43,9 @@ You are **executor**, the code execution agent for Plan-Build-Run. You receive v
43
43
  a. Read task XML
44
44
  b. Execute <action> steps
45
45
  c. Run <verify> commands
46
+ - If <verify> contains an <automated> child element, extract and run the command inside it
47
+ - If <verify> is plain text (no <automated> child), run it as before (backward compat)
48
+ - Both forms produce the same result — <automated> is machine-parseable, plain text is human-readable
46
49
  d. If verify passes: commit
47
50
  e. If verify fails: apply deviation rules
48
51
  f. If checkpoint: STOP and return
@@ -204,6 +207,11 @@ When a task has a checkpoint type, **STOP execution** and return a structured re
204
207
  | `decision` | Before executing | Decision needed, options, context |
205
208
  | `human-action` | Before executing | What user must do, step-by-step |
206
209
 
210
+ **auto_checkpoints config**: After loading plan frontmatter, read `gates.auto_checkpoints` from config.json (default false):
211
+ - Load with: `node pbr-tools.js config-get gates.auto_checkpoints`
212
+ - When `auto_checkpoints` is true AND task type is `checkpoint:human-verify`: run the automated verify command. If it passes, auto-approve and continue. If it fails, still STOP and return the checkpoint response.
213
+ - `checkpoint:decision` and `checkpoint:human-action` always require human input regardless of `auto_checkpoints`.
214
+
207
215
  **Automation-first**: Complete all automatable pre-work before any checkpoint. Only checkpoint for genuinely human-required actions (API keys needing account login, architectural choices, destructive approvals).
208
216
 
209
217
  All responses use: `CHECKPOINT: {TYPE}` header, task info, type-specific fields, completed tasks table, remaining tasks list.
@@ -163,14 +163,16 @@ Plans declare `provides`/`consumes`; all consumed items must have providers.
163
163
  | Missing provides/consumes for exports | INFO |
164
164
 
165
165
  ### D9: Requirement Traceability
166
- Plans declare `requirement_ids` with bidirectional coverage. Forward: IDs trace to REQUIREMENTS.md (or ROADMAP.md goals). Backward: every requirement covered by at least one plan.
166
+ Plans declare `implements` with bidirectional coverage. Forward: IDs trace to REQUIREMENTS.md (or ROADMAP.md goals). Backward: every requirement covered by at least one plan.
167
+
168
+ > **Note:** `requirement_ids:` is a deprecated alias for `implements:` — treat as equivalent during transition.
167
169
 
168
170
  | Condition | Severity |
169
171
  |-----------|----------|
170
- | requirement_id references nonexistent requirement | BLOCKER |
172
+ | implements: ID references nonexistent requirement | BLOCKER |
171
173
  | Requirement not covered by any plan | WARNING |
172
174
  | ROADMAP goal not covered (no REQUIREMENTS.md) | WARNING |
173
- | Plan missing requirement_ids entirely | INFO |
175
+ | Plan missing implements: entirely | WARNING |
174
176
 
175
177
  ### D10: Test Plan Coverage
176
178
  Code-producing tasks should include test expectations. Check that tasks creating or modifying source code have corresponding test references in `<files>`, `<action>`, or `<verify>`. Test files should appear in `<files>`, test commands in `<verify>`, and test outcomes in `<done>`.
@@ -16,7 +16,7 @@ you MUST Read every listed file BEFORE any other action.
16
16
  Skipping this causes hallucinated context and broken output.
17
17
  </files_to_read>
18
18
 
19
- > Default files: CONTEXT.md, ROADMAP.md, research documents, existing plan files
19
+ > Default files: PROJECT.md (if exists), CONTEXT.md (project-level, if exists), phase CONTEXT.md (if exists), ROADMAP.md, research documents, existing plan files
20
20
 
21
21
  # Plan-Build-Run Planner
22
22
 
@@ -27,7 +27,7 @@ You are **planner**, the planning agent for the Plan-Build-Run development syste
27
27
 
28
28
  ## Core Principle: Context Fidelity
29
29
 
30
- **Locked decisions from CONTEXT.md are NON-NEGOTIABLE.** You never substitute, reinterpret, or work around locked decisions. If CONTEXT.md says "Use PostgreSQL", the plan uses PostgreSQL. Period.
30
+ **Locked decisions from BOTH `.planning/CONTEXT.md` (project-level) AND `.planning/phases/{NN}-{slug}/CONTEXT.md` (phase-level) are NON-NEGOTIABLE.** Phase-level overrides project-level for the same decision area. You never substitute, reinterpret, or work around locked decisions. If CONTEXT.md says "Use PostgreSQL", the plan uses PostgreSQL. Period.
31
31
 
32
32
  **Deferred ideas from CONTEXT.md MUST NOT appear in plans.** If something is marked as deferred, it does not exist for planning purposes. Do not plan for it, do not create hooks for it, do not "prepare" for it.
33
33
  </role>
@@ -199,7 +199,13 @@ Two plans CONFLICT if their `files_modified` lists overlap. Conflicting plans MU
199
199
  <execution_flow>
200
200
  ## Planning Process
201
201
 
202
- 1. **Load Context**: Read CONTEXT.md (locked decisions + deferred ideas), phase goal, and any research documents.
202
+ 1. **Load Context**: Read locked decisions, phase goal, and any research documents.
203
+ - Read `.planning/PROJECT.md` (if exists) — project scope/out-of-scope constraints
204
+ - Read `.planning/CONTEXT.md` (project-level, if exists) — cross-cutting locked decisions
205
+ - Read `.planning/phases/{NN}-{slug}/CONTEXT.md` (phase-level, if exists) — phase-specific decisions
206
+ - Phase-level CONTEXT.md overrides project-level for conflicting decision areas
207
+ - **For each locked decision found**: embed it directly into the relevant task's `<action>` block.
208
+ Executors NEVER read CONTEXT.md — PLAN.md task actions must be self-contained.
203
209
 
204
210
  ### Handling [NEEDS DECISION] Items
205
211
  When CONTEXT.md or RESEARCH-SUMMARY.md contains `[NEEDS DECISION]` flags from the synthesizer:
@@ -209,7 +215,7 @@ When CONTEXT.md or RESEARCH-SUMMARY.md contains `[NEEDS DECISION]` flags from th
209
215
  2. **Derive Must-Haves**: Apply goal-backward methodology — state the phase goal as a user-observable outcome, derive truths, artifacts, and key links.
210
216
  3. **Break Down Tasks**: For each must-have, determine code changes, files involved, verification method, and observable done condition. Group related work into tasks (2-3 per plan).
211
217
  4. **Assign Waves and Dependencies**: Identify independent tasks (Wave 1), map dependencies, assign wave numbers, check for circular deps and file conflicts within same wave.
212
- 5. **Write Plan Files**: Complete YAML frontmatter (include `requirement_ids` from REQUIREMENTS.md or ROADMAP.md goal IDs for traceability), XML tasks with all 5 elements, clear action instructions, executable verify commands, observable done conditions. Append a `## Summary` section per `references/plan-format.md` (under 500 tokens): plan ID, numbered task list, key files, must-haves, provides/consumes.
218
+ 5. **Write Plan Files**: Complete YAML frontmatter (include `implements` field with REQ-IDs from REQUIREMENTS.md or ROADMAP.md for traceability; `requirement_ids` is a deprecated alias — use `implements` as the primary field), XML tasks with all 5 elements, clear action instructions, executable verify commands, observable done conditions. Append a `## Summary` section per `references/plan-format.md` (under 500 tokens): plan ID, numbered task list, key files, must-haves, provides/consumes.
213
219
  6. **Self-Check** before writing:
214
220
 
215
221
  **CRITICAL — Run the self-check. Plans missing must-have coverage or incomplete tasks cause executor failures.**
@@ -247,7 +253,7 @@ When receiving checker feedback:
247
253
 
248
254
  ## Context Optimization
249
255
 
250
- **Context Fidelity Self-Check**: Before writing plans, verify: (1) every locked decision in CONTEXT.md has a corresponding task, (2) no task implements a deferred idea, (3) each "Claude's Discretion" item is addressed in at least one task. Report: "CONTEXT.md compliance: {M}/{N} locked decisions mapped."
256
+ **Context Fidelity Self-Check**: Before writing plans, verify: (1) every locked decision in BOTH `.planning/CONTEXT.md` (project-level) AND `.planning/phases/{NN}-{slug}/CONTEXT.md` (phase-level) has a corresponding task (deduplicate identical decisions across both files), (2) no task implements a deferred idea, (3) each "Claude's Discretion" item is addressed in at least one task. Report: "CONTEXT.md compliance: {M}/{N} locked decisions mapped."
251
257
 
252
258
  **Frontmatter-First Assembly**: When prior plans exist, read SUMMARY.md frontmatter only (not full body) — 10 frontmatters ~500 tokens vs 10 full SUMMARYs ~5000 tokens. Extract: `provides`, `requires`, `key_files`, `key_decisions`, `patterns`. Only read full body when a specific detail is needed.
253
259
 
@@ -263,7 +269,7 @@ When receiving checker feedback:
263
269
  - [ ] Tasks grouped into plans by wave
264
270
  - [ ] PLAN files exist with XML task structure
265
271
  - [ ] Each plan: frontmatter complete (depends_on, files_modified, must_haves)
266
- - [ ] Each plan: requirement_ids field populated (MUST NOT be empty)
272
+ - [ ] Each plan: implements: field populated (list REQ-IDs; use [] only if phase has no REQUIREMENTS.md)
267
273
  - [ ] Each task: all 5 elements (name, files, action, verify, done)
268
274
  - [ ] Wave structure maximizes parallelism
269
275
  - [ ] Every REQ-ID from ROADMAP/REQUIREMENTS appears in at least one plan
@@ -343,7 +349,7 @@ One-line task descriptions in `<name>`. File paths in `<files>`, not explanation
343
349
  11. DO NOT leave done conditions vague — they must be observable
344
350
  12. DO NOT specify literal `undefined` for parameters that have a known source in the calling context — use data contracts to map sources
345
351
  13. DO NOT use Bash heredoc for file creation — ALWAYS use the Write tool
346
- 14. DO NOT leave requirement_ids empty in PLAN frontmatter — every plan must trace to requirements
352
+ 14. DO NOT leave implements: empty in PLAN frontmatter — use implements: as the primary traceability field (requirement_ids: is deprecated)
347
353
 
348
354
  </anti_patterns>
349
355