buildflow-dev 1.0.7 → 4.0.2

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.
@@ -1,60 +1,228 @@
1
1
  ---
2
2
  name: buildflow-plan
3
- description: Create a dependency-aware execution plan with the Architect agent
3
+ description: Spec-traced, dependency-reasoned, risk-sequenced execution plan with engineering review
4
4
  allowed-tools: Read, Write
5
5
  agent: architect
6
6
  ---
7
7
 
8
8
  # /buildflow-plan
9
9
 
10
- Create a detailed, phased execution plan. The Architect agent maps dependencies before sequencing work.
10
+ Creates a precise, dependency-reasoned execution plan. Every task traces to an Acceptance Criterion. Dependencies are explained, not just listed. Tasks are risk-sequenced and effort-estimated. An Engineering Review catches design problems before a single line of code is written.
11
+
12
+ Run after `/buildflow-spec`. Refuses to plan without locked specs.
11
13
 
12
14
  ## Usage
13
15
  - `/buildflow-plan` — plan the next phase
14
- - `/buildflow-plan phase-2` — plan a specific phase
15
- - `/buildflow-plan <feature>`plan a specific feature
16
+ - `/buildflow-plan phase-2` — plan a specific named phase
17
+ - `/buildflow-plan --scaffold-first`Wave 0 creates all file stubs before implementation begins
18
+ - `/buildflow-plan --risk-first` — orders risky/uncertain tasks to the front of each wave (fail fast)
19
+
20
+ ## Context Packet
21
+ - `.buildflow/specs/PRD.md`
22
+ - `.buildflow/specs/TDD.md`
23
+ - `.buildflow/specs/acceptance.md`
24
+ - `.buildflow/codebase/MAP.md` (if exists)
25
+ - `.buildflow/codebase/GRAPH.md` (if exists — for dependency chain reasoning)
26
+ - `.buildflow/memory/light.md` (phase, framework, spec_status only)
27
+
28
+ Do NOT load: full codebase, old phase plans, research files, retros.
29
+
30
+ ---
31
+
32
+ ## Step 1: Validate Specs
33
+ Check `spec_status: locked` in `light.md` and that `acceptance.md` exists.
34
+ If not: "Run `/buildflow-spec` first. No spec, no plan."
35
+
36
+ Read all ACs. Count: [N] features, [N] user stories, [N] ACs total.
37
+ Confirm: "Planning to satisfy [N] ACs across [N] features."
38
+
39
+ ---
40
+
41
+ ## Step 2: Component & Task Derivation
42
+ For each feature in PRD, derive the implementation tasks needed to satisfy its ACs:
16
43
 
17
- ## Step 1: Load Context
18
- Read `.buildflow/core/vision.md`, `.buildflow/memory/light.md`.
19
- If existing project: read `.buildflow/codebase/MAP.md` and `DEPENDENCIES.md`.
44
+ For each task ask:
45
+ 1. What code needs to exist that doesn't exist yet?
46
+ 2. What existing code needs to change?
47
+ 3. What tests must be written to verify the linked ACs?
48
+
49
+ Map each task to its AC refs:
50
+ ```
51
+ Task: Create JWT auth middleware
52
+ AC refs: AC-001, AC-002, AC-003
53
+ Files: src/middleware/auth.ts (new), src/routes/index.ts (modify)
54
+ Type: NEW / MODIFY / TEST
55
+ ```
20
56
 
21
- ## Step 2: Scope Confirmation
22
- Ask: "What are we building in this phase? What's the definition of done?"
23
- Confirm scope before planning.
57
+ ---
24
58
 
25
- ## Step 3: Dependency Mapping
26
- List all components/features needed. For each:
27
- - What does it depend on?
28
- - What depends on it?
29
- - Can it be built in parallel?
59
+ ## Step 3: Dependency Reasoning
60
+ For each task, identify dependencies and explain WHY they exist:
30
61
 
31
- ## Step 4: Task Breakdown
32
- For each task:
33
62
  ```
34
- Task: [name]
35
- Description: [what it does]
36
- Depends on: [prerequisite tasks]
37
- Parallelizable: yes/no
38
- Estimated complexity: low/medium/high
39
- Files affected: [list]
63
+ Task: Create login API route
64
+ Depends on: "Create auth middleware" — HARD dependency
65
+ Reason: Route cannot be registered until middleware exists; calling undefined throws at startup
66
+
67
+ Task: Write login integration tests
68
+ Depends on: "Create login API route" — HARD dependency
69
+ Reason: Tests call the live route; no route = test suite errors on import
70
+
71
+ Task: Create UI login form
72
+ Depends on: "Create login API route" — SOFT dependency
73
+ Reason: Form can be scaffolded independently; only needs real API for E2E tests
74
+ Can proceed in parallel if mocked: YES
40
75
  ```
41
76
 
