@sienklogic/plan-build-run 2.52.0 → 2.54.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 (68) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/package.json +2 -2
  3. package/plugins/copilot-pbr/agents/executor.agent.md +0 -2
  4. package/plugins/copilot-pbr/commands/setup.md +1 -1
  5. package/plugins/copilot-pbr/commands/undo.md +5 -0
  6. package/plugins/copilot-pbr/plugin.json +1 -1
  7. package/plugins/copilot-pbr/references/signal-files.md +41 -0
  8. package/plugins/copilot-pbr/skills/begin/SKILL.md +170 -17
  9. package/plugins/copilot-pbr/skills/build/SKILL.md +73 -8
  10. package/plugins/copilot-pbr/skills/plan/SKILL.md +67 -17
  11. package/plugins/copilot-pbr/skills/review/SKILL.md +12 -1
  12. package/plugins/copilot-pbr/skills/setup/SKILL.md +66 -214
  13. package/plugins/copilot-pbr/skills/shared/context-budget.md +27 -0
  14. package/plugins/copilot-pbr/skills/status/SKILL.md +44 -2
  15. package/plugins/copilot-pbr/skills/undo/SKILL.md +172 -0
  16. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  17. package/plugins/cursor-pbr/agents/executor.md +0 -2
  18. package/plugins/cursor-pbr/commands/setup.md +1 -1
  19. package/plugins/cursor-pbr/commands/undo.md +5 -0
  20. package/plugins/cursor-pbr/references/signal-files.md +41 -0
  21. package/plugins/cursor-pbr/skills/begin/SKILL.md +170 -17
  22. package/plugins/cursor-pbr/skills/build/SKILL.md +73 -8
  23. package/plugins/cursor-pbr/skills/plan/SKILL.md +67 -17
  24. package/plugins/cursor-pbr/skills/review/SKILL.md +12 -1
  25. package/plugins/cursor-pbr/skills/setup/SKILL.md +66 -214
  26. package/plugins/cursor-pbr/skills/shared/context-budget.md +27 -0
  27. package/plugins/cursor-pbr/skills/status/SKILL.md +44 -2
  28. package/plugins/cursor-pbr/skills/undo/SKILL.md +173 -0
  29. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
  30. package/plugins/pbr/agents/executor.md +0 -2
  31. package/plugins/pbr/commands/setup.md +1 -1
  32. package/plugins/pbr/commands/undo.md +5 -0
  33. package/plugins/pbr/references/signal-files.md +41 -0
  34. package/plugins/pbr/scripts/check-skill-workflow.js +7 -8
  35. package/plugins/pbr/scripts/check-subagent-output.js +7 -6
  36. package/plugins/pbr/scripts/config-schema.json +5 -1
  37. package/plugins/pbr/scripts/enforce-pbr-workflow.js +15 -6
  38. package/plugins/pbr/scripts/lib/alternatives.js +203 -0
  39. package/plugins/pbr/scripts/lib/preview.js +174 -0
  40. package/plugins/pbr/scripts/lib/skill-section.js +99 -0
  41. package/plugins/pbr/scripts/lib/step-verify.js +149 -0
  42. package/plugins/pbr/scripts/log-subagent.js +7 -10
  43. package/plugins/pbr/scripts/pbr-tools.js +122 -2
  44. package/plugins/pbr/scripts/validate-commit.js +2 -2
  45. package/plugins/pbr/skills/begin/SKILL.md +170 -17
  46. package/plugins/pbr/skills/begin/templates/config.json.tmpl +5 -1
  47. package/plugins/pbr/skills/build/SKILL.md +73 -8
  48. package/plugins/pbr/skills/plan/SKILL.md +67 -17
  49. package/plugins/pbr/skills/review/SKILL.md +12 -1
  50. package/plugins/pbr/skills/setup/SKILL.md +66 -214
  51. package/plugins/pbr/skills/shared/context-budget.md +27 -0
  52. package/plugins/pbr/skills/status/SKILL.md +44 -2
  53. package/plugins/pbr/skills/undo/SKILL.md +174 -0
  54. /package/plugins/copilot-pbr/references/{agent-anti-patterns.md → archive/agent-anti-patterns.md} +0 -0
  55. /package/plugins/copilot-pbr/references/{checkpoints.md → archive/checkpoints.md} +0 -0
  56. /package/plugins/copilot-pbr/references/{context-quality-tiers.md → archive/context-quality-tiers.md} +0 -0
  57. /package/plugins/copilot-pbr/references/{pbr-rules.md → archive/pbr-rules.md} +0 -0
  58. /package/plugins/copilot-pbr/references/{verification-patterns.md → archive/verification-patterns.md} +0 -0
  59. /package/plugins/cursor-pbr/references/{agent-anti-patterns.md → archive/agent-anti-patterns.md} +0 -0
  60. /package/plugins/cursor-pbr/references/{checkpoints.md → archive/checkpoints.md} +0 -0
  61. /package/plugins/cursor-pbr/references/{context-quality-tiers.md → archive/context-quality-tiers.md} +0 -0
  62. /package/plugins/cursor-pbr/references/{pbr-rules.md → archive/pbr-rules.md} +0 -0
  63. /package/plugins/cursor-pbr/references/{verification-patterns.md → archive/verification-patterns.md} +0 -0
  64. /package/plugins/pbr/references/{agent-anti-patterns.md → archive/agent-anti-patterns.md} +0 -0
  65. /package/plugins/pbr/references/{checkpoints.md → archive/checkpoints.md} +0 -0
  66. /package/plugins/pbr/references/{context-quality-tiers.md → archive/context-quality-tiers.md} +0 -0
  67. /package/plugins/pbr/references/{pbr-rules.md → archive/pbr-rules.md} +0 -0
  68. /package/plugins/pbr/references/{verification-patterns.md → archive/verification-patterns.md} +0 -0
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: setup
3
- description: "Onboarding wizard. Initialize project, select models, verify setup."
3
+ description: "Reconfigure an existing Plan-Build-Run project (models, features, CLAUDE.md)."
4
4
  ---
