@sienklogic/plan-build-run 2.59.0 → 2.61.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 (79) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/package.json +1 -1
  3. package/plugins/codex-pbr/agents/executor.md +8 -0
  4. package/plugins/codex-pbr/agents/plan-checker.md +5 -3
  5. package/plugins/codex-pbr/agents/planner.md +13 -7
  6. package/plugins/codex-pbr/agents/verifier.md +10 -1
  7. package/plugins/codex-pbr/references/plan-format.md +46 -8
  8. package/plugins/codex-pbr/skills/begin/SKILL.md +11 -27
  9. package/plugins/codex-pbr/skills/discuss/SKILL.md +52 -2
  10. package/plugins/codex-pbr/skills/health/SKILL.md +13 -0
  11. package/plugins/codex-pbr/skills/import/SKILL.md +275 -0
  12. package/plugins/codex-pbr/skills/plan/SKILL.md +11 -1
  13. package/plugins/codex-pbr/skills/shared/context-loader-task.md +2 -0
  14. package/plugins/codex-pbr/skills/status/SKILL.md +17 -0
  15. package/plugins/codex-pbr/templates/PROJECT.md.tmpl +41 -0
  16. package/plugins/codex-pbr/templates/REQUIREMENTS.md.tmpl +52 -0
  17. package/plugins/codex-pbr/templates/VERIFICATION-DETAIL.md.tmpl +5 -0
  18. package/plugins/codex-pbr/templates/project-CONTEXT.md.tmpl +43 -0
  19. package/plugins/copilot-pbr/agents/executor.agent.md +8 -0
  20. package/plugins/copilot-pbr/agents/plan-checker.agent.md +5 -3
  21. package/plugins/copilot-pbr/agents/planner.agent.md +13 -7
  22. package/plugins/copilot-pbr/agents/verifier.agent.md +10 -1
  23. package/plugins/copilot-pbr/hooks/hooks.json +1 -0
  24. package/plugins/copilot-pbr/plugin.json +1 -1
  25. package/plugins/copilot-pbr/references/plan-format.md +46 -8
  26. package/plugins/copilot-pbr/skills/begin/SKILL.md +11 -27
  27. package/plugins/copilot-pbr/skills/discuss/SKILL.md +52 -2
  28. package/plugins/copilot-pbr/skills/health/SKILL.md +13 -0
  29. package/plugins/copilot-pbr/skills/import/SKILL.md +275 -0
  30. package/plugins/copilot-pbr/skills/plan/SKILL.md +11 -1
  31. package/plugins/copilot-pbr/skills/shared/context-loader-task.md +2 -0
  32. package/plugins/copilot-pbr/skills/status/SKILL.md +17 -0
  33. package/plugins/copilot-pbr/templates/PROJECT.md.tmpl +41 -0
  34. package/plugins/copilot-pbr/templates/REQUIREMENTS.md.tmpl +52 -0
  35. package/plugins/copilot-pbr/templates/VERIFICATION-DETAIL.md.tmpl +5 -0
  36. package/plugins/copilot-pbr/templates/project-CONTEXT.md.tmpl +43 -0
  37. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  38. package/plugins/cursor-pbr/agents/executor.md +8 -0
  39. package/plugins/cursor-pbr/agents/plan-checker.md +5 -3
  40. package/plugins/cursor-pbr/agents/planner.md +13 -7
  41. package/plugins/cursor-pbr/agents/verifier.md +10 -1
  42. package/plugins/cursor-pbr/hooks/hooks.json +1 -0
  43. package/plugins/cursor-pbr/references/plan-format.md +46 -8
  44. package/plugins/cursor-pbr/skills/begin/SKILL.md +11 -27
  45. package/plugins/cursor-pbr/skills/discuss/SKILL.md +53 -3
  46. package/plugins/cursor-pbr/skills/health/SKILL.md +13 -0
  47. package/plugins/cursor-pbr/skills/import/SKILL.md +276 -1
  48. package/plugins/cursor-pbr/skills/plan/SKILL.md +11 -1
  49. package/plugins/cursor-pbr/skills/shared/context-loader-task.md +2 -0
  50. package/plugins/cursor-pbr/skills/status/SKILL.md +17 -0
  51. package/plugins/cursor-pbr/templates/PROJECT.md.tmpl +41 -0
  52. package/plugins/cursor-pbr/templates/REQUIREMENTS.md.tmpl +52 -0
  53. package/plugins/cursor-pbr/templates/VERIFICATION-DETAIL.md.tmpl +5 -0
  54. package/plugins/cursor-pbr/templates/project-CONTEXT.md.tmpl +43 -0
  55. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
  56. package/plugins/pbr/agents/executor.md +8 -0
  57. package/plugins/pbr/agents/plan-checker.md +5 -3
  58. package/plugins/pbr/agents/planner.md +13 -7
  59. package/plugins/pbr/agents/verifier.md +10 -1
  60. package/plugins/pbr/hooks/hooks.json +1 -0
  61. package/plugins/pbr/references/plan-format.md +46 -8
  62. package/plugins/pbr/scripts/check-plan-format.js +29 -0
  63. package/plugins/pbr/scripts/config-schema.json +14 -1
  64. package/plugins/pbr/scripts/context-bridge.js +1 -1
  65. package/plugins/pbr/scripts/lib/gates/doc-existence.js +46 -0
  66. package/plugins/pbr/scripts/post-write-dispatch.js +22 -2
  67. package/plugins/pbr/scripts/sync-context-to-claude.js +100 -0
  68. package/plugins/pbr/scripts/validate-task.js +14 -1
  69. package/plugins/pbr/skills/begin/SKILL.md +11 -27
  70. package/plugins/pbr/skills/discuss/SKILL.md +53 -3
  71. package/plugins/pbr/skills/health/SKILL.md +13 -0
  72. package/plugins/pbr/skills/import/SKILL.md +276 -1
  73. package/plugins/pbr/skills/plan/SKILL.md +11 -1
  74. package/plugins/pbr/skills/shared/context-loader-task.md +2 -0
  75. package/plugins/pbr/skills/status/SKILL.md +17 -0
  76. package/plugins/pbr/templates/PROJECT.md.tmpl +41 -0
  77. package/plugins/pbr/templates/REQUIREMENTS.md.tmpl +52 -0
  78. package/plugins/pbr/templates/VERIFICATION-DETAIL.md.tmpl +5 -0
  79. package/plugins/pbr/templates/project-CONTEXT.md.tmpl +43 -0
