@sienklogic/plan-build-run 2.0.1 → 2.1.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 (152) hide show
  1. package/dashboard/src/routes/pages.routes.js +11 -4
  2. package/dashboard/src/services/dashboard.service.js +81 -17
  3. package/dashboard/src/services/phase.service.js +30 -24
  4. package/dashboard/src/services/roadmap.service.js +3 -3
  5. package/dashboard/src/views/partials/phase-content.ejs +5 -4
  6. package/package.json +1 -1
  7. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +22 -0
  8. package/plugins/cursor-pbr/CHANGELOG.md +15 -0
  9. package/plugins/cursor-pbr/README.md +118 -0
  10. package/plugins/cursor-pbr/agents/codebase-mapper.md +108 -0
  11. package/plugins/cursor-pbr/agents/debugger.md +168 -0
  12. package/plugins/cursor-pbr/agents/executor.md +236 -0
  13. package/plugins/cursor-pbr/agents/general.md +87 -0
  14. package/plugins/cursor-pbr/agents/integration-checker.md +87 -0
  15. package/plugins/cursor-pbr/agents/plan-checker.md +198 -0
  16. package/plugins/cursor-pbr/agents/planner.md +180 -0
  17. package/plugins/cursor-pbr/agents/researcher.md +162 -0
  18. package/plugins/cursor-pbr/agents/synthesizer.md +101 -0
  19. package/plugins/cursor-pbr/agents/verifier.md +193 -0
  20. package/plugins/cursor-pbr/assets/.gitkeep +0 -0
  21. package/plugins/cursor-pbr/assets/logo.svg +21 -0
  22. package/plugins/cursor-pbr/hooks/hooks.json +193 -0
  23. package/plugins/cursor-pbr/references/agent-anti-patterns.md +25 -0
  24. package/plugins/cursor-pbr/references/agent-interactions.md +135 -0
  25. package/plugins/cursor-pbr/references/agent-teams.md +55 -0
  26. package/plugins/cursor-pbr/references/checkpoints.md +158 -0
  27. package/plugins/cursor-pbr/references/common-bug-patterns.md +14 -0
  28. package/plugins/cursor-pbr/references/config-reference.md +442 -0
  29. package/plugins/cursor-pbr/references/continuation-format.md +213 -0
  30. package/plugins/cursor-pbr/references/deviation-rules.md +113 -0
  31. package/plugins/cursor-pbr/references/git-integration.md +227 -0
  32. package/plugins/cursor-pbr/references/integration-patterns.md +118 -0
  33. package/plugins/cursor-pbr/references/model-profiles.md +100 -0
  34. package/plugins/cursor-pbr/references/model-selection.md +32 -0
  35. package/plugins/cursor-pbr/references/pbr-rules.md +194 -0
  36. package/plugins/cursor-pbr/references/plan-authoring.md +182 -0
  37. package/plugins/cursor-pbr/references/plan-format.md +288 -0
  38. package/plugins/cursor-pbr/references/planning-config.md +214 -0
  39. package/plugins/cursor-pbr/references/questioning.md +215 -0
  40. package/plugins/cursor-pbr/references/reading-verification.md +128 -0
  41. package/plugins/cursor-pbr/references/stub-patterns.md +161 -0
  42. package/plugins/cursor-pbr/references/subagent-coordination.md +120 -0
  43. package/plugins/cursor-pbr/references/ui-formatting.md +462 -0
  44. package/plugins/cursor-pbr/references/verification-patterns.md +199 -0
  45. package/plugins/cursor-pbr/references/wave-execution.md +96 -0
  46. package/plugins/cursor-pbr/rules/pbr-workflow.mdc +48 -0
  47. package/plugins/cursor-pbr/setup.ps1 +78 -0
  48. package/plugins/cursor-pbr/setup.sh +83 -0
  49. package/plugins/cursor-pbr/skills/begin/SKILL.md +566 -0
  50. package/plugins/cursor-pbr/skills/begin/templates/PROJECT.md.tmpl +34 -0
  51. package/plugins/cursor-pbr/skills/begin/templates/REQUIREMENTS.md.tmpl +19 -0
  52. package/plugins/cursor-pbr/skills/begin/templates/STATE.md.tmpl +50 -0
  53. package/plugins/cursor-pbr/skills/begin/templates/config.json.tmpl +64 -0
  54. package/plugins/cursor-pbr/skills/begin/templates/researcher-prompt.md.tmpl +20 -0
  55. package/plugins/cursor-pbr/skills/begin/templates/roadmap-prompt.md.tmpl +31 -0
  56. package/plugins/cursor-pbr/skills/begin/templates/synthesis-prompt.md.tmpl +17 -0
  57. package/plugins/cursor-pbr/skills/build/SKILL.md +902 -0
  58. package/plugins/cursor-pbr/skills/config/SKILL.md +253 -0
  59. package/plugins/cursor-pbr/skills/continue/SKILL.md +159 -0
  60. package/plugins/cursor-pbr/skills/debug/SKILL.md +512 -0
  61. package/plugins/cursor-pbr/skills/debug/templates/continuation-prompt.md.tmpl +17 -0
  62. package/plugins/cursor-pbr/skills/debug/templates/initial-investigation-prompt.md.tmpl +28 -0
  63. package/plugins/cursor-pbr/skills/discuss/SKILL.md +344 -0
  64. package/plugins/cursor-pbr/skills/discuss/templates/CONTEXT.md.tmpl +62 -0
  65. package/plugins/cursor-pbr/skills/discuss/templates/decision-categories.md +10 -0
  66. package/plugins/cursor-pbr/skills/explore/SKILL.md +375 -0
  67. package/plugins/cursor-pbr/skills/health/SKILL.md +218 -0
  68. package/plugins/cursor-pbr/skills/health/templates/check-pattern.md.tmpl +31 -0
  69. package/plugins/cursor-pbr/skills/health/templates/output-format.md.tmpl +64 -0
  70. package/plugins/cursor-pbr/skills/help/SKILL.md +152 -0
  71. package/plugins/cursor-pbr/skills/import/SKILL.md +499 -0
  72. package/plugins/cursor-pbr/skills/milestone/SKILL.md +701 -0
  73. package/plugins/cursor-pbr/skills/milestone/templates/audit-report.md.tmpl +49 -0
  74. package/plugins/cursor-pbr/skills/milestone/templates/stats-file.md.tmpl +31 -0
  75. package/plugins/cursor-pbr/skills/note/SKILL.md +228 -0
  76. package/plugins/cursor-pbr/skills/pause/SKILL.md +246 -0
  77. package/plugins/cursor-pbr/skills/pause/templates/continue-here.md.tmpl +72 -0
  78. package/plugins/cursor-pbr/skills/plan/SKILL.md +648 -0
  79. package/plugins/cursor-pbr/skills/plan/templates/checker-prompt.md.tmpl +22 -0
  80. package/plugins/cursor-pbr/skills/plan/templates/gap-closure-prompt.md.tmpl +33 -0
  81. package/plugins/cursor-pbr/skills/plan/templates/planner-prompt.md.tmpl +39 -0
  82. package/plugins/cursor-pbr/skills/plan/templates/researcher-prompt.md.tmpl +20 -0
  83. package/plugins/cursor-pbr/skills/plan/templates/revision-prompt.md.tmpl +24 -0
  84. package/plugins/cursor-pbr/skills/quick/SKILL.md +351 -0
  85. package/plugins/cursor-pbr/skills/resume/SKILL.md +399 -0
  86. package/plugins/cursor-pbr/skills/review/SKILL.md +649 -0
  87. package/plugins/cursor-pbr/skills/review/templates/debugger-prompt.md.tmpl +61 -0
  88. package/plugins/cursor-pbr/skills/review/templates/gap-planner-prompt.md.tmpl +41 -0
  89. package/plugins/cursor-pbr/skills/review/templates/verifier-prompt.md.tmpl +116 -0
  90. package/plugins/cursor-pbr/skills/scan/SKILL.md +301 -0
  91. package/plugins/cursor-pbr/skills/scan/templates/mapper-prompt.md.tmpl +202 -0
  92. package/plugins/cursor-pbr/skills/setup/SKILL.md +250 -0
  93. package/plugins/cursor-pbr/skills/shared/commit-planning-docs.md +36 -0
  94. package/plugins/cursor-pbr/skills/shared/config-loading.md +103 -0
  95. package/plugins/cursor-pbr/skills/shared/context-budget.md +41 -0
  96. package/plugins/cursor-pbr/skills/shared/context-loader-task.md +87 -0
  97. package/plugins/cursor-pbr/skills/shared/digest-select.md +80 -0
  98. package/plugins/cursor-pbr/skills/shared/domain-probes.md +126 -0
  99. package/plugins/cursor-pbr/skills/shared/error-reporting.md +80 -0
  100. package/plugins/cursor-pbr/skills/shared/gate-prompts.md +389 -0
  101. package/plugins/cursor-pbr/skills/shared/phase-argument-parsing.md +46 -0
  102. package/plugins/cursor-pbr/skills/shared/progress-display.md +54 -0
  103. package/plugins/cursor-pbr/skills/shared/revision-loop.md +82 -0
  104. package/plugins/cursor-pbr/skills/shared/state-loading.md +63 -0
  105. package/plugins/cursor-pbr/skills/shared/state-update.md +162 -0
  106. package/plugins/cursor-pbr/skills/shared/universal-anti-patterns.md +34 -0
  107. package/plugins/cursor-pbr/skills/status/SKILL.md +362 -0
  108. package/plugins/cursor-pbr/skills/todo/SKILL.md +195 -0
  109. package/plugins/cursor-pbr/templates/CONTEXT.md.tmpl +53 -0
  110. package/plugins/cursor-pbr/templates/INTEGRATION-REPORT.md.tmpl +152 -0
  111. package/plugins/cursor-pbr/templates/RESEARCH-SUMMARY.md.tmpl +98 -0
  112. package/plugins/cursor-pbr/templates/ROADMAP.md.tmpl +41 -0
  113. package/plugins/cursor-pbr/templates/SUMMARY.md.tmpl +82 -0
  114. package/plugins/cursor-pbr/templates/VERIFICATION-DETAIL.md.tmpl +117 -0
  115. package/plugins/cursor-pbr/templates/continue-here.md.tmpl +74 -0
  116. package/plugins/cursor-pbr/templates/prompt-partials/phase-project-context.md.tmpl +38 -0
  117. package/plugins/pbr/agents/codebase-mapper.md +41 -206
  118. package/plugins/pbr/agents/debugger.md +65 -171
  119. package/plugins/pbr/agents/executor.md +90 -275
  120. package/plugins/pbr/agents/general.md +27 -97
  121. package/plugins/pbr/agents/integration-checker.md +35 -112
  122. package/plugins/pbr/agents/plan-checker.md +71 -164
  123. package/plugins/pbr/agents/planner.md +75 -246
  124. package/plugins/pbr/agents/researcher.md +63 -255
  125. package/plugins/pbr/agents/synthesizer.md +49 -174
  126. package/plugins/pbr/agents/verifier.md +75 -366
  127. package/plugins/pbr/hooks/hooks.json +14 -10
  128. package/plugins/pbr/scripts/auto-continue.js +20 -4
  129. package/plugins/pbr/scripts/check-dangerous-commands.js +1 -1
  130. package/plugins/pbr/scripts/check-phase-boundary.js +1 -1
  131. package/plugins/pbr/scripts/check-plan-format.js +3 -3
  132. package/plugins/pbr/scripts/check-roadmap-sync.js +3 -3
  133. package/plugins/pbr/scripts/check-skill-workflow.js +1 -1
  134. package/plugins/pbr/scripts/check-state-sync.js +2 -2
  135. package/plugins/pbr/scripts/check-subagent-output.js +1 -1
  136. package/plugins/pbr/scripts/check-summary-gate.js +198 -0
  137. package/plugins/pbr/scripts/context-budget-check.js +1 -1
  138. package/plugins/pbr/scripts/event-handler.js +2 -2
  139. package/plugins/pbr/scripts/event-logger.js +1 -1
  140. package/plugins/pbr/scripts/log-subagent.js +1 -1
  141. package/plugins/pbr/scripts/pbr-tools.js +1 -1
  142. package/plugins/pbr/scripts/post-write-dispatch.js +1 -1
  143. package/plugins/pbr/scripts/post-write-quality.js +1 -1
  144. package/plugins/pbr/scripts/pre-bash-dispatch.js +1 -1
  145. package/plugins/pbr/scripts/pre-write-dispatch.js +16 -3
  146. package/plugins/pbr/scripts/session-cleanup.js +1 -1
  147. package/plugins/pbr/scripts/status-line.js +1 -1
  148. package/plugins/pbr/scripts/suggest-compact.js +1 -1
  149. package/plugins/pbr/scripts/task-completed.js +1 -1
  150. package/plugins/pbr/scripts/track-context-budget.js +11 -6
  151. package/plugins/pbr/scripts/validate-commit.js +1 -1
  152. package/plugins/pbr/scripts/validate-task.js +1 -1
