@sienklogic/plan-build-run 2.58.0 → 2.60.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 (128) hide show
  1. package/CHANGELOG.md +56 -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/commands/profile.md +7 -0
  8. package/plugins/codex-pbr/references/model-profiles.md +29 -3
  9. package/plugins/codex-pbr/references/plan-format.md +46 -8
  10. package/plugins/codex-pbr/skills/begin/SKILL.md +18 -34
  11. package/plugins/codex-pbr/skills/build/SKILL.md +8 -4
  12. package/plugins/codex-pbr/skills/debug/SKILL.md +2 -2
  13. package/plugins/codex-pbr/skills/discuss/SKILL.md +54 -4
  14. package/plugins/codex-pbr/skills/health/SKILL.md +15 -2
  15. package/plugins/codex-pbr/skills/milestone/SKILL.md +8 -8
  16. package/plugins/codex-pbr/skills/pause/SKILL.md +1 -1
  17. package/plugins/codex-pbr/skills/plan/SKILL.md +20 -8
  18. package/plugins/codex-pbr/skills/profile/SKILL.md +171 -0
  19. package/plugins/codex-pbr/skills/review/SKILL.md +5 -3
  20. package/plugins/codex-pbr/skills/scan/SKILL.md +2 -2
  21. package/plugins/codex-pbr/skills/setup/SKILL.md +66 -2
  22. package/plugins/codex-pbr/skills/shared/context-loader-task.md +2 -0
  23. package/plugins/codex-pbr/skills/status/SKILL.md +17 -0
  24. package/plugins/codex-pbr/templates/PROJECT.md.tmpl +41 -0
  25. package/plugins/codex-pbr/templates/REQUIREMENTS.md.tmpl +52 -0
  26. package/plugins/codex-pbr/templates/VERIFICATION-DETAIL.md.tmpl +5 -0
  27. package/plugins/codex-pbr/templates/project-CONTEXT.md.tmpl +43 -0
  28. package/plugins/copilot-pbr/agents/executor.agent.md +8 -0
  29. package/plugins/copilot-pbr/agents/plan-checker.agent.md +5 -3
  30. package/plugins/copilot-pbr/agents/planner.agent.md +13 -7
  31. package/plugins/copilot-pbr/agents/verifier.agent.md +10 -1
  32. package/plugins/copilot-pbr/commands/profile.md +7 -0
  33. package/plugins/copilot-pbr/hooks/hooks.json +27 -0
  34. package/plugins/copilot-pbr/plugin.json +1 -1
  35. package/plugins/copilot-pbr/references/model-profiles.md +29 -3
  36. package/plugins/copilot-pbr/references/plan-format.md +46 -8
  37. package/plugins/copilot-pbr/skills/begin/SKILL.md +18 -34
  38. package/plugins/copilot-pbr/skills/build/SKILL.md +8 -4
  39. package/plugins/copilot-pbr/skills/debug/SKILL.md +2 -2
  40. package/plugins/copilot-pbr/skills/discuss/SKILL.md +54 -4
  41. package/plugins/copilot-pbr/skills/health/SKILL.md +15 -2
  42. package/plugins/copilot-pbr/skills/milestone/SKILL.md +8 -8
  43. package/plugins/copilot-pbr/skills/pause/SKILL.md +1 -1
  44. package/plugins/copilot-pbr/skills/plan/SKILL.md +20 -8
  45. package/plugins/copilot-pbr/skills/profile/SKILL.md +171 -0
  46. package/plugins/copilot-pbr/skills/review/SKILL.md +5 -3
  47. package/plugins/copilot-pbr/skills/scan/SKILL.md +2 -2
  48. package/plugins/copilot-pbr/skills/setup/SKILL.md +66 -2
  49. package/plugins/copilot-pbr/skills/shared/context-loader-task.md +2 -0
  50. package/plugins/copilot-pbr/skills/status/SKILL.md +17 -0
  51. package/plugins/copilot-pbr/templates/PROJECT.md.tmpl +41 -0
  52. package/plugins/copilot-pbr/templates/REQUIREMENTS.md.tmpl +52 -0
  53. package/plugins/copilot-pbr/templates/VERIFICATION-DETAIL.md.tmpl +5 -0
  54. package/plugins/copilot-pbr/templates/project-CONTEXT.md.tmpl +43 -0
  55. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  56. package/plugins/cursor-pbr/agents/executor.md +8 -0
  57. package/plugins/cursor-pbr/agents/plan-checker.md +5 -3
  58. package/plugins/cursor-pbr/agents/planner.md +13 -7
  59. package/plugins/cursor-pbr/agents/verifier.md +10 -1
  60. package/plugins/cursor-pbr/commands/profile.md +7 -0
  61. package/plugins/cursor-pbr/hooks/hooks.json +23 -0
  62. package/plugins/cursor-pbr/references/model-profiles.md +29 -3
  63. package/plugins/cursor-pbr/references/plan-format.md +46 -8
  64. package/plugins/cursor-pbr/skills/begin/SKILL.md +18 -34
  65. package/plugins/cursor-pbr/skills/build/SKILL.md +9 -5
  66. package/plugins/cursor-pbr/skills/debug/SKILL.md +2 -2
  67. package/plugins/cursor-pbr/skills/discuss/SKILL.md +55 -5
  68. package/plugins/cursor-pbr/skills/health/SKILL.md +15 -2
  69. package/plugins/cursor-pbr/skills/milestone/SKILL.md +8 -8
  70. package/plugins/cursor-pbr/skills/pause/SKILL.md +1 -1
  71. package/plugins/cursor-pbr/skills/plan/SKILL.md +21 -9
  72. package/plugins/cursor-pbr/skills/profile/SKILL.md +172 -0
  73. package/plugins/cursor-pbr/skills/review/SKILL.md +6 -4
  74. package/plugins/cursor-pbr/skills/scan/SKILL.md +2 -2
  75. package/plugins/cursor-pbr/skills/setup/SKILL.md +66 -2
  76. package/plugins/cursor-pbr/skills/shared/context-loader-task.md +2 -0
  77. package/plugins/cursor-pbr/skills/status/SKILL.md +17 -0
  78. package/plugins/cursor-pbr/templates/PROJECT.md.tmpl +41 -0
  79. package/plugins/cursor-pbr/templates/REQUIREMENTS.md.tmpl +52 -0
  80. package/plugins/cursor-pbr/templates/VERIFICATION-DETAIL.md.tmpl +5 -0
  81. package/plugins/cursor-pbr/templates/project-CONTEXT.md.tmpl +43 -0
  82. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
  83. package/plugins/pbr/agents/audit.md +0 -1
  84. package/plugins/pbr/agents/codebase-mapper.md +0 -1
  85. package/plugins/pbr/agents/debugger.md +0 -1
  86. package/plugins/pbr/agents/dev-sync.md +0 -1
  87. package/plugins/pbr/agents/executor.md +8 -1
  88. package/plugins/pbr/agents/general.md +0 -1
  89. package/plugins/pbr/agents/integration-checker.md +0 -1
  90. package/plugins/pbr/agents/plan-checker.md +5 -4
  91. package/plugins/pbr/agents/planner.md +13 -8
  92. package/plugins/pbr/agents/researcher.md +0 -1
  93. package/plugins/pbr/agents/synthesizer.md +0 -1
  94. package/plugins/pbr/agents/verifier.md +10 -2
  95. package/plugins/pbr/commands/profile.md +7 -0
  96. package/plugins/pbr/hooks/hooks.json +23 -0
  97. package/plugins/pbr/references/model-profiles.md +29 -3
  98. package/plugins/pbr/references/plan-format.md +46 -8
  99. package/plugins/pbr/scripts/check-plan-format.js +29 -0
  100. package/plugins/pbr/scripts/config-schema.json +20 -1
  101. package/plugins/pbr/scripts/context-bridge.js +1 -1
  102. package/plugins/pbr/scripts/hooks-schema.json +3 -1
  103. package/plugins/pbr/scripts/lib/gates/doc-existence.js +46 -0
  104. package/plugins/pbr/scripts/lib/init.js +10 -7
  105. package/plugins/pbr/scripts/pbr-tools.js +6 -6
  106. package/plugins/pbr/scripts/post-write-dispatch.js +22 -2
  107. package/plugins/pbr/scripts/sync-context-to-claude.js +100 -0
  108. package/plugins/pbr/scripts/validate-task.js +14 -1
  109. package/plugins/pbr/scripts/worktree-create.js +93 -0
  110. package/plugins/pbr/scripts/worktree-remove.js +83 -0
  111. package/plugins/pbr/skills/begin/SKILL.md +18 -34
  112. package/plugins/pbr/skills/build/SKILL.md +9 -5
  113. package/plugins/pbr/skills/debug/SKILL.md +2 -2
  114. package/plugins/pbr/skills/discuss/SKILL.md +55 -5
  115. package/plugins/pbr/skills/health/SKILL.md +15 -2
  116. package/plugins/pbr/skills/milestone/SKILL.md +8 -8
  117. package/plugins/pbr/skills/pause/SKILL.md +1 -1
  118. package/plugins/pbr/skills/plan/SKILL.md +21 -9
  119. package/plugins/pbr/skills/profile/SKILL.md +173 -0
  120. package/plugins/pbr/skills/review/SKILL.md +6 -4
  121. package/plugins/pbr/skills/scan/SKILL.md +2 -2
  122. package/plugins/pbr/skills/setup/SKILL.md +66 -2
  123. package/plugins/pbr/skills/shared/context-loader-task.md +2 -0
  124. package/plugins/pbr/skills/status/SKILL.md +17 -0
  125. package/plugins/pbr/templates/PROJECT.md.tmpl +41 -0
  126. package/plugins/pbr/templates/REQUIREMENTS.md.tmpl +52 -0
  127. package/plugins/pbr/templates/VERIFICATION-DETAIL.md.tmpl +5 -0
  128. package/plugins/pbr/templates/project-CONTEXT.md.tmpl +43 -0