5
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. Using the Read tool on this SKILL.md file wastes ~7,600 tokens. Begin executing Step 1 immediately.**
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. Using the Read tool on this SKILL.md file wastes tokens. Begin executing Step 1 immediately.**
7
7
 
8
8
  ## Step 0 — Immediate Output
9
9
 
@@ -11,198 +11,54 @@ description: "Onboarding wizard. Initialize project, select models, verify setup
11
11
 
12
12
  ```
13
13
  ╔══════════════════════════════════════════════════════════════╗
14
- ║ PLAN-BUILD-RUN ► SETUP
14
+ ║ PLAN-BUILD-RUN ► RECONFIGURE
15
15
  ╚══════════════════════════════════════════════════════════════╝
16
16
  ```
17
17
 
18
18
  Then proceed to Step 1.
19
19
 
20
- # /pbr:setup — Plan-Build-Run Setup Wizard
20
+ # /pbr:setup — Plan-Build-Run Reconfigure
21
21
 
22
- You are running the **setup** skill. This is an interactive onboarding wizard that guides users through Plan-Build-Run project setup. Use AskUserQuestion at each step for clear choices.
22
+ You are running the **setup** skill in **reconfigure mode**. This wizard lets existing Plan-Build-Run projects change model profiles, workflow features, and CLAUDE.md integration. It does NOT re-initialize or overwrite project state.
23
23
 
24
24
  ---
25
25
 
26
- ## Step 1: Detect Project State — Idempotency Guard
26
+ ## Step 1: Detect Project State
27
27
 
28
- Check if `.planning/` directory exists in the current working directory.
28
+ Check if `.planning/config.json` exists.
29
29
 
