@sienklogic/plan-build-run 2.33.1 → 2.37.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 (140) hide show
  1. package/CHANGELOG.md +678 -0
  2. package/dashboard/public/css/command-center.css +152 -65
  3. package/dashboard/public/css/explorer.css +70 -41
  4. package/dashboard/public/css/layout.css +163 -2
  5. package/dashboard/public/css/settings.css +108 -110
  6. package/dashboard/public/css/timeline.css +2 -1
  7. package/dashboard/public/css/tokens.css +13 -0
  8. package/dashboard/public/js/sidebar-toggle.js +21 -7
  9. package/dashboard/src/components/Layout.tsx +51 -7
  10. package/dashboard/src/components/explorer/tabs/MilestonesTab.tsx +18 -2
  11. package/dashboard/src/components/explorer/tabs/PhasesTab.tsx +11 -1
  12. package/dashboard/src/components/explorer/tabs/TodosTab.tsx +25 -6
  13. package/dashboard/src/components/partials/AttentionPanel.tsx +7 -1
  14. package/dashboard/src/components/partials/CurrentPhaseCard.tsx +26 -24
  15. package/dashboard/src/components/partials/QuickActions.tsx +21 -11
  16. package/dashboard/src/components/partials/StatCardGrid.tsx +67 -0
  17. package/dashboard/src/components/partials/StatusHeader.tsx +2 -1
  18. package/dashboard/src/components/settings/LogEntryList.tsx +43 -5
  19. package/dashboard/src/routes/command-center.routes.tsx +8 -7
  20. package/dashboard/src/routes/index.routes.tsx +32 -29
  21. package/package.json +2 -2
  22. package/plugins/copilot-pbr/agents/audit.agent.md +128 -16
  23. package/plugins/copilot-pbr/agents/codebase-mapper.agent.md +48 -1
  24. package/plugins/copilot-pbr/agents/debugger.agent.md +47 -1
  25. package/plugins/copilot-pbr/agents/executor.agent.md +152 -8
  26. package/plugins/copilot-pbr/agents/general.agent.md +46 -1
  27. package/plugins/copilot-pbr/agents/integration-checker.agent.md +52 -2
  28. package/plugins/copilot-pbr/agents/plan-checker.agent.md +50 -2
  29. package/plugins/copilot-pbr/agents/planner.agent.md +54 -1
  30. package/plugins/copilot-pbr/agents/researcher.agent.md +47 -2
  31. package/plugins/copilot-pbr/agents/synthesizer.agent.md +49 -1
  32. package/plugins/copilot-pbr/agents/verifier.agent.md +86 -2
  33. package/plugins/copilot-pbr/hooks/hooks.json +11 -0
  34. package/plugins/copilot-pbr/plugin.json +1 -1
  35. package/plugins/copilot-pbr/references/agent-contracts.md +27 -0
  36. package/plugins/copilot-pbr/references/checkpoints.md +32 -1
  37. package/plugins/copilot-pbr/references/context-quality-tiers.md +45 -0
  38. package/plugins/copilot-pbr/references/pbr-tools-cli.md +115 -0
  39. package/plugins/copilot-pbr/references/questioning.md +21 -1
  40. package/plugins/copilot-pbr/references/verification-patterns.md +52 -1
  41. package/plugins/copilot-pbr/skills/audit/SKILL.md +19 -3
  42. package/plugins/copilot-pbr/skills/begin/SKILL.md +57 -4
  43. package/plugins/copilot-pbr/skills/build/SKILL.md +39 -2
  44. package/plugins/copilot-pbr/skills/debug/SKILL.md +12 -1
  45. package/plugins/copilot-pbr/skills/explore/SKILL.md +13 -2
  46. package/plugins/copilot-pbr/skills/import/SKILL.md +26 -1
  47. package/plugins/copilot-pbr/skills/milestone/SKILL.md +15 -3
  48. package/plugins/copilot-pbr/skills/plan/SKILL.md +50 -0
  49. package/plugins/copilot-pbr/skills/quick/SKILL.md +21 -0
  50. package/plugins/copilot-pbr/skills/review/SKILL.md +45 -0
  51. package/plugins/copilot-pbr/skills/scan/SKILL.md +20 -0
  52. package/plugins/copilot-pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  53. package/plugins/copilot-pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
  54. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  55. package/plugins/cursor-pbr/agents/audit.md +51 -5
  56. package/plugins/cursor-pbr/agents/codebase-mapper.md +48 -1
  57. package/plugins/cursor-pbr/agents/debugger.md +47 -1
  58. package/plugins/cursor-pbr/agents/executor.md +152 -8
  59. package/plugins/cursor-pbr/agents/general.md +46 -1
  60. package/plugins/cursor-pbr/agents/integration-checker.md +51 -1
  61. package/plugins/cursor-pbr/agents/plan-checker.md +49 -1
  62. package/plugins/cursor-pbr/agents/planner.md +54 -1
  63. package/plugins/cursor-pbr/agents/researcher.md +46 -1
  64. package/plugins/cursor-pbr/agents/synthesizer.md +49 -1
  65. package/plugins/cursor-pbr/agents/verifier.md +85 -1
  66. package/plugins/cursor-pbr/hooks/hooks.json +9 -0
  67. package/plugins/cursor-pbr/references/agent-contracts.md +27 -0
  68. package/plugins/cursor-pbr/references/checkpoints.md +32 -1
  69. package/plugins/cursor-pbr/references/context-quality-tiers.md +45 -0
  70. package/plugins/cursor-pbr/references/pbr-tools-cli.md +115 -0
  71. package/plugins/cursor-pbr/references/questioning.md +21 -1
  72. package/plugins/cursor-pbr/references/verification-patterns.md +52 -1
  73. package/plugins/cursor-pbr/skills/audit/SKILL.md +19 -3
  74. package/plugins/cursor-pbr/skills/begin/SKILL.md +57 -4
  75. package/plugins/cursor-pbr/skills/build/SKILL.md +37 -2
  76. package/plugins/cursor-pbr/skills/debug/SKILL.md +12 -1
  77. package/plugins/cursor-pbr/skills/explore/SKILL.md +13 -2
  78. package/plugins/cursor-pbr/skills/import/SKILL.md +26 -1
  79. package/plugins/cursor-pbr/skills/milestone/SKILL.md +15 -3
  80. package/plugins/cursor-pbr/skills/plan/SKILL.md +50 -0
  81. package/plugins/cursor-pbr/skills/quick/SKILL.md +21 -0
  82. package/plugins/cursor-pbr/skills/review/SKILL.md +45 -0
  83. package/plugins/cursor-pbr/skills/scan/SKILL.md +20 -0
  84. package/plugins/cursor-pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  85. package/plugins/cursor-pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
  86. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
  87. package/plugins/pbr/agents/audit.md +44 -0
  88. package/plugins/pbr/agents/codebase-mapper.md +47 -0
  89. package/plugins/pbr/agents/debugger.md +46 -0
  90. package/plugins/pbr/agents/executor.md +150 -6
  91. package/plugins/pbr/agents/general.md +45 -0
  92. package/plugins/pbr/agents/integration-checker.md +50 -0
  93. package/plugins/pbr/agents/plan-checker.md +48 -0
  94. package/plugins/pbr/agents/planner.md +51 -0
  95. package/plugins/pbr/agents/researcher.md +45 -0
  96. package/plugins/pbr/agents/synthesizer.md +48 -0
  97. package/plugins/pbr/agents/verifier.md +84 -0
  98. package/plugins/pbr/hooks/hooks.json +9 -0
  99. package/plugins/pbr/references/agent-contracts.md +27 -0
  100. package/plugins/pbr/references/checkpoints.md +32 -0
  101. package/plugins/pbr/references/context-quality-tiers.md +45 -0
  102. package/plugins/pbr/references/pbr-tools-cli.md +115 -0
  103. package/plugins/pbr/references/questioning.md +21 -0
  104. package/plugins/pbr/references/verification-patterns.md +52 -0
  105. package/plugins/pbr/scripts/check-plan-format.js +15 -3
  106. package/plugins/pbr/scripts/check-state-sync.js +26 -7
  107. package/plugins/pbr/scripts/check-subagent-output.js +30 -2
  108. package/plugins/pbr/scripts/config-schema.json +11 -1
  109. package/plugins/pbr/scripts/context-bridge.js +259 -0
  110. package/plugins/pbr/scripts/context-budget-check.js +2 -2
  111. package/plugins/pbr/scripts/lib/config.js +178 -0
  112. package/plugins/pbr/scripts/lib/core.js +578 -0
  113. package/plugins/pbr/scripts/lib/history.js +73 -0
  114. package/plugins/pbr/scripts/lib/init.js +166 -0
  115. package/plugins/pbr/scripts/lib/phase.js +364 -0
  116. package/plugins/pbr/scripts/lib/roadmap.js +175 -0
  117. package/plugins/pbr/scripts/lib/state.js +397 -0
  118. package/plugins/pbr/scripts/pbr-tools.js +346 -1235
  119. package/plugins/pbr/scripts/post-write-dispatch.js +5 -4
  120. package/plugins/pbr/scripts/post-write-quality.js +3 -3
  121. package/plugins/pbr/scripts/pre-write-dispatch.js +1 -1
  122. package/plugins/pbr/scripts/progress-tracker.js +1 -1
  123. package/plugins/pbr/scripts/suggest-compact.js +1 -1
  124. package/plugins/pbr/scripts/track-context-budget.js +53 -2
  125. package/plugins/pbr/scripts/validate-task.js +20 -28
  126. package/plugins/pbr/skills/audit/SKILL.md +19 -3
  127. package/plugins/pbr/skills/begin/SKILL.md +48 -2
  128. package/plugins/pbr/skills/build/SKILL.md +39 -2
  129. package/plugins/pbr/skills/debug/SKILL.md +12 -1
  130. package/plugins/pbr/skills/debug/templates/continuation-prompt.md.tmpl +12 -1
  131. package/plugins/pbr/skills/debug/templates/initial-investigation-prompt.md.tmpl +12 -5
  132. package/plugins/pbr/skills/explore/SKILL.md +13 -2
  133. package/plugins/pbr/skills/import/SKILL.md +26 -1
  134. package/plugins/pbr/skills/milestone/SKILL.md +15 -3
  135. package/plugins/pbr/skills/plan/SKILL.md +52 -2
  136. package/plugins/pbr/skills/quick/SKILL.md +21 -0
  137. package/plugins/pbr/skills/review/SKILL.md +46 -0
  138. package/plugins/pbr/skills/scan/SKILL.md +20 -0
  139. package/plugins/pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  140. package/plugins/pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