@@ -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:
@@ -114,7 +164,7 @@ Before jumping into specific gray areas, give the user space to share their ment
114
164
 
115
165
  Analyze the phase goal, requirements, and what's already built. Identify **3-4 gray areas** where the user's preference matters. Gray areas fall into these categories:
116
166
 
117
- Read `skills/discuss/templates/decision-categories.md` for the category reference table.
167
+ Read `${CLAUDE_SKILL_DIR}/templates/decision-categories.md` for the category reference table.
118
168
 
119
169
  **How to identify gray areas:**
120
170
  1. Look at the phase requirements — where are there multiple valid approaches?
@@ -198,7 +248,7 @@ Write the CONTEXT.md file to the phase directory:
198
248
 
199
249
  **Content:**
200
250
 
201
- Read `skills/discuss/templates/CONTEXT.md.tmpl` for the template structure.
251
+ Read `${CLAUDE_SKILL_DIR}/templates/CONTEXT.md.tmpl` for the template structure.
202
252
 
203
253
  **Placeholders to fill:**
204
254
  - `{N}` -- the phase number
@@ -33,9 +33,9 @@ Check if the user passed `--repair`:
33
33
 
34
34
  ## How Checks Work
35
35
 
36
- Each check follows the common pattern. Read `skills/health/templates/check-pattern.md.tmpl` for the shared execution flow: target files, validate against rules, classify as PASS/FAIL/WARN/INFO, and record the result with a fix suggestion for any failures.
36
+ Each check follows the common pattern. Read `${CLAUDE_SKILL_DIR}/templates/check-pattern.md.tmpl` for the shared execution flow: target files, validate against rules, classify as PASS/FAIL/WARN/INFO, and record the result with a fix suggestion for any failures.
37
37
 
