@sienklogic/plan-build-run 2.9.1 → 2.11.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 +44 -0
  2. package/package.json +1 -1
  3. package/plugins/copilot-pbr/agents/codebase-mapper.agent.md +42 -0
  4. package/plugins/copilot-pbr/agents/debugger.agent.md +4 -1
  5. package/plugins/copilot-pbr/agents/executor.agent.md +31 -1
  6. package/plugins/copilot-pbr/agents/integration-checker.agent.md +33 -2
  7. package/plugins/copilot-pbr/agents/planner.agent.md +58 -1
  8. package/plugins/copilot-pbr/agents/researcher.agent.md +23 -0
  9. package/plugins/copilot-pbr/agents/synthesizer.agent.md +24 -0
  10. package/plugins/copilot-pbr/agents/verifier.agent.md +35 -1
  11. package/plugins/copilot-pbr/plugin.json +1 -1
  12. package/plugins/copilot-pbr/references/agent-contracts.md +297 -0
  13. package/plugins/copilot-pbr/references/pbr-rules.md +1 -0
  14. package/plugins/copilot-pbr/references/pbr-tools-cli.md +285 -0
  15. package/plugins/copilot-pbr/references/ui-formatting.md +38 -56
  16. package/plugins/copilot-pbr/skills/begin/SKILL.md +30 -7
  17. package/plugins/copilot-pbr/skills/build/SKILL.md +28 -31
  18. package/plugins/copilot-pbr/skills/config/SKILL.md +9 -12
  19. package/plugins/copilot-pbr/skills/continue/SKILL.md +6 -6
  20. package/plugins/copilot-pbr/skills/dashboard/SKILL.md +12 -0
  21. package/plugins/copilot-pbr/skills/debug/SKILL.md +23 -26
  22. package/plugins/copilot-pbr/skills/discuss/SKILL.md +20 -10
  23. package/plugins/copilot-pbr/skills/do/SKILL.md +3 -3
  24. package/plugins/copilot-pbr/skills/explore/SKILL.md +11 -14
  25. package/plugins/copilot-pbr/skills/health/SKILL.md +75 -19
  26. package/plugins/copilot-pbr/skills/help/SKILL.md +6 -6
  27. package/plugins/copilot-pbr/skills/import/SKILL.md +22 -18
  28. package/plugins/copilot-pbr/skills/milestone/SKILL.md +90 -48
  29. package/plugins/copilot-pbr/skills/note/SKILL.md +3 -3
  30. package/plugins/copilot-pbr/skills/pause/SKILL.md +11 -10
  31. package/plugins/copilot-pbr/skills/plan/SKILL.md +22 -9
  32. package/plugins/copilot-pbr/skills/plan/templates/planner-prompt.md.tmpl +1 -1
  33. package/plugins/copilot-pbr/skills/quick/SKILL.md +9 -12
  34. package/plugins/copilot-pbr/skills/resume/SKILL.md +9 -9
  35. package/plugins/copilot-pbr/skills/review/SKILL.md +17 -12
  36. package/plugins/copilot-pbr/skills/scan/SKILL.md +9 -11
  37. package/plugins/copilot-pbr/skills/setup/SKILL.md +54 -8
  38. package/plugins/copilot-pbr/skills/shared/error-reporting.md +2 -1
  39. package/plugins/copilot-pbr/skills/shared/progress-display.md +0 -1
  40. package/plugins/copilot-pbr/skills/shared/universal-anti-patterns.md +10 -6
  41. package/plugins/copilot-pbr/skills/status/SKILL.md +3 -3
  42. package/plugins/copilot-pbr/skills/statusline/SKILL.md +12 -8
  43. package/plugins/copilot-pbr/skills/todo/SKILL.md +51 -28
  44. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  45. package/plugins/cursor-pbr/agents/codebase-mapper.md +42 -0
  46. package/plugins/cursor-pbr/agents/debugger.md +4 -1
  47. package/plugins/cursor-pbr/agents/executor.md +31 -1
  48. package/plugins/cursor-pbr/agents/integration-checker.md +33 -2
  49. package/plugins/cursor-pbr/agents/planner.md +58 -1
  50. package/plugins/cursor-pbr/agents/researcher.md +23 -0
  51. package/plugins/cursor-pbr/agents/synthesizer.md +24 -0
  52. package/plugins/cursor-pbr/agents/verifier.md +35 -1
  53. package/plugins/cursor-pbr/references/agent-contracts.md +297 -0
  54. package/plugins/cursor-pbr/references/pbr-rules.md +1 -0
  55. package/plugins/cursor-pbr/references/pbr-tools-cli.md +285 -0
  56. package/plugins/cursor-pbr/references/ui-formatting.md +38 -56
  57. package/plugins/cursor-pbr/skills/begin/SKILL.md +30 -7
  58. package/plugins/cursor-pbr/skills/build/SKILL.md +28 -31
  59. package/plugins/cursor-pbr/skills/config/SKILL.md +9 -10
  60. package/plugins/cursor-pbr/skills/continue/SKILL.md +6 -6
  61. package/plugins/cursor-pbr/skills/dashboard/SKILL.md +12 -0
  62. package/plugins/cursor-pbr/skills/debug/SKILL.md +23 -23
  63. package/plugins/cursor-pbr/skills/discuss/SKILL.md +20 -10
  64. package/plugins/cursor-pbr/skills/do/SKILL.md +3 -3
  65. package/plugins/cursor-pbr/skills/explore/SKILL.md +11 -12
  66. package/plugins/cursor-pbr/skills/health/SKILL.md +75 -19
  67. package/plugins/cursor-pbr/skills/help/SKILL.md +6 -6
  68. package/plugins/cursor-pbr/skills/import/SKILL.md +22 -16
  69. package/plugins/cursor-pbr/skills/milestone/SKILL.md +90 -48
  70. package/plugins/cursor-pbr/skills/note/SKILL.md +3 -3
  71. package/plugins/cursor-pbr/skills/pause/SKILL.md +11 -9
  72. package/plugins/cursor-pbr/skills/plan/SKILL.md +22 -9
  73. package/plugins/cursor-pbr/skills/plan/templates/planner-prompt.md.tmpl +1 -1
  74. package/plugins/cursor-pbr/skills/quick/SKILL.md +9 -12
  75. package/plugins/cursor-pbr/skills/resume/SKILL.md +9 -9
  76. package/plugins/cursor-pbr/skills/review/SKILL.md +17 -12
  77. package/plugins/cursor-pbr/skills/scan/SKILL.md +9 -10
  78. package/plugins/cursor-pbr/skills/setup/SKILL.md +54 -8
  79. package/plugins/cursor-pbr/skills/shared/error-reporting.md +2 -1
  80. package/plugins/cursor-pbr/skills/shared/progress-display.md +0 -1
  81. package/plugins/cursor-pbr/skills/shared/universal-anti-patterns.md +10 -6
  82. package/plugins/cursor-pbr/skills/status/SKILL.md +3 -3
  83. package/plugins/cursor-pbr/skills/statusline/SKILL.md +12 -8
  84. package/plugins/cursor-pbr/skills/todo/SKILL.md +51 -28
  85. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
  86. package/plugins/pbr/agents/codebase-mapper.md +42 -0
  87. package/plugins/pbr/agents/debugger.md +4 -1
  88. package/plugins/pbr/agents/executor.md +31 -1
  89. package/plugins/pbr/agents/integration-checker.md +34 -2
  90. package/plugins/pbr/agents/planner.md +58 -1
  91. package/plugins/pbr/agents/researcher.md +23 -0
  92. package/plugins/pbr/agents/synthesizer.md +24 -0
  93. package/plugins/pbr/agents/verifier.md +36 -1
  94. package/plugins/pbr/references/agent-contracts.md +297 -0
  95. package/plugins/pbr/references/pbr-rules.md +1 -0
  96. package/plugins/pbr/references/pbr-tools-cli.md +285 -0
  97. package/plugins/pbr/references/ui-formatting.md +37 -54
  98. package/plugins/pbr/scripts/check-skill-workflow.js +11 -0
  99. package/plugins/pbr/scripts/check-state-sync.js +58 -0
  100. package/plugins/pbr/scripts/check-subagent-output.js +43 -4
  101. package/plugins/pbr/scripts/validate-task.js +69 -17
  102. package/plugins/pbr/skills/begin/SKILL.md +36 -11
  103. package/plugins/pbr/skills/build/SKILL.md +37 -25
  104. package/plugins/pbr/skills/config/SKILL.md +12 -10
  105. package/plugins/pbr/skills/continue/SKILL.md +11 -9
  106. package/plugins/pbr/skills/dashboard/SKILL.md +12 -0
  107. package/plugins/pbr/skills/debug/SKILL.md +29 -23
  108. package/plugins/pbr/skills/discuss/SKILL.md +20 -10
  109. package/plugins/pbr/skills/do/SKILL.md +3 -3
  110. package/plugins/pbr/skills/explore/SKILL.md +14 -12
  111. package/plugins/pbr/skills/health/SKILL.md +76 -20
  112. package/plugins/pbr/skills/help/SKILL.md +8 -6
  113. package/plugins/pbr/skills/import/SKILL.md +25 -16
  114. package/plugins/pbr/skills/milestone/SKILL.md +88 -45
  115. package/plugins/pbr/skills/note/SKILL.md +3 -3
  116. package/plugins/pbr/skills/pause/SKILL.md +13 -9
  117. package/plugins/pbr/skills/plan/SKILL.md +28 -13
  118. package/plugins/pbr/skills/plan/templates/planner-prompt.md.tmpl +1 -1
  119. package/plugins/pbr/skills/quick/SKILL.md +12 -10
  120. package/plugins/pbr/skills/resume/SKILL.md +11 -9
  121. package/plugins/pbr/skills/review/SKILL.md +35 -24
  122. package/plugins/pbr/skills/scan/SKILL.md +12 -10
  123. package/plugins/pbr/skills/setup/SKILL.md +53 -7
  124. package/plugins/pbr/skills/shared/error-reporting.md +2 -0
  125. package/plugins/pbr/skills/shared/universal-anti-patterns.md +10 -6
  126. package/plugins/pbr/skills/status/SKILL.md +8 -6
  127. package/plugins/pbr/skills/statusline/SKILL.md +12 -8
  128. package/plugins/pbr/skills/todo/SKILL.md +51 -28