@@ -60,6 +60,8 @@ Execute these steps in order.
60
60
 
61
61
  ### Step 1: Parse and Validate (inline)
62
62
 
63
+ **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.
64
+
63
65
  1. Parse `$ARGUMENTS` for phase number and `--auto-fix` flag
64
66
  2. Read `.planning/config.json`
65
67
  **CRITICAL: Write .active-skill NOW.** Write the text "review" to `.planning/.active-skill` using the Write tool.
@@ -154,6 +156,16 @@ Invoke the `@verifier` agent to run three-layer checks.
154
156
 
155
157
  Read `skills/review/templates/verifier-prompt.md.tmpl` and use its content as the verifier prompt.
156
158
 
159
+ **Prepend this block to the verifier prompt before sending:**
160
+ ```
161
+ <files_to_read>
162
+ CRITICAL: Read these files BEFORE any other action:
163
+ 1. .planning/phases/{NN}-{slug}/PLAN-*.md — must-haves to verify against
164
+ 2. .planning/phases/{NN}-{slug}/SUMMARY-*.md — executor build summaries
165
+ 3. .planning/phases/{NN}-{slug}/VERIFICATION.md — prior verification results (if exists)
166
+ </files_to_read>
167
+ ```
168
+
157
169
  **Placeholders to fill before sending:**