38
- Read `skills/health/templates/output-format.md.tmpl` for the output format: summary table, status indicators, issues list, optional recent decisions, and final result line.
38
+ Read `${CLAUDE_SKILL_DIR}/templates/output-format.md.tmpl` for the output format: summary table, status indicators, issues list, optional recent decisions, and final result line.
39
39
 
40
40
  ---
41
41
 
@@ -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`.
@@ -160,7 +160,7 @@ Start a new milestone cycle with new phases.
160
160
  docs(planning): start milestone "{name}" (phases {start}-{end})
161
161
  ```
162
162
 
163
- 10. **Confirm** with branded output — read `skills/milestone/templates/new-output.md.tmpl` and fill in `{name}` (milestone name), `{count}` (phase count), `{N}` (first phase number).
163
+ 10. **Confirm** with branded output — read `${CLAUDE_SKILL_DIR}/templates/new-output.md.tmpl` and fill in `{name}` (milestone name), `{count}` (phase count), `{N}` (first phase number).
164
164
 
165
165
  ---
166
166
 
@@ -331,7 +331,7 @@ Archive a completed milestone and prepare for the next one.
331
331
 
332
332
  **Stats file content:**
333
333
 
334
- Read `skills/milestone/templates/stats-file.md.tmpl` for the stats file format. Fill in all `{variable}` placeholders with actual data gathered in Steps 3-4.
334
+ Read `${CLAUDE_SKILL_DIR}/templates/stats-file.md.tmpl` for the stats file format. Fill in all `{variable}` placeholders with actual data gathered in Steps 3-4.
335
335
 
336
336
  6. **Update PROJECT.md:**
337
337
  - Move milestone from "Active" to "Completed"
@@ -448,7 +448,7 @@ If `config.deployment.smoke_test_command` is set and non-empty:
448
448
 
449
449
  This is advisory only — the milestone is already archived. Surface it as a potential issue for the user to investigate.
450
450
 
451
- 10. **Confirm** with branded output — read `skills/milestone/templates/complete-output.md.tmpl` and fill in `{version}`, `{count}` (phases, plans, commits), `{lines}`, `{duration}`.
451
+ 10. **Confirm** with branded output — read `${CLAUDE_SKILL_DIR}/templates/complete-output.md.tmpl` and fill in `{version}`, `{count}` (phases, plans, commits), `{lines}`, `{duration}`.
452
452
 
453
453
  ---
454
454
 
@@ -471,7 +471,7 @@ Verify milestone completion with cross-phase integration checks.
471
471
 
472
472
  Display to the user: `◐ Spawning integration checker...`
473
473
 
474
- Spawn `Task(subagent_type: "pbr:integration-checker")`. Read `skills/milestone/templates/integration-checker-prompt.md.tmpl`, fill in `{version or "current"}`, `{list of phase directories}`, and `{phase SUMMARY.md paths}`, then use the filled template as the Task() prompt.
474
+ Spawn `Task(subagent_type: "pbr:integration-checker")`. Read `${CLAUDE_SKILL_DIR}/templates/integration-checker-prompt.md.tmpl`, fill in `{version or "current"}`, `{list of phase directories}`, and `{phase SUMMARY.md paths}`, then use the filled template as the Task() prompt.
475
475
 
476
476
  4. **Check integration-checker completion:**
477
477
 
@@ -488,11 +488,11 @@ Verify milestone completion with cross-phase integration checks.
488
488
 
489
489
  Create `.planning/{version}-MILESTONE-AUDIT.md` using the template:
490
490
 
491
- Read `skills/milestone/templates/audit-report.md.tmpl` for the audit report format. Fill in all `{variable}` placeholders with actual data from the audit.
491
+ Read `${CLAUDE_SKILL_DIR}/templates/audit-report.md.tmpl` for the audit report format. Fill in all `{variable}` placeholders with actual data from the audit.
492
492
 
