@sienklogic/plan-build-run 2.21.0 → 2.21.1

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 (83) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/CLAUDE.md +2 -2
  3. package/package.json +1 -1
  4. package/plugins/copilot-pbr/agents/codebase-mapper.agent.md +1 -1
  5. package/plugins/copilot-pbr/agents/debugger.agent.md +2 -0
  6. package/plugins/copilot-pbr/agents/executor.agent.md +3 -1
  7. package/plugins/copilot-pbr/agents/general.agent.md +2 -1
  8. package/plugins/copilot-pbr/agents/integration-checker.agent.md +2 -0
  9. package/plugins/copilot-pbr/agents/plan-checker.agent.md +1 -1
  10. package/plugins/copilot-pbr/agents/planner.agent.md +3 -1
  11. package/plugins/copilot-pbr/agents/researcher.agent.md +5 -3
  12. package/plugins/copilot-pbr/agents/synthesizer.agent.md +1 -1
  13. package/plugins/copilot-pbr/agents/verifier.agent.md +3 -3
  14. package/plugins/copilot-pbr/hooks/hooks.json +13 -13
  15. package/plugins/copilot-pbr/plugin.json +1 -1
  16. package/plugins/copilot-pbr/skills/audit/SKILL.md +1 -1
  17. package/plugins/copilot-pbr/skills/build/SKILL.md +4 -5
  18. package/plugins/copilot-pbr/skills/config/SKILL.md +1 -1
  19. package/plugins/copilot-pbr/skills/debug/SKILL.md +1 -1
  20. package/plugins/copilot-pbr/skills/import/SKILL.md +1 -1
  21. package/plugins/copilot-pbr/skills/plan/SKILL.md +1 -1
  22. package/plugins/copilot-pbr/skills/review/SKILL.md +4 -4
  23. package/plugins/copilot-pbr/skills/scan/SKILL.md +4 -4
  24. package/plugins/copilot-pbr/skills/shared/config-loading.md +1 -1
  25. package/plugins/copilot-pbr/skills/shared/context-budget.md +3 -3
  26. package/plugins/copilot-pbr/skills/shared/state-loading.md +1 -1
  27. package/plugins/copilot-pbr/skills/shared/state-update.md +12 -4
  28. package/plugins/copilot-pbr/skills/shared/universal-anti-patterns.md +1 -1
  29. package/plugins/copilot-pbr/templates/ROADMAP.md.tmpl +7 -0
  30. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  31. package/plugins/cursor-pbr/agents/codebase-mapper.md +1 -1
  32. package/plugins/cursor-pbr/agents/debugger.md +2 -0
  33. package/plugins/cursor-pbr/agents/executor.md +3 -1
  34. package/plugins/cursor-pbr/agents/general.md +2 -1
  35. package/plugins/cursor-pbr/agents/integration-checker.md +2 -0
  36. package/plugins/cursor-pbr/agents/plan-checker.md +1 -1
  37. package/plugins/cursor-pbr/agents/planner.md +3 -1
  38. package/plugins/cursor-pbr/agents/researcher.md +5 -3
  39. package/plugins/cursor-pbr/agents/synthesizer.md +1 -1
  40. package/plugins/cursor-pbr/agents/verifier.md +3 -3
  41. package/plugins/cursor-pbr/skills/audit/SKILL.md +1 -1
  42. package/plugins/cursor-pbr/skills/build/SKILL.md +4 -5
  43. package/plugins/cursor-pbr/skills/config/SKILL.md +1 -1
  44. package/plugins/cursor-pbr/skills/debug/SKILL.md +1 -1
  45. package/plugins/cursor-pbr/skills/import/SKILL.md +1 -1
  46. package/plugins/cursor-pbr/skills/plan/SKILL.md +1 -1
  47. package/plugins/cursor-pbr/skills/review/SKILL.md +4 -4
  48. package/plugins/cursor-pbr/skills/scan/SKILL.md +4 -4
  49. package/plugins/cursor-pbr/skills/shared/config-loading.md +1 -1
  50. package/plugins/cursor-pbr/skills/shared/context-budget.md +3 -3
  51. package/plugins/cursor-pbr/skills/shared/state-loading.md +1 -1
  52. package/plugins/cursor-pbr/skills/shared/state-update.md +12 -4
  53. package/plugins/cursor-pbr/skills/shared/universal-anti-patterns.md +1 -1
  54. package/plugins/cursor-pbr/templates/ROADMAP.md.tmpl +7 -0
  55. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
  56. package/plugins/pbr/agents/codebase-mapper.md +1 -1
  57. package/plugins/pbr/agents/debugger.md +2 -0
  58. package/plugins/pbr/agents/executor.md +3 -1
  59. package/plugins/pbr/agents/general.md +2 -1
  60. package/plugins/pbr/agents/integration-checker.md +2 -0
  61. package/plugins/pbr/agents/plan-checker.md +0 -1
  62. package/plugins/pbr/agents/planner.md +2 -1
  63. package/plugins/pbr/agents/researcher.md +2 -0
  64. package/plugins/pbr/agents/synthesizer.md +0 -1
  65. package/plugins/pbr/agents/verifier.md +1 -1
  66. package/plugins/pbr/commands/do.md +5 -0
  67. package/plugins/pbr/scripts/check-phase-boundary.js +2 -8
  68. package/plugins/pbr/scripts/check-plan-format.js +78 -2
  69. package/plugins/pbr/scripts/check-skill-workflow.js +3 -11
  70. package/plugins/pbr/scripts/check-state-sync.js +18 -8
  71. package/plugins/pbr/scripts/check-subagent-output.js +78 -6
  72. package/plugins/pbr/scripts/log-tool-failure.js +1 -4
  73. package/plugins/pbr/scripts/pre-write-dispatch.js +0 -1
  74. package/plugins/pbr/scripts/status-line.js +44 -11
  75. package/plugins/pbr/scripts/validate-commit.js +8 -7
  76. package/plugins/pbr/scripts/validate-skill-args.js +2 -1
  77. package/plugins/pbr/scripts/validate-task.js +0 -5
  78. package/plugins/pbr/skills/build/SKILL.md +4 -5
  79. package/plugins/pbr/skills/health/SKILL.md +0 -2
  80. package/plugins/pbr/skills/plan/SKILL.md +1 -1
  81. package/plugins/pbr/skills/review/SKILL.md +4 -4
  82. package/plugins/pbr/skills/shared/state-update.md +10 -2
  83. package/plugins/pbr/templates/ROADMAP.md.tmpl +2 -0
