@sienklogic/plan-build-run 2.53.0 → 2.55.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 (165) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/package.json +2 -2
  3. package/plugins/codex-pbr/agents/audit.md +223 -0
  4. package/plugins/codex-pbr/agents/codebase-mapper.md +196 -0
  5. package/plugins/codex-pbr/agents/debugger.md +245 -0
  6. package/plugins/codex-pbr/agents/dev-sync.md +142 -0
  7. package/plugins/codex-pbr/agents/executor.md +429 -0
  8. package/plugins/codex-pbr/agents/general.md +131 -0
  9. package/plugins/codex-pbr/agents/integration-checker.md +178 -0
  10. package/plugins/codex-pbr/agents/plan-checker.md +253 -0
  11. package/plugins/codex-pbr/agents/planner.md +343 -0
  12. package/plugins/codex-pbr/agents/researcher.md +253 -0
  13. package/plugins/codex-pbr/agents/synthesizer.md +183 -0
  14. package/plugins/codex-pbr/agents/verifier.md +352 -0
  15. package/plugins/codex-pbr/commands/audit.md +5 -0
  16. package/plugins/codex-pbr/commands/begin.md +5 -0
  17. package/plugins/codex-pbr/commands/build.md +5 -0
  18. package/plugins/codex-pbr/commands/config.md +5 -0
  19. package/plugins/codex-pbr/commands/continue.md +5 -0
  20. package/plugins/codex-pbr/commands/dashboard.md +5 -0
  21. package/plugins/codex-pbr/commands/debug.md +5 -0
  22. package/plugins/codex-pbr/commands/discuss.md +5 -0
  23. package/plugins/codex-pbr/commands/do.md +5 -0
  24. package/plugins/codex-pbr/commands/explore.md +5 -0
  25. package/plugins/codex-pbr/commands/health.md +5 -0
  26. package/plugins/codex-pbr/commands/help.md +5 -0
  27. package/plugins/codex-pbr/commands/import.md +5 -0
  28. package/plugins/codex-pbr/commands/milestone.md +5 -0
  29. package/plugins/codex-pbr/commands/note.md +5 -0
  30. package/plugins/codex-pbr/commands/pause.md +5 -0
  31. package/plugins/codex-pbr/commands/plan.md +5 -0
  32. package/plugins/codex-pbr/commands/quick.md +5 -0
  33. package/plugins/codex-pbr/commands/resume.md +5 -0
  34. package/plugins/codex-pbr/commands/review.md +5 -0
  35. package/plugins/codex-pbr/commands/scan.md +5 -0
  36. package/plugins/codex-pbr/commands/setup.md +5 -0
  37. package/plugins/codex-pbr/commands/status.md +5 -0
  38. package/plugins/codex-pbr/commands/statusline.md +5 -0
  39. package/plugins/codex-pbr/commands/test.md +5 -0
  40. package/plugins/codex-pbr/commands/todo.md +5 -0
  41. package/plugins/codex-pbr/commands/undo.md +5 -0
  42. package/plugins/codex-pbr/references/agent-contracts.md +324 -0
  43. package/plugins/codex-pbr/references/agent-teams.md +54 -0
  44. package/plugins/codex-pbr/references/common-bug-patterns.md +13 -0
  45. package/plugins/codex-pbr/references/config-reference.md +552 -0
  46. package/plugins/codex-pbr/references/continuation-format.md +212 -0
  47. package/plugins/codex-pbr/references/deviation-rules.md +112 -0
  48. package/plugins/codex-pbr/references/git-integration.md +256 -0
  49. package/plugins/codex-pbr/references/integration-patterns.md +117 -0
  50. package/plugins/codex-pbr/references/model-profiles.md +99 -0
  51. package/plugins/codex-pbr/references/model-selection.md +31 -0
  52. package/plugins/codex-pbr/references/pbr-tools-cli.md +400 -0
  53. package/plugins/codex-pbr/references/plan-authoring.md +246 -0
  54. package/plugins/codex-pbr/references/plan-format.md +313 -0
  55. package/plugins/codex-pbr/references/questioning.md +235 -0
  56. package/plugins/codex-pbr/references/reading-verification.md +127 -0
  57. package/plugins/codex-pbr/references/signal-files.md +41 -0
  58. package/plugins/codex-pbr/references/stub-patterns.md +160 -0
  59. package/plugins/codex-pbr/references/ui-formatting.md +444 -0
  60. package/plugins/codex-pbr/references/wave-execution.md +95 -0
  61. package/plugins/codex-pbr/skills/audit/SKILL.md +346 -0
  62. package/plugins/codex-pbr/skills/begin/SKILL.md +800 -0
  63. package/plugins/codex-pbr/skills/build/SKILL.md +958 -0
  64. package/plugins/codex-pbr/skills/config/SKILL.md +267 -0
  65. package/plugins/codex-pbr/skills/continue/SKILL.md +172 -0
  66. package/plugins/codex-pbr/skills/dashboard/SKILL.md +44 -0
  67. package/plugins/codex-pbr/skills/debug/SKILL.md +530 -0
  68. package/plugins/codex-pbr/skills/discuss/SKILL.md +355 -0
  69. package/plugins/codex-pbr/skills/do/SKILL.md +68 -0
  70. package/plugins/codex-pbr/skills/explore/SKILL.md +407 -0
  71. package/plugins/codex-pbr/skills/health/SKILL.md +300 -0
  72. package/plugins/codex-pbr/skills/help/SKILL.md +229 -0
  73. package/plugins/codex-pbr/skills/import/SKILL.md +538 -0
  74. package/plugins/codex-pbr/skills/milestone/SKILL.md +620 -0
  75. package/plugins/codex-pbr/skills/note/SKILL.md +215 -0
  76. package/plugins/codex-pbr/skills/pause/SKILL.md +258 -0
  77. package/plugins/codex-pbr/skills/plan/SKILL.md +650 -0
  78. package/plugins/codex-pbr/skills/quick/SKILL.md +417 -0
  79. package/plugins/codex-pbr/skills/resume/SKILL.md +403 -0
  80. package/plugins/codex-pbr/skills/review/SKILL.md +669 -0
  81. package/plugins/codex-pbr/skills/scan/SKILL.md +325 -0
  82. package/plugins/codex-pbr/skills/setup/SKILL.md +169 -0
  83. package/plugins/codex-pbr/skills/shared/commit-planning-docs.md +35 -0
  84. package/plugins/codex-pbr/skills/shared/config-loading.md +102 -0
  85. package/plugins/codex-pbr/skills/shared/context-budget.md +77 -0
  86. package/plugins/codex-pbr/skills/shared/context-loader-task.md +86 -0
  87. package/plugins/codex-pbr/skills/shared/digest-select.md +79 -0
  88. package/plugins/codex-pbr/skills/shared/domain-probes.md +125 -0
  89. package/plugins/codex-pbr/skills/shared/error-reporting.md +59 -0
  90. package/plugins/codex-pbr/skills/shared/gate-prompts.md +388 -0
  91. package/plugins/codex-pbr/skills/shared/phase-argument-parsing.md +45 -0
  92. package/plugins/codex-pbr/skills/shared/revision-loop.md +81 -0
  93. package/plugins/codex-pbr/skills/shared/state-update.md +169 -0
  94. package/plugins/codex-pbr/skills/shared/universal-anti-patterns.md +43 -0
  95. package/plugins/codex-pbr/skills/status/SKILL.md +449 -0
  96. package/plugins/codex-pbr/skills/statusline/SKILL.md +149 -0
  97. package/plugins/codex-pbr/skills/test/SKILL.md +210 -0
  98. package/plugins/codex-pbr/skills/todo/SKILL.md +281 -0
  99. package/plugins/codex-pbr/skills/undo/SKILL.md +172 -0
  100. package/plugins/codex-pbr/templates/CONTEXT.md.tmpl +52 -0
  101. package/plugins/codex-pbr/templates/INTEGRATION-REPORT.md.tmpl +167 -0
  102. package/plugins/codex-pbr/templates/RESEARCH-SUMMARY.md.tmpl +97 -0
  103. package/plugins/codex-pbr/templates/ROADMAP.md.tmpl +47 -0
  104. package/plugins/codex-pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  105. package/plugins/codex-pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
  106. package/plugins/codex-pbr/templates/SUMMARY.md.tmpl +81 -0
  107. package/plugins/codex-pbr/templates/VERIFICATION-DETAIL.md.tmpl +117 -0
  108. package/plugins/codex-pbr/templates/codebase/ARCHITECTURE.md.tmpl +98 -0
  109. package/plugins/codex-pbr/templates/codebase/CONCERNS.md.tmpl +93 -0
  110. package/plugins/codex-pbr/templates/codebase/CONVENTIONS.md.tmpl +104 -0
  111. package/plugins/codex-pbr/templates/codebase/INTEGRATIONS.md.tmpl +78 -0
  112. package/plugins/codex-pbr/templates/codebase/STACK.md.tmpl +78 -0
  113. package/plugins/codex-pbr/templates/codebase/STRUCTURE.md.tmpl +80 -0
  114. package/plugins/codex-pbr/templates/codebase/TESTING.md.tmpl +107 -0
  115. package/plugins/codex-pbr/templates/continue-here.md.tmpl +73 -0
  116. package/plugins/codex-pbr/templates/pr-body.md.tmpl +22 -0
  117. package/plugins/codex-pbr/templates/prompt-partials/phase-project-context.md.tmpl +37 -0
  118. package/plugins/codex-pbr/templates/research/ARCHITECTURE.md.tmpl +124 -0
  119. package/plugins/codex-pbr/templates/research/STACK.md.tmpl +71 -0
  120. package/plugins/codex-pbr/templates/research/SUMMARY.md.tmpl +112 -0
  121. package/plugins/codex-pbr/templates/research-outputs/phase-research.md.tmpl +81 -0
  122. package/plugins/codex-pbr/templates/research-outputs/project-research.md.tmpl +99 -0
  123. package/plugins/codex-pbr/templates/research-outputs/synthesis.md.tmpl +36 -0
  124. package/plugins/copilot-pbr/commands/setup.md +1 -1
  125. package/plugins/copilot-pbr/commands/undo.md +5 -0
  126. package/plugins/copilot-pbr/plugin.json +1 -1
  127. package/plugins/copilot-pbr/skills/begin/SKILL.md +170 -17
  128. package/plugins/copilot-pbr/skills/build/SKILL.md +73 -8
  129. package/plugins/copilot-pbr/skills/plan/SKILL.md +67 -17
  130. package/plugins/copilot-pbr/skills/review/SKILL.md +12 -1
  131. package/plugins/copilot-pbr/skills/setup/SKILL.md +66 -214
  132. package/plugins/copilot-pbr/skills/shared/context-budget.md +27 -0
  133. package/plugins/copilot-pbr/skills/status/SKILL.md +44 -2
  134. package/plugins/copilot-pbr/skills/undo/SKILL.md +172 -0
  135. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  136. package/plugins/cursor-pbr/commands/setup.md +1 -1
  137. package/plugins/cursor-pbr/commands/undo.md +5 -0
  138. package/plugins/cursor-pbr/skills/begin/SKILL.md +170 -17
  139. package/plugins/cursor-pbr/skills/build/SKILL.md +73 -8
  140. package/plugins/cursor-pbr/skills/plan/SKILL.md +67 -17
  141. package/plugins/cursor-pbr/skills/review/SKILL.md +12 -1
  142. package/plugins/cursor-pbr/skills/setup/SKILL.md +66 -214
  143. package/plugins/cursor-pbr/skills/shared/context-budget.md +27 -0
  144. package/plugins/cursor-pbr/skills/status/SKILL.md +44 -2
  145. package/plugins/cursor-pbr/skills/undo/SKILL.md +173 -0
  146. package/plugins/jules-pbr/AGENTS.md +600 -0
  147. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
  148. package/plugins/pbr/commands/setup.md +1 -1
  149. package/plugins/pbr/commands/undo.md +5 -0
  150. package/plugins/pbr/scripts/config-schema.json +5 -1
  151. package/plugins/pbr/scripts/lib/alternatives.js +203 -0
  152. package/plugins/pbr/scripts/lib/preview.js +174 -0
  153. package/plugins/pbr/scripts/lib/skill-section.js +99 -0
  154. package/plugins/pbr/scripts/lib/step-verify.js +149 -0
  155. package/plugins/pbr/scripts/pbr-tools.js +122 -2
  156. package/plugins/pbr/scripts/validate-commit.js +2 -2
  157. package/plugins/pbr/skills/begin/SKILL.md +170 -17
  158. package/plugins/pbr/skills/begin/templates/config.json.tmpl +5 -1
  159. package/plugins/pbr/skills/build/SKILL.md +73 -8
  160. package/plugins/pbr/skills/plan/SKILL.md +67 -17
  161. package/plugins/pbr/skills/review/SKILL.md +12 -1
  162. package/plugins/pbr/skills/setup/SKILL.md +66 -214
  163. package/plugins/pbr/skills/shared/context-budget.md +27 -0
  164. package/plugins/pbr/skills/status/SKILL.md +44 -2
  165. package/plugins/pbr/skills/undo/SKILL.md +174 -0
