@sienklogic/plan-build-run 2.57.0 → 2.59.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 (90) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/package.json +1 -1
  3. package/plugins/codex-pbr/commands/profile.md +7 -0
  4. package/plugins/codex-pbr/references/model-profiles.md +47 -3
  5. package/plugins/codex-pbr/references/model-selection.md +1 -1
  6. package/plugins/codex-pbr/skills/begin/SKILL.md +10 -7
  7. package/plugins/codex-pbr/skills/build/SKILL.md +8 -4
  8. package/plugins/codex-pbr/skills/debug/SKILL.md +2 -2
  9. package/plugins/codex-pbr/skills/discuss/SKILL.md +2 -2
  10. package/plugins/codex-pbr/skills/health/SKILL.md +2 -2
  11. package/plugins/codex-pbr/skills/milestone/SKILL.md +8 -8
  12. package/plugins/codex-pbr/skills/pause/SKILL.md +1 -1
  13. package/plugins/codex-pbr/skills/plan/SKILL.md +9 -7
  14. package/plugins/codex-pbr/skills/profile/SKILL.md +171 -0
  15. package/plugins/codex-pbr/skills/review/SKILL.md +5 -3
  16. package/plugins/codex-pbr/skills/scan/SKILL.md +2 -2
  17. package/plugins/codex-pbr/skills/setup/SKILL.md +68 -2
  18. package/plugins/copilot-pbr/commands/profile.md +7 -0
  19. package/plugins/copilot-pbr/hooks/hooks.json +39 -0
  20. package/plugins/copilot-pbr/plugin.json +1 -1
  21. package/plugins/copilot-pbr/references/model-profiles.md +47 -3
  22. package/plugins/copilot-pbr/references/model-selection.md +1 -1
  23. package/plugins/copilot-pbr/skills/begin/SKILL.md +10 -7
  24. package/plugins/copilot-pbr/skills/build/SKILL.md +8 -4
  25. package/plugins/copilot-pbr/skills/debug/SKILL.md +2 -2
  26. package/plugins/copilot-pbr/skills/discuss/SKILL.md +2 -2
  27. package/plugins/copilot-pbr/skills/health/SKILL.md +2 -2
  28. package/plugins/copilot-pbr/skills/milestone/SKILL.md +8 -8
  29. package/plugins/copilot-pbr/skills/pause/SKILL.md +1 -1
  30. package/plugins/copilot-pbr/skills/plan/SKILL.md +9 -7
  31. package/plugins/copilot-pbr/skills/profile/SKILL.md +171 -0
  32. package/plugins/copilot-pbr/skills/review/SKILL.md +5 -3
  33. package/plugins/copilot-pbr/skills/scan/SKILL.md +2 -2
  34. package/plugins/copilot-pbr/skills/setup/SKILL.md +68 -2
  35. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  36. package/plugins/cursor-pbr/commands/profile.md +7 -0
  37. package/plugins/cursor-pbr/hooks/hooks.json +33 -0
  38. package/plugins/cursor-pbr/references/model-profiles.md +47 -3
  39. package/plugins/cursor-pbr/references/model-selection.md +1 -1
  40. package/plugins/cursor-pbr/skills/begin/SKILL.md +10 -7
  41. package/plugins/cursor-pbr/skills/build/SKILL.md +9 -5
  42. package/plugins/cursor-pbr/skills/debug/SKILL.md +2 -2
  43. package/plugins/cursor-pbr/skills/discuss/SKILL.md +2 -2
  44. package/plugins/cursor-pbr/skills/health/SKILL.md +2 -2
  45. package/plugins/cursor-pbr/skills/milestone/SKILL.md +8 -8
  46. package/plugins/cursor-pbr/skills/pause/SKILL.md +1 -1
  47. package/plugins/cursor-pbr/skills/plan/SKILL.md +10 -8
  48. package/plugins/cursor-pbr/skills/profile/SKILL.md +172 -0
  49. package/plugins/cursor-pbr/skills/review/SKILL.md +6 -4
  50. package/plugins/cursor-pbr/skills/scan/SKILL.md +2 -2
  51. package/plugins/cursor-pbr/skills/setup/SKILL.md +68 -2
  52. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
  53. package/plugins/pbr/agents/audit.md +0 -1
  54. package/plugins/pbr/agents/codebase-mapper.md +0 -1
  55. package/plugins/pbr/agents/debugger.md +0 -1
  56. package/plugins/pbr/agents/dev-sync.md +0 -1
  57. package/plugins/pbr/agents/executor.md +0 -1
  58. package/plugins/pbr/agents/general.md +0 -1
  59. package/plugins/pbr/agents/integration-checker.md +0 -1
  60. package/plugins/pbr/agents/plan-checker.md +0 -1
  61. package/plugins/pbr/agents/planner.md +0 -1
  62. package/plugins/pbr/agents/researcher.md +0 -1
  63. package/plugins/pbr/agents/synthesizer.md +0 -1
  64. package/plugins/pbr/agents/verifier.md +0 -1
  65. package/plugins/pbr/commands/profile.md +7 -0
  66. package/plugins/pbr/hooks/hooks.json +33 -0
  67. package/plugins/pbr/references/model-profiles.md +47 -3
  68. package/plugins/pbr/references/model-selection.md +1 -1
  69. package/plugins/pbr/scripts/check-subagent-output.js +1 -1
  70. package/plugins/pbr/scripts/config-schema.json +18 -0
  71. package/plugins/pbr/scripts/hooks-schema.json +4 -1
  72. package/plugins/pbr/scripts/instructions-loaded.js +69 -0
  73. package/plugins/pbr/scripts/lib/gates/helpers.js +7 -0
  74. package/plugins/pbr/scripts/lib/init.js +10 -7
  75. package/plugins/pbr/scripts/pbr-tools.js +6 -6
  76. package/plugins/pbr/scripts/task-completed.js +89 -1
  77. package/plugins/pbr/scripts/worktree-create.js +93 -0
  78. package/plugins/pbr/scripts/worktree-remove.js +83 -0
  79. package/plugins/pbr/skills/begin/SKILL.md +10 -7
  80. package/plugins/pbr/skills/build/SKILL.md +9 -5
  81. package/plugins/pbr/skills/debug/SKILL.md +2 -2
  82. package/plugins/pbr/skills/discuss/SKILL.md +2 -2
  83. package/plugins/pbr/skills/health/SKILL.md +2 -2
  84. package/plugins/pbr/skills/milestone/SKILL.md +8 -8
  85. package/plugins/pbr/skills/pause/SKILL.md +1 -1
  86. package/plugins/pbr/skills/plan/SKILL.md +10 -8
  87. package/plugins/pbr/skills/profile/SKILL.md +173 -0
  88. package/plugins/pbr/skills/review/SKILL.md +6 -4
  89. package/plugins/pbr/skills/scan/SKILL.md +2 -2
  90. package/plugins/pbr/skills/setup/SKILL.md +68 -2