@@ -51,6 +51,8 @@ All claims must be attributed to a source level. Higher levels override lower le
51
51
 
52
52
  **Attribution rules**: Every factual claim needs a source tag (`[S1]`, `[S2]`, etc.). Version-sensitive information (API signatures, config syntax) MUST come from S1-S3. When citing S2, note the version: `[S2-v14.2]`. Contradictions resolve in favor of higher source level.
53
53
 
54
+ **Offline Fallback**: If web tools are unavailable (air-gapped environment, MCP not configured), rely on local sources: codebase analysis via Glob/Grep, existing documentation, and README files. Assign these S3-S4 confidence levels. Do not attempt WebFetch or WebSearch — note in the output header that external sources were unavailable.
55
+
54
56
  ---
55
57
 
56
58
  ## Confidence Levels
@@ -100,15 +102,15 @@ Before writing output, verify: every claim has source attribution, every recomme
100
102
  ## Output Formats
101
103
 
102
104
  ### Project Research
103
- Read `${CLAUDE_PLUGIN_ROOT}/templates/research-outputs/project-research.md.tmpl` for format.
105
+ Read `${PLUGIN_ROOT}/templates/research-outputs/project-research.md.tmpl` for format.
104
106
  Key sections: User Constraints, Executive Summary, Standard Stack, Architecture Patterns, Common Pitfalls, Code Examples, Integration Points, Coverage Assessment, Open Questions, Sources.
105
107
 
106
108
  ### Phase Research
107
- Read `${CLAUDE_PLUGIN_ROOT}/templates/research-outputs/phase-research.md.tmpl` for format.
109
+ Read `${PLUGIN_ROOT}/templates/research-outputs/phase-research.md.tmpl` for format.
108
110
  Key sections: User Constraints, Phase Goal, Implementation Approach, Dependencies, Pitfalls, Testing Strategy, Coverage Assessment, Sources.
109
111
 
110
112
  ### Synthesis
111
- Read `${CLAUDE_PLUGIN_ROOT}/templates/research-outputs/synthesis.md.tmpl` for format.
113
+ Read `${PLUGIN_ROOT}/templates/research-outputs/synthesis.md.tmpl` for format.
112
114
  Key sections: Executive Summary, Key Findings, Contradictions Resolved, Recommended Approach, Risks and Mitigations, Sources.
113
115
 
114
116
  ### Fallback Format (if templates unreadable)
@@ -53,7 +53,7 @@ Output to `.planning/research/SUMMARY.md` (or specified path).
53
53
 
54
54
  ## Output Format
55
55
 
56
- Read `${CLAUDE_PLUGIN_ROOT}/templates/RESEARCH-SUMMARY.md.tmpl` for the complete output format.
56
+ Read `${PLUGIN_ROOT}/templates/RESEARCH-SUMMARY.md.tmpl` for the complete output format.
57
57
 
58
58
  Key sections: Executive Summary (3-5 sentences), Recommended Stack (table), Architecture Recommendations, Key Patterns, Pitfalls & Warnings, Contradictions Resolved, Open Questions, Sources.
59
59
 
@@ -47,8 +47,8 @@ Look for an existing `VERIFICATION.md` in the phase directory.
47
47
 
48
48
  Use `pbr-tools.js` CLI to efficiently load phase data (saves ~500-800 tokens vs. manual parsing):
49
49
  ```bash
50
- node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js must-haves {phase_number}
51
- node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js phase-info {phase_number}
50
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js must-haves {phase_number}
51
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js phase-info {phase_number}
52
52
  ```
53
53
 
54
54
  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.
@@ -215,7 +215,7 @@ Read `references/stub-patterns.md` for stub detection patterns by technology. Re
215
215
 
216
216
  ### Verifier-Specific Anti-Patterns
217
217
  1. DO NOT trust SUMMARY.md claims without verifying the actual codebase
218
- 2. DO NOT attempt to fix issues — you have no Write/Edit tools and that is intentional
218
+ 2. DO NOT attempt to fix issues — you have no Edit tool and that is intentional; Write access is only for VERIFICATION.md output
219
219
  3. DO NOT mark stubs as SUBSTANTIVE — if it has a TODO, it's a stub
220
220
  4. DO NOT mark orphaned code as WIRED — if nothing imports it, it's orphaned
221
221
  5. DO NOT skip Level 2 or Level 3 checks — existence alone is insufficient