493
493
  **Spot-check:** After writing, verify `.planning/{version}-MILESTONE-AUDIT.md` exists on disk using Glob. If missing, re-attempt the write. If still missing, display an error and include findings inline.
494
494
 
495
- 7. **Report to user** using branded banners — read `skills/milestone/templates/audit-output.md.tmpl`. The template contains all 3 variants (PASSED, GAPS FOUND, TECH DEBT). Select the appropriate section based on audit result. Fill in `{version}`, `{count}`, `{gap 1}`, `{gap 2}` as applicable.
495
+ 7. **Report to user** using branded banners — read `${CLAUDE_SKILL_DIR}/templates/audit-output.md.tmpl`. The template contains all 3 variants (PASSED, GAPS FOUND, TECH DEBT). Select the appropriate section based on audit result. Fill in `{version}`, `{count}`, `{gap 1}`, `{gap 2}` as applicable.
496
496
 
497
497
  ---
498
498
 
@@ -572,7 +572,7 @@ Create phases to close gaps found during an audit.
572
572
  docs(planning): add gap-closure phases from milestone audit
573
573
  ```
574
574
 
575
- 9. **Confirm** with branded output — read `skills/milestone/templates/gaps-output.md.tmpl` and fill in `{count}` (gap-closure phases created), `{N}` (first gap phase number), `{name}` (phase name).
575
+ 9. **Confirm** with branded output — read `${CLAUDE_SKILL_DIR}/templates/gaps-output.md.tmpl` and fill in `{count}` (gap-closure phases created), `{N}` (first gap phase number), `{name}` (phase name).
576
576
 
577
577
  ---
578
578
 
@@ -603,7 +603,7 @@ Tags (complete only):
603
603
 
604
604
  ## Edge Cases
605
605
 
606
- For all edge case handling, see `skills/milestone/templates/edge-cases.md`.
606
+ For all edge case handling, see `${CLAUDE_SKILL_DIR}/templates/edge-cases.md`.
607
607
  Key scenarios: no ROADMAP.md, no phases, no gaps found, version collision, partially verified, large milestone (8+ phases).
608
608
 
609
609
  ---
@@ -128,7 +128,7 @@ Write the handoff file to the current phase directory:
128
128
 
129
129
  **Content:**
130
130
 
131
- Read `skills/pause/templates/continue-here.md.tmpl` for the handoff file format. Fill in all `{variable}` placeholders with actual session data gathered in Steps 1-3.
131
+ Read `${CLAUDE_SKILL_DIR}/templates/continue-here.md.tmpl` for the handoff file format. Fill in all `{variable}` placeholders with actual session data gathered in Steps 1-3.
132
132
 
133
133
  ### Step 5: Update STATE.md
134
134
 
@@ -54,6 +54,7 @@ Parse the phase number and optional flags:
54
54
  | `3 --assumptions` | Surface assumptions before planning phase 3 |
55
55
  | `3 --gaps` | Create gap-closure plans for phase 3 (from VERIFICATION.md) |
56
56
  | `3 --teams` | Plan phase 3 using specialist agent teams |
57
+ | `3 --model opus` | Use opus for all researcher, planner, and checker spawns in phase 3 |
57
58
  | (no number) | Use current phase from STATE.md |
58
59
  | `3 --preview` | Preview what planning would produce for phase 3 without spawning agents |
59
60
 
@@ -114,6 +115,7 @@ Execute these steps in order for standard `$pbr-plan <N>` invocations.
114
115
  Reference: `skills/shared/config-loading.md` for the tooling shortcut (`state load`, `plan-index`, `phase-info`) and config field reference.
115
116
 
116
117
  1. Parse `$ARGUMENTS` for phase number and flags
118
+ - If `--model <value>` is present in `$ARGUMENTS`, extract the value (sonnet, opus, haiku, inherit). Store as `override_model`. When spawning researcher, planner, and plan-checker Task() agents, use `override_model` instead of the config-derived model values. If an invalid value is provided, display an error and list valid values.
117
119
  2. Read `.planning/config.json` for settings (see config-loading.md for field reference)
118
120
  **CRITICAL (hook-enforced): Write .active-skill NOW.** Write the text "plan" to `.planning/.active-skill` using the Write tool.
119
121
  3. Resolve depth profile: run `node ${PLUGIN_ROOT}/scripts/pbr-tools.js config resolve-depth` to get the effective feature/gate settings for the current depth. Store the result for use in later gating decisions.
@@ -227,7 +229,7 @@ NOTE: The pbr:researcher subagent type auto-loads the agent definition. Do NOT i
227
229
 
228
230
  #### Phase Research Prompt Template
229
231
 
230
- Read `skills/plan/templates/researcher-prompt.md.tmpl` and use it as the prompt template for spawning the researcher agent. Fill in the placeholders with phase-specific context:
232
+ Read `${CLAUDE_SKILL_DIR}/templates/researcher-prompt.md.tmpl` and use it as the prompt template for spawning the researcher agent. Fill in the placeholders with phase-specific context:
231
233
  - `{NN}` - phase number (zero-padded)
232
234
  - `{phase name}` - phase name from roadmap
233
235
  - `{goal from roadmap}` - phase goal statement
@@ -352,7 +354,7 @@ After planner completes, check for completion markers: `## PLANNING COMPLETE`, `
352
354
 