@@ -0,0 +1,43 @@
1
+ # Universal Anti-Patterns
2
+
3
+ Rules that apply to ALL skills. Individual skills may have additional skill-specific anti-patterns listed in their own SKILL.md.
4
+
5
+ > Referenced by: all skills with Context Budget or Anti-Patterns sections
6
+
7
+ ---
8
+
9
+ ## Context Budget Rules (apply to every skill)
10
+
11
+ These rules prevent context rot -- quality degradation as the context window fills up.
12
+
13
+ 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.
14
+ 2. **Never** inline large files into Task() prompts -- tell agents to read files from disk instead. Agents have their own 200k token context windows.
15
+ 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.
16
+ 4. **Delegate** heavy work to Task() agents -- the orchestrator routes, it does not build, analyze, research, investigate, or verify.
17
+ 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.
18
+
19
+ ## File Reading Rules (apply to every skill)
20
+
21
+ 6. **Never** read full SUMMARY.md bodies from prior phases -- read frontmatter only (unless the skill specifically requires body content for presentation).
22
+ 7. **Never** read full PLAN.md files from other phases -- only current phase plans.
23
+ 8. **Never** read `.planning/logs/` files -- only the health skill reads these.
24
+ 9. **Do not** re-read full file contents when frontmatter is sufficient -- frontmatter contains status, key_files, commits, and provides fields.
25
+
26
+ ## Task/Subagent Rules (apply to every skill)
27
+
28
+ 10. **Never** invoke `Skill()` inside a `Task()` subagent -- the Skill tool is not available in subagent contexts. Agents spawned by `Task()` cannot resolve `$pbr-*` skill prefixes, so `Skill({ skill: "pbr:plan" })` will silently fail. Instead, chain skills at the orchestrator level (return control to the orchestrator, then call `Skill()` from there). For subagent work, use `subagent_type: "pbr:{agent}"` which auto-loads agent definitions.
29
+
30
+ ## Behavioral Rules (apply to every skill)
31
+
32
+ 11. **Do not** re-litigate decisions that are already locked in CONTEXT.md -- respect locked decisions unconditionally.
33
+ 12. **Do not** create artifacts the user did not approve -- always confirm before writing new planning documents.
34
+ 13. **Do not** modify files outside the skill's stated scope -- check the "Files Created/Modified" table in each skill.
35
+ 14. **Do not** suggest multiple next actions without clear priority -- one primary suggestion, alternatives listed secondary.
36
+ 15. **Do not** use `git add .` or `git add -A` -- stage specific files only.
37
+ 16. **Do not** include sensitive information (API keys, passwords, tokens) in planning documents or commits.
38
+
39
+ ## Error Recovery Rules (apply to every skill)
40
+
41
+ 17. **Git lock detection**: Before any git operation, if it fails with "Unable to create lock file", check for stale `.git/index.lock` and advise the user to remove it (do not remove automatically — another process may hold it legitimately).
42
+ 18. **Config fallback awareness**: `configLoad()` returns `null` silently on invalid JSON. If your skill depends on config values, check for null and warn the user: "config.json is invalid or missing — running with defaults. Run `$pbr-health` to diagnose."
43
+ 19. **Partial state recovery**: If STATE.md references a phase directory that doesn't exist, do not proceed silently. Warn the user and suggest `$pbr-health` to diagnose the mismatch.
@@ -0,0 +1,449 @@
1
+ ---
2
+ name: status
3
+ description: "Show current project status and suggest what to do next."
4
+ ---
5
+
6
+ **STOP — DO NOT READ THIS FILE. You are already reading it. This prompt was injected into your context by Claude Code's plugin system. Using the Read tool on this SKILL.md file wastes ~7,600 tokens. Begin executing Step 1 immediately.**
7
+
8
+ ## Step 0 — Immediate Output
9
+
10
+ **Before ANY tool calls**, display this banner:
11
+
12
+ ```
13
+ ╔══════════════════════════════════════════════════════════════╗
14
+ ║ PLAN-BUILD-RUN ► PROJECT STATUS ║
15
+ ╚══════════════════════════════════════════════════════════════╝
16
+ ```
17
+
18
+ Then proceed to Step 1.
19
+
20
+ # $pbr-status — Project Status Dashboard
21
+
22
+ You are running the **status** skill. Your job is to read the project state and present a clear, actionable status dashboard. You suggest the most logical next action based on where the project is.
23
+
24
+ This skill runs **inline** and is **read-only** — it never modifies any files.
25
+
26
+ ---
27
+
28
+ ## Core Principle
29
+
30
+ **Show the user where they are and what to do next.** The status display should be a quick glance, not a wall of text. Surface problems and route to the right action.
31
+
32
+ ---
33
+
34
+ ## Flow
35
+
36
+ ### Step 1: Read Project State
37
+
38
+ **Tooling shortcut**: Instead of parsing multiple files manually, you can run:
39
+ ```bash
40
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js state load
41
+ ```
42
+ and
43
+ ```bash
44
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js state check-progress
45
+ ```
46
+ These return structured JSON with config, state, roadmap, and filesystem-verified progress. Falls back gracefully if the script is missing — parse files manually in that case.
47
+
48
+ Read the following files (skip any that don't exist):
49
+
50
+ 1. **`.planning/config.json`** — Project settings
51
+ - If this doesn't exist, display:
52
+ ```
53
+ ╔══════════════════════════════════════════════════════════════╗
54
+ ║ ERROR ║
55
+ ╚══════════════════════════════════════════════════════════════╝
56
+
57
+ No Plan-Build-Run project found.
58
+
59
+ **To fix:** Run `$pbr-begin` to start a new project, or `$pbr-scan` to analyze an existing codebase.
60
+ ```
61
+ - Stop here if no project found.
62
+
63
+ 2. **`.planning/STATE.md`** — Current position, progress, blockers
64
+ - Extract: current phase, current plan, overall progress, blockers, session info
65
+
66
+ 3. **`.planning/ROADMAP.md`** — Phase overview
67
+ - Extract: all phases with names, descriptions, status indicators
68
+
69
+ 4. **`.planning/PROJECT.md`** — Project metadata (if exists)
70
+ - Extract: project name, milestone info
71
+
72
+ 5. **`.planning/REQUIREMENTS.md`** — Requirements (if exists)
73
+ - Extract: requirement completion status if tracked
74
+
75
+ ### Step 1b: Read Local LLM Stats (advisory — skip on any error)
76
+
77
+ After loading config.json, check `local_llm.enabled`. If `true`:
78
+
79
+ ```bash
80
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js llm status
81
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js llm metrics
82
+ ```
83
+
84
+ Parse both JSON responses. Capture:
85
+
86
+ - `status.model` — model name
87
+ - `metrics.total_calls` — lifetime total calls
88
+ - `metrics.tokens_saved` — lifetime frontier tokens saved
89
+ - `metrics.cost_saved_usd` — lifetime cost estimate
90
+ - `metrics.avg_latency_ms` — lifetime average latency
91
+
92
+ Also run session-scoped metrics if `.planning/.session-start` exists:
93
+
94
+ ```bash
95
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js llm metrics --session <content-of-.session-start>
96
+ ```
97
+
98
+ If `local_llm.enabled` is `false` or commands fail, skip this step silently.
99
+
100
+ ### Step 1c: Read Context Budget (advisory — skip on any error)
101
+
102
+ Run:
103
+ ```bash
104
+ node ${PLUGIN_ROOT}/scripts/pbr-tools.js context-triage
105
+ ```
106
+
107
+ Parse the JSON response. Capture:
108
+ - `tier` — one of PEAK / GOOD / DEGRADING / POOR / CRITICAL
109
+ - `percentage` — numeric 0-100 (or null if unavailable)
110
+ - `recommendation` — PROCEED / CHECKPOINT / COMPACT
111
+
112
+ Store these for use in Step 4 display and Step 5 routing.
113
+
114
+ ### Step 2: Scan Phase Directories
115
+
116
+ For each phase listed in ROADMAP.md:
117
+
118
+ 1. Check if the phase directory exists in `.planning/phases/`
119
+ 2. If exists, scan for:
120
+ - `CONTEXT.md` — discussion happened
121
+ - `*-PLAN.md` or `PLAN.md` files — plans exist
122
+ - `*-SUMMARY.md` or `SUMMARY.md` files — plans were executed
123
+ - `VERIFICATION.md` — phase was reviewed
124
+ - `.continue-here.md` — paused work
125
+
126
+ 3. Calculate phase status:
127
+
128
+ | Condition | Status |
129
+ |-----------|--------|
130
+ | No directory | Not started |
131
+ | Directory exists, no plans | Discussed only |
132
+ | Plans exist, no summaries | Planned (ready to build) |
133
+ | Some summaries, not all | Building (in progress) |
134
+ | All summaries exist | Built (ready to review) |
135
+ | VERIFICATION.md exists, status=passed | Verified (complete) |
136
+ | VERIFICATION.md exists, status=gaps_found | Needs fixes |
137
+
138
+ 4. Calculate progress percentage:
139
+ - Count total plans across all phases
140
+ - Count plans with SUMMARY.md (status=completed)
141
+ - Progress = completed / total * 100
142
+
143
+ ### Step 2b: Check STATE.md Size and Consistency
144
+
145
+ Count lines in `.planning/STATE.md`. If over 150 lines, add a warning to the dashboard:
146
+ ```
147
+ Warning: STATE.md is {N} lines (limit: 150). Run any build/review command to auto-compact it.
148
+ ```
149
+
150
+ **Discrepancy check:** Compare STATE.md phase/plan/status claims against the filesystem:
151
+ - Does the phase directory exist? If not: `Warning: STATE.md references Phase {N} but no directory exists.`
152
+ - Does the plan count match? If not: `Warning: STATE.md says {X} plans but filesystem has {Y}.`
153
+ - Does the status match? If STATE.md says "verified" but no `VERIFICATION.md` exists: `Warning: STATE.md says "verified" but no VERIFICATION.md found.`
154
+
155
+ If any discrepancy found, add: `Run $pbr-resume to auto-reconcile STATE.md.`
156
+
157
+ ### Step 3: Check for Special Conditions
158
+
159
+ #### Paused Work
160
+ - Search for `.continue-here.md` files in `.planning/phases/`
161
+ - If found: note the phase and brief description of where work stopped
162
+
163
+ #### Verification Gaps
164
+ - Search for `VERIFICATION.md` files with `gaps_found` status
165
+ - If found: note which phases have gaps
166
+
167
+ #### Cross-Phase Re-Planning Check
168
+ - For each planned phase, check if its dependency phases have been built yet
169
+ - Logic:
170
+ 1. Read ROADMAP.md to find phase dependencies (phases that come before)
171
+ 2. If Phase N has plans but Phase N-1 doesn't have summaries (wasn't built yet):
172
+ - This means Phase N was planned without knowledge of what Phase N-1 actually produced
173
+ - Flag for re-planning
174
+ - **Dependency fingerprint check**: For each planned phase with `dependency_fingerprints` in plan frontmatter:
175
+ 1. Compare the fingerprints against current dependency SUMMARY.md files
176
+ 2. If any fingerprint is stale (dependency was re-built after the plan was created):
177
+ - Flag: "WARN: Phase {N} plans may be stale — dependency phase {M} was re-built since planning. Consider re-planning with `$pbr-plan {N}`."
178
+
179
+ #### Active Debug Sessions
180
+ - Check `.planning/debug/` for files with `status: active`
181
+ - Note any active debug sessions
182
+
183
+ #### Pending Todos
184
+ - Check `.planning/todos/pending/` for pending todo files
185
+ - Count and summarize if any exist
186
+
187
+ #### Critical Path
188
+ Identify the single next-blocking item — the one phase or plan whose completion unblocks the most downstream work.
189
+
190
+ Logic:
191
+ 1. From ROADMAP.md dependency graph, find all phases that are NOT yet verified.
192
+ 2. For each unverified phase, count how many other unverified phases list it in `depends_on` (direct + transitive).
193
+ 3. The phase with the highest downstream dependent count is the critical-path phase.
194
+ 4. If all unverified phases are independent (no dependencies between them), the critical path is the current phase from STATE.md.
195
+ 5. Within the critical-path phase, the critical-path plan is the lowest-numbered plan without a SUMMARY.md.
196
+
197
+ Store: `criticalPhase` (number + name), `criticalPlan` (plan ID or null if phase not yet planned), `criticalCount` (number of downstream phases blocked).
198
+
199
+ #### Quick Notes
200
+ - Check `.planning/notes/` directory for note files (individual `.md` files)
201
+ - Count active notes (files where frontmatter does NOT contain `promoted: true`)
202
+ - Also check `~/.claude/notes/` for global notes
203
+
204
+ #### Quick Tasks
205
+ - Check `.planning/quick/` for recent quick tasks
206
+ - Note any failed or partial quick tasks
207
+
208
+ ### Step 4: Display Status Dashboard
209
+
210
+ Present the status in this format:
211
+
212
+ ```
213
+ Project: {name from PROJECT.md or config.json}
214
+ Phase: {current} of {total} -- {current phase name}
215
+ Progress: [{progress bar}] {percentage}%
216
+
217
+ Phase Status:
218
+ | Phase | Status | Plans | Progress |
219
+ |-------|--------|-------|----------|
220
+ | 1. {name} | {status indicator} {status text} | {completed}/{total} | {percentage}% |
221
+ | 2. {name} | {status indicator} {status text} | {completed}/{total} | {percentage}% |
222
+ | ...
223
+
224
+ {If context tier is DEGRADING, POOR, or CRITICAL:}
225
+ ⚠ Context: {percentage}% used ({tier}) — {recommendation_text}
226
+ Run `/compact` to reclaim context before spawning more agents.
227
+
228
+ Where `{recommendation_text}` maps:
229
+ - DEGRADING → "quality may degrade on complex agents"
230
+ - POOR → "context window is filling up"
231
+ - CRITICAL → "STOP — compact before continuing"
232
+
233
+ {If criticalPhase is identified AND criticalCount >= 1 AND there are 2+ unverified phases with dependencies:}
234
+ Critical Path: Phase {N} — {phase name}{, Plan {criticalPlan} is next} [BLOCKING {criticalCount} downstream phase(s)]
235
+ {Else: omit — not meaningful when only one phase remains or no inter-phase dependencies exist}
236
+
237
+ {If blockers exist:}
238
+ Blockers:
239
+ - {blocker 1}
240
+ - {blocker 2}
241
+
242
+ {If no blockers:}
243
+ Blockers: None
244
+
245
+ {If paused work:}
246
+ Paused: Phase {N} has a checkpoint at plan {M}. Run `$pbr-resume` to continue.
247
+
248
+ {If verification gaps:}
249
+ Gaps: Phase {N} verification found {count} gaps. Run `$pbr-plan {N} --gaps` to address.
250
+
251
+ {If cross-phase re-planning needed:}
252
+ Warning: Phase {N} was planned before Phase {M} was built. Consider re-planning with `$pbr-plan {N}`.
253
+
254
+ {If active debug sessions:}
255
+ Debug: {count} active session(s). Run `$pbr-debug` to continue.
256
+
257
+ {If pending todos:}
258
+ Todos: {count} pending. Run `$pbr-todo list` to see them.
259
+
260
+ {If notes exist:}
261
+ Notes: {count} quick capture(s). `$pbr-note list` to review.
262
+
263
+ {If local_llm.enabled AND total_calls > 0:}
264
+ Local LLM: enabled ({model}, avg {avg_ms}ms)
265
+ This session: {session_calls} calls, ~{session_tokens} frontier tokens saved
266
+ Lifetime: {total_calls} calls, ~{tokens_saved} tokens saved (~{cost_str} at $3/M)
267
+
268
+ {If local_llm.enabled AND total_calls == 0:}
269
+ Local LLM: enabled ({model}) — no calls yet this session
270
+ ```
271
+
272
+ The Local LLM block is **advisory only** — it never affects the routing decision or Next Up suggestion.
273
+
274
+ ### Progress Bar
275
+
276
+ Generate a 20-character progress bar:
277
+
278
+ ```
279
+ [████████████████████] 100% (all filled)
280
+ [████████████████░░░░] 80% (16 filled, 4 empty)
281
+ [████████░░░░░░░░░░░░] 40% (8 filled, 12 empty)
282
+ [░░░░░░░░░░░░░░░░░░░░] 0% (all empty)
283
+ ```
284
+
285
+ Use Unicode block characters:
286
+ - Filled: `█` (full block, U+2588)
287
+ - Empty: `░` (light shade, U+2591)
288
+
289
+ ### Status Indicators
290
+
291
+ Use indicators from `references/ui-formatting.md`:
292
+
293
+ | Status | Indicator |
294
+ |--------|-----------|
295
+ | Complete/Verified | checkmark |
296
+ | In Progress | half-filled circle |
297
+ | Not started | empty circle |
298
+ | Needs fixes | warning triangle |
299
+ | Blocked | blocked symbol |
300
+
301
+ ### Step 5: Smart Routing
302
+
303
+ Based on the project state, suggest the single most logical next action:
304
+
305
+ **Decision tree:**
306
+
307
+ ```
308
+ 1. Is there paused work (.continue-here.md)?
309
+ YES → "Resume your work: `$pbr-resume`"
310
+
311
+ 2. Is there a verification with gaps?
312
+ YES → "Fix verification gaps: `$pbr-plan {N} --gaps`"
313
+
314
+ 3. Is the current phase planned but not built?
315
+ YES → "Build the current phase: `$pbr-build {N}`"
316
+
317
+ 4. Is the current phase built but not reviewed?
318
+ YES → "Review what was built: `$pbr-review {N}`"
319
+
320
+ 5. Is the current phase verified (complete)?
321
+ YES → Is there a next phase?
322
+ YES → Was next phase already planned?
323
+ YES → Does it need re-planning? (dependency phase changed)
324
+ YES → "Re-plan with updated context: `$pbr-plan {N+1}`"
325
+ NO → "Build the next phase: `$pbr-build {N+1}`"
326
+ NO → "Plan the next phase: `$pbr-plan {N+1}`"
327
+ NO → Check for existing `*-MILESTONE-AUDIT.md` in `.planning/`:\n IF audit passed → "All phases complete and audited! `$pbr-milestone complete` to archive and tag."\n IF audit has gaps → "Audit found gaps. `$pbr-milestone gaps` to address them."\n IF no audit → "All phases complete! `$pbr-milestone audit` to verify cross-phase integration (recommended), then `$pbr-milestone complete`."
328
+
329
+ 6. Is the current phase not started?
330
+ YES → Has it been discussed?
331
+ YES → "Plan this phase: `$pbr-plan {N}`"
332
+ NO → "Start with a discussion: `$pbr-discuss {N}` or jump to `$pbr-plan {N}`"
333
+
334
+ 7. Active debug sessions?
335
+ YES → "Continue debugging: `$pbr-debug`"
336
+
337
+ 8. Nothing active?
338
+ → "Start your project: `$pbr-begin`"
339
+ ```
340
+
341
+ **If only one reasonable next action exists**, present it with branded routing:
342
+
343
+ ```
344
+
345
+
346
+ ╔══════════════════════════════════════════════════════════════╗
347
+ ║ ▶ NEXT UP ║
348
+ ╚══════════════════════════════════════════════════════════════╝
349
+
350
+ **{brief explanation}**
351
+
352
+ `{suggested command}`
353
+
354
+ {If context percentage > 40% OR tier is DEGRADING/POOR/CRITICAL:}
355
+ <sub>`/clear` first → fresh context window ({percentage}% used)</sub>
356
+ {Else: omit the /clear hint entirely}
357
+ {If `percentage` is null (no context data): omit the hint}
358
+
359
+
360
+ ```
361
+
362
+ **If multiple reasonable next actions exist** (2-3 alternatives), use the **action-routing** pattern (see `skills/shared/gate-prompts.md`):
363
+
364
+ Use AskUserQuestion:
365
+ question: "What would you like to do next?"
366
+ header: "Next Step"
367
+ options:
368
+ - label: "{primary action}" description: "{brief explanation}"
369
+ - label: "{alternative 1}" description: "{brief explanation}"
370
+ - label: "{alternative 2}" description: "{brief explanation}"
371
+ - label: "Something else" description: "Enter a different command"
372
+ multiSelect: false
373
+
374
+ Build options dynamically from the decision tree results. Always include "Something else" as the last option. Generate 1-3 real options based on the state analysis.
375
+
376
+ **After user selects an option:**
377
+ - If they selected a real action: display "Run: `$pbr-{action} {args}`" so they can execute it
378
+ - If they selected "Something else": ask what they'd like to do (freeform text)
379
+ - This skill remains read-only — display the command, do not execute it
380
+
381
+ ---
382
+
383
+ ## Edge Cases
384
+
385
+ ### No `.planning/` directory at all
386
+ - Display: "No Plan-Build-Run project found."
387
+ - Suggest: `$pbr-begin` to start a new project
388
+ - Also mention: `$pbr-scan` if there's an existing codebase to analyze first
389
+
390
+ ### STATE.md exists but is outdated
391
+ - STATE.md may not reflect the actual file system state
392
+ - Always verify by scanning phase directories
393
+ - If STATE.md disagrees with the file system, note the discrepancy:
394
+ "Note: STATE.md says Phase 2 is in progress, but all plans have summaries. Status may need updating."
395
+
396
+ ### All phases complete
397
+ - Celebrate briefly: "All phases complete!"
398
+ - Check for existing audit report: look for `*-MILESTONE-AUDIT.md` in `.planning/`
399
+ - **If audit exists and passed:** Suggest `$pbr-milestone complete` to archive (audit already done)
400
+ - **If audit exists with gaps:** Suggest `$pbr-milestone gaps` to address issues
401
+ - **If no audit exists:** Suggest `$pbr-milestone audit` to verify cross-phase integration (recommended first)
402
+ - Then: `$pbr-milestone complete` to archive the milestone and tag it
403
+ - Or: `$pbr-milestone new` to start the next set of features
404
+
405
+ ### ROADMAP.md has phases but no phase directories
406
+ - This is normal for future phases
407
+ - Show them as "Not started" with no plan counts
408
+
409
+ ### Multiple milestones
410
+ - If PROJECT.md shows multiple milestones, display the current one
411
+ - Show completed milestones as collapsed summary
412
+
413
+ ### Large project (many phases)
414
+ - If more than 8 phases, consider grouping:
415
+ - Completed phases: collapsed summary
416
+ - Current phase: full detail
417
+ - Upcoming phases: brief list
418
+
419
+ ---
420
+
421
+ ## Performance
422
+
423
+ This skill should be fast. It's a status check, not an analysis.
424
+
425
+ **DO:**
426
+ - Read files quickly (frontmatter only where possible)
427
+ - Use Glob to find files efficiently
428
+ - Cache nothing (always read fresh state)
429
+
430
+ **DO NOT:**
431
+
432
+ - Read full SUMMARY.md contents (frontmatter is enough)
433
+ - Read plan file contents (just check existence)
434
+ - Run Bash commands except for Step 1b (`pbr-tools llm` calls only when `local_llm.enabled: true`) and Step 1c (`pbr-tools context-triage`, always run but skip on error)
435
+ - Modify any files
436
+ - Spawn any Task agents
437
+
438
+ ---
439
+
440
+ ## Anti-Patterns
441
+
442
+ 1. **DO NOT** modify any files — this is read-only
443
+ 2. **DO NOT** run Bash commands — use Read and Glob only
444
+ 3. **DO NOT** show overwhelming detail — keep it scannable
445
+ 4. **DO NOT** hide problems — surface blockers, gaps, and warnings prominently
446
+ 5. **DO NOT** suggest multiple actions without prioritizing — the primary suggestion should be clear
447
+ 6. **DO NOT** re-read full file contents when frontmatter is sufficient
448
+ 7. **DO NOT** show completed phases in full detail unless specifically relevant
449
+ 8. **DO NOT** execute the suggested action — present it for the user to run manually. Use $pbr-continue for auto-execution.
@@ -0,0 +1,149 @@
1
+ ---
2
+ name: statusline
3
+ description: "Install or configure the PBR status line in Claude Code."
4
+ ---
5
+
6
+ **STOP — DO NOT READ THIS FILE. You are already reading it. This prompt was injected into your context by Claude Code's plugin system. Using the Read tool on this SKILL.md file wastes ~3,000 tokens. Begin executing Step 0 immediately.**
7
+
8
+ ## Step 0 — Immediate Output
9
+
10
+ **Before ANY tool calls**, display this banner:
11
+
12
+ ```
13
+ ╔══════════════════════════════════════════════════════════════╗
14
+ ║ PLAN-BUILD-RUN ► STATUS LINE ║
15
+ ╚══════════════════════════════════════════════════════════════╝
16
+ ```
17
+
18
+ Then proceed to Step 1.
19
+
20
+ # $pbr-statusline — Status Line Setup
21
+
22
+ The PBR status line displays live project state (phase, plan, status, git branch, context usage) in the Claude Code terminal status bar.
23
+
24
+ ---
25
+
26
+ ## Subcommand Parsing
27
+
28
+ Parse `$ARGUMENTS`:
29
+
30
+ | Argument | Action |
31
+ |----------|--------|
32
+ | `install` or empty | Install/enable the status line |
33
+ | `uninstall` or `remove` | Remove the status line configuration |
34
+ | `preview` | Show what the status line looks like without installing |
35
+
36
+ ---
37
+
38
+ ## Subcommand: install (default)
39
+
40
+ ### Step 1: Locate the status-line script
41
+
42
+ **CRITICAL: You must resolve the correct absolute path to `status-line.js`. Do NOT hardcode paths.**
43
+
44
+ 1. The script lives at `${PLUGIN_ROOT}/scripts/status-line.js`
45
+ 2. Resolve `${PLUGIN_ROOT}` to its absolute path using `pwd` or by checking the plugin root
46
+ 3. If running from a local plugin dir (`claude --plugin-dir .`), the path is the local repo's `plugins/pbr/scripts/status-line.js`
47
+ 4. If running from the installed plugin cache (`~/.claude/plugins/cache/`), use that path
48
+ 5. **Verify the script exists** with `ls` before proceeding. If it doesn't exist, show an error and stop.
49
+
50
+ Store the resolved absolute path as `SCRIPT_PATH`.
51
+
52
+ ### Step 2: Read current settings
53
+
54
+ Read `~/.claude/settings.json` (or `$HOME/.claude/settings.json`).
55
+
56
+ - If the file doesn't exist: start with an empty object `{}`
57
+ - If it exists: parse the JSON content
58
+ - Check if `statusLine` key already exists:
59
+ - If yes and points to the same script: inform user "PBR status line is already installed." and stop (unless they want to reconfigure)
60
+ - If yes but points to a different command: warn user and ask if they want to replace it
61
+
62
+ ### Step 3: Configure settings.json
63
+
64
+ Use AskUserQuestion:
65
+ question: "Install the PBR status line? This adds a `statusLine` entry to ~/.claude/settings.json."
66
+ header: "Install?"
67
+ options:
68
+ - label: "Install" description: "Enable the PBR status line in Claude Code"
69
+ - label: "Preview first" description: "Show a preview before installing"
70
+ - label: "Cancel" description: "Don't install"
71
+ multiSelect: false
72
+
73
+ If "Preview first": run the preview subcommand (show sample output), then ask again.
74
+ If "Cancel": stop.
75
+ If "Install":
76
+
77
+ **CRITICAL: Use Read tool to read the file, then Write to update it. Do NOT use sed or other text manipulation on JSON files.**
78
+
79
+ **CRITICAL: Back up settings.json NOW.** Write the original content to `~/.claude/settings.json.bak` before making any changes.
80
+
81
+ 1. Read `~/.claude/settings.json`
82
+ 2. Write the original content to `~/.claude/settings.json.bak`
83
+ 3. Parse the JSON
84
+ 4. Set `statusLine` to:
85
+ ```json
86
+ {
87
+ "type": "command",
88
+ "command": "node \"SCRIPT_PATH\""
89
+ }
90
+ ```
91
+ Where `SCRIPT_PATH` is the resolved absolute path from Step 1. Use forward slashes even on Windows.
92
+ 5. Write the updated JSON back (preserve all other settings, use 2-space indentation)
93
+
94
+ ### Step 4: Verify and confirm
95
+
96
+ Display:
97
+ ```
98
+ ✓ PBR status line installed
99
+
100
+ Script: {SCRIPT_PATH}
101
+ Config: ~/.claude/settings.json
102
+
103
+ The status line will appear on your next Claude Code session.
104
+ Restart Claude Code or run `/clear` to activate it now.
105
+
106
+ Customize per-project via .planning/config.json:
107
+ "status_line": {
108
+ "sections": ["phase", "plan", "status", "git", "context"],
109
+ "brand_text": "PBR"
110
+ }
111
+ ```
112
+
113
+ ---
114
+
115
+ ## Subcommand: uninstall
116
+
117
+ 1. Read `~/.claude/settings.json`
118
+ 2. If no `statusLine` key: inform user "No status line configured." and stop
119
+ 3. **CRITICAL: Back up settings.json NOW.** Write the original content to `~/.claude/settings.json.bak` before making any changes.
120
+ 4. Remove the `statusLine` key from the JSON
121
+ 5. Write the updated file
122
+ 5. Display: `✓ PBR status line removed. Restart Claude Code to take effect.`
123
+
124
+ ---
125
+
126
+ ## Subcommand: preview
127
+
128
+ 1. Locate and run the status-line script: `node {SCRIPT_PATH}`
129
+ - Pass sample stdin JSON: `{"context_window": {"used_percentage": 35}, "model": {"display_name": "Claude Opus 4.6"}, "cost": {"total_cost_usd": 0.42}}`
130
+ 2. Display the raw output to the user
131
+ 3. Also show a description of each section:
132
+ - **Phase**: Current phase number and name from STATE.md
133
+ - **Plan**: Plan progress (N of M)
134
+ - **Status**: Phase status keyword (planning, building, built, etc.)
135
+ - **Git**: Current branch + dirty indicator
136
+ - **Context**: Unicode bar showing context window usage (green/yellow/red)
137
+
138
+ ---
139
+
140
+ ## Edge Cases
141
+
142
+ ### No .planning/ directory
143
+ The status line works even without `.planning/` — it will show only git and context sections. Installation doesn't require a PBR project.
144
+
145
+ ### Plugin installed from npm vs local
146
+ The script path differs between `~/.claude/plugins/cache/plan-build-run/pbr/{version}/scripts/status-line.js` and a local `plugins/pbr/scripts/status-line.js`. The install command must resolve the actual path at install time.
147
+
148
+ ### Existing non-PBR status line
149
+ If `statusLine` already exists with a different command, warn the user and confirm before replacing.