@@ -86,7 +86,7 @@ find ~/.claude/projects/{encoded-path}/ -name "*.jsonl" -maxdepth 1 \
86
86
 
87
87
  For each session file found, also check for subagent logs:
88
88
  ```bash
89
- ls ~/.claude/projects/{encoded-path}/{session-id}/subagents/*.jsonl 2>/dev/null
89
+ ls ~/.claude/projects/{encoded-path}/{session-id}/agents/*.jsonl 2>/dev/null
90
90
  ```
91
91
 
92
92
  Display discovery results:
@@ -719,11 +719,10 @@ These return `{ success, old_status, new_status }` or `{ success, old_plans, new
719
719
 
720
720
  **CRITICAL: Update STATE.md NOW with phase completion status. Do NOT skip this step.**
721
721
 
722
- **8b. Update STATE.md:**
723
- - Phase status: {final_status from Step 8-pre}
724
- - Plan completion count
725
- - Last activity timestamp
726
- - Progress bar
722
+ **8b. Update STATE.md (CRITICAL — update BOTH frontmatter AND body):**
723
+ - Frontmatter: `status`, `plans_complete`, `last_activity`, `progress_percent`, `last_command`
724
+ - Body `## Current Position`: `Phase:` line, `Plan:` line, `Status:` line, `Last activity:` line, `Progress:` bar
725
+ - These MUST stay in sync — the status line reads frontmatter, humans read the body
727
726
 
728
727
  **8c. Commit planning docs (if configured):**
729
728
  Reference: `skills/shared/commit-planning-docs.md` for the standard commit pattern.
@@ -133,7 +133,7 @@ After setting depth, the profile is automatically resolved. Show the user the ef
133
133
  "Depth set to {value}. Effective profile:"
134
134
  Then display the profile summary (research, plan-check, verify, scan mappers, debug rounds, inline verify).
135
135
 
136
- To resolve the profile, run: `node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js config resolve-depth`
136
+ To resolve the profile, run: `node ${PLUGIN_ROOT}/scripts/pbr-tools.js config resolve-depth`
137
137
 
138
138
  If the user wants to override a specific profile setting, they can set `depth_profiles.{depth}.{key}` directly.
139
139
  For example: to use quick mode but keep plan-checking, the user would set depth to quick and then override:
@@ -55,7 +55,7 @@ This handles the case where neither `.planning/` nor `.planning/debug/` exist ye
55
55
 
56
56
  ### Step 2: Check for Active Debug Sessions
57
57
 
58
- **Load depth profile:** Run `node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js config resolve-depth` to get `debug.max_hypothesis_rounds`. If the command fails (no config.json or CLI error), default to 5 rounds. Initialize a round counter at 0. This counter increments each time a continuation debugger is spawned.
58
+ **Load depth profile:** Run `node ${PLUGIN_ROOT}/scripts/pbr-tools.js config resolve-depth` to get `debug.max_hypothesis_rounds`. If the command fails (no config.json or CLI error), default to 5 rounds. Initialize a round counter at 0. This counter increments each time a continuation debugger is spawned.
59
59
 
60
60
  Scan `.planning/debug/` for existing debug files:
61
61
 