@@ -0,0 +1,193 @@
1
+ ---
2
+ name: verifier
3
+ description: "Goal-backward phase verification. Checks codebase reality against phase goals - existence, substantiveness, and wiring of all deliverables."
4
+ model: sonnet
5
+ readonly: true
6
+ ---
7
+
8
+ # Plan-Build-Run Verifier
9
+
10
+ You are **verifier**, the phase verification agent for the Plan-Build-Run development system. You verify that executed plans actually achieved their stated goals by inspecting the real codebase. You are the quality gate between execution and phase completion.
11
+
12
+ ## Core Principle
13
+
14
+ **Task completion does NOT equal goal achievement.** You verify the GOAL, not the tasks. You check the CODEBASE, not the SUMMARY.md claims. Trust nothing — verify everything.
15
+
16
+ ## Critical Constraints
17
+
18
+ ### Read-Only Agent
19
+
20
+ You have **NO Write or Edit tools**. You CANNOT fix issues — you REPORT them. The planner creates gap-closure plans; the executor fixes them.
21
+
22
+ ### Evidence-Based Verification
23
+
24
+ Every claim must be backed by evidence. "I checked and it exists" is not evidence. File path, line count, exported symbols — that IS evidence.
25
+
26
+ ---
27
+
28
+ ## The 10-Step Verification Process
29
+
30
+ ### Step 1: Check Previous Verification (Always)
31
+
32
+ Look for an existing `VERIFICATION.md` in the phase directory.
33
+
34
+ - If it exists with `status: gaps_found` → **RE-VERIFICATION** mode
35
+ - Read the previous report, extract gaps and `overrides` list from frontmatter
36
+ - Focus on gaps NOT overridden; run full scan for regressions
37
+ - Increment the `attempt` counter by 1
38
+ - If it doesn't exist → Full verification mode (attempt: 1)
39
+
40
+ **Override handling:** Must-haves in the `overrides` list → mark `PASSED (override)`, count toward `must_haves_passed`. Preserve overrides in new frontmatter.
41
+
42
+ ### Step 2: Load Context (Always)
43
+
44
+ Use `pbr-tools.js` CLI to efficiently load phase data (saves ~500-800 tokens vs. manual parsing):
45
+ ```bash
46
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js must-haves {phase_number}
47
+ node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js phase-info {phase_number}
48
+ ```
49
+
50
+ Stop and report error if pbr-tools CLI is unavailable. Also read CONTEXT.md for locked decisions and deferred ideas, and ROADMAP.md for the phase goal and dependencies.
51
+
52
+ ### Step 3: Establish Must-Haves (Full Verification Only)
53
+
54
+ **Must-haves are the PRIMARY verification input.** Collect from ALL plan files' `must_haves` frontmatter — three categories:
55
+ - `truths`: Observable conditions (can this behavior be observed?)
56
+ - `artifacts`: Files/exports that must exist, be substantive, and not be stubs
57
+ - `key_links`: Connections that must be wired between components
58
+
59
+ If plans lack explicit must-haves, derive them goal-backward from ROADMAP.md: what must be TRUE → what must EXIST → what must be CONNECTED.
60
+
61
+ Output: A numbered list of every must-have to verify.
62
+
63
+ ### Step 4: Verify Observable Truths (Always)
64
+
65
+ For each truth: determine verification method, execute it, record evidence, classify as:
66
+ - **VERIFIED**: Truth holds, with evidence
67
+ - **FAILED**: Truth does not hold, with evidence of why
68
+ - **PARTIAL**: Truth partially holds
69
+ - **HUMAN_NEEDED**: Cannot verify programmatically
70
+
71
+ ### Step 5: Verify Artifacts (Always — depth varies in re-verification)
72
+
73
+ For EVERY artifact, perform three levels of verification:
74
+
75
+ #### Level 1: Existence
76
+ Does the artifact exist on disk? Check file/directory existence and expected exports/functions. Result: `EXISTS` or `MISSING`. If MISSING, mark FAILED Level 1 and stop.
77
+
78
+ #### Level 2: Substantive (Not a Stub)
79
+ Check for stub indicators: TODO/FIXME comments, empty function bodies, trivial returns, not-implemented errors, placeholder content, suspiciously low line counts. Result: `SUBSTANTIVE`, `STUB`, or `PARTIAL`.
80
+
81
+ #### Level 3: Wired (Connected to the System)
82
+ Verify the artifact is imported AND used by other parts of the system (functions called, components rendered, middleware applied, routes registered). Result: `WIRED`, `IMPORTED-UNUSED`, or `ORPHANED`.
83
+
84
+ #### Artifact Outcome Decision Table
85
+
86
+ | Exists | Substantive | Wired | Status |
87
+ |--------|-------------|-------|--------|
88
+ | No | -- | -- | MISSING |
89
+ | Yes | No | -- | STUB |
90
+ | Yes | Yes | No | UNWIRED |
91
+ | Yes | Yes | Yes | PASSED |
92
+
93
+ ### Step 6: Verify Key Links (Always)
94
+
95
+ For each key_link: identify source and target components, verify the import path resolves, verify the imported symbol is actually called/used, and verify call signatures match. Watch for: wrong import paths, imported-but-never-called symbols, defined-but-never-applied middleware, registered-but-never-triggered event handlers.
96
+
97
+ ### Step 7: Check Requirements Coverage (Always)
98
+
99
+ Cross-reference all must-haves against verification results in a table:
100
+
101
+ ```markdown
102
+ | # | Must-Have | Type | L1 (Exists) | L2 (Substantive) | L3 (Wired) | Status |
103
+ |---|----------|------|-------------|-------------------|------------|--------|
104
+ | 1 | {description} | truth | - | - | - | VERIFIED/FAILED |
105
+ | 2 | {description} | artifact | YES/NO | YES/STUB/PARTIAL | WIRED/ORPHANED | PASS/FAIL |
106
+ | 3 | {description} | key_link | - | - | YES/NO | PASS/FAIL |
107
+ ```
108
+
109
+ ### Step 8: Scan for Anti-Patterns (Full Verification Only)
110
+
111
+ Scan for: dead code/unused imports, console.log in production code, hardcoded secrets, TODO/FIXME comments (should be in deferred), disabled/skipped tests, empty catch blocks, committed .env files. Report blockers only.
112
+
113
+ ### Step 9: Identify Human Verification Needs (Full Verification Only)
114
+
115
+ List items that cannot be verified programmatically (visual/UI, UX flows, third-party integrations, performance, accessibility, security). For each, provide: what to check, how to test, expected behavior, and which must-have it relates to.
116
+
117
+ ### Step 10: Determine Overall Status (Always)
118
+
119
+ | Status | Condition |
120
+ |--------|-----------|
121
+ | `passed` | ALL must-haves verified at ALL levels. No blocker gaps. Anti-pattern scan clean or minor only. |
122
+ | `gaps_found` | One or more must-haves FAILED at any level. |
123
+ | `human_needed` | All automated checks pass BUT critical items require human verification. |
124
+
125
+ **Priority**: `gaps_found` > `human_needed` > `passed`. If ANY must-have fails, status is `gaps_found`.
126
+
127
+ ---
128
+
129
+ ## Output Format
130
+
131
+ Write to `.planning/phases/{phase_dir}/VERIFICATION.md`. Read the template from `templates/VERIFICATION-DETAIL.md.tmpl` (relative to `plugins/pbr/`). The template defines: YAML frontmatter (status, scores, gaps), verification tables (truths, artifacts, key links), gap details, human verification items, anti-pattern scan, regressions (re-verification only), and summary.
132
+
133
+ ---
134
+
135
+ ## Re-Verification Mode
136
+
137
+ When a previous VERIFICATION.md exists with `status: gaps_found`:
138
+
139
+ 1. Read previous report and extract gaps
140
+ 2. Re-run verification checks on each previous gap — classify as CLOSED or still OPEN
141
+ 3. Run full scan (all 10 steps) to catch regressions
142
+ 4. Compare current vs. previous results
143
+
144
+ **Selective depth**: Previously-PASSED items get Level 1 only (existence check for regression detection). Previously-FAILED items get full 3-level verification.
145
+
146
+ **Regression detection**: A previously-PASSED item that now FAILS is a regression — automatically HIGH priority. Gap statuses annotated as `[PREVIOUSLY KNOWN]`, `[NEW]`, or `[REGRESSION]`.
147
+
148
+ Output includes `is_re_verification: true` in frontmatter and a regressions section.
149
+
150
+ ---
151
+
152
+ ## Technology-Aware Stub Detection
153
+
154
+ Read `references/stub-patterns.md` for stub detection patterns by technology. Read the project's stack from `.planning/codebase/STACK.md` or `.planning/research/STACK.md` to determine which patterns to apply. If no stack file exists, use universal patterns only.
155
+
156
+ ---
157
+
158
+ ## Budget Management
159
+
160
+ **Output budget**: VERIFICATION.md ≤ 1,200 tokens (hard limit 1,800). Console output: final verdict + gap count only. One evidence row per must-have. Anti-pattern scan: blockers only. Omit verbose evidence; file path + line count suffices for existence checks.
161
+
162
+ **Context budget**: Stop before 50% usage. Write findings incrementally. Prioritize: must-haves > key links > anti-patterns > human items. Skip anti-pattern scan if needed. Record any items you could not check in a "Not Verified" section.
163
+
164
+ ---
165
+
166
+ ## Anti-Patterns
167
+
168
+ ### Universal Anti-Patterns
169
+ 1. DO NOT guess or assume — read actual files for evidence
170
+ 2. DO NOT trust SUMMARY.md or other agent claims without verifying codebase
171
+ 3. DO NOT use vague language ("seems okay", "looks fine") — be specific
172
+ 4. DO NOT present training knowledge as verified fact
173
+ 5. DO NOT exceed your role — recommend the correct agent if task doesn't fit
174
+ 6. DO NOT modify files outside your designated scope
175
+ 7. DO NOT add features or scope not requested — log to deferred
176
+ 8. DO NOT skip steps in your protocol, even for "obvious" cases
177
+ 9. DO NOT contradict locked decisions in CONTEXT.md
178
+ 10. DO NOT implement deferred ideas from CONTEXT.md
179
+ 11. DO NOT consume more than 50% context before producing output — write incrementally
180
+ 12. DO NOT read agent .md files from agents/ — they're auto-loaded via subagent_type
181
+
182
+ ### Verifier-Specific Anti-Patterns
183
+ 1. DO NOT trust SUMMARY.md claims without verifying the actual codebase
184
+ 2. DO NOT attempt to fix issues — you have no Write/Edit tools and that is intentional
185
+ 3. DO NOT mark stubs as SUBSTANTIVE — if it has a TODO, it's a stub
186
+ 4. DO NOT mark orphaned code as WIRED — if nothing imports it, it's orphaned
187
+ 5. DO NOT skip Level 2 or Level 3 checks — existence alone is insufficient
188
+ 6. DO NOT verify against the plan tasks — verify against the MUST-HAVES
189
+ 7. DO NOT assume passing tests mean the feature works end-to-end
190
+ 8. DO NOT ignore anti-pattern scan results just because must-haves pass
191
+ 9. DO NOT give PASSED status if ANY must-have fails at ANY level
192
+ 10. DO NOT count deferred items as gaps — they are intentionally not implemented
193
+ 11. DO NOT be lenient — your job is to find problems, not to be encouraging
File without changes
@@ -0,0 +1,21 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
2
+ <defs>
3
+ <linearGradient id="g1" x1="0%" y1="0%" x2="100%" y2="100%">
4
+ <stop offset="0%" stop-color="#0F766E"/>
5
+ <stop offset="100%" stop-color="#0EA5E9"/>
6
+ </linearGradient>
7
+ </defs>
8
+ <!-- Plan: circle -->
9
+ <circle cx="12" cy="32" r="9" fill="#0F766E" opacity="0.9"/>
10
+ <!-- Build: square -->
11
+ <rect x="23" y="23" width="18" height="18" rx="3" fill="#0D9488" opacity="0.9"/>
12
+ <!-- Run: triangle -->
13
+ <polygon points="52,23 62,32 52,41" fill="#0EA5E9" opacity="0.9"/>
14
+ <!-- Connecting lines -->
15
+ <line x1="21" y1="32" x2="23" y2="32" stroke="#94A3B8" stroke-width="1.5"/>
16
+ <line x1="41" y1="32" x2="52" y2="32" stroke="#94A3B8" stroke-width="1.5"/>
17
+ <!-- Labels -->
18
+ <text x="12" y="50" text-anchor="middle" font-family="system-ui,sans-serif" font-size="5" fill="#475569">P</text>
19
+ <text x="32" y="50" text-anchor="middle" font-family="system-ui,sans-serif" font-size="5" fill="#475569">B</text>
20
+ <text x="55" y="50" text-anchor="middle" font-family="system-ui,sans-serif" font-size="5" fill="#475569">R</text>
21
+ </svg>
@@ -0,0 +1,193 @@
1
+ {
2
+ "$schema": "../../pbr/scripts/hooks-schema.json",
3
+ "description": "Plan-Build-Run workflow hooks for Cursor plugin — delegates to shared scripts in plugins/pbr/scripts/",
4
+ "hooks": {
5
+ "SessionStart": [
6
+ {
7
+ "hooks": [
8
+ {
9
+ "type": "command",
10
+ "command": "node -e \"var r=process.env.CLAUDE_PLUGIN_ROOT||'',m=r.match(/^\\/([a-zA-Z])\\/(.*)/);if(m)r=m[1]+String.fromCharCode(58)+String.fromCharCode(92)+m[2];require(require('path').resolve(r,'..','pbr','scripts','run-hook.js'))\" progress-tracker.js",
11
+ "statusMessage": "Loading project state..."
12
+ }
13
+ ]
14
+ }
15
+ ],
16
+ "PostToolUse": [
17
+ {
18
+ "matcher": "Write|Edit",
19
+ "hooks": [
20
+ {
21
+ "type": "command",
22
+ "command": "node -e \"var r=process.env.CLAUDE_PLUGIN_ROOT||'',m=r.match(/^\\/([a-zA-Z])\\/(.*)/);if(m)r=m[1]+String.fromCharCode(58)+String.fromCharCode(92)+m[2];require(require('path').resolve(r,'..','pbr','scripts','run-hook.js'))\" post-write-dispatch.js",
23
+ "statusMessage": "Validating write output..."
24
+ }
25
+ ]
26
+ },
27
+ {
28
+ "matcher": "Write|Edit",
29
+ "hooks": [
30
+ {
31
+ "type": "command",
32
+ "command": "node -e \"var r=process.env.CLAUDE_PLUGIN_ROOT||'',m=r.match(/^\\/([a-zA-Z])\\/(.*)/);if(m)r=m[1]+String.fromCharCode(58)+String.fromCharCode(92)+m[2];require(require('path').resolve(r,'..','pbr','scripts','run-hook.js'))\" post-write-quality.js",
33
+ "statusMessage": "Running quality checks..."
34
+ }
35
+ ]
36
+ },
37
+ {
38
+ "matcher": "Task",
39
+ "hooks": [
40
+ {
41
+ "type": "command",
42
+ "command": "node -e \"var r=process.env.CLAUDE_PLUGIN_ROOT||'',m=r.match(/^\\/([a-zA-Z])\\/(.*)/);if(m)r=m[1]+String.fromCharCode(58)+String.fromCharCode(92)+m[2];require(require('path').resolve(r,'..','pbr','scripts','run-hook.js'))\" check-subagent-output.js",
43
+ "statusMessage": "Validating agent output..."
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "matcher": "Write|Edit",
49
+ "hooks": [
50
+ {
51
+ "type": "command",
52
+ "command": "node -e \"var r=process.env.CLAUDE_PLUGIN_ROOT||'',m=r.match(/^\\/([a-zA-Z])\\/(.*)/);if(m)r=m[1]+String.fromCharCode(58)+String.fromCharCode(92)+m[2];require(require('path').resolve(r,'..','pbr','scripts','run-hook.js'))\" suggest-compact.js",
53
+ "statusMessage": "Checking context budget..."
54
+ }
55
+ ]
56
+ },
57
+ {
58
+ "matcher": "Read",
59
+ "hooks": [
60
+ {
61
+ "type": "command",
62
+ "command": "node -e \"var r=process.env.CLAUDE_PLUGIN_ROOT||'',m=r.match(/^\\/([a-zA-Z])\\/(.*)/);if(m)r=m[1]+String.fromCharCode(58)+String.fromCharCode(92)+m[2];require(require('path').resolve(r,'..','pbr','scripts','run-hook.js'))\" track-context-budget.js",
63
+ "statusMessage": "Tracking context budget..."
64
+ }
65
+ ]
66
+ }
67
+ ],
68
+ "PostToolUseFailure": [
69
+ {
70
+ "hooks": [
71
+ {
72
+ "type": "command",
73
+ "command": "node -e \"var r=process.env.CLAUDE_PLUGIN_ROOT||'',m=r.match(/^\\/([a-zA-Z])\\/(.*)/);if(m)r=m[1]+String.fromCharCode(58)+String.fromCharCode(92)+m[2];require(require('path').resolve(r,'..','pbr','scripts','run-hook.js'))\" log-tool-failure.js",
74
+ "statusMessage": "Logging tool failure..."
75
+ }
76
+ ]
77
+ }
78
+ ],
79
+ "PreToolUse": [
80
+ {
81
+ "matcher": "Bash",
82
+ "hooks": [
83
+ {
84
+ "type": "command",
85
+ "command": "node -e \"var r=process.env.CLAUDE_PLUGIN_ROOT||'',m=r.match(/^\\/([a-zA-Z])\\/(.*)/);if(m)r=m[1]+String.fromCharCode(58)+String.fromCharCode(92)+m[2];require(require('path').resolve(r,'..','pbr','scripts','run-hook.js'))\" pre-bash-dispatch.js",
86
+ "statusMessage": "Validating Bash command..."
87
+ }
88
+ ]
89
+ },
90
+ {
91
+ "matcher": "Write|Edit",
92
+ "hooks": [
93
+ {
94
+ "type": "command",
95
+ "command": "node -e \"var r=process.env.CLAUDE_PLUGIN_ROOT||'',m=r.match(/^\\/([a-zA-Z])\\/(.*)/);if(m)r=m[1]+String.fromCharCode(58)+String.fromCharCode(92)+m[2];require(require('path').resolve(r,'..','pbr','scripts','run-hook.js'))\" pre-write-dispatch.js",
96
+ "statusMessage": "Checking write rules..."
97
+ }
98
+ ]
99
+ },
100
+ {
101
+ "matcher": "Task",
102
+ "hooks": [
103
+ {
104
+ "type": "command",
105
+ "command": "node -e \"var r=process.env.CLAUDE_PLUGIN_ROOT||'',m=r.match(/^\\/([a-zA-Z])\\/(.*)/);if(m)r=m[1]+String.fromCharCode(58)+String.fromCharCode(92)+m[2];require(require('path').resolve(r,'..','pbr','scripts','run-hook.js'))\" validate-task.js",
106
+ "statusMessage": "Validating Task() call..."
107
+ }
108
+ ]
109
+ }
110
+ ],
111
+ "PreCompact": [
112
+ {
113
+ "hooks": [
114
+ {
115
+ "type": "command",
116
+ "command": "node -e \"var r=process.env.CLAUDE_PLUGIN_ROOT||'',m=r.match(/^\\/([a-zA-Z])\\/(.*)/);if(m)r=m[1]+String.fromCharCode(58)+String.fromCharCode(92)+m[2];require(require('path').resolve(r,'..','pbr','scripts','run-hook.js'))\" context-budget-check.js",
117
+ "statusMessage": "Preserving state before compaction..."
118
+ }
119
+ ]
120
+ }
121
+ ],
122
+ "Stop": [
123
+ {
124
+ "hooks": [
125
+ {
126
+ "type": "command",
127
+ "command": "node -e \"var r=process.env.CLAUDE_PLUGIN_ROOT||'',m=r.match(/^\\/([a-zA-Z])\\/(.*)/);if(m)r=m[1]+String.fromCharCode(58)+String.fromCharCode(92)+m[2];require(require('path').resolve(r,'..','pbr','scripts','run-hook.js'))\" auto-continue.js",
128
+ "statusMessage": "Checking for auto-continue..."
129
+ }
130
+ ]
131
+ }
132
+ ],
133
+ "SubagentStart": [
134
+ {
135
+ "hooks": [
136
+ {
137
+ "type": "command",
138
+ "command": "node -e \"var r=process.env.CLAUDE_PLUGIN_ROOT||'',m=r.match(/^\\/([a-zA-Z])\\/(.*)/);if(m)r=m[1]+String.fromCharCode(58)+String.fromCharCode(92)+m[2];require(require('path').resolve(r,'..','pbr','scripts','run-hook.js'))\" log-subagent.js start",
139
+ "statusMessage": "Logging agent spawn..."
140
+ }
141
+ ]
142
+ }
143
+ ],
144
+ "SubagentStop": [
145
+ {
146
+ "hooks": [
147
+ {
148
+ "type": "command",
149
+ "command": "node -e \"var r=process.env.CLAUDE_PLUGIN_ROOT||'',m=r.match(/^\\/([a-zA-Z])\\/(.*)/);if(m)r=m[1]+String.fromCharCode(58)+String.fromCharCode(92)+m[2];require(require('path').resolve(r,'..','pbr','scripts','run-hook.js'))\" log-subagent.js stop",
150
+ "statusMessage": "Logging agent completion...",
151
+ "async": true,
152
+ "timeout": 30
153
+ }
154
+ ]
155
+ },
156
+ {
157
+ "hooks": [
158
+ {
159
+ "type": "command",
160
+ "command": "node -e \"var r=process.env.CLAUDE_PLUGIN_ROOT||'',m=r.match(/^\\/([a-zA-Z])\\/(.*)/);if(m)r=m[1]+String.fromCharCode(58)+String.fromCharCode(92)+m[2];require(require('path').resolve(r,'..','pbr','scripts','run-hook.js'))\" event-handler.js",
161
+ "statusMessage": "Checking for auto-verification...",
162
+ "async": true,
163
+ "timeout": 10
164
+ }
165
+ ]
166
+ }
167
+ ],
168
+ "TaskCompleted": [
169
+ {
170
+ "hooks": [
171
+ {
172
+ "type": "command",
173
+ "command": "node -e \"var r=process.env.CLAUDE_PLUGIN_ROOT||'',m=r.match(/^\\/([a-zA-Z])\\/(.*)/);if(m)r=m[1]+String.fromCharCode(58)+String.fromCharCode(92)+m[2];require(require('path').resolve(r,'..','pbr','scripts','run-hook.js'))\" task-completed.js",
174
+ "statusMessage": "Processing task completion..."
175
+ }
176
+ ]
177
+ }
178
+ ],
179
+ "SessionEnd": [
180
+ {
181
+ "hooks": [
182
+ {
183
+ "type": "command",
184
+ "command": "node -e \"var r=process.env.CLAUDE_PLUGIN_ROOT||'',m=r.match(/^\\/([a-zA-Z])\\/(.*)/);if(m)r=m[1]+String.fromCharCode(58)+String.fromCharCode(92)+m[2];require(require('path').resolve(r,'..','pbr','scripts','run-hook.js'))\" session-cleanup.js",
185
+ "statusMessage": "Cleaning up session...",
186
+ "async": true,
187
+ "timeout": 30
188
+ }
189
+ ]
190
+ }
191
+ ]
192
+ }
193
+ }
@@ -0,0 +1,25 @@
1
+ <!-- canonical: ../../pbr/references/agent-anti-patterns.md -->
2
+ # Universal Agent Anti-Patterns
3
+
4
+ These anti-patterns apply to ALL Plan-Build-Run agents. Each agent also has role-specific anti-patterns defined in its own agent file.
5
+
6
+ ## Evidence and Verification
7
+
8
+ 1. **DO NOT** guess, assume, or rely on cached knowledge when codebase evidence is available. Read the actual files.
9
+ 2. **DO NOT** trust claims in SUMMARY.md, PLAN.md, or other agent outputs without verifying against the real codebase.
10
+ 3. **DO NOT** use subjective or vague language ("seems okay", "looks fine", "probably works"). Be specific and evidence-based.
11
+ 4. **DO NOT** present training knowledge as verified fact. Flag unverified claims explicitly.
12
+
13
+ ## Scope and Boundaries
14
+
15
+ 5. **DO NOT** exceed your role. If a task belongs to another agent, stop and recommend the correct agent.
16
+ 6. **DO NOT** modify files outside your designated scope. Read-only agents must not attempt fixes. Executors must not modify plans.
17
+ 7. **DO NOT** add features, ideas, or scope not requested. Log scope creep to deferred items instead.
18
+ 8. **DO NOT** skip steps in your verification or execution protocol, even for "obvious" cases.
19
+
20
+ ## Context and State
21
+
22
+ 9. **DO NOT** contradict locked decisions in CONTEXT.md. These are non-negotiable.
23
+ 10. **DO NOT** implement deferred ideas from CONTEXT.md. They do not exist for your purposes.
24
+ 11. **DO NOT** consume more than 50% of your context window before producing output. Write incrementally.
25
+ 12. **DO NOT** read agent definition files from `agents/*.md`. Agent definitions are auto-loaded by Claude Code via `subagent_type`. Reading them wastes context.
@@ -0,0 +1,135 @@
1
+ <!-- canonical: ../../pbr/references/agent-interactions.md -->
2
+ # Agent Interaction Map
3
+
4
+ This document shows how Plan-Build-Run agents communicate through files on disk. Agents never message each other directly -- they read and write shared files in `.planning/`.
5
+
6
+ ## Interaction Graph
7
+
8
+ ```
9
+ User / Orchestrator
10
+ | ^
11
+ v |
12
+ +--------------+ |
13
+ | researcher |---+---> planner
14
+ +--------------+ | ^
15
+ | v |
16
+ +--------------+ +--------------+
17
+ | synthesizer | | plan-checker |
18
+ +--------------+ +--------------+
19
+ |
20
+ v
21
+ +-----------+
22
+ | executor |
23
+ +-----------+
24
+ |
25
+ v
26
+ +-----------+
27
+ | verifier |----> planner (gap closure)
28
+ +-----------+
29
+ |
30
+ v
31
+ +--------------------+
32
+ | integration-checker|
33
+ +--------------------+
34
+ ```
35
+
36
+ ## Per-Agent Interaction Details
37
+
38
+ ### researcher
39
+
40
+ | Direction | Agent/Role | What |
41
+ |-----------|-----------|------|
42
+ | Receives from | User/Orchestrator | Research topics, CONTEXT.md constraints, phase goals |
43
+ | Produces for | planner | Research documents with technology details and recommendations |
44
+ | Produces for | synthesizer | Research documents to be combined |
45
+ | Produces for | User | Direct reading for decision-making |
46
+
47
+ ### synthesizer
48
+
49
+ | Direction | Agent/Role | What |
50
+ |-----------|-----------|------|
51
+ | Receives from | researcher | Research documents to synthesize |
52
+ | Receives from | Orchestrator | Paths to research documents, synthesis request |
53
+ | Produces for | planner | SUMMARY.md as consolidated research input for planning |
54
+ | Produces for | User | High-level project/phase research overview |
55
+
56
+ ### planner
57
+
58
+ | Direction | Agent/Role | What |
59
+ |-----------|-----------|------|
60
+ | Receives from | researcher | Research documents with technology details and recommendations |
61
+ | Receives from | plan-checker | Issue reports requiring plan revision |
62
+ | Receives from | verifier | VERIFICATION.md reports requiring gap closure plans |
63
+ | Receives from | User/Orchestrator | Phase goals, CONTEXT.md, planning requests |
64
+ | Produces for | plan-checker | Plan files for quality verification |
65
+ | Produces for | executor | Plan files for execution |
66
+ | Produces for | verifier | Must-have definitions for verification (embedded in plan frontmatter) |
67
+
68
+ ### plan-checker
69
+
70
+ | Direction | Agent/Role | What |
71
+ |-----------|-----------|------|
72
+ | Receives from | Orchestrator/User | Plan files to check, phase context |
73
+ | Receives from | planner | Newly created or revised plan files |
74
+ | Produces for | planner | Issue reports for revision |
75
+ | Produces for | Orchestrator/User | Pass/fail decision on plan quality |
76
+
77
+ ### executor
78
+
79
+ | Direction | Agent/Role | What |
80
+ |-----------|-----------|------|
81
+ | Receives from | Orchestrator | Plan files to execute, continuation instructions |
82
+ | Receives from | planner | The plans themselves (indirectly, via files) |
83
+ | Produces for | verifier | SUMMARY.md for verification, committed code for inspection |
84
+ | Produces for | Orchestrator | Checkpoint responses, completion status |
85
+ | Produces for | planner | Deferred ideas (in SUMMARY.md) for future planning |
86
+
87
+ ### verifier
88
+
89
+ | Direction | Agent/Role | What |
90
+ |-----------|-----------|------|
91
+ | Receives from | Orchestrator | Phase to verify, timing trigger |
92
+ | Receives from | executor | Completed work (via codebase and SUMMARY.md) |
93
+ | Receives from | Previous VERIFICATION.md | Gaps to re-check (in re-verification mode) |
94
+ | Produces for | planner | Gap list for gap-closure planning (via VERIFICATION.md) |
95
+ | Produces for | Orchestrator | Phase status (passed/gaps_found/human_needed) |
96
+ | Produces for | User | Human verification items with specific test instructions |
97
+
98
+ ### integration-checker
99
+
100
+ | Direction | Agent/Role | What |
101
+ |-----------|-----------|------|
102
+ | Receives from | Orchestrator | Phases to check, trigger event (milestone/review) |
103
+ | Receives from | verifier | Phase-level verification reports (for context on per-phase status) |
104
+ | Produces for | planner | Integration gap list for cross-phase fix plans |
105
+ | Produces for | Orchestrator | Integration status for milestone decisions |
106
+ | Produces for | User | Integration health overview and security issues |
107
+
108
+ ### debugger
109
+
110
+ | Direction | Agent/Role | What |
111
+ |-----------|-----------|------|
112
+ | Receives from | Orchestrator/User | Bug reports, symptoms, reproduction steps |
113
+ | Receives from | executor | Errors encountered during execution (via checkpoint responses) |
114
+ | Receives from | verifier | Issues discovered during verification |
115
+ | Produces for | Orchestrator/User | Root cause analysis, fix commits, checkpoint requests |
116
+ | Produces for | planner | Findings requiring architectural changes |
117
+ | Produces for | executor | Simple fix instructions for executor to apply |
118
+
119
+ ### codebase-mapper
120
+
121
+ | Direction | Agent/Role | What |
122
+ |-----------|-----------|------|
123
+ | Receives from | Orchestrator/User | Focus area to analyze, project path |
124
+ | Receives from | researcher | May be invoked alongside researcher for new projects |
125
+ | Produces for | planner | STACK.md, ARCHITECTURE.md, STRUCTURE.md for informed planning |
126
+ | Produces for | executor | CONVENTIONS.md for code style, TESTING.md for test patterns |
127
+ | Produces for | verifier | All documents as reference for what "correct" looks like |
128
+ | Produces for | User | Direct reading for project understanding |
129
+
130
+ ### general
131
+
132
+ | Direction | Agent/Role | What |
133
+ |-----------|-----------|------|
134
+ | Receives from | Orchestrator/User | Ad-hoc task instructions |
135
+ | Produces for | Orchestrator/User | Task output (files, formatting, config changes) |
@@ -0,0 +1,55 @@
1
+ <!-- canonical: ../../pbr/references/agent-teams.md -->
2
+ # Agent Teams Reference
3
+
4
+ Agent Teams enable parallel specialist perspectives for critical phases. Teams are off by default.
5
+
6
+ ## Activation
7
+
8
+ - **Global**: Set `parallelization.use_teams: true` in `.planning/config.json`
9
+ - **Per-invocation**: Use `--teams` flag on `/pbr:plan`, `/pbr:review`, or `/pbr:build --team`
10
+ - Per-invocation flag takes precedence over global config
11
+
12
+ ## Planning Teams
13
+
14
+ When `/pbr:plan <N> --teams` is invoked, three specialist agents run in parallel:
15
+
16
+ | Role | Agent | Focus | Output File |
17
+ |------|-------|-------|-------------|
18
+ | Architect | planner | Structure, dependencies, wave ordering, file boundaries | `.planning/phases/{NN}/team/architect-PLAN.md` |
19
+ | Security Reviewer | planner | Auth, input validation, secrets handling, permission checks | `.planning/phases/{NN}/team/security-PLAN.md` |
20
+ | Test Designer | planner | Test strategy, coverage targets, edge cases, TDD candidates | `.planning/phases/{NN}/team/test-PLAN.md` |
21
+
22
+ All three use the `planner` agent with different prompts. The orchestrator includes the role and focus in the Task() spawn prompt.
23
+
24
+ After all three complete, the synthesizer agent reads all team outputs and produces the final unified PLAN.md files.
25
+
26
+ ## Review Teams
27
+
28
+ When `/pbr:review <N>` runs with teams enabled, three review agents run in parallel:
29
+
30
+ | Role | Agent | Focus | Output File |
31
+ |------|-------|-------|-------------|
32
+ | Functional Reviewer | verifier | Must-haves met, code correctness, completeness | `.planning/phases/{NN}/team/functional-VERIFY.md` |
33
+ | Security Auditor | verifier | Vulnerabilities, auth bypass, injection, secrets exposure | `.planning/phases/{NN}/team/security-VERIFY.md` |
34
+ | Performance Analyst | verifier | N+1 queries, memory leaks, bundle size, unnecessary re-renders | `.planning/phases/{NN}/team/performance-VERIFY.md` |
35
+
36
+ All three use the `verifier` agent with different prompts. The synthesizer combines them into a unified VERIFICATION.md.
37
+
38
+ ## File-Based Coordination
39
+
40
+ Team members write to separate files in a `team/` subdirectory. This avoids file conflicts:
41
+ ```
42
+ .planning/phases/{NN}-{slug}/
43
+ team/
44
+ architect-PLAN.md
45
+ security-PLAN.md
46
+ test-PLAN.md
47
+ ```
48
+
49
+ The synthesizer reads all files in `team/` and produces the final artifact. The `team/` directory is kept for audit purposes but is not read by subsequent skills.
50
+
51
+ ## When to Use Teams
52
+
53
+ - **Recommended**: Security-critical phases, architectural phases, public API design
54
+ - **Not recommended**: Simple refactors, documentation, configuration changes
55
+ - **Cost consideration**: Teams triple the agent spawns. Use only when the additional perspectives justify the cost.