30
- **If `.planning/` exists**:
31
- - Check for existing core files: `STATE.md`, `ROADMAP.md`, `config.json`
32
- - If ANY of these exist, present a checkpoint:
33
-
34
- Use AskUserQuestion:
35
- question: "Existing project detected with {list of found files}. How should we proceed?"
36
- header: "Setup"
37
- options:
38
- - label: "Resume" description: "Keep existing .planning/ and review configuration (recommended)"
39
- - label: "Reset" description: "Archive current .planning/ to .planning.bak/ and start fresh"
40
- - label: "Abort" description: "Cancel setup — keep everything as-is"
41
-
42
- - If "Resume": Tell the user: "Keeping existing project. Reviewing configuration." Skip to Step 3 (model selection)
43
- - If "Reset": Run `mv .planning .planning.bak` (creating a backup), then proceed with fresh setup below
44
- - If "Abort": Display "Setup cancelled. Run `/pbr:status` to see current project state." and stop
45
-
46
- - If `.planning/` exists but has NONE of the core files (empty or only has subdirs):
47
- - Tell the user: "Found empty .planning/ directory. Proceeding with initialization."
48
- - Continue to fresh setup below
49
-
50
- **If `.planning/` does NOT exist**:
51
- - Ask the user:
52
-
53
- ```
54
- AskUserQuestion:
55
- question: "No Plan-Build-Run project found. Would you like to initialize one?"
56
- header: "Initialize"
57
- options:
58
- - label: "Yes, initialize here"
59
- description: "Creates .planning/ directory with default config, STATE.md, and ROADMAP.md"
60
- - label: "No, just exploring"
61
- description: "Exit the wizard — you can run /pbr:begin later for full project setup"
62
- ```
63
-
64
- If "No", display: "Run `/pbr:begin` when you're ready to start a project. It includes deep requirements gathering and roadmap creation." Then stop.
65
-
66
- If "Yes", create the minimal `.planning/` structure:
67
-
68
- **CRITICAL: Create .planning/ directory structure NOW. Do NOT skip this step.**
69
-
70
- ```bash
71
- mkdir -p .planning/phases .planning/todos/pending .planning/todos/done .planning/logs .planning/research
72
- ```
73
-
74
- **CRITICAL: Write .planning/config.json NOW. Do NOT skip this step.**
75
-
76
- Before writing config.json, check for user-level defaults:
77
-
78
- ```bash
79
- node "${PLUGIN_ROOT}/scripts/pbr-tools.js" config load-defaults
80
- ```
81
-
82
- If user defaults exist (the output has keys like `mode`, `features`, etc.), inform the user: "Found your saved preferences from ~/.claude/pbr-defaults.json. These will be merged into your project config (project-specific settings take precedence)." Then deep-merge user defaults into the config below before writing.
83
-
84
- Create `.planning/config.json` with defaults (merged with user defaults if they exist):
85
- ```json
86
- {
87
- "version": 2,
88
- "context_strategy": "aggressive",
89
- "mode": "interactive",
90
- "depth": "standard",
91
- "features": {
92
- "structured_planning": true,
93
- "goal_verification": true,
94
- "integration_verification": true,
95
- "context_isolation": true,
96
- "atomic_commits": true,
97
- "session_persistence": true,
98
- "research_phase": true,
99
- "plan_checking": true,
100
- "tdd_mode": false,
101
- "status_line": true,
102
- "auto_continue": false,
103
- "auto_advance": false,
104
- "team_discussions": false,
105
- "inline_verify": false
106
- },
107
- "models": {
108
- "researcher": "sonnet",
109
- "planner": "inherit",
110
- "executor": "inherit",
111
- "verifier": "sonnet",
112
- "integration_checker": "sonnet",
113
- "debugger": "inherit",
114
- "mapper": "sonnet",
115
- "synthesizer": "sonnet"
116
- },
117
- "parallelization": {
118
- "enabled": true,
119
- "plan_level": true,
120
- "task_level": false,
121
- "max_concurrent_agents": 3,
122
- "min_plans_for_parallel": 2,
123
- "use_teams": false
124
- },
125
- "planning": {
126
- "commit_docs": true,
127
- "max_tasks_per_plan": 3,
128
- "search_gitignored": false
129
- },
130
- "git": {
131
- "branching": "none",
132
- "commit_format": "{type}({phase}-{plan}): {description}",
133
- "phase_branch_template": "plan-build-run/phase-{phase}-{slug}",
134
- "milestone_branch_template": "plan-build-run/{milestone}-{slug}",
135
- "mode": "enabled"
136
- },
137
- "gates": {
138
- "confirm_project": true,
139
- "confirm_roadmap": true,
140
- "confirm_plan": true,
141
- "confirm_execute": false,
142
- "confirm_transition": true,
143
- "issues_review": true
144
- },
145
- "safety": {
146
- "always_confirm_destructive": true,
147
- "always_confirm_external_services": true
148
- }
149
- }
150
- ```
151
-
152
- **CRITICAL: Write .planning/STATE.md NOW. Do NOT skip this step.**
153
-
154
- Create `.planning/STATE.md`:
155
- ```markdown
156
- ---
157
- version: 2
158
- current_phase: 0
159
- total_phases: 0
160
- status: "initialized"
161
- progress_percent: 0
162
- last_activity: "{today's date}"
163
- last_command: "/pbr:setup"
164
- blockers: []
165
- ---
166
- # Project State
167
-
168
- ## Current Position
169
- Phase: 0 of 0
170
- Status: initialized
171
-
172
- Plan-Build-Run project initialized via /pbr:setup. Run /pbr:begin to start requirements gathering and roadmap creation.
30
+ **If `.planning/config.json` does NOT exist:**
31
+ Display:
173
32
  ```