@@ -360,7 +360,7 @@ If the import process surfaced new locked decisions (from blocker resolutions in
360
360
  **8e. Emit workflow event (conditional):**
361
361
  If the event-logger script is available:
362
362
  ```bash
363
- node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js event workflow plan-import --phase {N} --plans {count} --source {filepath_or_user_input}
363
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js event workflow plan-import --phase {N} --plans {count} --source {filepath_or_user_input}
364
364
  ```
365
365
  Falls back silently if the command is not available.
366
366
 
@@ -463,7 +463,7 @@ Use the approve-revise-abort pattern from `skills/shared/gate-prompts.md`:
463
463
  4. Update the `Plans Complete` column to `0/{N}` where N = number of plan files just created
464
464
  5. Update the `Status` column to `planned`
465
465
  6. Save the file — do NOT skip this step
466
- - Update STATE.md: set current phase plan status to "planned"
466
+ - Update STATE.md **(CRITICAL update BOTH frontmatter AND body)**: set `status: "planned"`, `plans_total`, `last_command` in frontmatter AND update `Status:`, `Plan:` lines in body `## Current Position`
467
467
  - **If `features.auto_advance` is `true` AND `mode` is `autonomous`:** Chain directly to build. This continues the build->review->plan->build cycle automatically.
468
468
  - **Otherwise:** Suggest next action: `/pbr:build {N}`
469
469
 
@@ -312,10 +312,10 @@ If all automated checks and UAT items passed:
312
312
  4. Update the `Status` column to `verified`
313
313
  5. Update the `Completed` column to the current date (YYYY-MM-DD)
314
314
  6. Save the file — do NOT skip this step
315
- 2. Update `.planning/STATE.md`:
316
- - Phase status: "verified"
317
- - Progress updated
318
- - Last activity timestamp
315
+ 2. Update `.planning/STATE.md` **(CRITICAL — update BOTH frontmatter AND body):**
316
+ - Frontmatter: `status: "verified"`, `progress_percent`, `last_activity`, `last_command`
317
+ - Body `## Current Position`: `Status:` line, `Last activity:` line, `Progress:` bar
318
+ - These MUST stay in sync — see `skills/shared/state-update.md`
319
319
  - **STATE.md size limit:** Follow size limit enforcement rules in `skills/shared/state-update.md` (150 lines max).
320
320
  3. Update VERIFICATION.md with UAT results (append UAT section)
321
321
  3. Present completion:
@@ -28,9 +28,9 @@ This skill **spawns 4 parallel Task(subagent_type: "pbr:codebase-mapper")** agen
28
28
  Reference: `skills/shared/context-budget.md` for the universal orchestrator rules.
29
29
 
30
30
  Additionally for this skill:
31
- - **Never** analyze the codebase yourself — delegate ALL analysis to the 4 parallel codebase-mapper subagents
31
+ - **Never** analyze the codebase yourself — delegate ALL analysis to the 4 parallel codebase-mapper agents
32
32
  - **Minimize** reading mapper outputs — read only frontmatter or first 20 lines of each output document
33
- - **Delegate** all file reading, pattern analysis, and architecture mapping to the codebase-mapper subagents
33
+ - **Delegate** all file reading, pattern analysis, and architecture mapping to the codebase-mapper agents
34
34
 
35
35
  ---
36
36
 
@@ -50,7 +50,7 @@ Check if `.planning/codebase/` directory exists:
50
50
 
51
51
  First, resolve the depth profile so you know which areas are available:
52
52
  ```bash
53
- node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js config resolve-depth
53
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js config resolve-depth
54
54
  ```
55
55
  Read `profile["scan.mapper_areas"]` to determine available areas (quick: tech, arch; standard/comprehensive: tech, arch, quality, concerns).
56
56
 
@@ -93,7 +93,7 @@ Refer to the "Reconnaissance Detection Reference" section of `skills/scan/templa
93
93
 
94
94
  **Resolve mapper configuration:** Before spawning, resolve the depth profile:
95
95
  ```bash
96
- node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js config resolve-depth
96
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js config resolve-depth
97
97
  ```
98
98
 
99
99
  Read `profile["scan.mapper_count"]` and `profile["scan.mapper_areas"]` to determine how many mappers to spawn and which focus areas to cover.
@@ -11,7 +11,7 @@ Standard pattern for loading `.planning/config.json` fields at the start of a sk
11
11
 
12
12
  Instead of reading and parsing STATE.md, ROADMAP.md, and config.json manually, run:
13
13
  ```bash
14
- node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js state load
14
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js state load
15
15
  ```
16
16
  This returns a JSON object with `config`, `state`, `roadmap`, `current_phase`, and `progress`. Falls back gracefully if the script is missing -- parse files manually in that case.
17
17
 
@@ -1,7 +1,7 @@
1
1
  <!-- canonical: ../../../pbr/skills/shared/context-budget.md -->
2
2
  # Context Budget Rules
3
3
 
4
- Standard rules for keeping orchestrator context lean. Reference this fragment in skills that spawn Task() subagents.
4
+ Standard rules for keeping orchestrator context lean. Reference this fragment in skills that spawn Task() agents.
5
5
 
6
6
  See also: `skills/shared/universal-anti-patterns.md` for the complete set of universal rules (context budget + file reading + behavioral rules).
7
7
 
@@ -14,7 +14,7 @@ Every skill that spawns agents or reads significant content must follow these ru
14
14
  1. **Never** read agent definition files (`agents/*.md`) — `subagent_type` auto-loads them
15
15
  2. **Never** inline large files into Task() prompts — tell agents to read files from disk instead
16
16
  3. **Minimize** reading subagent output into main context — read only frontmatter, not full content
17
- 4. **Delegate** heavy work to subagents — the orchestrator routes, it doesn't execute
17
+ 4. **Delegate** heavy work to agents — the orchestrator routes, it doesn't execute
18
18
  5. **Before spawning agents**: If you've already consumed significant context (large file reads, multiple subagent results), warn the user: "Context budget is getting heavy. Consider running `/pbr:pause` to checkpoint progress." Suggest pause proactively rather than waiting for compaction.
19
19
 
20
20
  ## Customization
@@ -24,7 +24,7 @@ Skills should add skill-specific rules below the reference line. Common skill-sp
24
24
  - **build**: "Minimize reading executor output — read only SUMMARY.md frontmatter, not full content"
25
25
  - **plan**: "Minimize reading subagent output — read only plan frontmatter for summaries"
26
26
  - **review**: "Minimize reading subagent output — read only VERIFICATION.md frontmatter for summaries"
27
- - **scan**: "Delegate ALL analysis to the 4 parallel codebase-mapper subagents"
27
+ - **scan**: "Delegate ALL analysis to the 4 parallel codebase-mapper agents"
28
28
  - **quick**: "Never implement the task yourself — ALL code changes go through a spawned executor"
29
29
  - **debug**: "Never perform investigation work yourself — delegate ALL analysis to the debugger subagent"
30
30
 
@@ -42,7 +42,7 @@ Reading order (always this sequence):
42
42
  - Do NOT read HISTORY.md for normal build/plan/review operations
43
43
  - Read ONLY when: debugging a regression that may trace to a prior phase,
44
44
  or when a milestone audit needs historical context
45
- - Use: `node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js history load`
45
+ - Use: `node ${PLUGIN_ROOT}/scripts/pbr-tools.js history load`
46
46
  - This returns structured JSON -- do not read the raw file
47
47
  ```
48
48
 
@@ -5,12 +5,17 @@ Standard pattern for updating `.planning/STATE.md`. Include this fragment in ski
5
5
 
6
6
  ---
7
7
 
8
+ **CRITICAL: STATE.md has TWO representations — YAML frontmatter AND markdown body. You MUST update BOTH when changing state. The status line reads frontmatter; humans and hooks read the body. If you only update frontmatter, the body goes stale and the status line shows wrong data. Do NOT skip body updates under any circumstances.**
9
+
10
+ ---
11
+
8
12
  ## When to Update STATE.md
9
13
 
10
14
  | Event | What to Update |
11
15
  |-------|---------------|
12
- | Phase status changes (planned, building, verified) | Current Position section |
13
- | Plan completes or fails | Plan counter, status, last activity |
16
+ | Phase status changes (planned, building, verified) | Frontmatter fields AND Current Position section |
17
+ | Plan completes or fails | Frontmatter fields AND Plan counter, status, last activity |
18
+ | Phase advances to next phase | Frontmatter fields AND Phase line, Status, Last activity, Progress bar |
14
19
  | New decision made | Accumulated Context > Decisions |
15
20
  | Blocker discovered or resolved | Accumulated Context > Blockers/Concerns |
16
21
  | Session starts or ends | Session Continuity section |
@@ -32,6 +37,9 @@ See: .planning/PROJECT.md (updated {date})
32
37
  Update `Current focus` when phase changes.
33
38
 
34
39
  ### 2. Current Position (lines 9-14)
40
+
41
+ **CRITICAL: This section MUST match the frontmatter fields above it. When you update `current_phase` or `status` in frontmatter, you MUST also update the corresponding lines below. A hook will auto-fix drift, but do not rely on it.**
42
+
35
43
  ```
36
44
  ## Current Position
37
45
  Phase: {N} of {total} ({Phase name})
@@ -113,8 +121,8 @@ When a milestone completes or a phase is verified, archive historical context to
113
121
 
114
122
  Use `pbr-tools.js history append`:
115
123
  ```
116
- node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js history append phase "Phase 3 (Auth)" "Verified 2026-02-10. Key decisions: JWT + httpOnly cookies, Discord OAuth."
117
- node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js history append milestone "v1.0 User Auth" "Phases 1-4. All verified. Core auth flow complete."
124
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js history append phase "Phase 3 (Auth)" "Verified 2026-02-10. Key decisions: JWT + httpOnly cookies, Discord OAuth."
125
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js history append milestone "v1.0 User Auth" "Phases 1-4. All verified. Core auth flow complete."
118
126
  ```
119
127
 
120
128
  ### After Archiving
@@ -14,7 +14,7 @@ These rules prevent context rot -- quality degradation as the context window fil
14
14
  1. **Never** read agent definition files (`agents/*.md`) -- `subagent_type` auto-loads them. Reading agent definitions into the orchestrator wastes main context for content that is automatically injected into subagent sessions.
15
15
  2. **Never** inline large files into Task() prompts -- tell agents to read files from disk instead. Agents have their own 200k token context windows.
16
16
  3. **Minimize** reading subagent output into main context -- read only frontmatter, status fields, or summaries. Never read full SUMMARY.md, VERIFICATION.md, or RESEARCH.md bodies into the orchestrator unless specifically needed for inline presentation.
17
- 4. **Delegate** heavy work to Task() subagents -- the orchestrator routes, it does not build, analyze, research, investigate, or verify.
17
+ 4. **Delegate** heavy work to Task() agents -- the orchestrator routes, it does not build, analyze, research, investigate, or verify.
18
18
  5. **Proactive pause warning**: If you have already consumed significant context (large file reads, multiple subagent results), warn the user: "Context budget is getting heavy. Consider running `/pbr:pause` to checkpoint progress." Suggest pause proactively rather than waiting for compaction.
19
19
 
20
20
  ## File Reading Rules (apply to every skill)
@@ -22,6 +22,13 @@ Phase 01 ──→ Phase 02 ──→ Phase 04
22
22
  └──→ Phase 04
23
23
  ```
24
24
 
25
+ ---
26
+
27
+ ## Milestone: {project name} v1.0
28
+
29
+ **Goal:** {overall project goal from requirements}
30
+ **Phases:** 1 - {n}
31
+
25
32
  ## Phase Details
26
33
 
27
34
  ### Phase 01: Project Setup
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pbr",
3
- "version": "2.21.0",
3
+ "version": "2.21.1",
4
4
  "description": "Plan-Build-Run — Structured development workflow for Claude Code. Solves context rot through disciplined subagent delegation, structured planning, atomic execution, and goal-backward verification.",
5
5
  "author": {
6
6
  "name": "SienkLogic",
@@ -27,7 +27,7 @@ You are **codebase-mapper**, the codebase analysis agent for the Plan-Build-Run
27
27
 
28
28
  ### Forbidden Files
29
29
 
30
- When exploring, NEVER commit or recommend committing:
30
+ When exploring, NEVER write to or include in your output:
31
31
  - `.env` files (except `.env.example` or `.env.template`)
32
32
  - `*.key`, `*.pem`, `*.pfx`, `*.p12` — private keys and certificates
33
33
  - Files containing `credential` or `secret` in their name
@@ -14,6 +14,8 @@ tools:
14
14
 
15
15
  # Plan-Build-Run Debugger
16
16
 
17
+ > **Memory note:** Project memory is enabled to provide debugging continuity across investigation sessions.
18
+
17
19
  You are **debugger**, the systematic debugging agent. Investigate bugs using the scientific method: hypothesize, test, collect evidence, narrow the search space.
18
20
 
19
21
  ## Output Budget
@@ -14,6 +14,8 @@ tools:
14
14
 
15
15
  # Plan-Build-Run Executor
16
16
 
17
+ > **Memory note:** Project memory is enabled to provide build history context for deviation awareness.
18
+
17
19
  You are **executor**, the code execution agent for Plan-Build-Run. You receive verified plans and execute them task-by-task, producing working code with atomic commits, deviation handling, and self-verification.
18
20
 
19
21
  **You are a builder, not a designer.** Plans tell you WHAT to build. You figure out HOW at the code level. You do NOT redesign, skip, reorder, or add scope.
@@ -181,7 +183,7 @@ must_haves:
181
183
  ### Completeness Checklist
182
184
 
183
185
  Before deleting `.PROGRESS-{plan_id}`, verify SUMMARY.md has:
184
- - [ ] YAML frontmatter with `plan_id`, `status`, `tasks_completed`, `tasks_total`
186
+ - [ ] YAML frontmatter with `plan`, `status`, `tasks_completed`, `tasks_total`
185
187
  - [ ] Deviations section (use "None" if empty)
186
188
  - [ ] Files Changed listing at least one file
187
189
  - [ ] At least one commit hash reference
@@ -18,7 +18,8 @@ You are **general**, a lightweight utility agent for the Plan-Build-Run developm
18
18
 
19
19
  ## When You're Used
20
20
 
21
- - `/pbr:quick` ad-hoc task delegation
21
+ This agent is available for ad-hoc `Task()` calls from skills or custom orchestration. It is not currently spawned by any built-in PBR skill automatically — it must be invoked explicitly.
22
+
22
23
  - Simple file generation or formatting tasks
23
24
  - Tasks that need Plan-Build-Run context but not specialized methodology
24
25
  - Fallback when a specialized agent would be overkill
@@ -41,6 +41,8 @@ You MUST perform all applicable categories (skip only if zero items exist for th
41
41
  4. **E2E Flow Completeness** — Critical user workflows must trace from UI through API to data layer and back without breaks.
42
42
  5. **Cross-Phase Dependency Satisfaction** — Phase N's declared dependencies on Phase M must be actually satisfied in code.
43
43
 
44
+ > **First-phase edge case**: If no completed phases exist yet, focus on verifying the current phase's internal consistency — exports match imports within the phase, API contracts are self-consistent. Cross-phase checks are not applicable and should be skipped.
45
+
44
46
  ### Agent Contract Compliance
45
47
 
46
48
  Read `references/agent-contracts.md` to validate agent-to-agent handoffs. Verify that each agent's actual output matches its declared contract schema — especially `provides`/`consumes` fields in SUMMARY.md and status enums in VERIFICATION.md.
@@ -3,7 +3,6 @@ name: plan-checker
3
3
  description: "Verifies plans will achieve phase goals before execution. Goal-backward analysis of plan quality across 10 dimensions."
4
4
  model: sonnet
5
5
  memory: none
6
- isolation: worktree
7
6
  tools:
8
7
  - Read
9
8
  - Bash
@@ -9,11 +9,12 @@ tools:
9
9
  - Bash
10
10
  - Glob
11
11
  - Grep
12
- - WebFetch
13
12
  ---
14
13
 
15
14
  # Plan-Build-Run Planner
16
15
 
16
+ > **Memory note:** Project memory is enabled to provide planning continuity and awareness of prior phase decisions.
17
+
17
18
  You are **planner**, the planning agent for the Plan-Build-Run development system. You transform research, phase goals, and user requirements into executable plans that the executor agent can follow mechanically.
18
19
 
19
20
  ## Core Principle: Context Fidelity
@@ -60,6 +60,8 @@ All claims must be attributed to a source level. Higher levels override lower le
60
60
 
61
61
  **Attribution rules**: Every factual claim needs a source tag (`[S1]`, `[S2]`, etc.). Version-sensitive information (API signatures, config syntax) MUST come from S1-S3. When citing S2, note the version: `[S2-v14.2]`. Contradictions resolve in favor of higher source level.
62
62
 
63
+ **Offline Fallback**: If web tools are unavailable (air-gapped environment, MCP not configured), rely on local sources: codebase analysis via Glob/Grep, existing documentation, and README files. Assign these S3-S4 confidence levels. Do not attempt WebFetch or WebSearch — note in the output header that external sources were unavailable.
64
+
63
65
  ---
64
66
 
65
67
  ## Confidence Levels
@@ -6,7 +6,6 @@ memory: none
6
6
  tools:
7
7
  - Read
8
8
  - Write
9
- - Bash
10
9
  ---
11
10
 
12
11
  # Plan-Build-Run Synthesizer
@@ -222,7 +222,7 @@ Read `references/stub-patterns.md` for stub detection patterns by technology. Re
222
222
 
223
223
  ### Verifier-Specific Anti-Patterns
224
224
  1. DO NOT trust SUMMARY.md claims without verifying the actual codebase
225
- 2. DO NOT attempt to fix issues — you have no Write/Edit tools and that is intentional
225
+ 2. DO NOT attempt to fix issues — you have no Edit tool and that is intentional; Write access is only for VERIFICATION.md output
226
226
  3. DO NOT mark stubs as SUBSTANTIVE — if it has a TODO, it's a stub
227
227
  4. DO NOT mark orphaned code as WIRED — if nothing imports it, it's orphaned
228
228
  5. DO NOT skip Level 2 or Level 3 checks — existence alone is insufficient
@@ -0,0 +1,5 @@
1
+ ---
2
+ description: "Route freeform text to the right PBR skill automatically."
3
+ ---
4
+
5
+ This command is provided by the `pbr:do` skill.
@@ -102,10 +102,7 @@ function main() {
102
102
  process.exit(2);
103
103
  } else {
104
104
  const output = {
105
- hookSpecificOutput: {
106
- hookEventName: 'PreToolUse',
107
- additionalContext: `Warning: editing phase ${filePhase} file but current phase is ${currentPhase}. Ensure this cross-phase edit is intentional.`
108
- }
105
+ additionalContext: `Warning: editing phase ${filePhase} file but current phase is ${currentPhase}. Ensure this cross-phase edit is intentional.`
109
106
  };
110
107
  process.stdout.write(JSON.stringify(output));
111
108
  }
@@ -184,10 +181,7 @@ function checkBoundary(data) {
184
181
  return {
185
182
  exitCode: 0,
186
183
  output: {
187
- hookSpecificOutput: {
188
- hookEventName: 'PreToolUse',
189
- additionalContext: `Warning: editing phase ${filePhase} file but current phase is ${currentPhase}. Ensure this cross-phase edit is intentional.`
190
- }
184
+ additionalContext: `Warning: editing phase ${filePhase} file but current phase is ${currentPhase}. Ensure this cross-phase edit is intentional.`
191
185
  }
192
186
  };
193
187
  }
@@ -24,6 +24,7 @@ const fs = require('fs');
24
24
  const path = require('path');
25
25
  const { logHook } = require('./hook-logger');
26
26
  const { logEvent } = require('./event-logger');
27
+ const { atomicWrite } = require('./pbr-tools');
27
28
 
28
29
  function main() {
29
30
  let input = '';
@@ -334,9 +335,19 @@ function checkStateWrite(data) {
334
335
  if (basename !== 'STATE.md') return null;
335
336
  if (!fs.existsSync(filePath)) return null;
336
337
 
337
- const content = fs.readFileSync(filePath, 'utf8');
338
+ let content = fs.readFileSync(filePath, 'utf8');
338
339
  const result = validateState(content, filePath);
339
340
 
341
+ // Auto-fix frontmatter/body drift: if frontmatter current_phase differs from
342
+ // the body's "Phase: X of Y" line, rewrite the body to match frontmatter.
343
+ // This prevents stale status line display when the LLM updates frontmatter
344
+ // but skips the body under cognitive load.
345
+ const bodyFixed = syncStateBody(content, filePath);
346
+ if (bodyFixed) {
347
+ content = bodyFixed.content;
348
+ result.warnings.push(bodyFixed.message);
349
+ }
350
+
340
351
  if (result.warnings.length > 0) {
341
352
  logHook('check-plan-format', 'PostToolUse', 'warn', { file: basename, warnings: result.warnings });
342
353
  logEvent('workflow', 'state-validated', { file: basename, status: 'warn', warningCount: result.warnings.length });
@@ -348,5 +359,70 @@ function checkStateWrite(data) {
348
359
  return null;
349
360
  }
350
361
 
351
- module.exports = { validatePlan, validateSummary, validateVerification, validateState, checkPlanWrite, checkStateWrite };
362
+ /**
363
+ * Detect and fix frontmatter/body drift in STATE.md.
364
+ * When frontmatter current_phase doesn't match the body's "Phase: X of Y",
365
+ * rewrite the body line and persist.
366
+ *
367
+ * @param {string} content - Full STATE.md content
368
+ * @param {string} filePath - Absolute path to STATE.md
369
+ * @returns {null|{content: string, message: string}} null if in sync, otherwise the fixed content + message
370
+ */
371
+ function syncStateBody(content, filePath) {
372
+ if (!content.startsWith('---')) return null;
373
+ const fmEnd = content.indexOf('---', 3);
374
+ if (fmEnd === -1) return null;
375
+
376
+ const fm = content.substring(3, fmEnd);
377
+ const phaseMatch = fm.match(/^current_phase:\s*(\d+)/m);
378
+ const totalMatch = fm.match(/^total_phases:\s*(\d+)/m);
379
+ const slugMatch = fm.match(/^phase_name:\s*"?([^"\r\n]+)"?/m);
380
+ const statusMatch = fm.match(/^status:\s*"?([^"\r\n]+)"?/m);
381
+
382
+ if (!phaseMatch) return null;
383
+
384
+ const fmPhase = phaseMatch[1];
385
+ const fmTotal = totalMatch ? totalMatch[1] : null;
386
+ const fmName = slugMatch ? slugMatch[1] : null;
387
+ const fmStatus = statusMatch ? statusMatch[1] : null;
388
+
389
+ const bodyPhaseMatch = content.match(/^Phase:\s*(\d+)\s*of\s*(\d+)/m);
390
+ const bodyStatusMatch = content.match(/^Status:\s*(.+)/m);
391
+
392
+ let needsFix = false;
393
+ let updated = content;
394
+
395
+ // Fix phase line drift
396
+ if (bodyPhaseMatch && bodyPhaseMatch[1] !== fmPhase) {
397
+ const newPhaseLine = fmTotal
398
+ ? (fmName ? `Phase: ${fmPhase} of ${fmTotal} (${fmName})` : `Phase: ${fmPhase} of ${fmTotal}`)
399
+ : `Phase: ${fmPhase} of ${bodyPhaseMatch[2]}`;
400
+ updated = updated.replace(/^Phase:\s*\d+\s*of\s*\d+.*/m, newPhaseLine);
401
+ needsFix = true;
402
+ }
403
+
404
+ // Fix status line drift (only when phase also drifted — status text is often richer in body)
405
+ if (needsFix && bodyStatusMatch && fmStatus) {
406
+ // Capitalize frontmatter status for display
407
+ const displayStatus = fmStatus.replace(/-/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
408
+ updated = updated.replace(/^Status:\s*.+/m, `Status: ${displayStatus}`);
409
+ }
410
+
411
+ if (!needsFix) return null;
412
+
413
+ try {
414
+ atomicWrite(filePath, updated);
415
+ logHook('check-plan-format', 'PostToolUse', 'body-sync', {
416
+ fromPhase: bodyPhaseMatch[1], toPhase: fmPhase
417
+ });
418
+ return {
419
+ content: updated,
420
+ message: `Auto-fixed body drift: Phase ${bodyPhaseMatch[1]} → ${fmPhase} (body now matches frontmatter)`
421
+ };
422
+ } catch (_e) {
423
+ return null;
424
+ }
425
+ }
426
+
427
+ module.exports = { validatePlan, validateSummary, validateVerification, validateState, checkPlanWrite, checkStateWrite, syncStateBody };
352
428
  if (require.main === module || process.argv[1] === __filename) { main(); }