@@ -0,0 +1,52 @@
1
+ # Requirements
2
+
3
+ > Living document. Generated by `/pbr:begin`, updated via `/pbr:discuss`.
4
+ > All requirements flow from here into plans via `implements:[]` in PLAN.md frontmatter.
5
+
6
+ ## Functional Requirements
7
+
8
+ Capabilities the system must provide from the user's perspective.
9
+
10
+ ### {Category} (e.g., Authentication, API, UI)
11
+
12
+ | ID | Requirement | Priority | Status |
13
+ |----|-------------|----------|--------|
14
+ | REQ-F-001 | {User-centric, testable statement of capability} | Must | Open |
15
+ | REQ-F-002 | {User-centric, testable statement of capability} | Should | Open |
16
+
17
+ ### {Category 2}
18
+
19
+ | ID | Requirement | Priority | Status |
20
+ |----|-------------|----------|--------|
21
+ | REQ-F-010 | {User-centric, testable statement of capability} | Must | Open |
22
+
23
+ ## Non-Functional Requirements
24
+
25
+ Quality attributes and constraints the system must satisfy.
26
+
27
+ | ID | Requirement | Category | Priority |
28
+ |----|-------------|----------|----------|
29
+ | REQ-NF-001 | {Observable quality statement — e.g., "Page loads in <2s on 4G"} | Performance | Must |
30
+ | REQ-NF-002 | {Observable quality statement} | Security | Must |
31
+ | REQ-NF-003 | {Observable quality statement} | Reliability | Should |
32
+
33
+ ## Deferred Requirements (v2+)
34
+
35
+ Requirements explicitly out of scope for v1.
36
+
37
+ | ID | Requirement | Deferred Reason |
38
+ |----|-------------|----------------|
39
+ | REQ-F-099 | {requirement} | {reason — e.g., "Phase 2 priority"} |
40
+
41
+ ## Out of Scope
42
+
43
+ Features explicitly excluded. These must NOT appear in any plan.
44
+
45
+ - {Feature}: {brief rationale}
46
+
47
+ ## Traceability
48
+
49
+ | REQ-ID | Implemented In | Verified In |
50
+ |--------|---------------|------------|
51
+ | REQ-F-001 | Phase 01 PLAN-01 | Phase 01 VERIFICATION.md |
52
+ | REQ-F-002 | — | — |
@@ -23,6 +23,11 @@ anti_patterns:
23
23
  console_logs: {count}
24
24
  skipped_tests: {count}
25
25
  hardcoded_secrets: {count}
26
+ # populated by verifier from implements:[] in plan frontmatter
27
+ satisfied:
28
+ - "REQ-F-001" # REQ-IDs confirmed verified in this phase
29
+ unsatisfied:
30
+ - "REQ-F-002" # REQ-IDs that failed verification
26
31
  ---
27
32
 
28
33
  # Phase Verification: {phase_name}