158
170
  - `{For each PLAN.md file in the phase directory:}` — inline each plan's must_haves frontmatter block
159
171
  - `{For each SUMMARY.md file in the phase directory:}` — provide manifest table with file paths and status from frontmatter. The verifier reads full content from disk via Read tool.
@@ -180,6 +192,17 @@ Then show a brief table of must-haves with pass/fail status:
180
192
 
181
193
  Then display the overall verdict (`PASSED`, `GAPS FOUND`, or `HUMAN NEEDED`) before proceeding to the full results presentation.
182
194
 
195
+ ### Step 3a: Spot-Check Verifier Output
196
+
197
+ CRITICAL: Verify verifier output before proceeding.
198
+
199
+ 1. **VERIFICATION.md exists**: Check `.planning/phases/{NN}-{slug}/VERIFICATION.md` exists on disk
200
+ 2. **Status field present**: Read VERIFICATION.md frontmatter — verify `status` field is present and is one of: pass, fail, partial
201
+ 3. **Must-haves checked**: Verify `must_haves_checked` count > 0 in frontmatter
202
+ 4. **Completion marker**: Look for `## VERIFICATION COMPLETE` in the Task() output
203
+
204
+ If ANY spot-check fails, present the user with options: **Retry** / **Continue anyway** / **Abort**
205
+
183
206
  ---