@@ -0,0 +1,297 @@
1
+ # Agent Contracts
2
+
3
+ Input/output schemas for agent-to-agent handoffs in Plan-Build-Run.
4
+
5
+ Each contract defines: the file exchanged, required frontmatter fields, body structure, and special handling notes. Agents MUST produce output matching these schemas — consumers depend on them.
6
+
7
+ ---
8
+
9
+ ## Contract: Researcher -> Synthesizer
10
+
11
+ **File**: `.planning/research/{topic-slug}.md` (project) or `.planning/phases/{NN}-{slug}/RESEARCH.md` (phase)
12
+ **Direction**: Researcher writes, Synthesizer reads 2-4 of these
13
+
14
+ ### Required Frontmatter
15
+
16
+ ```yaml
17
+ ---
18
+ confidence: high|medium|low
19
+ sources_checked: N # integer count of sources consulted
20
+ coverage: "complete|partial|minimal"
21
+ ---
22
+ ```
23
+
24
+ ### Required Body Sections
25
+
26
+ - `## Key Findings` — each finding tagged with source level (`[S1]`..`[S6]`) and confidence
27
+ - `## Gaps` — areas not covered and why
28
+ - `## Sources` — source list with what each provided
29
+
30
+ ### Special Handling
31
+
32
+ - Every factual claim must have a source attribution tag
33
+ - Version-sensitive info (API signatures, config syntax) must come from S1-S3 sources
34
+ - `[SPECULATIVE]` tag marks unverified reasoning — synthesizer must not upgrade confidence
35
+
36
+ ---
37
+
38
+ ## Contract: Synthesizer -> Planner
39
+
40
+ **File**: `.planning/research/SUMMARY.md` (or specified path)
41
+ **Direction**: Synthesizer writes, Planner reads
42
+
43
+ ### Required Frontmatter
44
+
45
+ ```yaml
46
+ ---
47
+ confidence: high|medium|low
48
+ sources: N # integer count of input documents
49
+ conflicts: N # integer count of contradictions found
50
+ ---
51
+ ```
52
+
53
+ ### Required Body Sections
54
+
55
+ - `## Resolved Decisions` — table with Topic, Decision, Confidence, Sources columns
56
+ - `## Open Questions` — items marked `[NEEDS DECISION]` for planner to handle
57
+ - `## Deferred Ideas` — items out of scope
58
+
59
+ ### Special Handling
60
+
61
+ - `[NEEDS DECISION]` flags: planner creates `checkpoint:decision` tasks OR decides within discretion scope
62
+ - Confidence levels never upgraded beyond what input documents support
63
+ - Contradictions always documented, never silently dropped
64
+
65
+ ---
66
+
67
+ ## Contract: Planner -> Executor
68
+
69
+ **File**: `.planning/phases/{NN}-{slug}/PLAN-{NN}.md`
70
+ **Direction**: Planner writes, Executor reads and executes sequentially
71
+
72
+ ### Required Frontmatter
73
+
74
+ ```yaml
75
+ ---
76
+ phase: "{phase-slug}"
77
+ plan: "{NN-MM}"
78
+ wave: N
79
+ depends_on: []
80
+ files_modified: ["{path}"]
81
+ must_haves:
82
+ truths: ["{observable condition}"]
83
+ artifacts: ["{file: description}"]
84
+ key_links: ["{connection description}"]
85
+ provides: ["{exported item}"]
86
+ consumes: ["{required item}"]
87
+ requirement_ids: []
88
+ ---
89
+ ```
90
+
91
+ ### Required Body: XML Tasks (each task needs all 5 elements)
92
+
93
+ ```xml
94
+ <task id="{plan}-T{n}" type="{type}" tdd="{bool}" complexity="{simple|medium|complex}">
95
+ <name>{imperative verb phrase}</name>
96
+ <files>{file paths, one per line}</files>
97
+ <action>{numbered steps}</action>
98
+ <verify>{executable shell command}</verify>
99
+ <done>{observable outcome}</done>
100
+ </task>
101
+ ```
102
+
103
+ ### Special Handling
104
+
105
+ - Task types: `auto`, `tdd`, `checkpoint:human-verify`, `checkpoint:decision`, `checkpoint:human-action`
106
+ - Complexity drives model selection: simple=haiku, medium=sonnet, complex=inherit
107
+ - Executor stages ONLY files listed in `<files>` per task
108
+ - Plans end with a `## Summary` section (plan ID, task list, key files, must-haves, provides/consumes)
109
+
110
+ ---
111
+
112
+ ## Contract: Planner -> Plan-Checker
113
+
114
+ **File**: Same `PLAN-{NN}.md` files (read-only)
115
+ **Direction**: Planner writes, Plan-Checker reads and returns text assessment
116
+ **Returns**: Inline text report (no file output)
117
+
118
+ ### Expected Input
119
+
120
+ Plan-Checker reads plan frontmatter + XML tasks and evaluates across 9 dimensions (D1-D9). Optionally receives CONTEXT.md path.
121
+
122
+ ### Output Format
123
+
124
+ ```
125
+ VERIFICATION PASSED | ISSUES FOUND
126
+ Plans: N | Tasks: N | Blockers: N | Warnings: N | Info: N
127
+
128
+ ## Blockers
129
+ - [{plan_id}] D{N} {severity}: {description} -> Fix: {hint}
130
+ ```
131
+
132
+ ### Special Handling
133
+
134
+ - Blockers must be fixed before execution; warnings are advisory
135
+ - Plan-Checker never modifies plans — only reports issues
136
+ - Planner enters Revision Mode to address feedback
137
+
138
+ ---
139
+
140
+ ## Contract: Executor -> Verifier
141
+
142
+ **File**: `.planning/phases/{NN}-{slug}/SUMMARY-{plan_id}.md`
143
+ **Direction**: Executor writes after completing plan tasks, Verifier reads
144
+
145
+ ### Required Frontmatter
146
+
147
+ ```yaml
148
+ ---
149
+ plan: "{plan_id}"
150
+ status: complete|partial|checkpoint
151
+ commits: ["{sha1}", "{sha2}"]
152
+ provides: ["{exported item}"]
153
+ must_haves:
154
+ - "{must-have description}: DONE|PARTIAL|SKIPPED"
155
+ ---
156
+ ```
157
+
158
+ ### Required Body Sections
159
+
160
+ - `## Task Results` — table with Task, Status, Notes columns
161
+ - `## Deviations` — list of deviations from plan, or "None"
162
+
163
+ ### Special Handling
164
+
165
+ - Verifier does NOT trust SUMMARY.md claims — verifies against actual codebase
166
+ - Verifier checks must-haves from PLAN.md frontmatter, not SUMMARY.md self-reports
167
+ - One SUMMARY per plan execution; status reflects final state
168
+
169
+ ---
170
+
171
+ ## Contract: Verifier -> Planner (Gap Closure)
172
+
173
+ **File**: `.planning/phases/{NN}-{slug}/VERIFICATION.md`
174
+ **Direction**: Verifier writes, Planner reads to create gap-closure plans
175
+
176
+ ### Required Frontmatter
177
+
178
+ ```yaml
179
+ ---
180
+ status: passed|gaps_found|human_needed
181
+ attempt: N
182
+ must_haves_total: N
183
+ must_haves_passed: M
184
+ gaps: ["gap description"]
185
+ overrides: []
186
+ ---
187
+ ```
188
+
189
+ ### Required Body Sections
190
+
191
+ - `## Must-Have Verification` — table with #, Must-Have, Status, Evidence columns
192
+ - `## Gaps` — per-gap detail with Evidence and Suggested fix
193
+
194
+ ### Special Handling
195
+
196
+ - `gaps_found` triggers Planner Gap Closure Mode — planner creates targeted fix plans
197
+ - `overrides` list: must-haves marked as override by user, counted as passed
198
+ - Re-verification increments `attempt` counter; checks regressions on previously-passed items
199
+ - Verifier has Write access ONLY for VERIFICATION.md — cannot fix source code
200
+
201
+ ---
202
+
203
+ ## Contract: Integration-Checker -> Planner
204
+
205
+ **File**: `.planning/phases/{NN}-{slug}/INTEGRATION-REPORT.md`
206
+ **Direction**: Integration-Checker writes, Planner reads for cross-phase fixes
207
+
208
+ ### Required Frontmatter
209
+
210
+ ```yaml
211
+ ---
212
+ status: passed|issues_found
213
+ checks_total: N
214
+ checks_passed: M
215
+ critical_issues: K
216
+ ---
217
+ ```
218
+
219
+ ### Required Body Sections
220
+
221
+ - `## Integration Checks` — table with Check, Status, Evidence columns
222
+ - `## E2E Flows` — table with Flow, Status, Broken Link columns
223
+ - `## Critical Issues` — detailed issue descriptions
224
+
225
+ ### Special Handling
226
+
227
+ - Checks ACROSS phases (unlike Verifier which checks single phase)
228
+ - 5 check categories: Export/Import Wiring, API Route Coverage, Auth Protection, E2E Flows, Cross-Phase Dependencies
229
+ - Integration-Checker has Write access ONLY for INTEGRATION-REPORT.md — cannot fix source code
230
+
231
+ ---
232
+
233
+ ## Contract: Debugger (Self-Contained)
234
+
235
+ **File**: `.planning/debug/{slug}.md`
236
+ **Direction**: Debugger creates, updates, and resolves within a single session
237
+
238
+ ### Required Frontmatter
239
+
240
+ ```yaml
241
+ ---
242
+ slug: "{slug}"
243
+ status: "gathering|investigating|fixing|verifying|resolved"
244
+ created: "{ISO-8601}"
245
+ updated: "{ISO-8601}"
246
+ mode: "find_and_fix|find_root_cause_only"
247
+ ---
248
+ ```
249
+
250
+ ### Required Body Sections
251
+
252
+ - `## Current Focus` — Hypothesis, Test, Expecting, Disconfirm, Next action
253
+ - `## Symptoms` — IMMUTABLE after gathering phase
254
+ - `## Hypotheses` — Active (unchecked) and Eliminated (checked, append-only)
255
+ - `## Evidence Log` — append-only timestamped entries
256
+ - `## Resolution` — root cause, mechanism, fix, commit hash (when resolved)
257
+
258
+ ### Special Handling
259
+
260
+ - Status transitions: `gathering -> investigating -> fixing -> verifying -> resolved`
261
+ - Symptoms and Evidence Log are append-only / immutable — prevents mutation bias
262
+ - Fix commits use format: `fix({scope}): {description}` with root cause in body
263
+ - May emit checkpoints (`HUMAN-VERIFY`, `HUMAN-ACTION`, `DECISION`) for user input
264
+
265
+ ---
266
+
267
+ ## Contract: Codebase-Mapper (Self-Contained)
268
+
269
+ **Files**: `.planning/codebase/{STACK,ARCHITECTURE,CONVENTIONS,CONCERNS}.md` (varies by focus)
270
+ **Direction**: Codebase-Mapper writes, consumed by Researcher (as S0 local prior) and Planner
271
+
272
+ ### Focus Areas and Outputs
273
+
274
+ | Focus | Output Files |
275
+ |-------|-------------|
276
+ | `tech` | STACK.md, INTEGRATIONS.md |
277
+ | `arch` | ARCHITECTURE.md, STRUCTURE.md |
278
+ | `quality` | CONVENTIONS.md, TESTING.md |
279
+ | `concerns` | CONCERNS.md |
280
+
281
+ ### Fallback Frontmatter (per file)
282
+
283
+ No YAML frontmatter required — these are reference documents with markdown tables.
284
+
285
+ ### Required Body Structure (minimum per file)
286
+
287
+ - **STACK.md**: `## Tech Stack` table (Category, Technology, Version, Config File) + `## Package Manager`
288
+ - **ARCHITECTURE.md**: `## Architecture Overview` (pattern name) + `## Key Components` table + `## Data Flow`
289
+ - **CONVENTIONS.md**: `## Code Conventions` table (Convention, Pattern, Example File) + `## Naming Patterns`
290
+ - **CONCERNS.md**: `## Concerns` table (Severity, Area, Description, File) + `## Security Considerations`
291
+
292
+ ### Special Handling
293
+
294
+ - Every claim must reference actual file paths — no vague references
295
+ - Codebase-Mapper does NOT commit — the orchestrator handles commits
296
+ - Researcher treats these as S0 (highest confidence) local prior research
297
+ - One focus area per invocation
@@ -27,6 +27,7 @@ Condensed from the 3,100-line `docs/DEVELOPMENT-GUIDE.md`. When in doubt, these
27
27
  13. Read STATE.md and config.json fully. Read ROADMAP.md by section. Read PLAN.md/SUMMARY.md/VERIFICATION.md frontmatter only.
