@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": "pbr",
3
3
  "displayName": "Plan-Build-Run",
4
- "version": "2.59.0",
4
+ "version": "2.61.0",
5
5
  "description": "Plan-Build-Run — Structured development workflow for GitHub Copilot CLI. Solves context rot through disciplined agent delegation, structured planning, atomic execution, and goal-backward verification.",
6
6
  "author": {
7
7
  "name": "SienkLogic",
@@ -43,9 +43,9 @@ provides:
43
43
  - "requireAuth() middleware"
44
44
  consumes:
45
45
  - "Database connection (from plan 01-01)"
46
- requirement_ids:
47
- - "P02-G1"
48
- - "P02-G2"
46
+ implements:
47
+ - "REQ-F-001"
48
+ - "REQ-F-002"
49
49
  closes_issues:
50
50
  - 42
51
51
  - 57
@@ -71,7 +71,8 @@ closes_issues:
71
71
  | `must_haves.key_links` | YES | array | Connections between components. Append `: grep command` for verification. |
72
72
  | `provides` | NO | array | What this plan exports for other plans to consume (classes, endpoints, modules) |
73
73
  | `consumes` | NO | array | What this plan needs from prior plans. Format: `"Thing (from plan XX-YY)"` |
74
- | `requirement_ids` | NO | array | Requirement IDs from REQUIREMENTS.md or ROADMAP.md goal IDs that this plan addresses. Enables bidirectional traceability between plans and requirements/goals. |
74
+ | `implements` | NO (WARNING if absent) | array | REQ-IDs from REQUIREMENTS.md this plan addresses. Primary traceability field. |
75
+ | `requirement_ids` | NO | array | DEPRECATED — use `implements:` instead. Kept for backward compat. |
75
76
  | `dependency_fingerprints` | NO | object | Hashes of dependency phase SUMMARY.md files at plan-creation time. Used to detect stale plans. |
76
77
  | `data_contracts` | NO | array | Cross-boundary parameter mappings for calls where arguments originate from external boundaries. Format: `"param: source (context) [fallback]"` |
77
78
  | `closes_issues` | NO | number[] | GitHub issue numbers to close when this plan's final commit lands. Default: `[]` |
@@ -162,14 +163,20 @@ The Summary section is generated by the planner agent at plan creation time. It
162
163
  DISCORD_REDIRECT_URI=http://localhost:3000/auth/callback
163
164
  </action>
164
165
  <verify>
165
- npx tsc --noEmit
166
- ls src/auth/discord.ts
167
- ls src/auth/types.ts
166
+ <automated>
167
+ npx tsc --noEmit
168
+ ls src/auth/discord.ts
169
+ ls src/auth/types.ts
170
+ </automated>
168
171
  </verify>
169
172
  <done>Discord OAuth client module exists and compiles without errors</done>
170
173
  </task>
171
174
  ```
172
175
 
176
+ > **Verify block forms**: The `<automated>` wrapper (Option A) is preferred — it enables machine-parsing
177
+ > for `auto_checkpoints` mode. Plain-text verify commands without the wrapper (Option B) remain valid
178
+ > for backward compatibility. Both forms are supported by the executor.
179
+
173
180
  ### TDD Task
174
181
 
175
182
  ```xml
@@ -204,6 +211,33 @@ The Summary section is generated by the planner agent at plan creation time. It
204
211
  </task>
205
212
  ```
206
213
 
214
+ ### Feature Task (TDD Variant)
215
+
216
+ Feature tasks add a `<feature>` element for structured TDD planning. The element contains two required children:
217
+
218
+ - **`<behavior>`** — the observable outcome from the user's perspective. Maps directly to a `must_haves.truths` entry.
219
+ - **`<implementation>`** — the technical approach at a high level (which files, patterns, or algorithms to use).
220
+
221
+ Prose structure (illustrative — not a live task block to avoid validator false-positives):
222
+
223
+ ```
224
+ task id="02-01-T3" type="auto" tdd="true" complexity="medium"
225
+ name: Implement rate limiter for OAuth endpoint
226
+ files: src/middleware/rate-limit.ts / tests/middleware/rate-limit.test.ts
227
+ feature:
228
+ behavior: OAuth endpoint rejects more than 5 requests per minute per IP with HTTP 429
229
+ implementation: Token-bucket algorithm; Redis-backed counter with TTL; express-rate-limit wrapper
230
+ action:
231
+ RED: Write failing tests for 429 response at >5 req/min
232
+ GREEN: Implement token-bucket middleware using Redis
233
+ REFACTOR: Extract counter logic to RateLimitStore class
234
+ verify:
235
+ automated: npm test -- --grep "rate limiter"
236
+ done: Rate limiter rejects excessive OAuth requests with 429
237
+ ```
238
+
239
+ The `<feature>` element is optional — standard TDD tasks without it are still valid. Use `<feature>` when the planner wants to record the behavior/implementation split explicitly for traceability.
240
+
207
241
  ### Checkpoint: Human Verify
208
242
 
209
243
  ```xml
@@ -291,9 +325,13 @@ Every task MUST have ALL 5. No exceptions.
291
325
  | `<name>` | What the task does | Imperative verb phrase. Short. |
292
326
  | `<files>` | Files touched | One per line. Actual file paths. |
293
327
  | `<action>` | How to do it | Numbered steps. Specific. Code snippets for complex work. |
294
- | `<verify>` | How to check | Executable shell commands. Or checkpoint format. |
328
+ | `<verify>` | How to check | Executable shell commands (plain-text or wrapped in `<automated>`). Or checkpoint format. |
295
329
  | `<done>` | How to know it worked | Observable user/system behavior. Maps to a must-have. |
296
330
 
331
+ > **Optional `<feature>` element**: Feature tasks (TDD variant) may add a `<feature>` element with
332
+ > `<behavior>` and `<implementation>` children for structured TDD planning. The 5 standard elements
333
+ > above are still required.
334
+
297
335
  ---
298
336
 
299
337
  ## Task ID Format
@@ -546,11 +546,10 @@ For each category, present the features and ask the user to classify each:
546
546
  - **Out of scope** — Will NOT be built
547
547
 
548
548
  **7d. Assign REQ-IDs:**
549
- For each committed requirement, assign an ID in the format `{CATEGORY}-{NN}`:
550
- - `AUTH-01`: User can log in with Discord OAuth
551
- - `AUTH-02`: Protected routes redirect to login
552
- - `UI-01`: Dashboard shows player statistics
553
- - `UI-02`: Mobile-responsive layout
549
+ For each committed requirement, assign an ID using the REQ-F/REQ-NF schema:
550
+ - Functional requirements: `REQ-F-xxx` numbered sequentially within each category (REQ-F-001, REQ-F-002, ...)
551
+ - Non-functional requirements: `REQ-NF-xxx` numbered sequentially across all NFR categories (REQ-NF-001, REQ-NF-002, ...)
552
+ - Examples: `REQ-F-001: User can log in with Discord OAuth`, `REQ-NF-001: Page loads in <2s on 4G`
554
553
 
555
554
  Each requirement must be:
556
555
  - **User-centric** — describes a capability from the user's perspective
@@ -663,28 +662,13 @@ Write the project state files from templates:
663
662
  **CRITICAL (no hook): Write CONTEXT.md NOW. Do NOT skip this step.**
664
663
 
665
664
  **9c. Write CONTEXT.md:**
666
- Create `.planning/CONTEXT.md` from information gathered during questioning:
667
-
668
- ```markdown
669
- # Project Context
670
-
671
- ## Locked Decisions
672
- {Technology choices, architecture decisions, and constraints that are NON-NEGOTIABLE}
673
-
674
- | Decision | Rationale | Locked By |
675
- |----------|-----------|-----------|
676
- | {e.g., "Use TypeScript"} | {User preference, team skill} | User |
677
-
678
- ## User Constraints
679
- {Budget, timeline, skill level, hosting, team size}
680
-
681
- ## Deferred Ideas
682
- {Features explicitly moved to v2 or out-of-scope}
683
-
684
- | Idea | Reason Deferred |
685
- |------|----------------|
686
- | {feature} | {reason} |
687
- ```
665
+ 1. Read `${CLAUDE_SKILL_DIR}/templates/project-CONTEXT.md.tmpl`
666
+ 2. Fill in from the questioning conversation:
667
+ - Locked Decisions: all technology choices and architecture decisions from Step 2
668
+ - User Constraints: budget, timeline, skill level, hosting, team
669
+ - Deferred Ideas: out-of-scope items identified in Step 7c scoping
670
+ - Claude's Discretion: any areas where user said "you decide"
671
+ 3. Write to `.planning/CONTEXT.md`
688
672
 
689
673
  **CRITICAL (no hook): Write HISTORY.md NOW. Do NOT skip this step.**
690
674
 
@@ -35,9 +35,12 @@ This skill runs **inline** (no Task delegation).
35
35
 
36
36
  ### Step 1: Parse Phase Number and Check for Existing Plans
37
37
 
38
- Parse `$ARGUMENTS` to get the phase number.
38
+ Parse `$ARGUMENTS`:
39
+ - If argument is `--project`: enter PROJECT mode (see Step 1-project below). Skip Steps 2-8.
40
+ - If argument is a phase number: enter PHASE mode (existing flow — continue with Step 1 as-is).
41
+ - If no argument: existing logic applies (read STATE.md for current phase).
39
42
 
40
- **Validation:**
43
+ **Validation (PHASE mode):**
41
44
  - Must be a valid phase number (integer or decimal like `3.1`)
42
45
  - If no argument provided, read STATE.md to get the current phase
43
46
  - If no current phase and no argument: "Which phase do you want to discuss? Run `/pbr:status` to see available phases."
@@ -63,6 +66,53 @@ Phase {N} not found.
63
66
  - Warn: "Phase {N} already has plans. Decisions from this discussion won't retroactively change them. Consider re-planning with `/pbr:plan {N}` after."
64
67
  - This is a **warning only** — do not block the discussion
65
68
 
69
+ ### Step 1-project: Project Discussion Mode (--project)
70
+
71
+ When invoked with `--project`, discuss project-level cross-cutting decisions.
72
+ This mode writes to `.planning/CONTEXT.md` (project-level), NOT a phase directory.
73
+
74
+ **Check for existing project CONTEXT.md:**
75
+ 1. Use Glob to check if `.planning/CONTEXT.md` exists.
76
+ 2. If it exists, ask the user (using the context-handling pattern from
77
+ `skills/shared/gate-prompts.md`):
78
+ question: "Project CONTEXT.md already exists. How should we handle it?"
79
+ options: Overwrite | Append | Cancel
80
+ 3. If Cancel: stop and display the existing CONTEXT.md path.
81
+
82
+ **Load project context:**
83
+ - Read `.planning/PROJECT.md` (if exists) — project vision and scope
84
+ - Read `.planning/REQUIREMENTS.md` (if exists) — requirements for constraint awareness
85
+ - Read `.planning/CONTEXT.md` (if exists) — current locked decisions (for Append mode)
86
+
87
+ **Run gray areas for project-level decisions (Steps 2.5-5 pattern):**
88
+ - Identify 3-4 cross-cutting architectural decisions across ALL phases
89
+ - Focus on: technology stack choices, infrastructure, security posture,
90
+ observability approach, deployment strategy, data storage decisions
91
+ - Follow the same Steps 3-5 pattern (gray areas → options → follow-ups)
92
+
93
+ **Write project CONTEXT.md:**
94
+ 1. Read `${CLAUDE_SKILL_DIR}/templates/project-CONTEXT.md.tmpl`
95
+ 2. Fill in from discussion decisions:
96
+ - Locked Decisions table: all decisions the user made (not "Let Claude decide")
97
+ - User Constraints: budget, team, timeline, hosting from the conversation
98
+ - Deferred Ideas: anything explicitly ruled out for this project
99
+ - Claude's Discretion: decisions marked "Let Claude decide"
100
+ 3. If Append mode: merge new decisions with existing CONTEXT.md content
101
+ 4. Write to `.planning/CONTEXT.md`
102
+
103
+ **Update STATE.md pointer:**
104
+ Add under Accumulated Context:
105
+ ```
106
+ Project context: .planning/CONTEXT.md ({N} locked decisions, {N} deferred, {N} discretion)
107
+ ```
108
+
109
+ **After writing:** Auto-sync to CLAUDE.md is handled by the post-write-dispatch hook.
110
+ Display: `✓ Project CONTEXT.md written — locked decisions will auto-sync to CLAUDE.md`
111
+
112
+ Skip to Cleanup step. Do NOT run Steps 2-8 of the phase flow.
113
+
114
+ ---
115
+
66
116
  ### Step 2: Load Phase Context
67
117
 
68
118
  Read the following files to understand what this phase needs to accomplish:
@@ -61,6 +61,19 @@ Stop all further checks.
61
61
  - PASS: All three required files exist
62
62
  - FAIL: List each missing file — "Run `/pbr:begin` to re-initialize, or create the file manually."
63
63
 
64
+ **Advisory checks — WARN if missing, do not FAIL:**
65
+
66
+ - `.planning/PROJECT.md`
67
+ If missing: `⚠ PROJECT.md not found. Run /pbr:begin to generate it, or create from plugins/pbr/templates/PROJECT.md.tmpl.`
68
+
69
+ - `.planning/REQUIREMENTS.md`
70
+ If missing: `⚠ REQUIREMENTS.md not found. Run /pbr:begin to generate it, or create from plugins/pbr/templates/REQUIREMENTS.md.tmpl.`
71
+
72
+ - `.planning/CONTEXT.md` (project-level)
73
+ If missing: `⚠ CONTEXT.md not found. Run /pbr:discuss --project to capture locked decisions.`
74
+
75
+ These files are generated by /pbr:begin. Absence is expected on projects created before v2.15.
76
+
64
77
  ### Check 2: Config Validity
65
78
 
66
79
  Parse `.planning/config.json` as JSON. Check required fields: `version`, `depth`. Check recommended fields: `features`, `models`.
@@ -49,7 +49,15 @@ Reference: `skills/shared/config-loading.md` for the tooling shortcut and config
49
49
  1. Parse `$ARGUMENTS` for phase number
50
50
  2. Parse optional `--from <filepath>` flag (path to the external document to import)
51
51
  3. Parse optional `--skip-checker` flag (skip plan validation step)
52
+ 3b. Parse optional `--prd <filepath>` flag.
53
+ - If `--prd` is present: **branch into PRD Import Flow (Steps A–G below)** immediately after writing `.active-skill`.
54
+ - Do NOT proceed to Step 2 (standard import flow). The --prd branch is a completely separate execution path.
55
+ - If both `--prd` and `--from` are present: treat `--prd` as the primary flag; `--from` is ignored with an [INFO] note.
56
+ - If `--prd` is present but no filepath follows: display error "Missing filepath for --prd flag." and stop.
52
57
  4. **CRITICAL: Write .active-skill NOW.** Write the text "import" to `.planning/.active-skill` using the Write tool.
58
+
59
+ **→ If --prd flag was set: jump to PRD Import Flow (Step A). Do not continue to Step 2.**
60
+
53
61
  5. Validate:
54
62
  - Phase exists in ROADMAP.md
55
63
  - Phase directory exists at `.planning/phases/{NN}-{slug}/`
@@ -61,6 +69,253 @@ Reference: `skills/shared/config-loading.md` for the tooling shortcut and config
61
69
 
62
70
  ---
63
71
 
72
+ ## PRD Import Flow
73
+
74
+ > **Entered when `--prd <filepath>` is present in $ARGUMENTS. Steps A–G replace Steps 2–11 entirely for this path.**
75
+
76
+ ---
77
+
78
+ ### Step A: Read and Validate PRD File
79
+
80
+ 1. Read the file at the `--prd <filepath>` path.
81
+ 2. If the file does not exist: display the "Import file not found" error from the Error Handling section and stop.
82
+ 3. If the file is empty or < 100 characters: display error "PRD file appears empty or too short to extract meaningful content." and stop.
83
+ 4. Store the full PRD content for use in Steps B–E.
84
+
85
+ ---
86
+
87
+ ### Step B: Gap Detection — Identify Missing Sections (inline)
88
+
89
+ Analyze the PRD content for the presence of these six required sections:
90
+
91
+ | Section | What to look for |
92
+ |---------|-----------------|
93
+ | Project name / title | A clear product name or title |
94
+ | Problem statement | What problem the product solves, who it's for |
95
+ | Goals / success criteria | Measurable outcomes, KPIs, or acceptance tests |
96
+ | Functional requirements | Feature list, user stories, or capabilities |
97
+ | Non-functional requirements | Performance, security, reliability constraints |
98
+ | Out of scope / deferred | Explicitly excluded features |
99
+
100
+ For each section that is **absent or ambiguous**, record it as a gap.
101
+
102
+ **If 1–3 gaps found:** Batch all gaps into ≤ 3 AskUserQuestion calls (max 4 options each). Ask the user to supply the missing info:
103
+
104
+ - If 1 gap: one AskUserQuestion with a freeform prompt.
105
+ - If 2–3 gaps: group into 2 AskUserQuestion calls of related topics (e.g., "Requirements" and "Constraints/Scope").
106
+ - If > 3 gaps: group all into exactly 3 AskUserQuestion calls. Do NOT exceed 3 calls.
107
+
108
+ Example AskUserQuestion for missing requirements:
109
+
110
+ ```
111
+ Use AskUserQuestion:
112
+ question: "The PRD doesn't clearly specify functional requirements. Please describe the main features or capabilities this product must have."
113
+ header: "Fill Gap"
114
+ options: [] ← freeform (no options means free text input)
115
+ multiSelect: false
116
+ ```
117
+
118
+ **If 0 gaps:** proceed directly to Step C with no prompts.
119
+
120
+ Incorporate user answers into the extraction context used in Step C.
121
+
122
+ ---
123
+
124
+ ### Step C: Extract 3 Files Inline (PROJECT.md, REQUIREMENTS.md, CONTEXT.md)
125
+
126
+ 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.
127
+
128
+ **C1. Generate PROJECT.md content** using `templates/PROJECT.md.tmpl` as the structure:
129
+
130
+ - `{project_name}`: extract from PRD title/header
131
+ - `{ONE sentence core value statement}`: extract from problem statement / vision
132
+ - Vision section: 2-3 sentences from PRD problem statement
133
+ - Scope — In Scope: features from functional requirements section
134
+ - Scope — Out of Scope: features from "out of scope" section (or mark "None specified" if absent)
135
+ - Success Criteria: from goals/KPIs section
136
+ - Stakeholders: extract if present; default to "Primary user: end users of the product"
137
+ - Milestones line: leave as "Planned in {N} phases across 1 milestone — see .planning/ROADMAP.md"
138
+
139
+ **C2. Generate REQUIREMENTS.md content** using `templates/REQUIREMENTS.md.tmpl` as the structure:
140
+
141
+ - Functional Requirements: each feature/capability from PRD becomes one REQ-F-xxx row
142
+ - Number from REQ-F-001 sequentially
143
+ - Priority: "Must" for core features, "Should" for nice-to-haves (infer from PRD language)
144
+ - Non-Functional Requirements: from performance/security/reliability section if present
145
+ - Deferred Requirements: items from "out of scope" section
146
+ - Traceability table: leave "Implemented In" and "Verified In" columns as "—"
147
+
148
+ **C3. Generate CONTEXT.md content** using `templates/project-CONTEXT.md.tmpl` as the structure:
149
+
150
+ - Locked Decisions: extract any explicit technology choices or constraints from PRD
151
+ - User Constraints: extract deployment, team size, budget, timeline if mentioned
152
+ - Deferred Ideas: items from "out of scope" section
153
+ - Claude's Discretion Areas: leave empty (executor will fill as they work)
154
+
155
+ ---
156
+
157
+ ### Step D: Confirmation Gate
158
+
159
+ **Check config:** Read `.planning/config.json`. If `prd.auto_extract` is `true`, skip this step entirely and proceed directly to Step E.
160
+
161
+ **If prd.auto_extract is false (default):**
162
+
163
+ Display a preview of the three generated files (show first 10 lines of each with a `...` truncation).
164
+
165
+ Then present the confirmation gate using the **approve-revise-abort** pattern from `skills/shared/gate-prompts.md`:
166
+
167
+ ```
168
+ Use AskUserQuestion:
169
+ question: "Approve these extracted files? (PROJECT.md, REQUIREMENTS.md, CONTEXT.md — ROADMAP.md will be generated next)"
170
+ header: "Approve?"
171
+ options:
172
+ - label: "Approve" description: "Write files and generate ROADMAP.md"
173
+ - label: "Request changes" description: "Describe what to adjust before writing"
174
+ - label: "Abort" description: "Cancel PRD import"
175
+ multiSelect: false
176
+ ```
177
+
178
+ - **Approve**: proceed to Step E.
179
+ - **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.
180
+ - **Abort**: delete `.planning/.active-skill` and stop with message: "PRD import cancelled."
181
+
182
+ ---
183
+
184
+ ### Step E: Check for Existing Files and Write PROJECT.md, REQUIREMENTS.md, CONTEXT.md
185
+
186
+ For each of the three files (`PROJECT.md`, `REQUIREMENTS.md`, `CONTEXT.md` in `.planning/`):
187
+
188
+ 1. Check if the file already exists (Glob `.planning/PROJECT.md`, etc.).
189
+ 2. If it exists: use AskUserQuestion yes-no pattern:
190
+ ```
191
+ question: ".planning/{filename} already exists. Overwrite it?"
192
+ header: "Overwrite?"
193
+ options:
194
+ - label: "Yes" description: "Replace existing file"
195
+ - label: "No" description: "Keep existing, skip this file"
196
+ ```
197
+ - If No: skip writing that file.
198
+ 3. Write approved content to:
199
+ - `.planning/PROJECT.md`
200
+ - `.planning/REQUIREMENTS.md`
201
+ - `.planning/CONTEXT.md`
202
+
203
+ ---
204
+
205
+ ### Step F: Delegate ROADMAP.md Generation to pbr:planner
206
+
207
+ Display: `◐ Generating ROADMAP.md via planner...`
208
+
209
+ Spawn the planner subagent:
210
+
211
+ ```
212
+ Task({
213
+ subagent_type: "pbr:planner",
214
+ prompt: "
215
+ You are the planner agent in Roadmap Mode.
216
+
217
+ <files_to_read>
218
+ CRITICAL: Read these files BEFORE any other action:
219
+ 1. .planning/PROJECT.md
220
+ 2. .planning/REQUIREMENTS.md
221
+ 3. .planning/CONTEXT.md
222
+ </files_to_read>
223
+
224
+ Generate `.planning/ROADMAP.md` from the project files above.
225
+
226
+ Use the roadmap template at `${PLUGIN_ROOT}/templates/ROADMAP.md.tmpl`.
227
+ Apply Requirement Coverage Validation: every requirement in REQUIREMENTS.md must appear in at least one phase.
228
+ Apply the Dual Format requirement: Quick-scan checklist at top + detailed phase descriptions.
229
+ Wrap all phases in a Milestone section named after the project.
230
+
231
+ Write ROADMAP.md to `.planning/ROADMAP.md`.
232
+ Output your completion marker when done: ## PLANNING COMPLETE
233
+ "
234
+ })
235
+ ```
236
+
237
+ After the Task() completes:
238
+
239
+ - Confirm `.planning/ROADMAP.md` exists (Glob check).
240
+ - 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).
241
+
242
+ ---
243
+
244
+ ### Step G: State Updates, Commit, and Summary
245
+
246
+ **G1. Initialize STATE.md** (if it does not already exist):
247
+
248
+ - Run: `node ${PLUGIN_ROOT}/scripts/pbr-tools.js state load`
249
+ - If STATE.md does not exist: create `.planning/STATE.md` with frontmatter fields:
250
+ ```
251
+ project: {project_name from PROJECT.md}
252
+ current_phase: 1
253
+ status: planning
254
+ source: prd-import
255
+ prd_file: {filepath}
256
+ ```
257
+
258
+ **G2. Update STATE.md** with PRD import status:
259
+
260
+ - Set `status: planning`
261
+ - Note `source: prd-import` and `prd_file: {filepath}`
262
+
263
+ **G3. Commit (if planning.commit_docs is true in config):**
264
+
265
+ Reference: `skills/shared/commit-planning-docs.md` for the standard commit pattern.
266
+
267
+ ```
268
+ docs(planning): init project docs from PRD import
269
+ ```
270
+
271
+ Stage: `.planning/PROJECT.md`, `.planning/REQUIREMENTS.md`, `.planning/CONTEXT.md`, `.planning/ROADMAP.md` (if generated), `.planning/STATE.md`.
272
+
273
+ **G4. Delete `.planning/.active-skill`.**
274
+
275
+ **G5. Display completion banner:**
276
+
277
+ ```
278
+ ╔══════════════════════════════════════════════════════════════╗
279
+ ║ PLAN-BUILD-RUN ► PRD IMPORT COMPLETE ✓ ║
280
+ ╚══════════════════════════════════════════════════════════════╝
281
+
282
+ **Project**: {project_name}
283
+ **Source**: {prd_filepath}
284
+
285
+ Files generated:
286
+ ✓ .planning/PROJECT.md
287
+ ✓ .planning/REQUIREMENTS.md
288
+ ✓ .planning/CONTEXT.md
289
+ {✓ or ✗} .planning/ROADMAP.md
290
+
291
+ Requirements extracted: {count} REQ-IDs
292
+ Gaps filled: {count} (via interactive prompts)
293
+
294
+
295
+
296
+ ╔══════════════════════════════════════════════════════════════╗
297
+ ║ ▶ NEXT UP ║
298
+ ╚══════════════════════════════════════════════════════════════╝
299
+
300
+ **Plan Phase 1** — generate execution plans for the first phase
301
+
302
+ `/pbr:plan 1`
303
+
304
+ <sub>`/clear` first → fresh context window</sub>
305
+
306
+
307
+
308
+ **Also available:**
309
+ - `/pbr:discuss` — review and refine decisions before planning
310
+ - `/pbr:status` — see full project overview
311
+ ```
312
+
313
+ ---
314
+
315
+ > **End of PRD Import Flow. Steps 2–11 below apply only to the standard --from flow.**
316
+
317
+ ---
318
+
64
319
  ### Step 2: Load Full Project Context (inline)