184
207
 
185
208
  ### Step 3b: Local LLM Verification Quality Check (optional, advisory)
@@ -367,6 +390,16 @@ Invoke the `@debugger` agent to analyze each failure.
367
390
 
368
391
  Read `skills/review/templates/debugger-prompt.md.tmpl` and use its content as the debugger prompt.
369
392
 
393
+ **Prepend this block to the debugger prompt before sending:**
394
+ ```
395
+ <files_to_read>
396
+ CRITICAL: Read these files BEFORE any other action:
397
+ 1. .planning/phases/{NN}-{slug}/VERIFICATION.md — gaps and failure details
398
+ 2. .planning/phases/{NN}-{slug}/SUMMARY-*.md — what was built
399
+ 3. .planning/phases/{NN}-{slug}/PLAN-*.md — original plan must-haves
400
+ </files_to_read>
401
+ ```
402
+
370
403
  **Placeholders to fill before sending:**
371
404
  - `[Inline the VERIFICATION.md content]` — provide file path; debugger reads via Read tool
372
405
  - `[Inline all SUMMARY.md files for the phase]` — provide manifest table of file paths
@@ -382,6 +415,16 @@ Invoke the `@planner` agent in gap-closure mode.
382
415
 
383
416
  Read `skills/review/templates/gap-planner-prompt.md.tmpl` and use its content as the gap planner prompt.
384
417
 
418
+ **Prepend this block to the gap planner prompt before sending:**
419
+ ```
420
+ <files_to_read>
421
+ CRITICAL: Read these files BEFORE any other action:
422
+ 1. .planning/phases/{NN}-{slug}/VERIFICATION.md — gaps to close
423
+ 2. .planning/phases/{NN}-{slug}/PLAN-*.md — existing plans for context
424
+ 3. .planning/CONTEXT.md — locked decisions and constraints (if exists)
425
+ </files_to_read>
426
+ ```
427
+
385
428
  **Placeholders to fill before sending:**
386
429
  - `[Inline VERIFICATION.md]` — provide file path; planner reads via Read tool
387
430
  - `[Inline the debugger's root cause analysis]` — keep inline (already in conversation context)
@@ -562,6 +605,8 @@ After review completes, always present a clear next action using the completion
562
605
  - **If gaps remain:** Use the "Gaps Found" template. Fill in phase number, name, gap count, and gap summaries.
563
606
  - **If final phase:** Use the "Milestone Complete" template. Fill in phase count.
564
607
 
608
+ Include `<sub>/clear first → fresh context window</sub>` inside the Next Up routing block of the completion template.
609
+
565
610
  ---
566
611
 
567
612
  ## Notes
@@ -123,6 +123,14 @@ For each agent, read `skills/scan/templates/mapper-prompt.md.tmpl` and fill in t
123
123
  - `{scale}`: detected scale from Step 2
124
124
  - `{output_path}`: `.planning/codebase/`
125
125
 
126
+ **Prepend this block to each mapper prompt before sending:**
127
+ ```
128
+ <files_to_read>
129
+ CRITICAL: Read these files BEFORE any other action:
130
+ 1. .planning/codebase/RECON.md — baseline reconnaissance data (if exists)
131
+ </files_to_read>
132
+ ```
133
+
126
134
  | Agent | Focus | Output Files | When |
127
135
  |-------|-------|-------------|------|
128
136
  | 1 | tech | STACK.md, INTEGRATIONS.md | Always |
@@ -142,6 +150,18 @@ All agents run in parallel. As each completes, display:
142
150
 
143
151
  (Only display lines for the focus areas that were actually spawned.)
144
152
 
153
+ ### Step 4b: Check Completion Markers
154
+
155
+ After each codebase-mapper Task() completes, check the Task() output for the `## MAPPING COMPLETE` marker:
156
+
157
+ - If `## MAPPING COMPLETE` is present: the mapper finished successfully, proceed normally
158
+ - If the marker is missing: warn the user that the mapper may not have completed successfully:
159
+ ```
160
+ ⚠ Codebase mapper ({focus_area}) did not report MAPPING COMPLETE.
161
+ Output may be incomplete — check .planning/codebase/ for partial results.
162
+ ```
163
+ Continue to Step 5 verification regardless (the file existence checks will catch truly missing output).
164
+
145
165
  ### Step 5: Verify Output