353
355
  #### Planning Prompt Template
354
356
 
355
- Read `skills/plan/templates/planner-prompt.md.tmpl` and use it as the prompt template for spawning the planner agent. Fill in all placeholder blocks with phase-specific context:
357
+ Read `${CLAUDE_SKILL_DIR}/templates/planner-prompt.md.tmpl` and use it as the prompt template for spawning the planner agent. Fill in all placeholder blocks with phase-specific context:
356
358
 
357
359
  - `<phase_context>` - phase number, directory, goal, requirements, dependencies, success criteria
358
360
  - `<project_context>` - locked decisions, user constraints, deferred ideas, phase-specific decisions
@@ -424,7 +426,7 @@ NOTE: The pbr:plan-checker subagent type auto-loads the agent definition. Do NOT
424
426
 
425
427
  #### Checker Prompt Template
426
428
 
427
- Read `skills/plan/templates/checker-prompt.md.tmpl` and use it as the prompt template for spawning the plan checker agent. Fill in the placeholders:
429
+ Read `${CLAUDE_SKILL_DIR}/templates/checker-prompt.md.tmpl` and use it as the prompt template for spawning the plan checker agent. Fill in the placeholders:
428
430
  - `<plans_to_check>` - manifest table of PLAN.md file paths (checker reads each via Read tool)
429
431
  - `<phase_context>` - phase goal and requirement IDs
430
432
  - `<context>` - file paths to project-level and phase-level CONTEXT.md files (checker reads via Read tool)
@@ -452,7 +454,7 @@ After the plan checker returns, display its result:
452
454
  Reference: `skills/shared/revision-loop.md` for the full Check-Revise-Escalate pattern.
453
455
 
454
456
  Follow the revision loop pattern with:
455
- - **Producer**: planner (re-spawned with `skills/plan/templates/revision-prompt.md.tmpl`)
457
+ - **Producer**: planner (re-spawned with `${CLAUDE_SKILL_DIR}/templates/revision-prompt.md.tmpl`)
456
458
  - **Checker**: plan-checker (back to Step 6)
457
459
  - **Escalation**: present issues to user, offer "Proceed anyway" or "Adjust approach" (re-enter Step 5)
458
460
 