28
28
  14. Use the `limit` parameter on Read to restrict line counts.
29
29
  15. Proactively suggest `/pbr:pause` when context gets heavy — before compaction, not after.
30
+ 15b. **After compaction or context recovery**, always read `.planning/STATE.md` (especially the `## Session Continuity` section) before proceeding with any work. The PreCompact hook writes recovery state there automatically.
30
31
 
31
32
  ---
32
33
 
@@ -0,0 +1,285 @@
1
+ # pbr-tools.js CLI Reference
2
+
3
+ Command-line interface for structured JSON operations on `.planning/` state.
4
+ Skills and agents call this via Bash to avoid token-expensive text parsing.
5
+
6
+ ```
7
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js <command> [args]
8
+ ```
9
+
10
+ All commands output JSON to stdout. Errors output JSON with an `error` field to stderr (exit code 1).
11
+
12
+ ---
13
+
14
+ ## State Commands
15
+
16
+ ### `state load`
17
+
18
+ Returns full project state as a single JSON object.
19
+
20
+ ```bash
21
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js state load
22
+ ```
23
+
24
+ **Output:**
25
+ ```json
26
+ {
27
+ "exists": true,
28
+ "config": { ... }, // config.json contents
29
+ "state": { // STATE.md frontmatter + parsed body
30
+ "version": 2,
31
+ "current_phase": "1",
32
+ "status": "building",
33
+ "progress_percent": 45,
34
+ "last_activity": "2025-01-15",
35
+ "last_command": "/pbr:build",
36
+ "blockers": []
37
+ },
38
+ "roadmap": { // Parsed ROADMAP.md
39
+ "phases": [{ "number": "01", "name": "...", "status": "planned", ... }]
40
+ },
41
+ "phase_count": 3,
42
+ "current_phase": "1",
43
+ "progress": { "phases": [...], "total_plans": 5, "completed_plans": 2, "percentage": 40 }
44
+ }
45
+ ```
46
+
47
+ ### `state check-progress`
48
+
49
+ Recalculates progress from filesystem (plan files, summaries, verification).
50
+
51
+ ```bash
52
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js state check-progress
53
+ ```
54
+
55
+ **Output:**
56
+ ```json
57
+ {
58
+ "phases": [
59
+ { "directory": "01-setup", "plans": 2, "summaries": 2, "completed": 2, "has_verification": true, "status": "verified" }
60
+ ],
61
+ "total_plans": 5,
62
+ "completed_plans": 3,
63
+ "percentage": 60
64
+ }
65
+ ```
66
+
67
+ ### `state update <field> <value>`
68
+
69
+ Atomically updates a single field in STATE.md. Uses file locking.
70
+
71
+ ```bash
72
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js state update current_phase 2
73
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js state update status building
74
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js state update last_activity now # auto-timestamps
75
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js state update plans_complete 3
76
+ ```
77
+
78
+ **Valid fields:** `current_phase`, `status`, `plans_complete`, `last_activity`
79
+
80
+ **Output:** `{ "success": true, "field": "status", "value": "building" }`
81
+
82
+ ---
83
+
84
+ ## Config Commands
85
+
86
+ ### `config validate`
87
+
88
+ Validates `config.json` against the JSON schema. Detects both schema violations and semantic conflicts.
89
+
90
+ ```bash
91
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js config validate
92
+ ```
93
+
94
+ **Output:**
95
+ ```json
96
+ {
97
+ "valid": true,
98
+ "errors": [],
99
+ "warnings": ["features.auto_continue=true with mode=interactive: auto_continue only fires in autonomous mode"]
100
+ }
101
+ ```
102
+
103
+ ### `config resolve-depth [dir]`
104
+
105
+ Resolves the effective depth profile by merging base profile with user overrides.
106
+
107
+ ```bash
108
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js config resolve-depth
109
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js config resolve-depth /path/to/.planning
110
+ ```
111
+
112
+ **Output:** Full depth profile object with all resolved values (research rounds, plan detail level, verification depth, etc.)
113
+
114
+ ---
115
+
116
+ ## Plan & Phase Commands
117
+
118
+ ### `plan-index <phase>`
119
+
120
+ Returns plan inventory for a phase, grouped by wave.
121
+
122
+ ```bash
123
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js plan-index 1
124
+ ```
125
+
126
+ **Output:**
127
+ ```json
128
+ {
129
+ "phase": "01-setup",
130
+ "total_plans": 3,
131
+ "plans": [
132
+ {
133
+ "file": "PLAN-01.md",
134
+ "plan_id": "01",
135
+ "wave": 1,
136
+ "type": "feature",
137
+ "autonomous": true,
138
+ "depends_on": [],
139
+ "gap_closure": false,
140
+ "has_summary": true,
141
+ "must_haves_count": 4
142
+ }
143
+ ],
144
+ "waves": { "wave_1": ["01", "02"], "wave_2": ["03"] }
145
+ }
146
+ ```
147
+
148
+ ### `phase-info <phase>`
149
+
150
+ Comprehensive single-phase status combining roadmap, filesystem, and plan data.
151
+
152
+ ```bash
153
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js phase-info 1
154
+ ```
155
+
156
+ **Output:**
157
+ ```json
158
+ {
159
+ "phase": "01-setup",
160
+ "name": "setup",
161
+ "goal": "Initialize project infrastructure",
162
+ "roadmap_status": "building",
163
+ "filesystem_status": "partial",
164
+ "plans": [...],
165
+ "plan_count": 3,
166
+ "summaries": [{ "file": "SUMMARY-01.md", "plan": "01", "status": "complete" }],
167
+ "completed": 1,
168
+ "verification": null,
169
+ "has_context": false
170
+ }
171
+ ```
172
+
173
+ ### `must-haves <phase>`
174
+
175
+ Collects all must-haves from phase plans — truths, artifacts, and key links.
176
+
177
+ ```bash
178
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js must-haves 1
179
+ ```
180
+
181
+ **Output:**
182
+ ```json
183
+ {
184
+ "phase": "01-setup",
185
+ "plans": {
186
+ "01": { "truths": ["..."], "artifacts": ["..."], "key_links": ["..."] }
187
+ },
188
+ "all": { "truths": [...], "artifacts": [...], "key_links": [...] },
189
+ "total": 12
190
+ }
191
+ ```
192
+
193
+ ---
194
+
195
+ ## Frontmatter Command
196
+
197
+ ### `frontmatter <filepath>`
198
+
199
+ Parses a markdown file's YAML frontmatter and returns as JSON.
200
+
201
+ ```bash
202
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js frontmatter .planning/phases/01-setup/PLAN-01.md
203
+ ```
204
+
205
+ **Output:** The frontmatter fields as a JSON object. Returns `{ "error": "File not found: ..." }` if the file doesn't exist.
206
+
207
+ ---
208
+
209
+ ## Roadmap Commands
210
+
211
+ ### `roadmap update-status <phase> <status>`
212
+
213
+ Updates the Status column for a phase in ROADMAP.md's Phase Overview table. Uses file locking. Warns on invalid status transitions but does not block them.
214
+
215
+ ```bash
216
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js roadmap update-status 1 building
217
+ ```
218
+
219
+ **Valid statuses:** `pending`, `planned`, `building`, `built`, `partial`, `needs_fixes`, `verified`, `skipped`
220
+
221
+ **Output:** `{ "success": true, "old_status": "planned", "new_status": "building" }`
222
+
223
+ ### `roadmap update-plans <phase> <complete> <total>`
224
+
225
+ Updates the Plans column (e.g., "2/5") for a phase in ROADMAP.md.
226
+
227
+ ```bash
228
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js roadmap update-plans 1 2 5
229
+ ```
230
+
231
+ **Output:** `{ "success": true, "old_plans": "1/5", "new_plans": "2/5" }`
232
+
233
+ ---
234
+
235
+ ## History Commands
236
+
237
+ ### `history append <type> <title> [body]`
238
+
239
+ Appends a record to HISTORY.md. Creates the file if it doesn't exist.
240
+
241
+ ```bash
242
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js history append milestone "v1.0 Release" "Initial release with core features"
243
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js history append phase "01-setup Complete" "3 plans executed, all verified"
244
+ ```
245
+
246
+ **Types:** `milestone`, `phase`
247
+
248
+ **Output:** `{ "success": true }`
249
+
250
+ ### `history load`
251
+
252
+ Loads all HISTORY.md records as structured JSON.
253
+
254
+ ```bash
255
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js history load
256
+ ```
257
+
258
+ **Output:**
259
+ ```json
260
+ {
261
+ "records": [
262
+ { "type": "milestone", "title": "v1.0 Release", "date": "2025-01-15", "body": "..." }
263
+ ],
264
+ "line_count": 42
265
+ }
266
+ ```
267
+
268
+ Returns `null` if HISTORY.md doesn't exist.
269
+
270
+ ---
271
+
272
+ ## Event Command
273
+
274
+ ### `event <category> <event> [JSON-details]`
275
+
276
+ Logs a structured event to `.planning/logs/events.jsonl`.
277
+
278
+ ```bash
279
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js event build plan-complete '{"plan":"01","phase":"01-setup"}'
280
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js event error hook-failure '{"script":"validate-task.js"}'
281
+ ```
282
+
283
+ **Output:** `{ "logged": true, "category": "build", "event": "plan-complete" }`
284
+
285
+ If the JSON-details argument is not valid JSON, it's stored as `{ "raw": "<the string>" }`.