146
166
 
147
167
  After all agents complete, verify the expected files exist:
@@ -0,0 +1,95 @@
1
+ # SUMMARY-complex.md Template
2
+
3
+ > Use when: decisions were made OR fileCount > 6
4
+ > Referenced by: executor agent (complex plans, architectural work)
5
+
6
+ ## Frontmatter (YAML)
7
+
8
+ ```yaml
9
+ ---
10
+ phase: "{phase_id}"
11
+ plan: "{plan_id}"
12
+ status: "complete" # complete | partial | checkpoint
13
+ subsystem: "{main subsystem affected}"
14
+ tags:
15
+ - "{tag1}"
16
+ requires:
17
+ - "{plan_id}: {artifact}"
18
+ provides:
19
+ - "{export/artifact description}"
20
+ affects:
21
+ - "{affected area 1}"
22
+ tech_stack:
23
+ - "{technology used}"
24
+ key_files:
25
+ - "{file1}: {what it does}"
26
+ key_decisions:
27
+ - "{decision 1}: {rationale}"
28
+ patterns:
29
+ - "{pattern used}: {where}"
30
+ metrics:
31
+ duration_minutes: {n}
32
+ tasks_completed: {n}
33
+ tasks_total: {n}
34
+ commits: {n}
35
+ files_created: {n}
36
+ files_modified: {n}
37
+ deferred:
38
+ - "{thing noticed but not implemented}"
39
+ self_check_failures:
40
+ - "{failure description}"
41
+ architecture_notes:
42
+ - "{key architectural decision and why}"
43
+ ---
44
+ ```
45
+
46
+ ## Body Structure
47
+
48
+ ```markdown
49
+ # Plan Summary: {plan_id}
50
+
51
+ ## What Was Built
52
+
53
+ {2-3 paragraph description of what was accomplished}
54
+
55
+ ## Architecture Decisions
56
+
57
+ | Decision | Options Considered | Chosen | Rationale |
58
+ |----------|-------------------|--------|-----------|
59
+ | {decision} | {opt1}, {opt2} | {chosen} | {why} |
60
+
61
+ ## Task Results
62
+
63
+ | Task | Status | Commit | Files | Verify |
64
+ |------|--------|--------|-------|--------|
65
+ | {task_id}: {name} | done | {hash} | {count} | passed |
66
+
67
+ ## Key Implementation Details
68
+
69
+ {Important details about HOW things were implemented}
70
+
71
+ ## Integration Points
72
+
73
+ {How this plan connects to other plans - imports, exports, shared state}
74
+
75
+ ## Known Issues
76
+
77
+ {Issues discovered during execution}
78
+
79
+ ## Dependencies Provided
80
+
81
+ {What other plans can now depend on}
82
+
83
+ ## Deferred Items
84
+
85
+ {Items noticed but intentionally deferred - with rationale}
86
+ ```
87
+
88
+ ## Selection Heuristic
89
+
90
+ Use this template when ANY of the following are true:
91
+ - Key architectural decisions were made during execution
92
+ - Total files created or modified > 6
93
+ - Deviations from the plan occurred
94
+ - Multiple integration points were established
95
+ - The plan touched shared infrastructure or patterns
@@ -0,0 +1,48 @@
1
+ # SUMMARY-minimal.md Template
2
+
3
+ > Use when: taskCount <= 2 AND fileCount <= 3
4
+ > Referenced by: executor agent (quick tasks, simple plans)
5
+
6
+ ## Frontmatter (YAML)
7
+
8
+ ```yaml
9
+ ---
10
+ phase: "{phase_id}"
11
+ plan: "{plan_id}"
12
+ status: "complete" # complete | partial | checkpoint
13
+ requires: []
14
+ provides:
15
+ - "{export/artifact description}"
16
+ key_files:
17
+ - "{file1}: {what it does}"
18
+ deferred: []
19
+ metrics:
20
+ tasks_completed: {n}
21
+ tasks_total: {n}
22
+ commits: {n}
23
+ ---
24
+ ```
25
+
26
+ ## Body Structure
27
+
28
+ ```markdown
29
+ # Plan Summary: {plan_id}
30
+
31
+ ## What Was Built
32
+
33
+ {1 paragraph description}
34
+
35
+ ## Task Results
36
+
37
+ | Task | Status | Commit | Files |
38
+ |------|--------|--------|-------|
39
+ | {task_id}: {name} | done | {hash} | {count} |
40
+ ```
41
+
42
+ ## Selection Heuristic
43
+
44
+ Use this template when ALL of the following are true:
45
+ - Total tasks in the plan <= 2
46
+ - Total files created or modified <= 3
47
+ - No key decisions were made
48
+ - No deviations from the plan occurred
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pbr",
3
3
  "displayName": "Plan-Build-Run",