@@ -0,0 +1,43 @@
1
+ # Project Context
2
+
3
+ > Cross-cutting decisions that ALL phases must honor.
4
+ > Updated via `/pbr:discuss --project`. Auto-synced to CLAUDE.md on write.
5
+ > Phase-level CONTEXT.md (in phase directories) overrides project-level for that phase.
6
+ >
7
+ > PLANNER NOTE: Embed each locked decision directly into the relevant task's action block.
8
+ > Executors NEVER read this file — PLAN.md is self-contained.
9
+
10
+ ## Locked Decisions
11
+
12
+ Technology choices, architecture decisions, and constraints that are NON-NEGOTIABLE across ALL phases.
13
+ The planner embeds these into PLAN.md task actions. Executors never read this file directly.
14
+
15
+ | Decision | Rationale | Locked By |
16
+ |----------|-----------|-----------|
17
+ | {e.g., "Use TypeScript strict mode"} | {User preference, team skill} | User |
18
+ | {e.g., "PostgreSQL via Supabase"} | {Existing infrastructure} | User |
19
+
20
+ ## User Constraints
21
+
22
+ Budget, timeline, skill level, hosting, team size — factors that shape ALL planning decisions.
23
+
24
+ - {e.g., "Solo developer, no team"}
25
+ - {e.g., "Deploy to Hetzner VPS"}
26
+ - {e.g., "Must work offline"}
27
+
28
+ ## Deferred Ideas
29
+
30
+ Ideas explicitly moved to v2 or ruled out. Plans at ANY phase MUST NOT include these.
31
+
32
+ | Idea | Reason Deferred |
33
+ |------|----------------|
34
+ | {feature} | {reason — e.g., "Post-launch priority"} |
35
+
36
+ ## Claude's Discretion Areas
37
+
38
+ Areas where planners can make implementation choices without asking the user.
39
+ Document the choice made and rationale when exercised.
40
+
41
+ | Area | Choice Made | Rationale |
42
+ |------|------------|-----------|
43
+ | {e.g., "Logging library"} | {e.g., "pino"} | {e.g., "Lightweight, structured output"} |
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pbr",
3
3
  "displayName": "Plan-Build-Run",
4
- "version": "2.59.0",
4
+ "version": "2.61.0",
5
5
  "description": "Plan-Build-Run — Structured development workflow for Cursor. Solves context rot through disciplined subagent delegation, structured planning, atomic execution, and goal-backward verification.",