77
+ Dependency types:
78
+ - **HARD** — code fails to compile/run without the prerequisite
79
+ - **SOFT** — can proceed with a mock/stub; full integration requires prerequisite
80
+ - **EXTERNAL** — depends on env var, database, third-party API (flag for setup checklist)
81
+
82
+ Detect circular dependencies: if A → B → A exists, flag immediately and resolve before proceeding.
83
+
84
+ External dependency checklist (generated if any EXTERNAL deps found):
85
+ ```
86
+ Before building, verify these exist:
87
+ - [ ] DATABASE_URL env var set
88
+ - [ ] [service] API key configured
89
+ - [ ] [schema] migration run
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Step 4: Effort Estimation
95
+ Estimate each task:
96
+ | Size | Meaning |
97
+ |------|---------|
98
+ | XS | < 30 min — config, type, single function |
99
+ | S | 30–90 min — single component or endpoint |
100
+ | M | 2–4 hrs — feature with tests |
101
+ | L | 4–8 hrs — complex feature, multiple components |
102
+ | XL | > 1 day — requires research or architectural decision |
103
+
104
+ Flag XL tasks: "This task is XL — consider splitting or running `/buildflow-think` first."
105
+
106
+ ---
107
+
42
108
  ## Step 5: Wave Planning
43
- Group tasks into parallel waves:
109
+
110
+ Group tasks into parallel waves based on HARD dependencies only (SOFT deps don't block):
111
+
44
112
  ```