@@ -0,0 +1,173 @@
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
+ allowed-tools: Read, Write, Bash, AskUserQuestion
5
+ argument-hint: "[quality|balanced|budget|adaptive|<custom>]"
6
+ ---
7
+
8
+ **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.**
9
+
10
+ # /pbr:profile — Model Profile Manager
11
+
12
+ 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`.
13
+
14
+ ## Step 0 — Immediate Output
15
+
16
+ **Before ANY tool calls**, display this banner:
17
+
18
+ ```
19
+ ╔══════════════════════════════════════════════════════════════╗
20
+ ║ PLAN-BUILD-RUN ► MODEL PROFILE ║
21
+ ╚══════════════════════════════════════════════════════════════╝
22
+ ```
23
+
24
+ Then proceed to Step 1.
25
+
26
+ ## Step 1 — Load Config
27
+
28
+ Read `.planning/config.json`.
29
+
30
+ If the file does not exist, output:
31
+
32
+ ```
33
+ Error: .planning/config.json not found. Run /pbr:begin first.
34
+ ```
35
+
36
+ Stop immediately.
37
+
38
+ ## Step 2 — Parse Arguments
39
+
40
+ Extract the first word from `$ARGUMENTS` as the profile name. Trim whitespace.
41
+
42
+ - If `$ARGUMENTS` is empty or blank → **show-mode** (go to Step 3).
43
+ - If a profile name is present → **switch-mode** (go to Step 4).
44
+
45
+ ## Step 3 — Show Mode (no argument)
46
+
47
+ Display the current profile status and available options.
48
+
49
+ 1. Read `config.json` key `model_profile`. If absent, treat as `"balanced"`.
50
+ 2. Read `config.json` key `models` (object). If absent, use empty object.
51
+ 3. Read `config.json` key `model_profiles` (object, optional custom profiles). If absent, use empty object.
52
+
53
+ Output the following (fill in actual values):
54
+
55
+ ```
56
+ Active profile: <model_profile value>
57
+
58
+ Current model assignments:
59
+ researcher : <models.researcher or "not set">
60
+ planner : <models.planner or "not set">
61
+ executor : <models.executor or "not set">
62
+ verifier : <models.verifier or "not set">
63
+ integration_checker : <models.integration_checker or "not set">
64
+ debugger : <models.debugger or "not set">
65
+ mapper : <models.mapper or "not set">
66
+ synthesizer : <models.synthesizer or "not set">
67
+
68
+ Available presets:
69
+ quality — all agents use opus (maximum capability)
70
+ balanced — mix of sonnet/inherit/haiku (default)
71
+ budget — all agents use haiku (minimum cost)
72
+ adaptive — sonnet for planning/verification, inherit/haiku for execution
73
+ ```
74
+
75
+ If `model_profiles` has any keys, also display:
76
+
77
+ ```
78
+ Custom profiles:
79
+ <profile-name> — <key count> model overrides
80
+ ```
81
+
82
+ Output: "Run `/pbr:profile <name>` to switch profiles."
83
+
84
+ Stop. Do not write anything.
85
+
86
+ ## Step 4 — Switch Mode (argument provided)
87
+
88
+ ### Step 4a — Validate Profile Name
89
+
90
+ Built-in preset names: `quality`, `balanced`, `budget`, `adaptive`.
91
+
92
+ Custom profile names: keys in `config.json model_profiles` (if any).
93
+
94
+ If the provided name does not match any of the above:
95
+
96
+ ```
97
+ Error: Unknown profile "<name>".
98
+
99
+ Valid presets: quality, balanced, budget, adaptive
100
+ <list any custom profile names from config.json model_profiles, if any>
101
+
102
+ Run `/pbr:profile` to see the current status.
103
+ ```
104
+
105
+ Stop immediately.
106
+
107
+ ### Step 4b — Resolve Model Values
108
+
109
+ Use the preset table to resolve model values:
110
+
111
+ | Agent | quality | balanced | budget | adaptive |
112
+ |---------------------|---------|----------|--------|----------|
113
+ | researcher | opus | sonnet | haiku | sonnet |
114
+ | planner | opus | inherit | haiku | sonnet |
115
+ | executor | opus | inherit | haiku | inherit |
116
+ | verifier | opus | sonnet | haiku | sonnet |
117
+ | integration_checker | sonnet | sonnet | haiku | haiku |
118
+ | debugger | opus | inherit | haiku | inherit |
119
+ | mapper | sonnet | sonnet | haiku | haiku |
120
+ | synthesizer | sonnet | haiku | haiku | haiku |
121
+
122
+ For a **custom profile** (name found in `config.json model_profiles`):
123
+ - Start with the `balanced` defaults from the table above.
124
+ - Overlay any keys present in `config.json model_profiles[<name>]`.
125
+ - Any agents not specified in the custom profile use the balanced default.
126
+
127
+ ### Step 4c — Write to config.json
128
+
129
+ Update `config.json` using the Bash tool with `node -e` inline script:
130
+
131
+ ```bash
132
+ node -e "
133
+ const fs = require('fs');
134
+ const cfg = JSON.parse(fs.readFileSync('.planning/config.json', 'utf8'));
135
+ cfg.model_profile = '<name>';
136
+ cfg.models = cfg.models || {};
137
+ cfg.models.researcher = '<value>';
138
+ cfg.models.planner = '<value>';
139
+ cfg.models.executor = '<value>';
140
+ cfg.models.verifier = '<value>';
141
+ cfg.models.integration_checker = '<value>';
142
+ cfg.models.debugger = '<value>';
143
+ cfg.models.mapper = '<value>';
144
+ cfg.models.synthesizer = '<value>';
145
+ fs.writeFileSync('.planning/config.json', JSON.stringify(cfg, null, 2));
146
+ console.log('OK');
147
+ "
148
+ ```
149
+
150
+ Replace each `<value>` with the resolved model string for that agent. Replace `<name>` with the profile name.
151
+
152
+ ### Step 4d — Confirm
153
+
154
+ Output:
155
+
156
+ ```
157
+ Active profile set to: <name>
158
+
159
+ Model assignments updated:
160
+ researcher : <value>
161
+ planner : <value>
162
+ executor : <value>
163
+ verifier : <value>
164
+ integration_checker : <value>
165
+ debugger : <value>
166
+ mapper : <value>
167
+ synthesizer : <value>
168
+
169
+ Config written to .planning/config.json.
170
+ Run /pbr:profile to verify.
171
+ ```
172
+
173
+ Stop. Done.
@@ -2,7 +2,7 @@
2
2
  name: review
3
3
  description: "Verify the build matched the plan. Automated checks + walkthrough with you."
4
4
  allowed-tools: Read, Write, Bash, Glob, Grep, Task, AskUserQuestion, Skill
5
- argument-hint: "<phase-number> [--auto-fix] [--teams]"
5
+ argument-hint: "<phase-number> [--auto-fix] [--teams] [--model <model>]"
6
6
  ---
7
7
 
8
8
  **STOP — DO NOT READ THIS FILE. You are already reading it. This prompt was injected into your context by Claude Code's plugin system. Using the Read tool on this SKILL.md file wastes ~7,600 tokens. Begin executing Step 1 immediately.**
@@ -52,6 +52,7 @@ Parse `$ARGUMENTS` according to `skills/shared/phase-argument-parsing.md`.
52
52
  | `3` | Review phase 3 |
53
53
  | `3 --auto-fix` | Review phase 3, automatically diagnose and create gap-closure plans for failures |
54
54
  | `3 --teams` | Review phase 3 with parallel specialist verifiers (functional + security + performance) |
55
+ | `3 --model opus` | Use opus for all verifier spawns in phase 3 (overrides config verifier_model) |
55
56
  | (no number) | Use current phase from STATE.md |
56
57
 
57
58
  ---
@@ -67,6 +68,7 @@ Execute these steps in order.
67
68
  **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.
68
69
 
69
70
  1. Parse `$ARGUMENTS` for phase number and `--auto-fix` flag
71
+ - 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.
70
72
  2. Read `.planning/config.json`
71
73
  **CRITICAL (hook-enforced): Write .active-skill NOW.** Write the text "review" to `.planning/.active-skill` using the Write tool.
72
74
  3. Resolve depth profile: run `node ${CLAUDE_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.
@@ -186,7 +188,7 @@ Task({
186
188
 
187
189
  #### Verifier Prompt Template
188
190
 
189
- Read `skills/review/templates/verifier-prompt.md.tmpl` and use its content as the verifier prompt.
191
+ Read `${CLAUDE_SKILL_DIR}/templates/verifier-prompt.md.tmpl` and use its content as the verifier prompt.
190
192
 
191
193
  **Prepend this block to the verifier prompt before sending:**
192
194
  ```
@@ -428,7 +430,7 @@ Task({
428
430
 
429
431
  ##### Debugger Prompt Template
430
432
 
431
- Read `skills/review/templates/debugger-prompt.md.tmpl` and use its content as the debugger prompt.
433
+ Read `${CLAUDE_SKILL_DIR}/templates/debugger-prompt.md.tmpl` and use its content as the debugger prompt.
432
434
 
433
435
  **Prepend this block to the debugger prompt before sending:**
434
436
  ```
@@ -460,7 +462,7 @@ Task({
460
462
 
461
463
  ##### Gap Planner Prompt Template
462
464
 
463
- Read `skills/review/templates/gap-planner-prompt.md.tmpl` and use its content as the gap planner prompt.
465
+ Read `${CLAUDE_SKILL_DIR}/templates/gap-planner-prompt.md.tmpl` and use its content as the gap planner prompt.
464
466
 
465
467
  **Prepend this block to the gap planner prompt before sending:**
466
468
  ```
@@ -90,7 +90,7 @@ Before spawning agents, do a quick scan to identify what we're working with. Thi
90
90
  4. **Read existing docs** — README.md, architecture docs, .env.example
91
91
  5. **Write `.planning/codebase/RECON.md`** with project type, scale, key directories, entry points, and quick stats
92
92
 
93
- Refer to the "Reconnaissance Detection Reference" section of `skills/scan/templates/mapper-prompt.md.tmpl` for the full detection checklists.
93
+ Refer to the "Reconnaissance Detection Reference" section of `${CLAUDE_SKILL_DIR}/templates/mapper-prompt.md.tmpl` for the full detection checklists.
94
94
 
95
95
  ### Step 3: Spawn Analysis Agents
96
96
 
@@ -119,7 +119,7 @@ Display to the user:
119
119
 
120
120
  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.
121
121
 
122
- For each agent, read `skills/scan/templates/mapper-prompt.md.tmpl` and fill in the placeholders:
122
+ For each agent, read `${CLAUDE_SKILL_DIR}/templates/mapper-prompt.md.tmpl` and fill in the placeholders:
123
123
  - `{focus_area}`: one of `tech`, `arch`, `quality`, `concerns`
124
124
  - `{project_path}`: the working directory
125
125
  - `{recon_data}`: contents of RECON.md
@@ -58,6 +58,8 @@ Stop. Do not proceed further.
58
58
 
59
59
  ## Step 2: Model Selection
60
60
 
61
+ Note: These profiles control agent models, not the orchestrator. The orchestrator uses your Claude Code session model. For cost optimization, consider running your session on Sonnet -- agents with `inherit` will follow. See `references/model-profiles.md` for details.
62
+
61
63
  Use AskUserQuestion:
62
64
  question: "Which model profile should agents use?"
63
65
  header: "Models"
@@ -134,7 +136,69 @@ This project uses [Plan-Build-Run](https://github.com/SienkLogic/plan-build-run)
134
136
 
135
137
  ---
136
138
 
137
- ## Step 5: Write Updated Config
139
+ ## Step 5: Platform Settings
140
+
141
+ Manage Claude Code platform settings that PBR recommends for optimal token usage.
142
+
143
+ **Read `.planning/config.json`** (already loaded in Step 1). Check for a `platform_settings` block:
144
+ - If absent, treat it as `{}` (no managed settings).
145
+
146
+ **Check for existing `.claude/settings.json`**:
147
+ - If it exists, read its contents. Parse as JSON (or `{}` if empty/missing).
148
+ - If it does not exist, start from `{}`.
149
+
150
+ **Compute the merge**:
151
+ - Start with the existing `.claude/settings.json` content.
152
+ - Apply each key from `platform_settings` in config.json on top.
153
+ - If `platform_settings` is absent or empty, skip the write entirely.
154
+
155
+ **Report drift** (compare before/after):
156
+ - List keys being ADDED (were absent in .claude/settings.json)
157
+ - List keys being CHANGED (differ from existing .claude/settings.json value)
158
+ - List keys that MATCH (already correct — no change needed)
159
+
160
+ Display the report:
161
+
162
+ ```
163
+ Platform Settings:
164
+ Keys added: includeGitInstructions → false
165
+ Keys matched: (none)
166
+ Keys changed: (none)
167
+
168
+ Writing .claude/settings.json...
169
+ ```
170
+
171
+ If all keys already match, display:
172
+
173
+ ```
174
+ Platform Settings: .claude/settings.json is already in sync — no changes needed.
175
+ ```
176
+
177
+ **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:
178
+
179
+ ```
180
+ WARNING: .claude/settings.json has includeGitInstructions: true
181
+ PBR recommends false (removes redundant built-in git instructions).
182
+ Overwriting with PBR recommended value.
183
+ ```
184
+
185
+ **Write the merged settings.json**:
186
+ - Write to `.claude/settings.json` in the project root (alongside `.planning/`).
187
+ - Ensure the directory `.claude/` exists (create it if needed with Bash `mkdir -p .claude`).
188
+ - Write with 2-space indentation. Include a `$schema` key at the top:
189
+ ```json
190
+ {
191
+ "$schema": "https://json.schemastore.org/claude-code-settings.json",
192
+ "includeGitInstructions": false
193
+ }
194
+ ```
195
+ (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.)
196
+
197
+ **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.
198
+
199
+ ---
200
+
201
+ ## Step 6: Write Updated Config
138
202
 
139
203
  **CRITICAL: Write `.planning/config.json` NOW with all changes from Steps 2-3. Do NOT skip this step.**
140
204
 
@@ -142,13 +206,14 @@ Write the updated config.json to disk with all applied changes.
142
206
 
143
207
  ---
144
208
 
145
- ## Step 6: Verification
209
+ ## Step 7: Verification
146
210
 
147
211
  Run a quick check:
148
212
  1. Verify `.planning/config.json` is valid JSON (read it back)
149
213
  2. Display updated settings summary
150
214
 
151
215
  Display:
216
+
152
217
  ```
153
218
  ╔══════════════════════════════════════════════════════════════╗
154
219
  ║ PLAN-BUILD-RUN ► RECONFIGURE COMPLETE ✓ ║
@@ -158,6 +223,7 @@ Updated:
158
223
  - Model profile: {new profile}
159
224
  - Features changed: {list or "none"}
160
225
  - CLAUDE.md: {updated/skipped}
226
+ - Platform settings: {".claude/settings.json updated" or "already in sync" or "no managed settings"}
161
227
 
162
228
  Run /pbr:status to see current project state.
163
229
  ```