6
6
  "author": {
7
7
  "name": "SienkLogic",
@@ -37,6 +37,9 @@ You are **executor**, the code execution agent for Plan-Build-Run. You receive v
37
37
  a. Read task XML
38
38
  b. Execute <action> steps
39
39
  c. Run <verify> commands
40
+ - If <verify> contains an <automated> child element, extract and run the command inside it
41
+ - If <verify> is plain text (no <automated> child), run it as before (backward compat)
42
+ - Both forms produce the same result — <automated> is machine-parseable, plain text is human-readable
40
43
  d. If verify passes: commit
41
44
  e. If verify fails: apply deviation rules
42
45
  f. If checkpoint: STOP and return
@@ -198,6 +201,11 @@ When a task has a checkpoint type, **STOP execution** and return a structured re
198
201
  | `decision` | Before executing | Decision needed, options, context |
199
202
  | `human-action` | Before executing | What user must do, step-by-step |
200
203
 
204
+ **auto_checkpoints config**: After loading plan frontmatter, read `gates.auto_checkpoints` from config.json (default false):
205
+ - Load with: `node pbr-tools.js config-get gates.auto_checkpoints`
206
+ - When `auto_checkpoints` is true AND task type is `checkpoint:human-verify`: run the automated verify command. If it passes, auto-approve and continue. If it fails, still STOP and return the checkpoint response.
207
+ - `checkpoint:decision` and `checkpoint:human-action` always require human input regardless of `auto_checkpoints`.
208
+
201
209
  **Automation-first**: Complete all automatable pre-work before any checkpoint. Only checkpoint for genuinely human-required actions (API keys needing account login, architectural choices, destructive approvals).
202
210
 
203
211
  All responses use: `CHECKPOINT: {TYPE}` header, task info, type-specific fields, completed tasks table, remaining tasks list.
@@ -159,14 +159,16 @@ Plans declare `provides`/`consumes`; all consumed items must have providers.
159
159
  | Missing provides/consumes for exports | INFO |
160
160
 
161
161
  ### D9: Requirement Traceability
162
- Plans declare `requirement_ids` with bidirectional coverage. Forward: IDs trace to REQUIREMENTS.md (or ROADMAP.md goals). Backward: every requirement covered by at least one plan.
162
+ Plans declare `implements` with bidirectional coverage. Forward: IDs trace to REQUIREMENTS.md (or ROADMAP.md goals). Backward: every requirement covered by at least one plan.
163
+
164
+ > **Note:** `requirement_ids:` is a deprecated alias for `implements:` — treat as equivalent during transition.
163
165
 
164
166
  | Condition | Severity |
165
167
  |-----------|----------|
166
- | requirement_id references nonexistent requirement | BLOCKER |
168
+ | implements: ID references nonexistent requirement | BLOCKER |
167
169
  | Requirement not covered by any plan | WARNING |
168
170
  | ROADMAP goal not covered (no REQUIREMENTS.md) | WARNING |
169
- | Plan missing requirement_ids entirely | INFO |
171
+ | Plan missing implements: entirely | WARNING |
170
172
 
171
173
  ### D10: Test Plan Coverage
172
174
  Code-producing tasks should include test expectations. Check that tasks creating or modifying source code have corresponding test references in `<files>`, `<action>`, or `<verify>`. Test files should appear in `<files>`, test commands in `<verify>`, and test outcomes in `<done>`.
@@ -11,7 +11,7 @@ you MUST Read every listed file BEFORE any other action.
11
11
  Skipping this causes hallucinated context and broken output.
12
12
  </files_to_read>
13
13
 
14
- > Default files: CONTEXT.md, ROADMAP.md, research documents, existing plan files
14
+ > Default files: PROJECT.md (if exists), CONTEXT.md (project-level, if exists), phase CONTEXT.md (if exists), ROADMAP.md, research documents, existing plan files
15
15
 
16
16
  # Plan-Build-Run Planner
17
17
 
@@ -22,7 +22,7 @@ You are **planner**, the planning agent for the Plan-Build-Run development syste
22
22
 
23
23
  ## Core Principle: Context Fidelity
24
24
 
25
- **Locked decisions from CONTEXT.md are NON-NEGOTIABLE.** You never substitute, reinterpret, or work around locked decisions. If CONTEXT.md says "Use PostgreSQL", the plan uses PostgreSQL. Period.
25
+ **Locked decisions from BOTH `.planning/CONTEXT.md` (project-level) AND `.planning/phases/{NN}-{slug}/CONTEXT.md` (phase-level) are NON-NEGOTIABLE.** Phase-level overrides project-level for the same decision area. You never substitute, reinterpret, or work around locked decisions. If CONTEXT.md says "Use PostgreSQL", the plan uses PostgreSQL. Period.
26
26
 
27
27
  **Deferred ideas from CONTEXT.md MUST NOT appear in plans.** If something is marked as deferred, it does not exist for planning purposes. Do not plan for it, do not create hooks for it, do not "prepare" for it.
28
28
  </role>
@@ -194,7 +194,13 @@ Two plans CONFLICT if their `files_modified` lists overlap. Conflicting plans MU
194
194
  <execution_flow>
195
195
  ## Planning Process
196
196
 
197
- 1. **Load Context**: Read CONTEXT.md (locked decisions + deferred ideas), phase goal, and any research documents.
197
+ 1. **Load Context**: Read locked decisions, phase goal, and any research documents.
198
+ - Read `.planning/PROJECT.md` (if exists) — project scope/out-of-scope constraints
199
+ - Read `.planning/CONTEXT.md` (project-level, if exists) — cross-cutting locked decisions
200
+ - Read `.planning/phases/{NN}-{slug}/CONTEXT.md` (phase-level, if exists) — phase-specific decisions
201
+ - Phase-level CONTEXT.md overrides project-level for conflicting decision areas
202
+ - **For each locked decision found**: embed it directly into the relevant task's `<action>` block.
203
+ Executors NEVER read CONTEXT.md — PLAN.md task actions must be self-contained.
198
204
 
199
205
  ### Handling [NEEDS DECISION] Items
200
206
  When CONTEXT.md or RESEARCH-SUMMARY.md contains `[NEEDS DECISION]` flags from the synthesizer:
@@ -204,7 +210,7 @@ When CONTEXT.md or RESEARCH-SUMMARY.md contains `[NEEDS DECISION]` flags from th
204
210
  2. **Derive Must-Haves**: Apply goal-backward methodology — state the phase goal as a user-observable outcome, derive truths, artifacts, and key links.
205
211
  3. **Break Down Tasks**: For each must-have, determine code changes, files involved, verification method, and observable done condition. Group related work into tasks (2-3 per plan).
206
212
  4. **Assign Waves and Dependencies**: Identify independent tasks (Wave 1), map dependencies, assign wave numbers, check for circular deps and file conflicts within same wave.
207
- 5. **Write Plan Files**: Complete YAML frontmatter (include `requirement_ids` from REQUIREMENTS.md or ROADMAP.md goal IDs for traceability), XML tasks with all 5 elements, clear action instructions, executable verify commands, observable done conditions. Append a `## Summary` section per `references/plan-format.md` (under 500 tokens): plan ID, numbered task list, key files, must-haves, provides/consumes.
213
+ 5. **Write Plan Files**: Complete YAML frontmatter (include `implements` field with REQ-IDs from REQUIREMENTS.md or ROADMAP.md for traceability; `requirement_ids` is a deprecated alias — use `implements` as the primary field), XML tasks with all 5 elements, clear action instructions, executable verify commands, observable done conditions. Append a `## Summary` section per `references/plan-format.md` (under 500 tokens): plan ID, numbered task list, key files, must-haves, provides/consumes.
208
214
  6. **Self-Check** before writing:
209
215
 
210
216
  **CRITICAL — Run the self-check. Plans missing must-have coverage or incomplete tasks cause executor failures.**
@@ -242,7 +248,7 @@ When receiving checker feedback:
242
248
 
243
249
  ## Context Optimization
244
250
 
245
- **Context Fidelity Self-Check**: Before writing plans, verify: (1) every locked decision in CONTEXT.md has a corresponding task, (2) no task implements a deferred idea, (3) each "Claude's Discretion" item is addressed in at least one task. Report: "CONTEXT.md compliance: {M}/{N} locked decisions mapped."
251
+ **Context Fidelity Self-Check**: Before writing plans, verify: (1) every locked decision in BOTH `.planning/CONTEXT.md` (project-level) AND `.planning/phases/{NN}-{slug}/CONTEXT.md` (phase-level) has a corresponding task (deduplicate identical decisions across both files), (2) no task implements a deferred idea, (3) each "Claude's Discretion" item is addressed in at least one task. Report: "CONTEXT.md compliance: {M}/{N} locked decisions mapped."
246
252
 
247
253
  **Frontmatter-First Assembly**: When prior plans exist, read SUMMARY.md frontmatter only (not full body) — 10 frontmatters ~500 tokens vs 10 full SUMMARYs ~5000 tokens. Extract: `provides`, `requires`, `key_files`, `key_decisions`, `patterns`. Only read full body when a specific detail is needed.
248
254
 
@@ -258,7 +264,7 @@ When receiving checker feedback:
258
264
  - [ ] Tasks grouped into plans by wave
259
265
  - [ ] PLAN files exist with XML task structure
260
266
  - [ ] Each plan: frontmatter complete (depends_on, files_modified, must_haves)
261
- - [ ] Each plan: requirement_ids field populated (MUST NOT be empty)
267
+ - [ ] Each plan: implements: field populated (list REQ-IDs; use [] only if phase has no REQUIREMENTS.md)
262
268
  - [ ] Each task: all 5 elements (name, files, action, verify, done)
263
269
  - [ ] Wave structure maximizes parallelism
264
270
  - [ ] Every REQ-ID from ROADMAP/REQUIREMENTS appears in at least one plan
@@ -338,7 +344,7 @@ One-line task descriptions in `<name>`. File paths in `<files>`, not explanation
338
344
  11. DO NOT leave done conditions vague — they must be observable
339
345
  12. DO NOT specify literal `undefined` for parameters that have a known source in the calling context — use data contracts to map sources
340
346
  13. DO NOT use Bash heredoc for file creation — ALWAYS use the Write tool
341
- 14. DO NOT leave requirement_ids empty in PLAN frontmatter — every plan must trace to requirements
347
+ 14. DO NOT leave implements: empty in PLAN frontmatter — use implements: as the primary traceability field (requirement_ids: is deprecated)
342
348
 
343
349
  </anti_patterns>
344
350
 
@@ -76,7 +76,8 @@ Stop and report error if pbr-tools CLI is unavailable. Also read CONTEXT.md for
76
76
  - `artifacts`: Files/exports that must exist, be substantive, and not be stubs
77
77
  - `key_links`: Connections that must be wired between components
78
78
 
79
- If plans lack explicit must-haves, derive them goal-backward from ROADMAP.md: what must be TRUE → what must EXIST → what must be CONNECTED.
79
+ Must-haves in plan frontmatter are canonical use exactly what mustHavesCollect returns.
80
+ Only fall back to goal-backward derivation from ROADMAP.md if ALL plans in the phase have completely empty must_haves sections. Do NOT supplement or re-derive when must_haves are present.
80
81
 
81
82
  Output: A numbered list of every must-have to verify.
82
83
 
@@ -161,6 +162,14 @@ Cross-reference all must-haves against verification results in a table:
161
162
 
162
163
  L4 column shows `-` when no automated verification is available. Only artifacts with test commands or build verification get L4 checks.
163
164
 
165
+ ### Step 7b: Write REQ-ID Traceability (Always)
166
+
167
+ After verifying all must-haves, collect `implements:[]` from all plan frontmatters in the phase.
168
+
169
+ - For each REQ-ID: if all must-haves for that plan passed → add to `satisfied:[]`
170
+ - If any must-have for that plan failed → add to `unsatisfied:[]`
171
+ - Write `satisfied:[]` and `unsatisfied:[]` to the VERIFICATION.md frontmatter
172
+
164
173
  ### Step 8: Scan for Anti-Patterns (Full Verification Only)
165
174
 
166
175
  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.
@@ -98,6 +98,7 @@
98
98
  ]