33
+ No Plan-Build-Run project found in this directory.
174
34
 
175
- ---
176
-
177
- ## Step 2: Project Type (new projects only)
35
+ /pbr:setup is for reconfiguring existing projects.
36
+ To start a new project, run: /pbr:begin
178
37
 
38
+ /pbr:begin includes everything /pbr:setup used to do, plus deep requirements gathering and roadmap creation.
179
39
  ```
180
- AskUserQuestion:
181
- question: "What kind of project is this?"
182
- header: "Project type"
183
- options:
184
- - label: "Greenfield"
185
- description: "Starting from scratch — full planning cycle recommended"
186
- - label: "Existing codebase"
187
- description: "Adding Plan-Build-Run to an existing project — run /pbr:scan first"
188
- - label: "Prototype/experiment"
189
- description: "Quick iteration — lighter workflow with fewer gates"
190
- ```
191
-
192
- Based on selection:
193
- - **Greenfield**: Keep defaults (full gates, structured planning)
194
- - **Existing codebase**: Suggest running `/pbr:scan` after setup to map the codebase
195
- - **Prototype**: Set `depth: "quick"`, disable `gates.verification`, disable `gates.review`, set `features.research_phase: false`
40
+ Stop. Do not proceed further.
196
41
 
197
- Update config.json with any changes.
42
+ **If `.planning/config.json` exists:**
43
+ - Read `.planning/config.json`
44
+ - Display the current settings summary:
45
+ ```
46
+ Current configuration:
47
+ - Model profile: {derived from models block — balanced/quality/budget or custom}
48
+ - Depth: {depth}
49
+ - Mode: {mode}
50
+ - Auto-continue: {features.auto_continue}
51
+ - TDD mode: {features.tdd_mode}
52
+ - Git branching: {git.branching}
53
+ ```
54
+ - Proceed to Step 2.
198
55
 
199
56
  ---
200
57
 
201
- ## Step 3: Model Selection
58
+ ## Step 2: Model Selection
202
59
 
203
- ```
204
- AskUserQuestion:
205
- question: "Which model profile should Plan-Build-Run use for agents?"
60
+ Use AskUserQuestion:
61
+ question: "Which model profile should agents use?"
206
62
  header: "Models"
207
63
  options:
208
64
  - label: "Balanced (Recommended)"
@@ -211,19 +67,20 @@ AskUserQuestion:
211
67
  description: "Opus for executor and planner, Sonnet for others. Best results, highest cost."
212
68
  - label: "Budget"
213
69
  description: "Haiku for most agents. Fastest and cheapest, but lower quality."
214
- ```
70
+ - label: "Keep current"
71
+ description: "Leave model settings unchanged."
215
72
 
216
- Apply the selected profile to `config.json`:
73
+ Apply the selected profile to the models block in config.json:
217
74
  - **Balanced**: executor=sonnet, researcher=sonnet, planner=sonnet, verifier=sonnet, synthesizer=haiku
218
75
  - **Quality**: executor=opus, researcher=sonnet, planner=opus, verifier=sonnet, synthesizer=sonnet
219
76
  - **Budget**: executor=haiku, researcher=haiku, planner=sonnet, verifier=haiku, synthesizer=haiku
77
+ - **Keep current**: no change to models block
220
78
 
221
79
  ---
222
80
 
223
- ## Step 4: Workflow Preferences
81
+ ## Step 3: Workflow Features
224
82
 
225
- ```
226
- AskUserQuestion:
83
+ Use AskUserQuestion:
227
84
  question: "Which workflow features do you want enabled?"
228
85
  header: "Features"
229
86
  multiSelect: true
@@ -236,9 +93,8 @@ AskUserQuestion:
236
93
  description: "Require verification AND review to pass before advancing phases"
237
94
  - label: "Git branching"
238
95
  description: "Create a branch per phase for cleaner PR history"
239
- ```
240
96
 
241
- Apply selections:
97
+ Apply selections (others unchanged):
242
98
  - **Auto-continue**: Set `features.auto_continue: true`
243
99
  - **TDD mode**: Set `features.tdd_mode: true`
244
100
  - **Strict gates**: Set `gates.verification: true`, `gates.review: true`, `gates.plan_approval: true`
@@ -246,15 +102,23 @@ Apply selections:
246
102
 
247
103
  ---
248
104
 
249
- ## Step 4b: CLAUDE.md Integration
105
+ ## Step 4: CLAUDE.md Integration
250
106
 
251
107
  Check if a `CLAUDE.md` file exists in the project root.
252
108
 
