@sienklogic/plan-build-run 2.38.1 → 2.39.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 (37) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.json +1 -1
  3. package/plugins/copilot-pbr/agents/executor.agent.md +13 -0
  4. package/plugins/copilot-pbr/plugin.json +1 -1
  5. package/plugins/copilot-pbr/references/config-reference.md +22 -0
  6. package/plugins/copilot-pbr/references/git-integration.md +30 -0
  7. package/plugins/copilot-pbr/references/plan-format.md +4 -0
  8. package/plugins/copilot-pbr/skills/begin/SKILL.md +22 -0
  9. package/plugins/copilot-pbr/skills/build/SKILL.md +45 -0
  10. package/plugins/copilot-pbr/skills/explore/SKILL.md +17 -0
  11. package/plugins/copilot-pbr/skills/milestone/SKILL.md +38 -0
  12. package/plugins/copilot-pbr/templates/pr-body.md.tmpl +22 -0
  13. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  14. package/plugins/cursor-pbr/agents/executor.md +13 -0
  15. package/plugins/cursor-pbr/references/config-reference.md +22 -0
  16. package/plugins/cursor-pbr/references/git-integration.md +30 -0
  17. package/plugins/cursor-pbr/references/plan-format.md +4 -0
  18. package/plugins/cursor-pbr/skills/begin/SKILL.md +22 -0
  19. package/plugins/cursor-pbr/skills/build/SKILL.md +45 -0
  20. package/plugins/cursor-pbr/skills/explore/SKILL.md +17 -0
  21. package/plugins/cursor-pbr/skills/milestone/SKILL.md +38 -0
  22. package/plugins/cursor-pbr/templates/pr-body.md.tmpl +22 -0
  23. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
  24. package/plugins/pbr/agents/executor.md +13 -0
  25. package/plugins/pbr/references/config-reference.md +22 -0
  26. package/plugins/pbr/references/git-integration.md +30 -0
  27. package/plugins/pbr/references/plan-format.md +4 -0
  28. package/plugins/pbr/scripts/lib/learnings.js +312 -0
  29. package/plugins/pbr/scripts/milestone-learnings.js +283 -0
  30. package/plugins/pbr/scripts/pbr-tools.js +43 -1
  31. package/plugins/pbr/scripts/progress-tracker.js +24 -1
  32. package/plugins/pbr/skills/begin/SKILL.md +23 -0
  33. package/plugins/pbr/skills/build/SKILL.md +45 -0
  34. package/plugins/pbr/skills/explore/SKILL.md +16 -0
  35. package/plugins/pbr/skills/milestone/SKILL.md +38 -0
  36. package/plugins/pbr/skills/plan/SKILL.md +23 -0
  37. package/plugins/pbr/templates/pr-body.md.tmpl +22 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ All notable changes to Plan-Build-Run will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.39.0](https://github.com/SienkLogic/plan-build-run/compare/plan-build-run-v2.38.1...plan-build-run-v2.39.0) (2026-02-27)
9
+
10
+
11
+ ### Features
12
+
13
+ * **45-01:** add learnings subcommands to pbr-tools.js dispatcher ([a2c9b98](https://github.com/SienkLogic/plan-build-run/commit/a2c9b98a60291611b85b086a4c274fa4ee82477b))
14
+ * **45-01:** add lib/learnings.js with schema, storage, ingest, and query ([feb6bf6](https://github.com/SienkLogic/plan-build-run/commit/feb6bf6b2b1adcedc71d0558804a722be60aac77))
15
+ * **45-03:** add deferral notifications to progress-tracker and aggregation step to milestone skill ([ac89d05](https://github.com/SienkLogic/plan-build-run/commit/ac89d05323d8b8468718bfad52181cf72b635ce6))
16
+ * **45-03:** GREEN - milestone-learnings.js aggregation script ([68fa377](https://github.com/SienkLogic/plan-build-run/commit/68fa3778937825ad09b1b38cb5b626abf68dffc1))
17
+ * **45-04:** add learnings injection to begin/SKILL.md researcher spawn step ([ebe3970](https://github.com/SienkLogic/plan-build-run/commit/ebe39702e4f04a2576b6e0ad6b7edb6e93672a4c))
18
+ * **45-04:** add learnings injection to explore/SKILL.md and plan skill planner spawn ([53644cf](https://github.com/SienkLogic/plan-build-run/commit/53644cf9601ff47341ebde40c712e99d54f34ebb))
19
+ * **45-05:** sync learnings injection and aggregation to cursor-pbr and copilot-pbr ([eef6a0c](https://github.com/SienkLogic/plan-build-run/commit/eef6a0caa5f19629d08d0cce878b51a7823b9424))
20
+ * **quick-019:** add ecosystem integration — PR creation, CI gate, issue sync, smoke test ([c57e44e](https://github.com/SienkLogic/plan-build-run/commit/c57e44ede58d167cd69ffe5403cc20645c537635))
21
+
8
22
  ## [2.38.1](https://github.com/SienkLogic/plan-build-run/compare/plan-build-run-v2.38.0...plan-build-run-v2.38.1) (2026-02-27)
9
23
 
10
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sienklogic/plan-build-run",
3
- "version": "2.38.1",
3
+ "version": "2.39.0",
4
4
  "description": "Plan it, Build it, Run it — structured development workflow for Claude Code",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -114,6 +114,19 @@ One task = one commit. Exception: TDD tasks get 3 commits (RED, GREEN, REFACTOR)
114
114
 
115
115
  Stage only files listed in the task's `<files>`. If git commit fails with lock error, retry up to 3 times with 2s delay.
116
116
 
117
+ ### Issue Auto-Close
118
+
119
+ When the plan frontmatter contains a non-empty `closes_issues` array, append issue-closing syntax to the **final** commit body for the plan:
120
+
121
+ ```
122
+ git commit -m "feat(01-02): implement user auth
123
+
124
+ Closes #42
125
+ Closes #57"
126
+ ```
127
+
128
+ Only append to the LAST commit of the plan — intermediate commits (RED/GREEN in TDD, partial progress) should NOT include closing syntax.
129
+
117
130
  ---
118
131
 
119
132
  ## Deviation Rules
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pbr",
3
3
  "displayName": "Plan-Build-Run",
4
- "version": "2.38.1",
4
+ "version": "2.39.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",
@@ -156,11 +156,23 @@ Controls git integration and branching strategy.
156
156
  | `phase_branch_template` | string | `plan-build-run/phase-{phase}-{slug}` | Phase branch name pattern |
157
157
  | `milestone_branch_template` | string | `plan-build-run/{milestone}-{slug}` | Milestone branch name pattern |
158
158
  | `mode` | string | `enabled` | Git mode: `enabled` or `disabled` |
159
+ | `auto_pr` | boolean | `false` | Create a GitHub PR after successful phase verification when branching is enabled |
159
160
 
160
161
  When `git.mode` is `disabled`, no git commands run at all -- no commits, branching, or hook validation. Useful for prototyping or non-git projects. See `references/git-integration.md` for full branching strategy details.
161
162
 
162
163
  ---
163
164
 
165
+ ## ci
166
+
167
+ Controls CI integration for build gates.
168
+
169
+ | Property | Type | Default | Description |
170
+ |----------|------|---------|-------------|
171
+ | `ci.gate_enabled` | boolean | `false` | Block wave advancement until CI passes |
172
+ | `ci.wait_timeout_seconds` | number | `120` | Max seconds to wait for CI completion |
173
+
174
+ ---
175
+
164
176
  ## gates
165
177
 
166
178
  Confirmation gates that pause execution to ask the user before proceeding. Setting a gate to `false` makes that step automatic.
@@ -220,6 +232,16 @@ This value is overridden by the active depth profile if a `depth_profiles` entry
220
232
 
221
233
  ---
222
234
 
235
+ ## deployment
236
+
237
+ Controls post-milestone deployment verification.
238
+
239
+ | Property | Type | Default | Description |
240
+ |----------|------|---------|-------------|
241
+ | `deployment.smoke_test_command` | string | `""` | Bash command to run after milestone completion (e.g., `"curl -sf https://myapp.com/health"`) |
242
+
243
+ ---
244
+
223
245
  ## depth_profiles
224
246
 
225
247
  Override the built-in depth profile defaults. Each key (`quick`, `standard`, `comprehensive`) maps to an object of settings that take effect when that depth is active.
@@ -175,6 +175,36 @@ Branch name templates are configured in `config.json`:
175
175
  - `git.phase_branch_template`: Default `plan-build-run/phase-{phase}-{slug}`
176
176
  - `git.milestone_branch_template`: Default `plan-build-run/{milestone}-{slug}`
177
177
 
178
+ ### PR Creation
179
+
180
+ When `git.auto_pr: true` and `git.branching` is `phase` or `milestone`, the build skill creates a GitHub PR after verification passes:
181
+
182
+ 1. Push the phase branch to the remote
183
+ 2. Create a PR via `gh pr create` with structured title and body
184
+ 3. PR title follows the commit convention: `feat(phase-{N}): {phase slug}`
185
+ 4. PR body includes phase goal, key files changed, and must-have verification results
186
+
187
+ When `git.auto_pr: false` (default), the build skill offers the user a choice after verification:
188
+ - Create PR now
189
+ - Skip PR creation
190
+ - Push branch only (create PR later)
191
+
192
+ PR creation requires `gh` CLI authenticated with repo write access.
193
+
194
+ ### CI Integration
195
+
196
+ When `ci.gate_enabled: true`, the build skill checks GitHub Actions status after each wave completes:
197
+
198
+ 1. Run: `gh run list --branch $(git branch --show-current) --limit 1 --json status,conclusion,url`
199
+ 2. If `status == completed` and `conclusion == success`: proceed to next wave
200
+ 3. If `status == in_progress`: wait up to `ci.wait_timeout_seconds`, re-check
201
+ 4. If `conclusion != success` or timeout: surface warning with run URL and offer:
202
+ - **Wait**: continue polling
203
+ - **Continue anyway**: proceed despite CI failure (logged as deviation)
204
+ - **Abort**: stop the build
205
+
206
+ CI gate requires `gh` CLI and GitHub Actions configured on the repository. The gate only activates when there are commits pushed to a remote branch (branching must be enabled).
207
+
178
208
  ### Git Mode
179
209
 
180
210
  The `git.mode` field controls whether git integration is active:
@@ -47,6 +47,9 @@ consumes:
47
47
  requirement_ids:
48
48
  - "P02-G1"
49
49
  - "P02-G2"
50
+ closes_issues:
51
+ - 42
52
+ - 57
50
53
  ---
51
54
  ```
52
55
 
@@ -72,6 +75,7 @@ requirement_ids:
72
75
  | `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. |
73
76
  | `dependency_fingerprints` | NO | object | Hashes of dependency phase SUMMARY.md files at plan-creation time. Used to detect stale plans. |
74
77
  | `data_contracts` | NO | array | Cross-boundary parameter mappings for calls where arguments originate from external boundaries. Format: `"param: source (context) [fallback]"` |
78
+ | `closes_issues` | NO | number[] | GitHub issue numbers to close when this plan's final commit lands. Default: `[]` |
75
79
 
76
80
  ### Data Contracts
77
81
 
@@ -212,6 +212,25 @@ Spawn parallel agents for research. Each researcher writes to `.planning/researc
212
212
 
213
213
  **CRITICAL: Create .planning/research/ directory NOW before spawning researchers. Do NOT skip this step.**
214
214
 
215
+ **Learnings injection (opt-in):** Before spawning researchers, check if global learnings exist:
216
+
217
+ ```bash
218
+ node {resolved_plugin_root}/scripts/pbr-tools.js learnings query --tags "stack,tech" 2>/dev/null
219
+ ```
220
+
221
+ If the command succeeds AND returns a non-empty JSON array:
222
+
223
+ - Write the results to a temp file:
224
+
225
+ ```bash
226
+ node {resolved_plugin_root}/scripts/pbr-tools.js learnings query --tags "stack,tech" > /tmp/pbr-learnings-$$.md
227
+ ```
228
+
229
+ - Note the temp file path as `{learnings_temp_path}`
230
+ - Add this file to the researcher's `files_to_read` block (see below)
231
+
232
+ If no learnings exist or the command fails: skip injection silently.
233
+
215
234
  **For each research topic, invoke the @researcher agent:**
216
235
 
217
236
  Invoke `@researcher` with the research prompt constructed from the template.
@@ -231,9 +250,12 @@ Read `skills/begin/templates/researcher-prompt.md.tmpl` for the prompt structure
231
250
  <files_to_read>
232
251
  CRITICAL: Read these files BEFORE any other action:
233
252
  1. .planning/REQUIREMENTS.md — scoped requirements (if exists)
253
+ {if learnings_temp_path exists}2. {learnings_temp_path} — cross-project learnings (tech stack patterns from past PBR projects){/if}
234
254
  </files_to_read>
235
255
  ```
236
256
 
257
+ If `{learnings_temp_path}` was produced in the learnings injection step above, replace `{if...}{/if}` with the actual line. If no learnings were found, omit line 2 entirely.
258
+
237
259
  **Placeholders to fill:**
238
260
  - `{project name from questioning}` — project name gathered in Step 2
239
261
  - `{2-3 sentence description from questioning}` — project description from Step 2
@@ -614,6 +614,26 @@ Resume at: Task {N+1} (or re-execute checkpoint task with user's answer)
614
614
  Continue execution from the checkpoint. Skip completed tasks. Process the checkpoint resolution, then continue with remaining tasks. Write SUMMARY.md when done.
615
615
  ```
616
616
 
617
+ #### 6e-ii. CI Gate (after wave completion, conditional)
618
+
619
+ If `config.ci.gate_enabled` is `true` AND `config.git.branching` is not `none`:
620
+
621
+ 1. Push current commits: `git push`
622
+ 2. Wait 5 seconds for CI to trigger
623
+ 3. Check: `gh run list --branch $(git branch --show-current) --limit 1 --json status,conclusion,url`
624
+ 4. If in_progress: poll every 15 seconds up to `config.ci.wait_timeout_seconds`
625
+ 5. If failed/timed out: show warning box:
626
+
627
+ ```
628
+ ⚠ CI Status: {conclusion}
629
+ Run: {url}
630
+ Options: [Wait] [Continue anyway] [Abort]
631
+ ```
632
+
633
+ 6. Use AskUserQuestion to present options: Wait / Continue anyway / Abort
634
+ 7. If "Continue anyway": log deviation — `DEVIATION: CI gate bypassed for wave {N}`
635
+ 8. If "Abort": stop build, update STATE.md
636
+
617
637
  #### 6f. Update STATE.md
618
638
 
619
639
  After each wave completes (all plans in the wave are done, skipped, or aborted):
@@ -789,6 +809,31 @@ If `git.branching` is `phase`:
789
809
  - If "Yes, merge": complete the merge and delete the phase branch
790
810
  - If "No, keep" or "Other": leave the branch as-is and inform the user
791
811
 
812
+ **8d-ii. PR Creation (when branching enabled):**
813
+
814
+ If `config.git.branching` is `phase` or `milestone` AND phase verification passed:
815
+
816
+ 1. Push the phase branch: `git push -u origin {branch-name}`
817
+ 2. If `config.git.auto_pr` is `true`:
818
+ - Run: `gh pr create --title "feat({phase-scope}): {phase-slug}" --body "$(cat <<'EOF'
819
+ ## Phase {N}: {phase name}
820
+
821
+ **Goal**: {phase goal from ROADMAP.md}
822
+
823
+ ### Key Files
824
+ {key_files from SUMMARY.md, bulleted}
825
+
826
+ ### Verification
827
+ {pass/fail status from VERIFICATION.md}
828
+
829
+ ---
830
+ Generated by Plan-Build-Run
831
+ EOF
832
+ )"`
833
+ 3. If `config.git.auto_pr` is `false`:
834
+ - Use AskUserQuestion to ask: "Phase branch pushed. Create a PR?"
835
+ - Options: Yes (create PR as above) / No / Later (skip)
836
+
792
837
  **8e. Auto-advance / auto-continue (conditional):**
793
838
 
794
839
  **If `features.auto_advance` is `true` AND `mode` is `autonomous`:**
@@ -115,6 +115,19 @@ When a knowledge gap emerges during the conversation — you're unsure about a l
115
115
 
116
116
  Display to the user: `◐ Spawning researcher...`
117
117
 
118
+ **Learnings injection (opt-in):** Check for relevant tech stack learnings:
119
+
120
+ ```bash
121
+ node {resolved_plugin_root}/scripts/pbr-tools.js learnings query --tags "stack,tech" 2>/dev/null
122
+ ```
123
+
124
+ If non-empty JSON array returned:
125
+
126
+ - Write to temp file: `node {resolved_plugin_root}/scripts/pbr-tools.js learnings query --tags "stack,tech" > /tmp/pbr-learnings-$$.md`
127
+ - Note path as `{learnings_temp_path}`; add as item 3 in the researcher's `files_to_read` block below
128
+
129
+ If no learnings or command fails: omit the extra files_to_read entry.
130
+
118
131
  ```
119
132
  Task({
120
133
  subagent_type: "pbr:researcher",
@@ -122,6 +135,7 @@ Task({
122
135
  CRITICAL: Read these files BEFORE any other action:
123
136
  1. .planning/CONTEXT.md — locked decisions and constraints (if exists)
124
137
  2. .planning/STATE.md — current project state (if exists)
138
+ {if learnings_temp_path exists}3. {learnings_temp_path} — cross-project learnings (tech stack patterns from past PBR projects){/if}
125
139
  </files_to_read>
126
140
  <research_assignment>
127
141
  Topic: {specific research question}
@@ -135,6 +149,9 @@ Task({
135
149
  })
136
150
  ```
137
151
 
152
+ If `{learnings_temp_path}` was produced above, replace `{if...}{/if}` with the actual line. If no learnings were found, omit item 3 entirely.
153
+ ```
154
+
138
155
  After the researcher completes, check for completion markers in the Task() output:
139
156
 
140
157
  - If `## RESEARCH COMPLETE` is present: proceed normally
@@ -412,6 +412,28 @@ Archive a completed milestone and prepare for the next one.
412
412
  - Key deliverables: {summary from Step 4}
413
413
  ```
414
414
 
415
+ 7d. **Aggregate learnings from milestone phases:**
416
+
417
+ **CRITICAL: Run learnings aggregation NOW. Do NOT skip this step.**
418
+
419
+ ```bash
420
+ node ${PLUGIN_ROOT}/scripts/milestone-learnings.js .planning/milestones/{version} --project {project-name-from-STATE.md}
421
+ ```
422
+
423
+ - If the script outputs an error, log it but do NOT abort milestone completion — learnings aggregation is advisory.
424
+ - Display the aggregation summary line to the user (e.g., "Learnings aggregated: 12 new, 3 updated, 0 errors").
425
+ - After aggregation, check for triggered deferral thresholds:
426
+
427
+ ```bash
428
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js learnings check-thresholds
429
+ ```
430
+
431
+ If any thresholds are triggered, display each as a notification:
432
+
433
+ ```
434
+ Note: Learnings threshold met — {key}: {trigger}. Consider implementing the deferred feature.
435
+ ```
436
+
415
437
  8. **Git tag:**
416
438
  ```bash
417
439
  git tag -a {version} -m "Milestone: {name}"
@@ -423,6 +445,22 @@ Archive a completed milestone and prepare for the next one.
423
445
  git commit -m "docs(planning): complete milestone {version}"
424
446
  ```
425
447
 
448
+ ### Post-Completion Smoke Test
449
+
450
+ If `config.deployment.smoke_test_command` is set and non-empty:
451
+
452
+ 1. Run the command via Bash
453
+ 2. If exit code 0: display "Smoke test passed" with command output
454
+ 3. If exit code non-zero: display advisory warning:
455
+
456
+ ```
457
+ ⚠ Smoke test failed (exit code {N})
458
+ Command: {smoke_test_command}
459
+ Output: {first 20 lines of output}
460
+ ```
461
+
462
+ This is advisory only — the milestone is already archived. Surface it as a potential issue for the user to investigate.
463
+
426
464
  10. **Confirm** with branded output:
427
465
  ```
428
466
  ╔══════════════════════════════════════════════════════════════╗
@@ -0,0 +1,22 @@
1
+ ## Phase <%= phase_number %>: <%= phase_name %>
2
+
3
+ **Goal**: <%= phase_goal %>
4
+
5
+ ### Key Files Changed
6
+ <% key_files.forEach(f => { %>
7
+ - `<%= f %>`
8
+ <% }) %>
9
+
10
+ ### Verification
11
+ - Status: <%= verification_status %>
12
+ - Must-haves: <%= must_haves_passed %>/<%= must_haves_total %> passed
13
+
14
+ <% if (closes_issues && closes_issues.length > 0) { %>
15
+ ### Issues
16
+ <% closes_issues.forEach(n => { %>
17
+ Closes #<%= n %>
18
+ <% }) %>
19
+ <% } %>
20
+
21
+ ---
22
+ *Generated by [Plan-Build-Run](https://github.com/SienkLogic/plan-build-run)*
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pbr",
3
3
  "displayName": "Plan-Build-Run",
4
- "version": "2.38.1",
4
+ "version": "2.39.0",
5
5
  "description": "Plan-Build-Run — Structured development workflow for Cursor. Solves context rot through disciplined subagent delegation, structured planning, atomic execution, and goal-backward verification.",
6
6
  "author": {
7
7
  "name": "SienkLogic",
@@ -113,6 +113,19 @@ One task = one commit. Exception: TDD tasks get 3 commits (RED, GREEN, REFACTOR)
113
113
 
114
114
  Stage only files listed in the task's `<files>`. If git commit fails with lock error, retry up to 3 times with 2s delay.
115
115
 
116
+ ### Issue Auto-Close
117
+
118
+ When the plan frontmatter contains a non-empty `closes_issues` array, append issue-closing syntax to the **final** commit body for the plan:
119
+
120
+ ```
121
+ git commit -m "feat(01-02): implement user auth
122
+
123
+ Closes #42
124
+ Closes #57"
125
+ ```
126
+
127
+ Only append to the LAST commit of the plan — intermediate commits (RED/GREEN in TDD, partial progress) should NOT include closing syntax.
128
+
116
129
  ---
117
130
 
118
131
  ## Deviation Rules
@@ -156,11 +156,23 @@ Controls git integration and branching strategy.
156
156
  | `phase_branch_template` | string | `plan-build-run/phase-{phase}-{slug}` | Phase branch name pattern |
157
157
  | `milestone_branch_template` | string | `plan-build-run/{milestone}-{slug}` | Milestone branch name pattern |
158
158
  | `mode` | string | `enabled` | Git mode: `enabled` or `disabled` |
159
+ | `auto_pr` | boolean | `false` | Create a GitHub PR after successful phase verification when branching is enabled |
159
160
 
160
161
  When `git.mode` is `disabled`, no git commands run at all -- no commits, branching, or hook validation. Useful for prototyping or non-git projects. See `references/git-integration.md` for full branching strategy details.
161
162
 
162
163
  ---
163
164
 
165
+ ## ci
166
+
167
+ Controls CI integration for build gates.
168
+
169
+ | Property | Type | Default | Description |
170
+ |----------|------|---------|-------------|
171
+ | `ci.gate_enabled` | boolean | `false` | Block wave advancement until CI passes |
172
+ | `ci.wait_timeout_seconds` | number | `120` | Max seconds to wait for CI completion |
173
+
174
+ ---
175
+
164
176
  ## gates
165
177
 
166
178
  Confirmation gates that pause execution to ask the user before proceeding. Setting a gate to `false` makes that step automatic.
@@ -220,6 +232,16 @@ This value is overridden by the active depth profile if a `depth_profiles` entry
220
232
 
221
233
  ---
222
234
 
235
+ ## deployment
236
+
237
+ Controls post-milestone deployment verification.
238
+
239
+ | Property | Type | Default | Description |
240
+ |----------|------|---------|-------------|
241
+ | `deployment.smoke_test_command` | string | `""` | Bash command to run after milestone completion (e.g., `"curl -sf https://myapp.com/health"`) |
242
+
243
+ ---
244
+
223
245
  ## depth_profiles
224
246
 
225
247
  Override the built-in depth profile defaults. Each key (`quick`, `standard`, `comprehensive`) maps to an object of settings that take effect when that depth is active.
@@ -175,6 +175,36 @@ Branch name templates are configured in `config.json`:
175
175
  - `git.phase_branch_template`: Default `plan-build-run/phase-{phase}-{slug}`
176
176
  - `git.milestone_branch_template`: Default `plan-build-run/{milestone}-{slug}`
177
177
 
178
+ ### PR Creation
179
+
180
+ When `git.auto_pr: true` and `git.branching` is `phase` or `milestone`, the build skill creates a GitHub PR after verification passes:
181
+
182
+ 1. Push the phase branch to the remote
183
+ 2. Create a PR via `gh pr create` with structured title and body
184
+ 3. PR title follows the commit convention: `feat(phase-{N}): {phase slug}`
185
+ 4. PR body includes phase goal, key files changed, and must-have verification results
186
+
187
+ When `git.auto_pr: false` (default), the build skill offers the user a choice after verification:
188
+ - Create PR now
189
+ - Skip PR creation
190
+ - Push branch only (create PR later)
191
+
192
+ PR creation requires `gh` CLI authenticated with repo write access.
193
+
194
+ ### CI Integration
195
+
196
+ When `ci.gate_enabled: true`, the build skill checks GitHub Actions status after each wave completes:
197
+
198
+ 1. Run: `gh run list --branch $(git branch --show-current) --limit 1 --json status,conclusion,url`
199
+ 2. If `status == completed` and `conclusion == success`: proceed to next wave
200
+ 3. If `status == in_progress`: wait up to `ci.wait_timeout_seconds`, re-check
201
+ 4. If `conclusion != success` or timeout: surface warning with run URL and offer:
202
+ - **Wait**: continue polling
203
+ - **Continue anyway**: proceed despite CI failure (logged as deviation)
204
+ - **Abort**: stop the build
205
+
206
+ CI gate requires `gh` CLI and GitHub Actions configured on the repository. The gate only activates when there are commits pushed to a remote branch (branching must be enabled).
207
+
178
208
  ### Git Mode
179
209
 
180
210
  The `git.mode` field controls whether git integration is active:
@@ -47,6 +47,9 @@ consumes:
47
47
  requirement_ids:
48
48
  - "P02-G1"
49
49
  - "P02-G2"
50
+ closes_issues:
51
+ - 42
52
+ - 57
50
53
  ---
51
54
  ```
52
55
 
@@ -72,6 +75,7 @@ requirement_ids:
72
75
  | `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. |
73
76
  | `dependency_fingerprints` | NO | object | Hashes of dependency phase SUMMARY.md files at plan-creation time. Used to detect stale plans. |
74
77
  | `data_contracts` | NO | array | Cross-boundary parameter mappings for calls where arguments originate from external boundaries. Format: `"param: source (context) [fallback]"` |
78
+ | `closes_issues` | NO | number[] | GitHub issue numbers to close when this plan's final commit lands. Default: `[]` |
75
79
 
76
80
  ### Data Contracts
77
81
 
@@ -212,6 +212,25 @@ Spawn parallel agents for research. Each researcher writes to `.planning/researc
212
212
 
213
213
  **CRITICAL: Create .planning/research/ directory NOW before spawning researchers. Do NOT skip this step.**
214
214
 
215
+ **Learnings injection (opt-in):** Before spawning researchers, check if global learnings exist:
216
+
217
+ ```bash
218
+ node {resolved_plugin_root}/scripts/pbr-tools.js learnings query --tags "stack,tech" 2>/dev/null
219
+ ```
220
+
221
+ If the command succeeds AND returns a non-empty JSON array:
222
+
223
+ - Write the results to a temp file:
224
+
225
+ ```bash
226
+ node {resolved_plugin_root}/scripts/pbr-tools.js learnings query --tags "stack,tech" > /tmp/pbr-learnings-$$.md
227
+ ```
228
+
229
+ - Note the temp file path as `{learnings_temp_path}`
230
+ - Add this file to the researcher's `files_to_read` block (see below)
231
+
232
+ If no learnings exist or the command fails: skip injection silently.
233
+
215
234
  **For each research topic, invoke the @researcher agent:**
216
235
 
217
236
  Invoke `@researcher` with the research prompt constructed from the template.
@@ -231,9 +250,12 @@ Read `skills/begin/templates/researcher-prompt.md.tmpl` for the prompt structure
231
250
  <files_to_read>
232
251
  CRITICAL: Read these files BEFORE any other action:
233
252
  1. .planning/REQUIREMENTS.md — scoped requirements (if exists)
253
+ {if learnings_temp_path exists}2. {learnings_temp_path} — cross-project learnings (tech stack patterns from past PBR projects){/if}
234
254
  </files_to_read>
235
255
  ```
236
256
 
257
+ If `{learnings_temp_path}` was produced in the learnings injection step above, replace `{if...}{/if}` with the actual line. If no learnings were found, omit line 2 entirely.
258
+
237
259
  **Placeholders to fill:**
238
260
  - `{project name from questioning}` — project name gathered in Step 2
239
261
  - `{2-3 sentence description from questioning}` — project description from Step 2
@@ -615,6 +615,26 @@ Resume at: Task {N+1} (or re-execute checkpoint task with user's answer)
615
615
  Continue execution from the checkpoint. Skip completed tasks. Process the checkpoint resolution, then continue with remaining tasks. Write SUMMARY.md when done.
616
616
  ```
617
617
 
618
+ #### 6e-ii. CI Gate (after wave completion, conditional)
619
+
620
+ If `config.ci.gate_enabled` is `true` AND `config.git.branching` is not `none`:
621
+
622
+ 1. Push current commits: `git push`
623
+ 2. Wait 5 seconds for CI to trigger
624
+ 3. Check: `gh run list --branch $(git branch --show-current) --limit 1 --json status,conclusion,url`
625
+ 4. If in_progress: poll every 15 seconds up to `config.ci.wait_timeout_seconds`
626
+ 5. If failed/timed out: show warning box:
627
+
628
+ ```
629
+ ⚠ CI Status: {conclusion}
630
+ Run: {url}
631
+ Options: [Wait] [Continue anyway] [Abort]
632
+ ```
633
+
634
+ 6. Use AskUserQuestion to present options: Wait / Continue anyway / Abort
635
+ 7. If "Continue anyway": log deviation — `DEVIATION: CI gate bypassed for wave {N}`
636
+ 8. If "Abort": stop build, update STATE.md
637
+
618
638
  #### 6f. Update STATE.md
619
639
 
620
640
  After each wave completes (all plans in the wave are done, skipped, or aborted):
@@ -790,6 +810,31 @@ If `git.branching` is `phase`:
790
810
  - If "Yes, merge": complete the merge and delete the phase branch
791
811
  - If "No, keep" or "Other": leave the branch as-is and inform the user
792
812
 
813
+ **8d-ii. PR Creation (when branching enabled):**
814
+
815
+ If `config.git.branching` is `phase` or `milestone` AND phase verification passed:
816
+
817
+ 1. Push the phase branch: `git push -u origin {branch-name}`
818
+ 2. If `config.git.auto_pr` is `true`:
819
+ - Run: `gh pr create --title "feat({phase-scope}): {phase-slug}" --body "$(cat <<'EOF'
820
+ ## Phase {N}: {phase name}
821
+
822
+ **Goal**: {phase goal from ROADMAP.md}
823
+
824
+ ### Key Files
825
+ {key_files from SUMMARY.md, bulleted}
826
+
827
+ ### Verification
828
+ {pass/fail status from VERIFICATION.md}
829
+
830
+ ---
831
+ Generated by Plan-Build-Run
832
+ EOF
833
+ )"`
834
+ 3. If `config.git.auto_pr` is `false`:
835
+ - Use AskUserQuestion to ask: "Phase branch pushed. Create a PR?"
836
+ - Options: Yes (create PR as above) / No / Later (skip)
837
+
793
838
  **8e. Auto-advance / auto-continue (conditional):**
794
839
 
795
840
  **If `features.auto_advance` is `true` AND `mode` is `autonomous`:**
@@ -116,6 +116,19 @@ When a knowledge gap emerges during the conversation — you're unsure about a l
116
116
 
117
117
  Display to the user: `◐ Spawning researcher...`
118
118
 
119
+ **Learnings injection (opt-in):** Check for relevant tech stack learnings:
120
+
121
+ ```bash
122
+ node {resolved_plugin_root}/scripts/pbr-tools.js learnings query --tags "stack,tech" 2>/dev/null
123
+ ```
124
+
125
+ If non-empty JSON array returned:
126
+
127
+ - Write to temp file: `node {resolved_plugin_root}/scripts/pbr-tools.js learnings query --tags "stack,tech" > /tmp/pbr-learnings-$$.md`
128
+ - Note path as `{learnings_temp_path}`; add as item 3 in the researcher's `files_to_read` block below
129
+
130
+ If no learnings or command fails: omit the extra files_to_read entry.
131
+
119
132
  ```
120
133
  Task({
121
134
  subagent_type: "pbr:researcher",
@@ -123,6 +136,7 @@ Task({
123
136
  CRITICAL: Read these files BEFORE any other action:
124
137
  1. .planning/CONTEXT.md — locked decisions and constraints (if exists)
125
138
  2. .planning/STATE.md — current project state (if exists)
139
+ {if learnings_temp_path exists}3. {learnings_temp_path} — cross-project learnings (tech stack patterns from past PBR projects){/if}
126
140
  </files_to_read>
127
141
  <research_assignment>
128
142
  Topic: {specific research question}
@@ -136,6 +150,9 @@ Task({
136
150
  })
137
151
  ```
138
152
 
153
+ If `{learnings_temp_path}` was produced above, replace `{if...}{/if}` with the actual line. If no learnings were found, omit item 3 entirely.
154
+ ```
155
+
139
156
  After the researcher completes, check for completion markers in the Task() output:
140
157
 
141
158
  - If `## RESEARCH COMPLETE` is present: proceed normally