99
99
  },
100
100
  {
101
+ "matcher": "Write|Edit|Bash|Task",
101
102
  "hooks": [
102
103
  {
103
104
  "type": "command",
@@ -43,9 +43,9 @@ provides:
43
43
  - "requireAuth() middleware"
44
44
  consumes:
45
45
  - "Database connection (from plan 01-01)"
46
- requirement_ids:
47
- - "P02-G1"
48
- - "P02-G2"
46
+ implements:
47
+ - "REQ-F-001"
48
+ - "REQ-F-002"
49
49
  closes_issues:
50
50
  - 42
51
51
  - 57
@@ -71,7 +71,8 @@ closes_issues:
71
71
  | `must_haves.key_links` | YES | array | Connections between components. Append `: grep command` for verification. |
72
72
  | `provides` | NO | array | What this plan exports for other plans to consume (classes, endpoints, modules) |
73
73
  | `consumes` | NO | array | What this plan needs from prior plans. Format: `"Thing (from plan XX-YY)"` |
74
- | `requirement_ids` | NO | array | Requirement IDs from REQUIREMENTS.md or ROADMAP.md goal IDs that this plan addresses. Enables bidirectional traceability between plans and requirements/goals. |
74
+ | `implements` | NO (WARNING if absent) | array | REQ-IDs from REQUIREMENTS.md this plan addresses. Primary traceability field. |
75
+ | `requirement_ids` | NO | array | DEPRECATED — use `implements:` instead. Kept for backward compat. |
75
76
  | `dependency_fingerprints` | NO | object | Hashes of dependency phase SUMMARY.md files at plan-creation time. Used to detect stale plans. |
76
77
  | `data_contracts` | NO | array | Cross-boundary parameter mappings for calls where arguments originate from external boundaries. Format: `"param: source (context) [fallback]"` |
77
78
  | `closes_issues` | NO | number[] | GitHub issue numbers to close when this plan's final commit lands. Default: `[]` |
@@ -162,14 +163,20 @@ The Summary section is generated by the planner agent at plan creation time. It
162
163
  DISCORD_REDIRECT_URI=http://localhost:3000/auth/callback
163
164
  </action>
164
165
  <verify>
165
- npx tsc --noEmit
166
- ls src/auth/discord.ts
167
- ls src/auth/types.ts
166
+ <automated>
167
+ npx tsc --noEmit
168
+ ls src/auth/discord.ts
169
+ ls src/auth/types.ts
170
+ </automated>
168
171
  </verify>
169
172
  <done>Discord OAuth client module exists and compiles without errors</done>
170
173
  </task>
171
174
  ```
172
175
 
176
+ > **Verify block forms**: The `<automated>` wrapper (Option A) is preferred — it enables machine-parsing
177
+ > for `auto_checkpoints` mode. Plain-text verify commands without the wrapper (Option B) remain valid
178
+ > for backward compatibility. Both forms are supported by the executor.
179
+
173
180
  ### TDD Task
174
181
 
175
182
  ```xml
@@ -204,6 +211,33 @@ The Summary section is generated by the planner agent at plan creation time. It
204
211
  </task>
205
212
  ```
206
213
 
214
+ ### Feature Task (TDD Variant)
215
+
216
+ Feature tasks add a `<feature>` element for structured TDD planning. The element contains two required children:
217
+
218
+ - **`<behavior>`** — the observable outcome from the user's perspective. Maps directly to a `must_haves.truths` entry.
219
+ - **`<implementation>`** — the technical approach at a high level (which files, patterns, or algorithms to use).
220
+
221
+ Prose structure (illustrative — not a live task block to avoid validator false-positives):
222
+
223
+ ```
224
+ task id="02-01-T3" type="auto" tdd="true" complexity="medium"
225
+ name: Implement rate limiter for OAuth endpoint
226
+ files: src/middleware/rate-limit.ts / tests/middleware/rate-limit.test.ts
227
+ feature:
228
+ behavior: OAuth endpoint rejects more than 5 requests per minute per IP with HTTP 429
229
+ implementation: Token-bucket algorithm; Redis-backed counter with TTL; express-rate-limit wrapper
230
+ action:
231
+ RED: Write failing tests for 429 response at >5 req/min
232
+ GREEN: Implement token-bucket middleware using Redis
233
+ REFACTOR: Extract counter logic to RateLimitStore class
234
+ verify:
235
+ automated: npm test -- --grep "rate limiter"
236
+ done: Rate limiter rejects excessive OAuth requests with 429
237
+ ```
238
+
239
+ The `<feature>` element is optional — standard TDD tasks without it are still valid. Use `<feature>` when the planner wants to record the behavior/implementation split explicitly for traceability.
240
+
207
241
  ### Checkpoint: Human Verify
208
242
 
209
243
  ```xml
@@ -291,9 +325,13 @@ Every task MUST have ALL 5. No exceptions.
291
325
  | `<name>` | What the task does | Imperative verb phrase. Short. |
292
326
  | `<files>` | Files touched | One per line. Actual file paths. |
293
327
  | `<action>` | How to do it | Numbered steps. Specific. Code snippets for complex work. |
294
- | `<verify>` | How to check | Executable shell commands. Or checkpoint format. |
328
+ | `<verify>` | How to check | Executable shell commands (plain-text or wrapped in `<automated>`). Or checkpoint format. |
295
329
  | `<done>` | How to know it worked | Observable user/system behavior. Maps to a must-have. |
296
330
 
331
+ > **Optional `<feature>` element**: Feature tasks (TDD variant) may add a `<feature>` element with
332
+ > `<behavior>` and `<implementation>` children for structured TDD planning. The 5 standard elements
333
+ > above are still required.
334
+
297
335
  ---
298
336
 
299
337
  ## Task ID Format
@@ -546,11 +546,10 @@ For each category, present the features and ask the user to classify each:
546
546
  - **Out of scope** — Will NOT be built
547
547
 
548
548
  **7d. Assign REQ-IDs:**
549
- For each committed requirement, assign an ID in the format `{CATEGORY}-{NN}`:
550
- - `AUTH-01`: User can log in with Discord OAuth
551
- - `AUTH-02`: Protected routes redirect to login
552
- - `UI-01`: Dashboard shows player statistics
553
- - `UI-02`: Mobile-responsive layout
549
+ For each committed requirement, assign an ID using the REQ-F/REQ-NF schema:
550
+ - Functional requirements: `REQ-F-xxx` numbered sequentially within each category (REQ-F-001, REQ-F-002, ...)
551
+ - Non-functional requirements: `REQ-NF-xxx` numbered sequentially across all NFR categories (REQ-NF-001, REQ-NF-002, ...)
552
+ - Examples: `REQ-F-001: User can log in with Discord OAuth`, `REQ-NF-001: Page loads in <2s on 4G`
554
553
 
555
554
  Each requirement must be:
556
555
  - **User-centric** — describes a capability from the user's perspective
@@ -663,28 +662,13 @@ Write the project state files from templates:
663
662
  **CRITICAL (no hook): Write CONTEXT.md NOW. Do NOT skip this step.**
664
663
 
665
664
  **9c. Write CONTEXT.md:**
666
- Create `.planning/CONTEXT.md` from information gathered during questioning:
667
-
668
- ```markdown
669
- # Project Context
670
-
671
- ## Locked Decisions
672
- {Technology choices, architecture decisions, and constraints that are NON-NEGOTIABLE}
673
-
674
- | Decision | Rationale | Locked By |
675
- |----------|-----------|-----------|
676
- | {e.g., "Use TypeScript"} | {User preference, team skill} | User |
677
-
678
- ## User Constraints
679
- {Budget, timeline, skill level, hosting, team size}
680
-
681
- ## Deferred Ideas
682
- {Features explicitly moved to v2 or out-of-scope}
683
-
684
- | Idea | Reason Deferred |
685
- |------|----------------|
686
- | {feature} | {reason} |
687
- ```
665
+ 1. Read `${CLAUDE_SKILL_DIR}/templates/project-CONTEXT.md.tmpl`
666
+ 2. Fill in from the questioning conversation:
667
+ - Locked Decisions: all technology choices and architecture decisions from Step 2
668
+ - User Constraints: budget, timeline, skill level, hosting, team
669
+ - Deferred Ideas: out-of-scope items identified in Step 7c scoping
670
+ - Claude's Discretion: any areas where user said "you decide"
671
+ 3. Write to `.planning/CONTEXT.md`
688
672
 
689
673
  **CRITICAL (no hook): Write HISTORY.md NOW. Do NOT skip this step.**
690
674
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: discuss
3
3
  description: "Talk through a phase before planning. Identifies gray areas and captures your decisions."
4
- argument-hint: "<phase-number>"
4
+ argument-hint: "<phase-number> | --project"
5
5
  ---
6
6
 
7
7
  **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.**
@@ -36,9 +36,12 @@ This skill runs **inline** (no Task delegation).
36
36
 
37
37
  ### Step 1: Parse Phase Number and Check for Existing Plans
38
38
 
39
- Parse `$ARGUMENTS` to get the phase number.
39
+ Parse `$ARGUMENTS`:
40
+ - If argument is `--project`: enter PROJECT mode (see Step 1-project below). Skip Steps 2-8.
41
+ - If argument is a phase number: enter PHASE mode (existing flow — continue with Step 1 as-is).
42
+ - If no argument: existing logic applies (read STATE.md for current phase).
40
43
 
41
- **Validation:**
44
+ **Validation (PHASE mode):**
42
45
  - Must be a valid phase number (integer or decimal like `3.1`)
43
46
  - If no argument provided, read STATE.md to get the current phase
44
47
  - If no current phase and no argument: "Which phase do you want to discuss? Run `/pbr:status` to see available phases."
@@ -64,6 +67,53 @@ Phase {N} not found.
64
67
  - Warn: "Phase {N} already has plans. Decisions from this discussion won't retroactively change them. Consider re-planning with `/pbr:plan {N}` after."
65
68
  - This is a **warning only** — do not block the discussion
66
69
 
70
+ ### Step 1-project: Project Discussion Mode (--project)
71
+
72
+ When invoked with `--project`, discuss project-level cross-cutting decisions.
73
+ This mode writes to `.planning/CONTEXT.md` (project-level), NOT a phase directory.
74
+
75
+ **Check for existing project CONTEXT.md:**
76
+ 1. Use Glob to check if `.planning/CONTEXT.md` exists.
77
+ 2. If it exists, ask the user (using the context-handling pattern from
78
+ `skills/shared/gate-prompts.md`):
79
+ question: "Project CONTEXT.md already exists. How should we handle it?"
80
+ options: Overwrite | Append | Cancel
81
+ 3. If Cancel: stop and display the existing CONTEXT.md path.
82
+
83
+ **Load project context:**
84
+ - Read `.planning/PROJECT.md` (if exists) — project vision and scope
85
+ - Read `.planning/REQUIREMENTS.md` (if exists) — requirements for constraint awareness
86
+ - Read `.planning/CONTEXT.md` (if exists) — current locked decisions (for Append mode)
87
+
88
+ **Run gray areas for project-level decisions (Steps 2.5-5 pattern):**
89
+ - Identify 3-4 cross-cutting architectural decisions across ALL phases
90
+ - Focus on: technology stack choices, infrastructure, security posture,
91
+ observability approach, deployment strategy, data storage decisions
92
+ - Follow the same Steps 3-5 pattern (gray areas → options → follow-ups)
93
+
94
+ **Write project CONTEXT.md:**
95
+ 1. Read `${CLAUDE_SKILL_DIR}/templates/project-CONTEXT.md.tmpl`
96
+ 2. Fill in from discussion decisions:
97
+ - Locked Decisions table: all decisions the user made (not "Let Claude decide")
98
+ - User Constraints: budget, team, timeline, hosting from the conversation
99
+ - Deferred Ideas: anything explicitly ruled out for this project
100
+ - Claude's Discretion: decisions marked "Let Claude decide"
101
+ 3. If Append mode: merge new decisions with existing CONTEXT.md content
102
+ 4. Write to `.planning/CONTEXT.md`
103
+
104
+ **Update STATE.md pointer:**
105
+ Add under Accumulated Context:
106
+ ```
107
+ Project context: .planning/CONTEXT.md ({N} locked decisions, {N} deferred, {N} discretion)
108
+ ```
109
+
110
+ **After writing:** Auto-sync to CLAUDE.md is handled by the post-write-dispatch hook.
111
+ Display: `✓ Project CONTEXT.md written — locked decisions will auto-sync to CLAUDE.md`
112
+
113
+ Skip to Cleanup step. Do NOT run Steps 2-8 of the phase flow.
114
+
115
+ ---
116
+
67
117
  ### Step 2: Load Phase Context
68
118
 
69
119
  Read the following files to understand what this phase needs to accomplish:
@@ -62,6 +62,19 @@ Stop all further checks.
62
62
  - PASS: All three required files exist
63
63
  - FAIL: List each missing file — "Run `/pbr:begin` to re-initialize, or create the file manually."
64
64
 
65
+ **Advisory checks — WARN if missing, do not FAIL:**
66
+
67
+ - `.planning/PROJECT.md`
68
+ If missing: `⚠ PROJECT.md not found. Run /pbr:begin to generate it, or create from plugins/pbr/templates/PROJECT.md.tmpl.`
69
+
70
+ - `.planning/REQUIREMENTS.md`
71
+ If missing: `⚠ REQUIREMENTS.md not found. Run /pbr:begin to generate it, or create from plugins/pbr/templates/REQUIREMENTS.md.tmpl.`
72
+
73
+ - `.planning/CONTEXT.md` (project-level)
74
+ If missing: `⚠ CONTEXT.md not found. Run /pbr:discuss --project to capture locked decisions.`
75
+
76
+ These files are generated by /pbr:begin. Absence is expected on projects created before v2.15.
77
+
65
78
  ### Check 2: Config Validity
66
79
 
67
80
  Parse `.planning/config.json` as JSON. Check required fields: `version`, `depth`. Check recommended fields: `features`, `models`.