4
- "version": "2.33.1",
4
+ "version": "2.37.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",
@@ -2,9 +2,17 @@
2
2
  name: audit
3
3
  description: "Analyzes Claude Code session logs for PBR workflow compliance, hook firing, state file hygiene, and user experience quality."
4
4
  model: sonnet
5
- readonly: true
5
+ readonly: false
6
6
  ---
7
7
 
8
+ <files_to_read>
9
+ CRITICAL: If your spawn prompt contains a files_to_read block,
10
+ you MUST Read every listed file BEFORE any other action.
11
+ Skipping this causes hallucinated context and broken output.
12
+ </files_to_read>
13
+
14
+ > Default files: session JSONL path provided in spawn prompt
15
+
8
16
  # Plan-Build-Run Session Auditor
9
17
 
10
18
  You are **audit**, the session analysis agent for the Plan-Build-Run development system. You analyze Claude Code session JSONL logs to evaluate PBR workflow compliance, hook firing, state management, commit discipline, and user experience quality.
@@ -75,9 +83,9 @@ For each session, check:
75
83
  - Check for forbidden `Co-Authored-By` lines
76
84
 
77
85
  ### 7. Subagent Delegation
78
- - Was implementation work delegated to executor subagents?
86
+ - Was implementation work delegated to executor agents?
79
87
  - Or was it done directly in main context (anti-pattern)?
80
- - Count tool calls in main context vs subagents
88
+ - Count tool calls in main context vs agents
81
89
 
82
90
  ### 8. Active Skill Management
83
91
  - Was `.active-skill` written when skills were invoked?
@@ -111,14 +119,14 @@ For each session, evaluate:
111
119
 
112
120
  ### 5. Context Efficiency
113
121
  - Did the session approach or hit context limits?
114
- - Was work delegated to subagents appropriately?
122
+ - Was work delegated to agents appropriately?
115
123
  - Were there unnecessary file reads burning context?
116
124
 
117
125
  ---
118
126
 
119
127
  ## Output Format
120
128
 
121
- Return findings as structured markdown (inline in your response):
129
+ Write findings to the specified output path using this structure:
122
130
 
123
131
  ```markdown
124
132
  # PBR Session Audit
@@ -127,6 +135,8 @@ Return findings as structured markdown (inline in your response):
127
135
  - **Session ID**: {id}
128
136
  - **Time Range**: {start} to {end}
129
137
  - **Duration**: {duration}
138
+ - **Claude Code Version**: {version}
139
+ - **Branch**: {branch}
130
140
 
131
141
  ## PBR Commands Invoked
132
142
  | # | Command | Arguments | Timestamp |
@@ -168,6 +178,19 @@ Return findings as structured markdown (inline in your response):
168
178
 
169
179
  ---
170
180
 
181
+ ### Context Quality Tiers
182
+
183
+ | Budget Used | Tier | Behavior |
184
+ |------------|------|----------|
185
+ | 0-30% | PEAK | Explore freely, read broadly |
186
+ | 30-50% | GOOD | Be selective with reads |
187
+ | 50-70% | DEGRADING | Write incrementally, skip non-essential |
188
+ | 70%+ | POOR | Finish current task and return immediately |
189
+
190
+ ---
191
+
192
+ <anti_patterns>
193
+
171
194
  ## Anti-Patterns
172
195
 
173
196
  1. DO NOT guess what hooks did — only report what the log evidence shows
@@ -176,3 +199,26 @@ Return findings as structured markdown (inline in your response):
176
199
  4. DO NOT fabricate timestamps or session IDs
177
200
  5. DO NOT include raw JSONL content in the output — summarize findings
178
201
  6. DO NOT over-report informational items as critical — use appropriate severity
202
+
203
+ </anti_patterns>
204
+
205
+ ---
206
+
207
+ <success_criteria>
208
+ - [ ] Session JSONL files located and read
209
+ - [ ] Compliance checklist evaluated
210
+ - [ ] UX checklist evaluated (if mode includes UX)
211
+ - [ ] Hook firing patterns analyzed
212
+ - [ ] Scores calculated with evidence
213
+ - [ ] Report written with required sections
214
+ - [ ] Completion marker returned
215
+ </success_criteria>
216
+
217
+ ---
218
+
219
+ ## Completion Protocol
220
+
221
+ CRITICAL: Your final output MUST end with exactly one completion marker.
222
+ Orchestrators pattern-match on these markers to route results. Omitting causes silent failures.
223
+
224
+ - `## AUDIT COMPLETE` - audit report written to .planning/audits/
@@ -5,6 +5,14 @@ model: sonnet
5
5
  readonly: false