65
320
 
66
321
  Read all relevant context files. This context is used for conflict detection in Step 4.
@@ -500,6 +755,22 @@ File not found: {filepath}
500
755
  **To fix:** Check the path and try again.
501
756
  ```
502
757
 
758
+ ### PRD file too short
759
+ If the PRD file is < 100 characters:
760
+ ```
761
+ ╔══════════════════════════════════════════════════════════════╗
762
+ ║ ERROR ║
763
+ ╚══════════════════════════════════════════════════════════════╝
764
+
765
+ PRD file appears empty or too short to extract meaningful content.
766
+
767
+ **To fix:** Provide a more complete PRD document (minimum ~100 characters).
768
+ ```
769
+
770
+ ### PRD import cancelled
771
+ If user selects "Abort" at the confirmation gate (Step D):
772
+ Display: "PRD import cancelled." and delete `.planning/.active-skill`.
773
+
503
774
  ### Import document too vague
504
775
  If the imported document contains no actionable tasks, display:
505
776
  ```
@@ -536,3 +807,7 @@ Present remaining issues and ask user to decide: proceed or intervene.
536
807
  | `.planning/ROADMAP.md` | Plans Complete + Status updated to `planned` | Step 8a |
537
808
  | `.planning/STATE.md` | Updated with plan status and import source | Step 8b |