253
- **If it exists**: Read it. If it does NOT already contain a "Plan-Build-Run" section, append the block below.
254
- **If it does NOT exist**: Create `CLAUDE.md` with the block below.
109
+ **If it exists**: Read it. If it does NOT already contain a "Plan-Build-Run" section, offer to append the integration block.
110
+ **If it does NOT exist**: Offer to create `CLAUDE.md` with the integration block.
255
111
 
256
- Append/create this content:
112
+ Use AskUserQuestion:
113
+ question: "Update CLAUDE.md with Plan-Build-Run integration notes?"
114
+ header: "CLAUDE.md"
115
+ options:
116
+ - label: "Yes"
117
+ description: "Add or update the Plan-Build-Run section in CLAUDE.md"
118
+ - label: "No"
119
+ description: "Skip — leave CLAUDE.md as-is"
257
120
 
121
+ If "Yes", append/create:
258
122
  ```markdown
259
123
  ## Plan-Build-Run
260
124
 
@@ -269,49 +133,37 @@ This project uses [Plan-Build-Run](https://github.com/SienkLogic/plan-build-run)
269
133
 
270
134
  ---
271
135
 
272
- ## Step 5: Verification
136
+ ## Step 5: Write Updated Config
273
137
 
274
- **CRITICAL: Run validation checks NOW to confirm setup succeeded. Do NOT skip this step.**
138
+ **CRITICAL: Write `.planning/config.json` NOW with all changes from Steps 2-3. Do NOT skip this step.**
275
139
 
276
- Run a quick health check:
140
+ Write the updated config.json to disk with all applied changes.
277
141
 
278
- 1. Verify `.planning/config.json` is valid JSON
279
- 2. Verify `.planning/STATE.md` exists and is parseable
280
- 3. Verify hook scripts are accessible: `node ${PLUGIN_ROOT}/scripts/progress-tracker.js` from the project directory
281
- 4. Check that `npm test` works (if package.json exists)
142
+ ---
282
143
 
283
- Display results:
144
+ ## Step 6: Verification
284
145
 
285
- ```
286
- ╔══════════════════════════════════════════════════════════════╗
287
- ║ PLAN-BUILD-RUN SETUP COMPLETE ✓ ║
288
- ╚══════════════════════════════════════════════════════════════╝
289
-
290
- Project: {cwd basename}
291
- Model profile: {balanced/quality/budget}
292
- Depth: {quick/standard/comprehensive}
293
- Features: {list of enabled non-default features}
146
+ Run a quick check:
147
+ 1. Verify `.planning/config.json` is valid JSON (read it back)
148
+ 2. Display updated settings summary
294
149
 
150
+ Display:
151
+ ```
295
152
  ╔══════════════════════════════════════════════════════════════╗
296
- NEXT UP
153
+ PLAN-BUILD-RUN RECONFIGURE COMPLETE ✓
297
154
  ╚══════════════════════════════════════════════════════════════╝
298
155
 
299
- **Start your project** — define requirements and create a roadmap
300
-
301
- `/pbr:begin`
302
-
303
- <sub>`/clear` first → fresh context window</sub>
156
+ Updated:
157
+ - Model profile: {new profile}
158
+ - Features changed: {list or "none"}
159
+ - CLAUDE.md: {updated/skipped}
304
160
 
305
- **Also available:**
306
- - `/pbr:scan` — analyze existing codebase (if adding to existing project)
307
- - `/pbr:config` — fine-tune individual settings
308
- - `/pbr:help` — command reference
161
+ Run /pbr:status to see current project state.
309
162
  ```
310
163
 
311
164
  ---
312
165
 
313
166
  ## Error Handling
314
167
 
315
- - If `.planning/` creation fails (permissions): Tell user to create it manually and retry
168
+ - If config.json parse fails: Display the raw content and ask user to fix it manually, then retry
316
169
  - If config.json write fails: Display the JSON content and ask user to save it manually
317
- - If health check fails: Display specific failure and suggest `/pbr:health` for diagnostics
@@ -48,3 +48,30 @@ Additionally for this skill:
48
48
  - {Skill-specific rule 1}
49
49
  - {Skill-specific rule 2}