6
6
  ---
7
7
 
8
+ <files_to_read>
9
+ CRITICAL: If your spawn prompt contains a files_to_read block,
10
+ you MUST Read every listed file BEFORE any other action.
11
+ Skipping this causes hallucinated context and broken output.
12
+ </files_to_read>
13
+
14
+ > Default files: none (explores freely based on focus area)
15
+
8
16
  # Plan-Build-Run Codebase Mapper
9
17
 
10
18
  You are **codebase-mapper**, the codebase analysis agent for the Plan-Build-Run development system. You explore existing codebases and produce structured documentation that helps other agents (and humans) understand the project's technology stack, architecture, conventions, and concerns.
@@ -100,6 +108,26 @@ If the template files cannot be read, use these minimum viable structures:
100
108
 
101
109
  ---
102
110
 
111
+ <success_criteria>
112
+ - [ ] Focus area explored thoroughly
113
+ - [ ] Every claim references actual file paths
114
+ - [ ] Output files written with required sections
115
+ - [ ] Tables populated with real data (not placeholders)
116
+ - [ ] Version numbers extracted from config files
117
+ - [ ] Completion marker returned
118
+ </success_criteria>
119
+
120
+ ---
121
+
122
+ ## Completion Protocol
123
+
124
+ CRITICAL: Your final output MUST end with exactly one completion marker.
125
+ Orchestrators pattern-match on these markers to route results. Omitting causes silent failures.
126
+
127
+ - `## MAPPING COMPLETE` - analysis document written to output path
128
+
129
+ ---
130
+
103
131
  ## Output Budget
104
132
 
105
133
  | Artifact | Target | Hard Limit |
@@ -117,6 +145,17 @@ If the template files cannot be read, use these minimum viable structures:
117
145
 
118
146
  ---
119
147
 
148
+ <critical_rules>
149
+
150
+ ### Context Quality Tiers
151
+
152
+ | Budget Used | Tier | Behavior |
153
+ |------------|------|----------|
154
+ | 0-30% | PEAK | Explore freely, read broadly |
155
+ | 30-50% | GOOD | Be selective with reads |
156
+ | 50-70% | DEGRADING | Write incrementally, skip non-essential |
157
+ | 70%+ | POOR | Finish current task and return immediately |
158
+
120
159
  ## Quality Standards
121
160
 
122
161
  1. Every claim must reference actual file paths (with line numbers when possible)
@@ -127,6 +166,10 @@ If the template files cannot be read, use these minimum viable structures:
127
166
 
128
167
  ---
129
168
 
169
+ </critical_rules>
170
+
171
+ <anti_patterns>
172
+
130
173
  ## Universal Anti-Patterns
131
174
 
132
175
  1. DO NOT guess or assume — read actual files for evidence
@@ -140,7 +183,7 @@ If the template files cannot be read, use these minimum viable structures:
140
183
  9. DO NOT contradict locked decisions in CONTEXT.md
141
184
  10. DO NOT implement deferred ideas from CONTEXT.md
142
185
  11. DO NOT consume more than 50% context before producing output
143
- 12. DO NOT read agent .md files from agents/ — auto-loaded via subagent_type
186
+ 12. DO NOT read agent .md files from agents/ — auto-loaded via agent:
144
187
 
145
188
  Additionally for this agent:
146
189
 
@@ -148,3 +191,7 @@ Additionally for this agent:
148
191
  2. DO NOT use temporal language ("recently added", "old code")
149
192
  3. DO NOT produce generic documentation — every claim must reference this specific codebase
150
193
  4. DO NOT commit the output — the orchestrator handles commits
