deepflow 0.1.95 → 0.1.97
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.
- package/package.json +1 -1
- package/src/commands/df/plan.md +224 -2
package/package.json
CHANGED
package/src/commands/df/plan.md
CHANGED
|
@@ -106,13 +106,102 @@ After all tasks have `Files:` lists, detect overlaps requiring sequential execut
|
|
|
106
106
|
|
|
107
107
|
**Rules:** Chain only (T5→T3, not T5→T1+T3). Append `(file conflict: {filename})`. Logical deps override conflict edges. Cross-spec conflicts get same treatment.
|
|
108
108
|
|
|
109
|
+
### 4.7. FAN-OUT ORCHESTRATION (MULTI-SPEC)
|
|
110
|
+
|
|
111
|
+
**When:** >1 plannable spec found in §1.
|
|
112
|
+
|
|
113
|
+
**Skip condition:** If exactly 1 plannable spec → skip this section entirely, continue to §5 monolithic path with zero overhead. No fan-out code runs.
|
|
114
|
+
|
|
115
|
+
#### 4.7.1. Count & Cap
|
|
116
|
+
|
|
117
|
+
Count plannable specs (no `doing-`/`done-` prefix, passed `validateSpec`).
|
|
118
|
+
|
|
119
|
+
- **1 spec** → skip to §5 (monolithic path)
|
|
120
|
+
- **2–5 specs** → fan-out all
|
|
121
|
+
- **>5 specs** → select first 5 by filesystem `ls` order. Report to user:
|
|
122
|
+
```
|
|
123
|
+
⚠ {total} specs found. Planning first 5 now. Queued for next run:
|
|
124
|
+
- {spec6.md}
|
|
125
|
+
- {spec7.md}
|
|
126
|
+
...
|
|
127
|
+
Re-run /df:plan to process remaining specs.
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### 4.7.2. Spawn Sub-Agents
|
|
131
|
+
|
|
132
|
+
For each plannable spec (up to 5), spawn a **parallel non-background** `Task(subagent_type="default", model="sonnet")` call. All calls are independent — spawn them simultaneously.
|
|
133
|
+
|
|
134
|
+
Each sub-agent prompt MUST include:
|
|
135
|
+
|
|
136
|
+
1. **Layer-gating rules** (from §1.5): The spec's computed layer and which task types are allowed
|
|
137
|
+
2. **Experiment check results** (from §2): Past experiments for this spec's topic — `--passed.md`, `--failed.md`, `--active.md` status and extracted next-hypothesis
|
|
138
|
+
3. **Project context** (from §3): Code style, patterns, integration points detected for this project
|
|
139
|
+
4. **Impact analysis instructions** (from §4, L3 specs only): LSP-first blast radius search for each file in the task's `Files:` list
|
|
140
|
+
5. **Targeted exploration instructions** (from §4.5): Follow `templates/explore-agent.md` spawn rules
|
|
141
|
+
6. **The spec content**: Full text of that spec file
|
|
142
|
+
7. **Format enforcement clause**:
|
|
143
|
+
```
|
|
144
|
+
OUTPUT FORMAT — MANDATORY (no deviations):
|
|
145
|
+
Return ONLY a markdown task list. Use local T-numbering starting at T1.
|
|
146
|
+
Each task MUST follow this exact format:
|
|
147
|
+
|
|
148
|
+
### {spec-name}
|
|
149
|
+
|
|
150
|
+
- [ ] **T{N}**: {Task description}
|
|
151
|
+
- Files: {comma-separated file paths}
|
|
152
|
+
- Blocked by: none | T{N}[, T{M}...]
|
|
153
|
+
|
|
154
|
+
Optional fields (add when applicable):
|
|
155
|
+
- Model: haiku | sonnet | opus
|
|
156
|
+
- Effort: low | medium | high
|
|
157
|
+
- Impact: {blast radius details, L3 only}
|
|
158
|
+
- Optimize: {metric block, for metric ACs only}
|
|
159
|
+
|
|
160
|
+
Rules:
|
|
161
|
+
- "Blocked by: none" is required (not "N/A", not empty)
|
|
162
|
+
- T-numbers are local to this spec (T1, T2, T3...)
|
|
163
|
+
- One task = one atomic commit
|
|
164
|
+
- Spike tasks use: **T{N}** [SPIKE]: {description}
|
|
165
|
+
- L0-L1 specs: ONLY spike tasks allowed
|
|
166
|
+
- L2+ specs: spikes + implementation tasks allowed
|
|
167
|
+
- L3 specs: include Impact: blocks from impact analysis
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### 4.7.3. Collect Mini-Plans
|
|
171
|
+
|
|
172
|
+
Each sub-agent returns a mini-plan string (markdown). Collect all return values.
|
|
173
|
+
|
|
174
|
+
**Graceful degradation (AC-11):** For each sub-agent result, check for failure conditions:
|
|
175
|
+
- Sub-agent threw an error or returned a non-string value → log warning, skip spec
|
|
176
|
+
- Output is empty (whitespace only) → log warning, skip spec
|
|
177
|
+
- Output contains no task items (no `- [ ] **T` pattern) → log warning (unparseable), skip spec
|
|
178
|
+
|
|
179
|
+
Warning format:
|
|
180
|
+
```
|
|
181
|
+
⚠ Warning: sub-agent for {specName} failed — {reason}. Continuing with remaining specs.
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Continue processing remaining specs regardless of individual failures. Only successfully parsed mini-plans are stored.
|
|
185
|
+
|
|
186
|
+
- Store results as an array of `{ specName, miniPlan }` objects (successfully parsed only) for consolidation by §5.
|
|
187
|
+
- If ALL sub-agents fail: report error, abort plan generation.
|
|
188
|
+
- If at least 1 succeeds: continue to §5 with successful mini-plans only.
|
|
189
|
+
|
|
190
|
+
**Flow after fan-out:** The collected mini-plans are passed to §5 for consolidation (global renumbering, cross-spec conflict detection, prioritization). §5 handles both the single-spec monolithic path and the multi-spec consolidation path.
|
|
191
|
+
|
|
109
192
|
### 5. COMPARE & PRIORITIZE
|
|
110
193
|
|
|
194
|
+
**Two paths** — determined by spec count from §1/§4.7:
|
|
195
|
+
|
|
196
|
+
#### 5A. SINGLE-SPEC (MONOLITHIC PATH)
|
|
197
|
+
|
|
198
|
+
**When:** Exactly 1 plannable spec (§4.7 was skipped).
|
|
199
|
+
|
|
111
200
|
Spawn `Task(subagent_type="reasoner", model="opus")`. Map each requirement to DONE/PARTIAL/MISSING/CONFLICT. Check REQ-AC alignment. Flag spec gaps.
|
|
112
201
|
|
|
113
202
|
Priority: Dependencies → Impact → Risk
|
|
114
203
|
|
|
115
|
-
|
|
204
|
+
##### Metric AC Detection
|
|
116
205
|
|
|
117
206
|
Scan ACs for pattern `{metric} {operator} {number}[unit]` (e.g., `coverage > 85%`, `latency < 200ms`). Operators: `>`, `<`, `>=`, `<=`, `==`.
|
|
118
207
|
|
|
@@ -120,8 +209,137 @@ Scan ACs for pattern `{metric} {operator} {number}[unit]` (e.g., `coverage > 85%
|
|
|
120
209
|
- **Non-match:** standard implementation task
|
|
121
210
|
- **Ambiguous** ("fast", "small"): flag as spec gap, request numeric threshold
|
|
122
211
|
|
|
212
|
+
Then apply §5.5 routing matrix. Continue to §6.
|
|
213
|
+
|
|
214
|
+
#### 5B. MULTI-SPEC CONSOLIDATOR (FAN-OUT PATH)
|
|
215
|
+
|
|
216
|
+
**When:** >1 plannable spec (§4.7 produced mini-plans).
|
|
217
|
+
|
|
218
|
+
**This is the ONLY Opus invocation in the fan-out path** (REQ-12). Sub-agents in §4.7 use Sonnet.
|
|
219
|
+
|
|
220
|
+
Spawn a single `Task(subagent_type="reasoner", model="opus")` with the following prompt:
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
You are the plan consolidator. You receive mini-plans from multiple spec-planning agents.
|
|
224
|
+
Your job is to merge them into a single globally-numbered PLAN.md.
|
|
225
|
+
|
|
226
|
+
## Input mini-plans
|
|
227
|
+
|
|
228
|
+
{for each entry in miniPlans array:}
|
|
229
|
+
### {specName}
|
|
230
|
+
{miniPlan content}
|
|
231
|
+
{end for}
|
|
232
|
+
|
|
233
|
+
## Instructions
|
|
234
|
+
|
|
235
|
+
### Step 1: Spec Priority Ordering
|
|
236
|
+
Sort specs for global numbering. Use this priority:
|
|
237
|
+
1. Specs with no cross-spec file overlaps first (independent work)
|
|
238
|
+
2. Specs with overlaps ordered by dependency direction (depended-on first)
|
|
239
|
+
3. Alphabetical as tiebreaker
|
|
240
|
+
|
|
241
|
+
### Step 2: Global T-Number Assignment
|
|
242
|
+
Assign sequential global T-numbers (T1, T2, ..., TN) with NO gaps and NO duplicates.
|
|
243
|
+
- Process specs in priority order from Step 1
|
|
244
|
+
- Within each spec, preserve the local task ordering
|
|
245
|
+
- Translate all intra-spec `Blocked by: T{local}` references to global T-IDs
|
|
246
|
+
|
|
247
|
+
### Step 3: Cross-Spec File Conflict Detection
|
|
248
|
+
Build a map: `file → [global task IDs]`.
|
|
249
|
+
For each file appearing in >1 task across different specs:
|
|
250
|
+
- Add `Blocked by` from the later task → the earlier task
|
|
251
|
+
- Append `[file-conflict: {filename}]` annotation to the Blocked by line
|
|
252
|
+
- Skip if a dependency already exists (direct or transitive)
|
|
253
|
+
- Chain only: T5→T3, not T5→T1+T3 (block on nearest earlier task for that file)
|
|
254
|
+
|
|
255
|
+
### Step 4: Requirement Mapping
|
|
256
|
+
For each spec, map requirements to DONE/PARTIAL/MISSING/CONFLICT. Flag spec gaps.
|
|
257
|
+
|
|
258
|
+
### Step 5: Metric AC Detection
|
|
259
|
+
Scan ACs for pattern `{metric} {operator} {number}[unit]`.
|
|
260
|
+
- Match → flag as metric AC (for §6.5 Optimize task generation)
|
|
261
|
+
- Ambiguous ("fast", "small") → flag as spec gap
|
|
262
|
+
|
|
263
|
+
### Step 6: Model + Effort Classification
|
|
264
|
+
Apply routing matrix to each task:
|
|
265
|
+
|
|
266
|
+
| Task type | Model | Effort |
|
|
267
|
+
|-----------|-------|--------|
|
|
268
|
+
| Bootstrap (scaffold, config, rename) | haiku | low |
|
|
269
|
+
| browse-fetch (doc retrieval) | haiku | low |
|
|
270
|
+
| Single-file simple addition | haiku | high |
|
|
271
|
+
| Multi-file with clear specs | sonnet | medium |
|
|
272
|
+
| Bug fix (clear repro) | sonnet | medium |
|
|
273
|
+
| Bug fix (unclear cause) | sonnet | high |
|
|
274
|
+
| Spike / validation | sonnet | high |
|
|
275
|
+
| Optimize (metric AC) | opus | high |
|
|
276
|
+
| Feature work (well-specced) | sonnet | medium |
|
|
277
|
+
| Feature work (ambiguous ACs) | opus | medium |
|
|
278
|
+
| Refactor (>5 files, many callers) | opus | medium |
|
|
279
|
+
| Architecture change | opus | high |
|
|
280
|
+
| Unfamiliar API integration | opus | high |
|
|
281
|
+
| Retried after revert | (raise one level) | high |
|
|
282
|
+
|
|
283
|
+
Defaults: sonnet / medium.
|
|
284
|
+
|
|
285
|
+
### Step 7: Output
|
|
286
|
+
Return the consolidated plan in this exact format:
|
|
287
|
+
|
|
288
|
+
## Summary
|
|
289
|
+
|
|
290
|
+
| Metric | Count |
|
|
291
|
+
|--------|-------|
|
|
292
|
+
| Specs analyzed | {N} |
|
|
293
|
+
| Tasks created | {N} |
|
|
294
|
+
| Ready (no blockers) | {N} |
|
|
295
|
+
| Blocked | {N} |
|
|
296
|
+
|
|
297
|
+
## Spec Gaps
|
|
298
|
+
|
|
299
|
+
- [ ] `specs/{name}.md`: {gap description}
|
|
300
|
+
|
|
301
|
+
## Tasks
|
|
302
|
+
|
|
303
|
+
### doing-{spec-name-1}
|
|
304
|
+
|
|
305
|
+
- [ ] **T1**: {Task description}
|
|
306
|
+
- Files: {files}
|
|
307
|
+
- Model: {model}
|
|
308
|
+
- Effort: {effort}
|
|
309
|
+
- Blocked by: none
|
|
310
|
+
|
|
311
|
+
- [ ] **T2**: {Task description}
|
|
312
|
+
- Files: {files}
|
|
313
|
+
- Model: {model}
|
|
314
|
+
- Effort: {effort}
|
|
315
|
+
- Blocked by: T1
|
|
316
|
+
|
|
317
|
+
### doing-{spec-name-2}
|
|
318
|
+
|
|
319
|
+
- [ ] **T3**: {Task description}
|
|
320
|
+
- Files: {files}
|
|
321
|
+
- Model: {model}
|
|
322
|
+
- Effort: {effort}
|
|
323
|
+
- Blocked by: none
|
|
324
|
+
|
|
325
|
+
Rules:
|
|
326
|
+
- T-numbers MUST be globally sequential (T1...TN), no gaps, no duplicates
|
|
327
|
+
- Group tasks under `### doing-{spec-name}` headers
|
|
328
|
+
- Preserve all optional fields from mini-plans (Impact:, Optimize:, etc.)
|
|
329
|
+
- [file-conflict: {filename}] annotations are REQUIRED for cross-spec file overlaps
|
|
330
|
+
- "Blocked by: none" is required (not "N/A", not empty)
|
|
331
|
+
- Spike tasks keep their [SPIKE] or [OPTIMIZE] markers
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
**Post-consolidation:**
|
|
335
|
+
- The orchestrator receives the consolidator's output as structured PLAN.md content
|
|
336
|
+
- Mini-plans are ephemeral — they exist only as sub-agent return values, never written to disk (REQ-7)
|
|
337
|
+
- §8 cleanup and §9 output/rename run after this step in the orchestrator (REQ-13)
|
|
338
|
+
|
|
123
339
|
### 5.5. CLASSIFY MODEL + EFFORT PER TASK
|
|
124
340
|
|
|
341
|
+
**Note:** In the fan-out path (§5B), model/effort classification is performed inside the consolidator prompt. This section applies only to the monolithic path (§5A).
|
|
342
|
+
|
|
125
343
|
#### Routing matrix
|
|
126
344
|
|
|
127
345
|
| Task type | Model | Effort |
|
|
@@ -199,11 +417,15 @@ Unfamiliar APIs or performance-critical → prototype in scratchpad. Fails → `
|
|
|
199
417
|
|
|
200
418
|
### 8. CLEANUP PLAN.md
|
|
201
419
|
|
|
420
|
+
**Fan-out path:** Run ONLY after §5B consolidation is complete. Operate on the consolidated output only — do NOT run inside sub-agents or during mini-plan collection.
|
|
421
|
+
|
|
202
422
|
Prune stale `done-*` sections and orphaned headers. Recalculate Summary. Empty → recreate fresh.
|
|
203
423
|
|
|
204
424
|
### 9. OUTPUT & RENAME
|
|
205
425
|
|
|
206
|
-
|
|
426
|
+
**Fan-out path:** Run ONLY after §5B consolidation is complete (AC-13). Operate on successfully planned specs only — specs whose sub-agents failed (§4.7.3) are NOT renamed and NOT appended to PLAN.md.
|
|
427
|
+
|
|
428
|
+
Append tasks grouped by `### doing-{spec-name}`. Rename `specs/feature.md` → `specs/doing-feature.md` for each successfully planned spec only.
|
|
207
429
|
|
|
208
430
|
Report:
|
|
209
431
|
```
|