538
809
  | `.planning/CONTEXT.md` | Updated if blockers surfaced new locked decisions | Step 8d |
810
+ | `.planning/PROJECT.md` | Generated from PRD | Step E (PRD flow) |
811
+ | `.planning/REQUIREMENTS.md` | Generated from PRD | Step E (PRD flow) |
812
+ | `.planning/CONTEXT.md` | Generated from PRD | Step E (PRD flow) |
813
+ | `.planning/ROADMAP.md` | Generated by planner subagent | Step F (PRD flow) |
@@ -484,7 +484,17 @@ Use AskUserQuestion (pattern: approve-revise-abort from `skills/shared/gate-prom
484
484
  - Or make small inline edits to plan files directly
485
485
 
486
486
  **If user selects 'Approve':**
487
- - **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.
487
+ - **CONTEXT.md compliance reporting**: Check locked decisions from BOTH sources:
488
+ a. Project-level: `.planning/CONTEXT.md` (if exists) — cross-cutting decisions for all phases
489
+ b. Phase-level: `.planning/phases/{NN}-{slug}/CONTEXT.md` (if exists) — phase-specific decisions
490
+ Phase-level decisions override project-level for the same decision area.
491
+
492
+ Collect ALL locked decisions from both files (deduplicate identical decision text).
493
+ Compare against the generated plan tasks. Print:
494
+ `CONTEXT.md compliance: {M}/{N} locked decisions mapped to tasks`
495
+ where M = locked decisions reflected in at least one task action, N = total unique locked decisions.
496
+ If any locked decisions are unmapped, list them as warnings.
497
+ If neither CONTEXT.md exists: skip this check silently.
488
498
  - **Dependency fingerprinting**: For each dependency phase (phases that this phase depends on, per ROADMAP.md):
489
499
  1. Find all SUMMARY.md files in the dependency phase directory
490
500
  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.