194
+
195
+ </anti_patterns>
196
+
197
+ ---
@@ -5,12 +5,43 @@ model: sonnet
5
5
  readonly: false
6
6
  ---
7
7
 
8
+ <files_to_read>
9
+ CRITICAL: If your spawn prompt contains a files_to_read block,
10
+ you MUST Read every listed file BEFORE any other action.
11
+ Skipping this causes hallucinated context and broken output.
12
+ </files_to_read>
13
+
14
+ > Default files: .planning/debug/{slug}.md (if continuation session)
15
+
8
16
  # Plan-Build-Run Debugger
9
17
 
10
18
  > **Memory note:** Project memory is enabled to provide debugging continuity across investigation sessions.
11
19
 
12
20
  You are **debugger**, the systematic debugging agent. Investigate bugs using the scientific method: hypothesize, test, collect evidence, narrow the search space.
13
21
 
22
+ ---
23
+
24
+ <success_criteria>
25
+ - [ ] Symptoms documented (immutable after gathering)
26
+ - [ ] Hypotheses formed and tracked
27
+ - [ ] Evidence log maintained (append-only)
28
+ - [ ] Scientific method followed (hypothesis, test, observe)
29
+ - [ ] Fix committed with root cause in body (if fix mode)
30
+ - [ ] Debug file updated with current status
31
+ - [ ] Completion marker returned
32
+ </success_criteria>
33
+
34
+ ---
35
+
36
+ ## Completion Protocol
37
+
38
+ CRITICAL: Your final output MUST end with exactly one completion marker.
39
+ Orchestrators pattern-match on these markers to route results. Omitting causes silent failures.
40
+
41
+ - `## DEBUG COMPLETE` - root cause found and fix applied
42
+ - `## ROOT CAUSE FOUND` - root cause identified, fix recommended
43
+ - `## DEBUG SESSION PAUSED` - checkpoint saved, can resume later
44
+
14
45
  ## Output Budget
15
46
 
16
47
  - **Debug state updates**: ≤ 500 tokens. Focus on evidence and next hypothesis.
@@ -156,6 +187,8 @@ If classification succeeds, use the returned category to bias your initial hypot
156
187
 
157
188
  Reference: `references/common-bug-patterns.md` — covers off-by-one, null/undefined, async/timing, state management, import/module, environment, and data shape patterns.
158
189
 
190
+ <anti_patterns>
191
+
159
192
  ## Universal Anti-Patterns
160
193
 
161
194
  1. DO NOT guess or assume — read actual files for evidence
@@ -169,7 +202,7 @@ Reference: `references/common-bug-patterns.md` — covers off-by-one, null/undef
169
202
  9. DO NOT contradict locked decisions in CONTEXT.md
170
203
  10. DO NOT implement deferred ideas from CONTEXT.md
171
204
  11. DO NOT consume more than 50% context before producing output
172
- 12. DO NOT read agent .md files from agents/ — auto-loaded via subagent_type
205
+ 12. DO NOT read agent .md files from agents/ — auto-loaded via agent:
173
206
 
174
207
  ### Debugger-Specific
175
208
 
@@ -183,10 +216,23 @@ Reference: `references/common-bug-patterns.md` — covers off-by-one, null/undef
183
216
  8. DO NOT trust error messages at face value — may be a deeper symptom
184
217
  9. DO NOT apply fixes without explicit user approval — present findings first, wait for confirmation
185
218
 
219
+ </anti_patterns>
220
+
221
+ ---
222
+
186
223
  ## Context Budget
187
224
 
188
225
  **Stop before 50% context.** Write evidence to debug file continuously. If approaching limit, emit `CHECKPOINT: CONTEXT-LIMIT` with: debug file path, status, hypotheses tested/eliminated, best hypothesis + evidence, next steps.
189
226
 
227
+ ### Context Quality Tiers
228
+
229
+ | Budget Used | Tier | Behavior |
230
+ |------------|------|----------|
231
+ | 0-30% | PEAK | Explore freely, read broadly |
232
+ | 30-50% | GOOD | Be selective with reads |
233
+ | 50-70% | DEGRADING | Write incrementally, skip non-essential |
234
+ | 70%+ | POOR | Finish current task and return immediately |
235
+
190
236
  ## Return Values
191
237
 
192
238
  All return types must include `**Debug file**: .planning/debug/{slug}.md` at the end.