50
50
  ```
51
+
52
+ ## Agent Elapsed Time Estimates
53
+
54
+ When displaying agent spawn lines (e.g., "Spawning researcher..."), append a parenthetical estimate:
55
+
56
+ | Agent Type | Display Text | Estimate |
57
+ |------------|-------------|----------|
58
+ | researcher | Spawning researcher... | (est. 1-3 min) |
59
+ | planner | Spawning planner... | (est. 2-5 min) |
60
+ | executor | Spawning executor... | (est. 3-8 min) |
61
+ | verifier | Spawning verifier... | (est. 1-2 min) |
62
+ | codebase-mapper | Spawning codebase-mapper... | (est. 1-2 min) |
63
+ | plan-checker | Spawning plan-checker... | (est. 1-2 min) |
64
+ | integration-checker | Spawning integration-checker... | (est. 2-4 min) |
65
+ | debugger | Spawning debugger... | (est. 2-5 min) |
66
+ | general | Spawning agent... | (est. 1-4 min) |
67
+ | audit | Spawning audit... | (est. 2-4 min) |
68
+
69
+ **Usage**: In any skill that spawns Task() agents, prefix spawn displays with the agent name and append the estimate from this table. Example:
70
+
71
+ ```
72
+ Spawning researcher... (est. 1-3 min)
73
+ Spawning planner... (est. 2-5 min)
74
+ [Wave 1: 3 plans in parallel] Spawning executors... (est. 3-8 min each)
75
+ ```
76
+
77
+ Skills that spawn agents: build, plan, review, debug, scan, milestone, quick.
@@ -97,6 +97,20 @@ node ${PLUGIN_ROOT}/scripts/pbr-tools.js llm metrics --session <content-of-.sess
97
97
 
98
98
  If `local_llm.enabled` is `false` or commands fail, skip this step silently.
99
99
 
100
+ ### Step 1c: Read Context Budget (advisory — skip on any error)
101
+
102
+ Run:
103
+ ```bash
104
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js context-triage
105
+ ```
106
+
107
+ Parse the JSON response. Capture:
108
+ - `tier` — one of PEAK / GOOD / DEGRADING / POOR / CRITICAL
109
+ - `percentage` — numeric 0-100 (or null if unavailable)
110
+ - `recommendation` — PROCEED / CHECKPOINT / COMPACT
111
+
112
+ Store these for use in Step 4 display and Step 5 routing.
113
+
100
114
  ### Step 2: Scan Phase Directories
101
115
 
102
116
  For each phase listed in ROADMAP.md:
@@ -170,6 +184,18 @@ If any discrepancy found, add: `Run /pbr:resume to auto-reconcile STATE.md.`
170
184
  - Check `.planning/todos/pending/` for pending todo files
171
185
  - Count and summarize if any exist
172
186
 
187
+ #### Critical Path
188
+ Identify the single next-blocking item — the one phase or plan whose completion unblocks the most downstream work.
189
+
190
+ Logic:
191
+ 1. From ROADMAP.md dependency graph, find all phases that are NOT yet verified.
192
+ 2. For each unverified phase, count how many other unverified phases list it in `depends_on` (direct + transitive).
193
+ 3. The phase with the highest downstream dependent count is the critical-path phase.
194
+ 4. If all unverified phases are independent (no dependencies between them), the critical path is the current phase from STATE.md.
195
+ 5. Within the critical-path phase, the critical-path plan is the lowest-numbered plan without a SUMMARY.md.
196
+
197
+ Store: `criticalPhase` (number + name), `criticalPlan` (plan ID or null if phase not yet planned), `criticalCount` (number of downstream phases blocked).
198
+
173
199
  #### Quick Notes
174
200
  - Check `.planning/notes/` directory for note files (individual `.md` files)
175
201
  - Count active notes (files where frontmatter does NOT contain `promoted: true`)
@@ -195,6 +221,19 @@ Phase Status:
195
221
  | 2. {name} | {status indicator} {status text} | {completed}/{total} | {percentage}% |
196
222
  | ...
197
223
 
224
+ {If context tier is DEGRADING, POOR, or CRITICAL:}
225
+ ⚠ Context: {percentage}% used ({tier}) — {recommendation_text}
226
+ Run `/compact` to reclaim context before spawning more agents.
227
+
228
+ Where `{recommendation_text}` maps:
229
+ - DEGRADING → "quality may degrade on complex agents"
230
+ - POOR → "context window is filling up"
231
+ - CRITICAL → "STOP — compact before continuing"
232
+
233
+ {If criticalPhase is identified AND criticalCount >= 1 AND there are 2+ unverified phases with dependencies:}
234
+ Critical Path: Phase {N} — {phase name}{, Plan {criticalPlan} is next} [BLOCKING {criticalCount} downstream phase(s)]
235
+ {Else: omit — not meaningful when only one phase remains or no inter-phase dependencies exist}
236
+
198
237
  {If blockers exist:}
199
238
  Blockers:
200
239
  - {blocker 1}
@@ -312,7 +351,10 @@ Based on the project state, suggest the single most logical next action:
312
351
 
313
352
  `{suggested command}`
314
353
 
315
- <sub>`/clear` first fresh context window</sub>
354
+ {If context percentage > 40% OR tier is DEGRADING/POOR/CRITICAL:}
355
+ <sub>`/clear` first → fresh context window ({percentage}% used)</sub>
356
+ {Else: omit the /clear hint entirely}
357
+ {If `percentage` is null (no context data): omit the hint}
316
358
 
317
359
 
318
360
  ```