@@ -482,7 +484,17 @@ Use AskUserQuestion (pattern: approve-revise-abort from `skills/shared/gate-prom
482
484
  - Or make small inline edits to plan files directly
483
485
 
484
486
  **If user selects 'Approve':**
485
- - **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.
486
498
  - **Dependency fingerprinting**: For each dependency phase (phases that this phase depends on, per ROADMAP.md):
487
499
  1. Find all SUMMARY.md files in the dependency phase directory
488
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.
@@ -529,7 +541,7 @@ Use AskUserQuestion (pattern: approve-revise-abort from `skills/shared/gate-prom
529
541
 
530
542
  ### Subcommand: `insert <N>`
531
543
 
532
- Reference: `skills/plan/decimal-phase-calc.md` for decimal numbering rules.
544
+ Reference: `${CLAUDE_SKILL_DIR}/decimal-phase-calc.md` for decimal numbering rules.
533
545
 
534
546
  **CRITICAL (hook-enforced): Write .active-skill NOW.** Write the text "plan" to `.planning/.active-skill` using the Write tool.
535
547
 
@@ -573,7 +585,7 @@ When invoked with `--gaps`:
573
585
  2. Extract all gaps from the verification report
574
586
  3. Spawn planner Task() in Gap Closure mode:
575
587
 
576
- Read `skills/plan/templates/gap-closure-prompt.md.tmpl` and use it as the prompt template for the gap closure planner. Fill in the placeholders:
588
+ Read `${CLAUDE_SKILL_DIR}/templates/gap-closure-prompt.md.tmpl` and use it as the prompt template for the gap closure planner. Fill in the placeholders:
577
589
  - `<verification_report>` - inline the FULL VERIFICATION.md content
578
590
  - `<existing_plans>` - inline all existing PLAN.md files for the phase
579
591
  - `<gap_closure_instructions>` - specify output path and gap_closure frontmatter flag
@@ -646,5 +658,5 @@ Delete `.planning/.active-skill` if it exists. This must happen on all paths (su
646
658
 
647
659
  After planning completes, present:
648
660
 
649
- Use the branded stage banner and next-up block from `skills/plan/templates/completion-output.md.tmpl`.
661
+ Use the branded stage banner and next-up block from `${CLAUDE_SKILL_DIR}/templates/completion-output.md.tmpl`.
650
662
  Fill in: `{N}` (phase number), `{phase-name}`, `{plan_count}`, `{plan_list_lines}` (one line per plan with wave and task count), `{wave_table_lines}` (one line per wave).
@@ -0,0 +1,171 @@
1
+ ---
2
+ name: profile
3
+ description: "Switch the active model profile. Presets: quality, balanced, budget, adaptive. Supports custom profiles from config.json model_profiles."
4
+ ---
5
+
6
+ **STOP — DO NOT READ THIS FILE. You are already reading it. This prompt was injected into your context by Claude Code's plugin system. Begin executing Step 0 immediately.**
7
+
8
+ # $pbr-profile — Model Profile Manager
9
+
10
+ You are running the **profile** skill. Your job is to show the current model profile or switch to a new one by writing model assignments to `.planning/config.json`.
11
+
12
+ ## Step 0 — Immediate Output
13
+
14
+ **Before ANY tool calls**, display this banner:
15
+
16
+ ```
17
+ ╔══════════════════════════════════════════════════════════════╗
18
+ ║ PLAN-BUILD-RUN ► MODEL PROFILE ║
19
+ ╚══════════════════════════════════════════════════════════════╝
20
+ ```
21
+
22
+ Then proceed to Step 1.
23
+
24
+ ## Step 1 — Load Config
25
+
26
+ Read `.planning/config.json`.
27
+
28
+ If the file does not exist, output:
29
+
30
+ ```
31
+ Error: .planning/config.json not found. Run $pbr-begin first.
32
+ ```
33
+
34
+ Stop immediately.
35
+
36
+ ## Step 2 — Parse Arguments
37
+
38
+ Extract the first word from `$ARGUMENTS` as the profile name. Trim whitespace.
39
+
40
+ - If `$ARGUMENTS` is empty or blank → **show-mode** (go to Step 3).
41
+ - If a profile name is present → **switch-mode** (go to Step 4).
42
+
43
+ ## Step 3 — Show Mode (no argument)
44
+
45
+ Display the current profile status and available options.
46
+
47
+ 1. Read `config.json` key `model_profile`. If absent, treat as `"balanced"`.
48
+ 2. Read `config.json` key `models` (object). If absent, use empty object.
49
+ 3. Read `config.json` key `model_profiles` (object, optional custom profiles). If absent, use empty object.
50
+
51
+ Output the following (fill in actual values):
52
+
53
+ ```
54
+ Active profile: <model_profile value>
55
+
56
+ Current model assignments:
57
+ researcher : <models.researcher or "not set">
58
+ planner : <models.planner or "not set">
59
+ executor : <models.executor or "not set">
60
+ verifier : <models.verifier or "not set">
61
+ integration_checker : <models.integration_checker or "not set">
62
+ debugger : <models.debugger or "not set">
63
+ mapper : <models.mapper or "not set">
64
+ synthesizer : <models.synthesizer or "not set">
65
+
66
+ Available presets:
67
+ quality — all agents use opus (maximum capability)
68
+ balanced — mix of sonnet/inherit/haiku (default)
69
+ budget — all agents use haiku (minimum cost)
70
+ adaptive — sonnet for planning/verification, inherit/haiku for execution
71
+ ```
72
+
73
+ If `model_profiles` has any keys, also display:
74
+
75
+ ```
76
+ Custom profiles:
77
+ <profile-name> — <key count> model overrides
78
+ ```
79
+
80
+ Output: "Run `$pbr-profile <name>` to switch profiles."
81
+
82
+ Stop. Do not write anything.
83
+
84
+ ## Step 4 — Switch Mode (argument provided)
85
+
86
+ ### Step 4a — Validate Profile Name
87
+
88
+ Built-in preset names: `quality`, `balanced`, `budget`, `adaptive`.
89
+
90
+ Custom profile names: keys in `config.json model_profiles` (if any).
91
+
92
+ If the provided name does not match any of the above:
93
+
94
+ ```
95
+ Error: Unknown profile "<name>".
96
+
97
+ Valid presets: quality, balanced, budget, adaptive
98
+ <list any custom profile names from config.json model_profiles, if any>
99
+
100
+ Run `$pbr-profile` to see the current status.
101
+ ```
102
+
103
+ Stop immediately.
104
+
105
+ ### Step 4b — Resolve Model Values
106
+
107
+ Use the preset table to resolve model values:
108
+
109
+ | Agent | quality | balanced | budget | adaptive |
110
+ |---------------------|---------|----------|--------|----------|
111
+ | researcher | opus | sonnet | haiku | sonnet |
112
+ | planner | opus | inherit | haiku | sonnet |
113
+ | executor | opus | inherit | haiku | inherit |
114
+ | verifier | opus | sonnet | haiku | sonnet |
115
+ | integration_checker | sonnet | sonnet | haiku | haiku |
116
+ | debugger | opus | inherit | haiku | inherit |
117
+ | mapper | sonnet | sonnet | haiku | haiku |
118
+ | synthesizer | sonnet | haiku | haiku | haiku |
119
+
120
+ For a **custom profile** (name found in `config.json model_profiles`):
121
+ - Start with the `balanced` defaults from the table above.
122
+ - Overlay any keys present in `config.json model_profiles[<name>]`.
123
+ - Any agents not specified in the custom profile use the balanced default.
124
+
125
+ ### Step 4c — Write to config.json
126
+
127
+ Update `config.json` using the Bash tool with `node -e` inline script:
128
+
129
+ ```bash
130
+ node -e "
131
+ const fs = require('fs');
132
+ const cfg = JSON.parse(fs.readFileSync('.planning/config.json', 'utf8'));
133
+ cfg.model_profile = '<name>';
134
+ cfg.models = cfg.models || {};
135
+ cfg.models.researcher = '<value>';
136
+ cfg.models.planner = '<value>';
137
+ cfg.models.executor = '<value>';
138
+ cfg.models.verifier = '<value>';
139
+ cfg.models.integration_checker = '<value>';
140
+ cfg.models.debugger = '<value>';
141
+ cfg.models.mapper = '<value>';
142
+ cfg.models.synthesizer = '<value>';
143
+ fs.writeFileSync('.planning/config.json', JSON.stringify(cfg, null, 2));
144
+ console.log('OK');
145
+ "
146
+ ```
147
+
148
+ Replace each `<value>` with the resolved model string for that agent. Replace `<name>` with the profile name.
149
+
150
+ ### Step 4d — Confirm
151
+
152
+ Output:
153
+
154
+ ```
155
+ Active profile set to: <name>
156
+
157
+ Model assignments updated:
158
+ researcher : <value>
159
+ planner : <value>
160
+ executor : <value>
161
+ verifier : <value>
162
+ integration_checker : <value>
163
+ debugger : <value>
164
+ mapper : <value>
165
+ synthesizer : <value>
166
+
167
+ Config written to .planning/config.json.
168
+ Run $pbr-profile to verify.
169
+ ```
170
+
171
+ Stop. Done.
@@ -50,6 +50,7 @@ Parse `$ARGUMENTS` according to `skills/shared/phase-argument-parsing.md`.
50
50
  | `3` | Review phase 3 |
51
51
  | `3 --auto-fix` | Review phase 3, automatically diagnose and create gap-closure plans for failures |
52
52
  | `3 --teams` | Review phase 3 with parallel specialist verifiers (functional + security + performance) |
53
+ | `3 --model opus` | Use opus for all verifier spawns in phase 3 (overrides config verifier_model) |
53
54
  | (no number) | Use current phase from STATE.md |
54
55
 
55
56
  ---
@@ -65,6 +66,7 @@ Execute these steps in order.
65
66
  **Init-first pattern**: When spawning agents, pass the output of `node plugins/pbr/scripts/pbr-tools.js init verify-work {N}` as context rather than having the agent read multiple files separately. This reduces file reads and prevents context-loading failures.
66
67
 
67
68
  1. Parse `$ARGUMENTS` for phase number and `--auto-fix` flag
69
+ - If `--model <value>` is present in `$ARGUMENTS`, extract the value (sonnet, opus, haiku, inherit). Store as `override_model`. When spawning verifier Task() agents, use `override_model` instead of the config-derived verifier_model. If an invalid value is provided, display an error and list valid values.
68
70
  2. Read `.planning/config.json`
69
71
  **CRITICAL (hook-enforced): Write .active-skill NOW.** Write the text "review" to `.planning/.active-skill` using the Write tool.
70
72
  3. Resolve depth profile: run `node ${PLUGIN_ROOT}/scripts/pbr-tools.js config resolve-depth` to get the effective feature/gate settings for the current depth. Store the result for use in later gating decisions.
@@ -184,7 +186,7 @@ Task({
184
186
 
185
187
  #### Verifier Prompt Template
186
188
 
187
- Read `skills/review/templates/verifier-prompt.md.tmpl` and use its content as the verifier prompt.
189
+ Read `${CLAUDE_SKILL_DIR}/templates/verifier-prompt.md.tmpl` and use its content as the verifier prompt.
188
190
 
189
191
  **Prepend this block to the verifier prompt before sending:**
190
192
  ```
@@ -426,7 +428,7 @@ Task({
426
428
 
427
429
  ##### Debugger Prompt Template
428
430
 
429
- Read `skills/review/templates/debugger-prompt.md.tmpl` and use its content as the debugger prompt.
431
+ Read `${CLAUDE_SKILL_DIR}/templates/debugger-prompt.md.tmpl` and use its content as the debugger prompt.
430
432
 
431
433
  **Prepend this block to the debugger prompt before sending:**
432
434
  ```
@@ -458,7 +460,7 @@ Task({
458
460
 
459
461
  ##### Gap Planner Prompt Template
460
462
 
461
- Read `skills/review/templates/gap-planner-prompt.md.tmpl` and use its content as the gap planner prompt.
463
+ Read `${CLAUDE_SKILL_DIR}/templates/gap-planner-prompt.md.tmpl` and use its content as the gap planner prompt.
462
464
 
463
465
  **Prepend this block to the gap planner prompt before sending:**
464
466
  ```
@@ -89,7 +89,7 @@ Before spawning agents, do a quick scan to identify what we're working with. Thi
89
89
  4. **Read existing docs** — README.md, architecture docs, .env.example
90
90
  5. **Write `.planning/codebase/RECON.md`** with project type, scale, key directories, entry points, and quick stats
91
91
 
92
- Refer to the "Reconnaissance Detection Reference" section of `skills/scan/templates/mapper-prompt.md.tmpl` for the full detection checklists.
92
+ Refer to the "Reconnaissance Detection Reference" section of `${CLAUDE_SKILL_DIR}/templates/mapper-prompt.md.tmpl` for the full detection checklists.
93
93
 
94
94
  ### Step 3: Spawn Analysis Agents
95
95
 
@@ -118,7 +118,7 @@ Display to the user:
118
118
 
119
119
  Spawn `{mapper_count}` parallel `Task(subagent_type: "pbr:codebase-mapper")` agents, one for each area in `scan.mapper_areas`. All should be spawned in a single response for maximum parallelism.
120
120
 
121
- For each agent, read `skills/scan/templates/mapper-prompt.md.tmpl` and fill in the placeholders:
121
+ For each agent, read `${CLAUDE_SKILL_DIR}/templates/mapper-prompt.md.tmpl` and fill in the placeholders:
122
122
  - `{focus_area}`: one of `tech`, `arch`, `quality`, `concerns`
123
123
  - `{project_path}`: the working directory
124
124
  - `{recon_data}`: contents of RECON.md
@@ -135,7 +135,69 @@ This project uses [Plan-Build-Run](https://github.com/SienkLogic/plan-build-run)
135
135
 
136
136
  ---
137
137
 
138
- ## Step 5: Write Updated Config
138
+ ## Step 5: Platform Settings
139
+
140
+ Manage Claude Code platform settings that PBR recommends for optimal token usage.
141
+
142
+ **Read `.planning/config.json`** (already loaded in Step 1). Check for a `platform_settings` block:
143
+ - If absent, treat it as `{}` (no managed settings).
144
+
145
+ **Check for existing `.claude/settings.json`**:
146
+ - If it exists, read its contents. Parse as JSON (or `{}` if empty/missing).
147
+ - If it does not exist, start from `{}`.
148
+
149
+ **Compute the merge**:
150
+ - Start with the existing `.claude/settings.json` content.
151
+ - Apply each key from `platform_settings` in config.json on top.
152
+ - If `platform_settings` is absent or empty, skip the write entirely.
153
+
154
+ **Report drift** (compare before/after):
155
+ - List keys being ADDED (were absent in .claude/settings.json)
156
+ - List keys being CHANGED (differ from existing .claude/settings.json value)
157
+ - List keys that MATCH (already correct — no change needed)
158
+
159
+ Display the report:
160
+
161
+ ```
162
+ Platform Settings:
163
+ Keys added: includeGitInstructions → false
164
+ Keys matched: (none)
165
+ Keys changed: (none)
166
+
167
+ Writing .claude/settings.json...
168
+ ```
169
+
170
+ If all keys already match, display:
171
+
172
+ ```
173
+ Platform Settings: .claude/settings.json is already in sync — no changes needed.
174
+ ```
175
+
176
+ **Conflict detection**: If an existing `.claude/settings.json` has a key from `platform_settings` set to the OPPOSITE value (e.g., `"includeGitInstructions": true` when PBR wants `false`), display a WARNING before overwriting:
177
+
178
+ ```
179
+ WARNING: .claude/settings.json has includeGitInstructions: true
180
+ PBR recommends false (removes redundant built-in git instructions).
181
+ Overwriting with PBR recommended value.
182
+ ```
183
+
184
+ **Write the merged settings.json**:
185
+ - Write to `.claude/settings.json` in the project root (alongside `.planning/`).
186
+ - Ensure the directory `.claude/` exists (create it if needed with Bash `mkdir -p .claude`).
187
+ - Write with 2-space indentation. Include a `$schema` key at the top:
188
+ ```json
189
+ {
190
+ "$schema": "https://json.schemastore.org/claude-code-settings.json",
191
+ "includeGitInstructions": false
192
+ }
193
+ ```
194
+ (Merge in any pre-existing keys from .claude/settings.json that are NOT managed by PBR — pass them through unchanged at the bottom of the object.)
195
+
196
+ **Drift detection note**: On subsequent $pbr-setup runs, if `.claude/settings.json` has drifted from `platform_settings` (e.g., user manually changed it), this step will detect and re-apply the PBR values with a drift warning. This is by design — platform_settings in config.json is the source of truth.
197
+
198
+ ---
199
+
200
+ ## Step 6: Write Updated Config
139
201
 
140
202
  **CRITICAL: Write `.planning/config.json` NOW with all changes from Steps 2-3. Do NOT skip this step.**
141
203
 
@@ -143,13 +205,14 @@ Write the updated config.json to disk with all applied changes.
143
205
 
144
206
  ---
145
207
 
146
- ## Step 6: Verification
208
+ ## Step 7: Verification
147
209
 
148
210
  Run a quick check:
149
211
  1. Verify `.planning/config.json` is valid JSON (read it back)
150
212
  2. Display updated settings summary
151
213
 
152
214
  Display:
215
+
153
216
  ```
154
217
  ╔══════════════════════════════════════════════════════════════╗
155
218
  ║ PLAN-BUILD-RUN ► RECONFIGURE COMPLETE ✓ ║
@@ -159,6 +222,7 @@ Updated:
159
222
  - Model profile: {new profile}
160
223
  - Features changed: {list or "none"}
161
224
  - CLAUDE.md: {updated/skipped}
225
+ - Platform settings: {".claude/settings.json updated" or "already in sync" or "no managed settings"}
162
226
 
163
227
  Run $pbr-status to see current project state.
164
228
  ```
@@ -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)