45
- Wave 1 (parallel): [tasks with no dependencies]
46
- Wave 2 (parallel): [tasks depending only on Wave 1]
47
- Wave 3: [tasks depending on Wave 2]
113
+ Wave 0 Scaffolding (if --scaffold-first)
114
+ Create empty file stubs for all new files
115
+ Purpose: Builders know what exists; no "file not found" errors mid-wave
116
+
117
+ Wave 1 — Foundation (parallel, no hard dependencies)
118
+ • Task A [AC-001] S NEW
119
+ • Task B [AC-NF-001] M NEW
120
+
121
+ Wave 2 — Core (parallel, hard-depends on Wave 1)
122
+ • Task C [AC-001, AC-002] M MODIFY
123
+ • Task D [AC-003] S NEW
124
+
125
+ Wave 3 — Integration (depends on Wave 2)
126
+ • Task E [AC-001–AC-003] M TEST
127
+ • Task F [AC-004] L NEW
128
+
129
+ Wave 4 — UI / E2E (depends on Wave 3)
130
+ • Task G [AC-005, AC-006] M NEW
131
+ • Task H [all ACs] L TEST
132
+ ```
133
+
134
+ If `--risk-first`: within each wave, sort tasks by uncertainty/novelty (most uncertain first). This surfaces problems early before other wave tasks build on broken assumptions.
135
+
136
+ ---
137
+
138
+ ## Step 6: AC Coverage Verification
139
+ Every AC must be covered by at least one task. Report:
140
+
141
+ ```
142
+ AC Coverage
143
+ ───────────
144
+ AC-001 ✓ Task C, Task E
145
+ AC-002 ✓ Task C
146
+ AC-003 ✓ Task D, Task E
147
+ AC-004 ✓ Task F
148
+ AC-005 ✓ Task G
149
+ AC-006 ✓ Task G
150
+ AC-NF-001 ✓ Task B, Task H
151
+ Uncovered: NONE
152
+ ```
153
+
154
+ If any AC is uncovered: stop. "AC-[X] has no task. Add a task or explicitly mark it out of scope."
155
+
156
+ ---
157
+
158
+ ## Step 7: Engineering Review
159
+ Before writing the plan file, review the plan as an Engineering Lead:
160
+
161
+ **Over-engineering check:**
162
+ - Is any task adding abstraction layers not required by the ACs?
163
+ - Are there tasks that implement features "for future use" not in specs?
164
+ - Flag and remove.
165
+
166
+ **Under-engineering check:**
167
+ - Are there ACs that will be technically impossible to satisfy with the planned approach?
168
+ - Are there missing error handling tasks?
169
+ - Are tests planned for every non-trivial AC?
170
+
171
+ **Architecture smell check:**
172
+ - Does the plan introduce new patterns that conflict with `PATTERNS.md`?
173
+ - Does any task modify a HOTSPOT file? If yes, flag with: "⚠ This task touches [file] (risk: [N]) — verify test coverage before proceeding."
174
+ - Are there tasks that cross module boundaries inappropriately?
175
+
176
+ **Engineering Review Report:**
177
+ ```
178
+ Engineering Review
179
+ ──────────────────
180
+ Over-engineering: [list or NONE]
181
+ Under-engineering: [list or NONE]
182
+ Architecture: [conflicts or NONE]
183
+ Hotspot warnings: [files or NONE]
184
+ Verdict: APPROVED / NEEDS REVISION
48
185
  ```
49
186
 
50
- ## Step 6: Risk Check
51
- Identify:
52
- - Tasks with high complexity
53
- - Tasks touching security-sensitive code
54
- - Tasks requiring external APIs or services
187
+ If NEEDS REVISION: apply fixes, re-run review, then proceed.
188
+
189
+ ---
190
+
191
+ ## Step 8: Write Plan
192
+ Write `.buildflow/phases/[N]/PLAN.md`:
193
+
194
+ ```markdown
195
+ # Phase [N] Plan
196
+ **Goal:** [one sentence — what the user can DO after this phase that they can't do now]
197
+ **ACs:** [N] **Tasks:** [N] **Waves:** [N] **Est. total:** [sum of estimates]
198
+ **Engineering Review:** APPROVED
55
199
 
56
- ## Step 7: Save Plan
57
- Write to `.buildflow/phases/[N]/PLAN.md`
58
- Update state.md with current phase number.
200
+ ## External Dependencies Checklist
201
+ - [ ] [item] — [how to verify]
202
+
203
+ ## Waves
204
+
205
+ ### Wave 1 — [theme]
206
+ | Task | ACs | Est | Type | Files |
207
+ |------|-----|-----|------|-------|
208
+ | [name] | AC-001 | S | NEW | src/... |
209
+
210
+ ### Wave 2 — [theme]
211
+ ...
212
+
213
+ ## AC → Task Traceability
214
+ | AC | Task(s) |
215
+ |----|---------|
216
+ | AC-001 | Task C, Task E |
217
+ ```
218
+
219
+ Update `light.md`:
220
+ ```yaml
221
+ current_phase: [N]
222
+ plan_status: ready
223
+ wave_count: [N]
224
+ task_count: [N]
225
+ est_total: [size]
226
+ ```
59
227
 
60
- ## Token Budget: ~20K
228
+ ## Token Budget: ~22K
@@ -1,56 +1,91 @@
1
1
  ---
2
2
  name: buildflow-ship
3
- description: Finalize phase with mandatory pre-ship security gate
3
+ description: Finalize phase with spec gate, security gate, and context pruning
4
4
  allowed-tools: Read, Write, Bash
5
5
  agents: strategist, security-auditor
6
6
  ---
7
7
 
8
8
  # /buildflow-ship
9
9
 
10
- Finalize current phase. Security gate runs automatically before shipping.
10
+ Finalize current phase. Three gates run before shipping: spec compliance, security scan, and test pass. After shipping, session context is pruned so the next phase starts clean.
11
11
 
12
- ## MANDATORY Step 0: Pre-Ship Security Gate
12
+ ## Context Packet (load only these)
13
+ - `.buildflow/specs/acceptance.md`
14
+ - `.buildflow/core/state.md`
15
+ - `.buildflow/memory/light.md`
16
+ - Git diff of changed files (not full codebase)
17
+
18
+ ## MANDATORY Gate 0: Spec Compliance Check
19
+
20
+ Read `.buildflow/specs/acceptance.md`. Verify every AC is satisfied.
21
+
22
+ ```
23
+ Spec Gate
24
+ ─────────
25
+ AC-001 ✓
26
+ AC-002 ✓
27
+ AC-003 ✗ FAIL — password reset not implemented
28
+ ```
29
+
30
+ **If any AC is ✗ FAIL → BLOCK:**
31
+ ```
32
+ 🔴 SHIP BLOCKED — Spec Not Complete
33
+
34
+ These acceptance criteria are not satisfied:
35
+ [AC-003] password reset not implemented
36
+
37
+ Fix them with /buildflow-build or /buildflow-modify, then re-run /buildflow-ship.
38
+ Override (skips spec gate only): /buildflow-ship --skip-spec
39
+ ```
40
+
41
+ **If all ACs pass → proceed to Gate 1.**
42
+
43
+ ---
44
+
45
+ ## MANDATORY Gate 1: Pre-Ship Security Scan
13
46
 
14
47
  Spawn Security Auditor in `--pre-ship` mode:
15
- - Scan only changed files (git diff since last commit)
48
+ - Scan changed files only (git diff since last commit)
16
49
  - Check for secrets
17
50
  - Check critical injection patterns
18
51
  - Check auth bypass risks
19
52
  - Check critical dependency CVEs
20
- - Token cost: ~10K
21
-
22
- ### Gate Outcomes
23
53
 
24
54
  **Critical found → BLOCK:**
25
55
  ```
26
56
  🔴 SHIP BLOCKED — Critical Security Issues
27
57
 
28
- Fix these before shipping:
29
- [C1] [Issue] at [file:line]
58
+ [C1] [issue] at [file:line]
30
59
  Fix: [specific action]
31
60
 
32
61
  Run /buildflow-modify for surgical fixes.
33
62
  Override (not recommended): /buildflow-ship --force
34
63
  ```
35
64
 
36
- **High found → WARN:**
65
+ **High found → WARN (non-blocking):**
37
66
  ```
38
- ⚠️ Security Warnings (non-blocking)
39
- [H1] [Issue]
40
- Risk: [...]
41
- Fix later: /buildflow-audit for details
67
+ ⚠️ Security Warnings
68
+ [H1] [issue] — fix in next phase
42
69
  ```
43
70
 
44
- **Clean → proceed:**
45
- ```
46
- ✅ Security gate passed. No critical issues.
47
- ```
71
+ **Clean → proceed.**
72
+
73
+ ---
74
+
75
+ ## MANDATORY Gate 2: Tests Pass
76
+
77
+ Run the test suite one final time.
78
+ If any test fails: BLOCK. "Fix test failures before shipping."
79
+
80
+ ---
48
81
 
49
- ## Step 1: Pre-Ship Checklist
50
- - [ ] All acceptance criteria met
51
- - [ ] /buildflow-check passed
52
- - [ ] Tests pass
53
- - [ ] Security gate passed (above)
82
+ ## Step 1: Pre-Ship Checklist (summary)
83
+ - [ ] All ACs satisfied (Gate 0)
84
+ - [ ] Security gate passed (Gate 1)
85
+ - [ ] All tests passing (Gate 2)
86
+ - [ ] `/buildflow-check` run and reviewed
87
+
88
+ ---
54
89
 
55
90
  ## Step 2: Retrospective
56
91
  Ask:
@@ -61,37 +96,64 @@ Ask:
61
96
 
62
97
  Save to `.buildflow/phases/[N]/retro.md`
63
98
 
64
- ## Step 3: Update Docs
65
- - README if needed
66
- - vision.md if pivots occurred
67
- - state.md: Phase X → Shipped
99
+ ---
100
+
101
+ ## Step 3: Context Pruning (token efficiency)
102
+
103
+ After a successful ship, prune `light.md` to stay lean for the next phase:
104
+
105
+ **Archive** these from `light.md` to `phases/[N]/retro.md`:
106
+ - Phase-specific task lists
107
+ - Wave completion details
108
+ - Build timestamps
109
+ - Hotfix history older than current phase
68
110
 
69
- ## Step 4: Update Codebase Map (existing projects)
70
- If patterns changed, new hotspots added, or dependencies updated:
71
- - Update PATTERNS.md
72
- - Update HOTSPOTS.md
73
- - Update DEPENDENCIES.md
111
+ **Keep** in `light.md`:
112
+ - app_name, framework, language
113
+ - current_phase (update to N+1 or "complete")
114
+ - spec_status (reset to "none" for next phase)
115
+ - style_fingerprint
116
+ - last 2 architectural decisions
117
+ - onboard_status
118
+
119
+ **Target:** `light.md` must be under 3K tokens after pruning.
120
+
121
+ Update `light.md`:
122
+ ```yaml
123
+ current_phase: [N+1 or complete]
124
+ last_ship_date: [today]
125
+ spec_status: none
126
+ plan_status: none
127
+ context_pruned: [today]
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Step 4: Update Docs
133
+ - README if public-facing features shipped
134
+ - `vision.md` if pivots occurred during the phase
135
+
136
+ ---
74
137
 
75
138
  ## Step 5: Tag Release
76
139
  ```bash
77
140
  git add .
78
- git commit -m "buildflow: phase X shipped"
79
- git tag "buildflow-phase-X-complete"
141
+ git commit -m "ship: phase [N] complete"
142
+ git tag "phase-[N]-complete"
80
143
  ```
81
144
 
82
- ## Step 6: Update Memory
83
- ```yaml
84
- last_ship_date: [today]
85
- phase: X
86
- security_gate: passed|passed-with-warnings|overridden
87
- ```
145
+ ---
146
+
147
+ ## Step 6: Next Phase
148
+ Suggest next phase based on remaining roadmap items.
149
+ "Phase [N] shipped. Run `/buildflow-spec` to define the next phase."
150
+
151
+ ---
88
152
 
89
- ## Step 7: Next Phase
90
- Suggest next phase based on roadmap.
153
+ ## Override Flags
154
+ - `--skip-spec` skips spec gate only. Logs to `security/DEBT.md`: "Spec gate skipped — [reason]"
155
+ - `--force` — skips security gate. Requires typed confirmation. Logged with timestamp.
91
156
 
92
- ## --force Override
93
- If used, adds to `.buildflow/security/DEBT.md` and requires:
94
- - Typed confirmation: "I understand the risk"
95
- - Logged with timestamp
157
+ Neither flag skips the test gate.
96
158
 
97
- ## Token Budget: ~22K (including pre-ship audit)
159
+ ## Token Budget: ~22K (including gates)