@@ -389,7 +431,7 @@ This skill should be fast. It's a status check, not an analysis.
389
431
 
390
432
  - Read full SUMMARY.md contents (frontmatter is enough)
391
433
  - Read plan file contents (just check existence)
392
- - Run Bash commands except for Step 1b (2-3 `pbr-tools` calls only when `local_llm.enabled: true`, skipped entirely otherwise)
434
+ - Run Bash commands except for Step 1b (`pbr-tools llm` calls only when `local_llm.enabled: true`) and Step 1c (`pbr-tools context-triage`, always run but skip on error)
393
435
  - Modify any files
394
436
  - Spawn any Task agents
395
437
 
@@ -0,0 +1,172 @@
1
+ ---
2
+ name: undo
3
+ description: "Revert recent PBR-generated commits by phase/plan, safely using git revert."
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
+ ## Step 0 — Immediate Output
9
+
10
+ **Before ANY tool calls**, display this banner:
11
+
12
+ ```
13
+ ╔══════════════════════════════════════════════════════════════╗
14
+ ║ PLAN-BUILD-RUN ► UNDO ║
15
+ ╚══════════════════════════════════════════════════════════════╝
16
+ ```
17
+
18
+ Then proceed to Step 1.
19
+
20
+ # /pbr:undo — Safe Commit Reversal
21
+
22
+ You are running the **undo** skill. Your job is to help the user safely revert recent PBR-generated commits using `git revert` (history-preserving), not `git reset` (destructive).
23
+
24
+ This skill runs **inline** (no Task delegation).
25
+
26
+ ---
27
+
28
+ ## Step 1 — Gather PBR Commits
29
+
30
+ Run:
31
+
32
+ ```bash
33
+ git log --oneline --no-merges -50
34
+ ```
35
+
36
+ Filter lines matching the PBR commit pattern:
37
+ `^[0-9a-f]+ (feat|fix|refactor|test|docs|chore|wip|revert)(\([a-zA-Z0-9._-]+\))?:`
38
+
39
+ If no PBR commits found, display:
40
+
41
+ ```
42
+ No PBR commits found in the last 50 commits.
43
+ ```
44
+
45
+ Then exit.
46
+
47
+ **Parse $ARGUMENTS for flags**:
48
+ - `--last N`: limit to N most recent PBR commits (default 20)
49
+ - `--phase NN`: filter to commits for a specific phase number (e.g. `--phase 55`)
50
+ - `--plan NN-MM`: filter to commits for a specific plan (e.g. `--plan 55-02`)
51
+ - `--range HASH..HASH`: preselect a hash range for revert — if provided, skip to Step 5 with that range pre-filled
52
+
53
+ Apply filters to the collected PBR commits before proceeding.
54
+
55
+ ---
56
+
57
+ ## Step 2 — Group Commits by Scope
58
+
59
+ Parse the scope from each commit message (e.g., `55-02`, `quick-003`, `planning`). If no scope is present, use `(no scope)`.
60
+
61
+ Present grouped output:
62
+
63
+ ```
64
+ Recent PBR commits (grouped by scope):
65
+
66
+ [55-02] Phase 55, Plan 02
67
+ abc1234 feat(55-02): add undo skill
68
+ def5678 chore(55-02): register undo command
69
+
70
+ [quick-003]
71
+ ghi9012 fix(quick-003): fix hook path resolution
72
+
73
+ [planning]
74
+ jkl3456 docs(planning): update roadmap phase 55
75
+ ```
76
+
77
+ For phase-plan scopes (NN-MM pattern), add a "Phase NN, Plan MM" annotation. For other scopes, show just the scope label.
78
+
79
+ ---
80
+
81
+ ## Step 3 — Prompt for Selection
82
+
83
+ Use AskUserQuestion with the **select-action** pattern:
84
+
85
+ - **question**: "Which commit(s) do you want to undo? Select a scope to revert all commits in that scope, or choose a custom option."
86
+ - **header**: "Select commits to undo"
87
+ - **options**: (dynamic — top 8 scope labels from grouped list, each formatted as `[{scope}] {N} commit(s)`, plus "Enter custom hash or range" and "Cancel")
88
+ - **multiSelect**: false
89
+
90
+ If user selects a scope label: collect all commits with that scope as the revert set.
91
+ If user selects "Enter custom hash or range": use AskUserQuestion (freeform) to ask:
92
+ - "Enter a commit hash or range (e.g. abc1234 or abc..def):"
93
+ - Parse the response as a hash or HASH1..HASH2 range
94
+ If user selects "Cancel": print "Undo cancelled." and exit.
95
+
96
+ ---
97
+
98
+ ## Step 4 — Confirm Selection
99
+
100
+ Display the commits that will be reverted:
101
+
102
+ ```
103
+ The following commits will be reverted (using git revert, NOT git reset):
104
+
105
+ abc1234 feat(55-02): add undo skill
106
+ def5678 chore(55-02): register undo command
107
+
108
+ This creates new revert commits — your history is preserved.
109
+ ```
110
+
111
+ Use AskUserQuestion with the **yes-no** pattern:
112
+ - **question**: "Proceed with reverting these commits?"
113
+ - **options**: ["Proceed with revert", "Cancel"]
114
+
115
+ If user selects "Cancel": print "Undo cancelled." and exit.
116
+
117
+ ---
118
+
119
+ ## Step 5 — Execute git revert
120
+
121
+ For each commit hash in **reverse chronological order** (newest first):
122
+
123
+ ```bash
124
+ git revert --no-commit {hash}
125
+ ```
126
+
127
+ After all reverts are staged, determine the commit message:
128
+ - Extract scope from the first commit being reverted (e.g., `55-02`)
129
+ - If reverting a **single commit**: `revert({scope}): undo {original description}`
130
+ - If reverting **multiple commits**: `revert({scope}): undo {N} commits from {scope}`
131
+
132
+ Commit with:
133
+
134
+ ```bash
135
+ git commit -m "revert({scope}): undo {description}"
136
+ ```
137
+
138
+ **Conflict handling**: If `git revert --no-commit` exits non-zero or produces conflict markers:
139
+ 1. Run `git revert --abort` to clean up
140
+ 2. Display:
141
+ ```
142
+ Revert failed due to merge conflicts. Manual resolution required.
143
+ Run: git revert {hashes} and resolve conflicts.
144
+ ```
145
+ 3. Exit without committing.
146
+
147
+ ---
148
+
149
+ ## Step 6 — Report Result
150
+
151
+ Display completion banner:
152
+
153
+ ```
154
+ ╔══════════════════════════════════════════════════════════════╗
155
+ ║ PLAN-BUILD-RUN ► UNDO COMPLETE ║
156
+ ╚══════════════════════════════════════════════════════════════╝
157
+
158
+ Reverted: {N} commit(s) from scope {scope}
159
+ New revert commit: {hash} — revert({scope}): undo {description}
160
+
161
+ /pbr:status — check current state
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Anti-Patterns
167
+
168
+ 1. **DO NOT** use `git reset` — always use `git revert` to preserve history
169
+ 2. **DO NOT** revert commits from other users without confirmation
170
+ 3. **DO NOT** revert merge commits without warning the user about potential complexity
171
+ 4. **DO NOT** skip the confirmation step (Step 4)
172
+ 5. **DO NOT** commit if `git revert` reports conflicts — abort and report instead
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pbr",
3
3
  "displayName": "Plan-Build-Run",
4
- "version": "2.52.0",
4
+ "version": "2.54.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",
@@ -134,8 +134,6 @@ Only append to the LAST commit of the plan — intermediate commits (RED/GREEN i
134
134
 
135
135
  ## Deviation Rules
136
136
 
137
- Reference: `references/deviation-rules.md` for examples and decision tree.
138
-
139
137
  | Rule | Trigger | Action | Approval |
140
138
  |------|---------|--------|----------|
141
139
  | 1 — Bug | Code bug (typo, wrong import, syntax) | Auto-fix in same commit. 3 attempts max. | No |
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Interactive onboarding wizard for new Plan-Build-Run projects."
2
+ description: "Reconfigure an existing Plan-Build-Run project (models, features, CLAUDE.md). For new projects, use /pbr:begin."
3
3
  ---
4
4
 
5
5
  This command is provided by the `pbr:setup` skill.