@@ -231,18 +231,10 @@ function checkBuildRules(filePath, isInPlanning, planningDir) {
231
231
 
232
232
  /**
233
233
  * /pbr:statusline rules:
234
- * - Warn when writing settings.json with hardcoded home directory paths
234
+ * Content check requires full hook data handled by checkStatuslineContent() in main()
235
235
  */
236
- function checkStatuslineRules(filePath, _isInPlanning, _planningDir) {
237
- const normalizedPath = filePath.replace(/\\/g, '/');
238
-
239
- // Only check settings.json writes
240
- if (!normalizedPath.endsWith('settings.json')) return null;
241
-
242
- // Check tool_input content isn't available here — we only have filePath.
243
- // The hardcoded path check needs content, which we get from the hook data.
244
- // This function is called from checkSkillRules which only passes filePath.
245
- // We'll check in the wrapper instead. For now, return null (pass).
236
+ function checkStatuslineRules(_filePath, _isInPlanning, _planningDir) {
237
+ // Content check requires full hook data — handled by checkStatuslineContent() in main()
246
238
  return null;
247
239
  }
248
240
 
@@ -363,10 +363,15 @@ function checkStateSync(data) {
363
363
  if (fs.existsSync(roadmapPath)) {
364
364
  try {
365
365
  const roadmapContent = fs.readFileSync(roadmapPath, 'utf8');
366
- const updatedRoadmap = updateProgressTable(roadmapContent, phaseNum, plansComplete, newStatus, completedDate);
367
- if (updatedRoadmap !== roadmapContent) {
368
- atomicWrite(roadmapPath, updatedRoadmap);
369
- messages.push(`ROADMAP.md: Phase ${phaseNum} ${plansComplete} plans, ${newStatus}`);
366
+ const hasProgressTable = /Plans\s*Complete/i.test(roadmapContent);
367
+ if (!hasProgressTable) {
368
+ messages.push(`ROADMAP.md: No Progress table found. Add a table with columns: | Phase | Plans Complete | Status | Completed | for the current milestone phases.`);
369
+ } else {
370
+ const updatedRoadmap = updateProgressTable(roadmapContent, phaseNum, plansComplete, newStatus, completedDate);
371
+ if (updatedRoadmap !== roadmapContent) {
372
+ atomicWrite(roadmapPath, updatedRoadmap);
373
+ messages.push(`ROADMAP.md: Phase ${phaseNum} → ${plansComplete} plans, ${newStatus}`);
374
+ }
370
375
  }
371
376
  } catch (e) {
372
377
  logHook('check-state-sync', 'PostToolUse', 'error', { reason: 'ROADMAP.md update failed', error: e.message });
@@ -443,10 +448,15 @@ function checkStateSync(data) {
443
448
  if (fs.existsSync(roadmapPath)) {
444
449
  try {
445
450
  const roadmapContent = fs.readFileSync(roadmapPath, 'utf8');
446
- const updatedRoadmap = updateProgressTable(roadmapContent, phaseNum, plansComplete, roadmapStatus, completedDate);
447
- if (updatedRoadmap !== roadmapContent) {
448
- atomicWrite(roadmapPath, updatedRoadmap);
449
- messages.push(`ROADMAP.md: Phase ${phaseNum} ${roadmapStatus}`);
451
+ const hasProgressTable = /Plans\s*Complete/i.test(roadmapContent);
452
+ if (!hasProgressTable) {
453
+ messages.push(`ROADMAP.md: No Progress table found. Add a table with columns: | Phase | Plans Complete | Status | Completed | for the current milestone phases.`);
454
+ } else {
455
+ const updatedRoadmap = updateProgressTable(roadmapContent, phaseNum, plansComplete, roadmapStatus, completedDate);
456
+ if (updatedRoadmap !== roadmapContent) {
457
+ atomicWrite(roadmapPath, updatedRoadmap);
458
+ messages.push(`ROADMAP.md: Phase ${phaseNum} → ${roadmapStatus}`);
459
+ }
450
460
  }
451
461
  } catch (e) {
452
462
  logHook('check-state-sync', 'PostToolUse', 'error', { reason: 'ROADMAP.md update failed', error: e.message });