deepflow 0.1.49 → 0.1.51

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.
@@ -31,28 +31,11 @@ Transform conversation context into a structured specification file.
31
31
 
32
32
  ### 1. GATHER CODEBASE CONTEXT
33
33
 
34
- **Check for debate file first:** If `specs/.debate-{name}.md` exists, read it using the Read tool. Pass its content (especially the Synthesis section) to the reasoner agent in step 3 as additional context. The debate file contains multi-perspective analysis that should inform requirements and constraints.
34
+ **Check for debate file first:** If `specs/.debate-{name}.md` exists, read it using the Read tool. Pass its content (especially the Synthesis section) to the reasoner agent in step 3 as additional context.
35
35
 
36
- **NEVER use `run_in_background` for Explore agents** causes late "Agent completed" notifications that pollute output after work is done.
36
+ Follow `templates/explore-agent.md` for spawn rules, prompt structure, and scope restrictions.
37
37
 
38
- **NEVER use TaskOutput** returns full agent transcripts (100KB+) that explode context.
39
-
40
- **Spawn ALL Explore agents in ONE message (non-background, parallel):**
41
-
42
- ```python
43
- # All in single message — runs in parallel, blocks until all complete:
44
- Task(subagent_type="Explore", model="haiku", prompt="Find: ...")
45
- Task(subagent_type="Explore", model="haiku", prompt="Find: ...")
46
- Task(subagent_type="Explore", model="haiku", prompt="Find: ...")
47
- # Each returns agent's final message only (not full transcript)
48
- # No late notifications — agents complete before orchestrator proceeds
49
- ```
50
-
51
- Find:
52
- - Related existing implementations
53
- - Code patterns and conventions
54
- - Integration points relevant to the feature
55
- - Existing TODOs or placeholders in related areas
38
+ Find: related implementations, code patterns/conventions, integration points, existing TODOs.
56
39
 
57
40
  | Codebase Size | Agents |
58
41
  |---------------|--------|
@@ -60,35 +43,6 @@ Find:
60
43
  | 20-100 | 5-8 |
61
44
  | 100+ | 10-15 |
62
45
 
63
- **Explore Agent Prompt Structure:**
64
- ```
65
- Find: [specific question]
66
-
67
- Return ONLY:
68
- - File paths matching criteria
69
- - One-line description per file
70
- - Integration points (if asked)
71
-
72
- DO NOT:
73
- - Read or summarize spec files
74
- - Make recommendations
75
- - Propose solutions
76
- - Generate tables or lengthy explanations
77
-
78
- Max response: 500 tokens (configurable via .deepflow/config.yaml explore.max_tokens)
79
- ```
80
-
81
- **Explore Agent Scope Restrictions:**
82
- - MUST only report factual findings:
83
- - Files found
84
- - Patterns/conventions observed
85
- - Integration points
86
- - MUST NOT:
87
- - Make recommendations
88
- - Propose architectures
89
- - Read and summarize specs (that's orchestrator's job)
90
- - Draw conclusions about what should be built
91
-
92
46
  ### 2. GAP CHECK
93
47
  Use the `gap-discovery` skill to analyze conversation + agent findings.
94
48
 
@@ -176,18 +130,6 @@ Acceptance criteria: {count}
176
130
  Next: Run /df:plan to generate tasks
177
131
  ```
178
132
 
179
- ### 6. CAPTURE DECISIONS
180
-
181
- Extract up to 4 candidate decisions (requirements chosen, constraints accepted). Use `AskUserQuestion` with `multiSelect: true`:
182
- - `label`: `[APPROACH|PROVISIONAL|ASSUMPTION] <decision>`
183
- - `description`: rationale
184
-
185
- Append each confirmed selection to `.deepflow/decisions.md` (create if absent):
186
- ```
187
- ### {YYYY-MM-DD} — spec
188
- - [TAG] <decision> — <rationale>
189
- ```
190
-
191
133
  ## Rules
192
134
  - **Orchestrator never searches** — Spawn agents for all codebase exploration
193
135
  - Do NOT generate spec if critical gaps remain
@@ -7,9 +7,9 @@ Check that implemented code satisfies spec requirements and acceptance criteria.
7
7
 
8
8
  ## Usage
9
9
  ```
10
- /df:verify # Verify all done-* specs
11
- /df:verify --doing # Also verify in-progress specs
12
- /df:verify done-upload # Verify specific spec
10
+ /df:verify # Verify doing-* specs with all tasks completed
11
+ /df:verify doing-upload # Verify specific spec
12
+ /df:verify --re-verify # Re-verify done-* specs (already merged)
13
13
  ```
14
14
 
15
15
  ## Skills & Agents
@@ -20,31 +20,30 @@ Check that implemented code satisfies spec requirements and acceptance criteria.
20
20
  |-------|---------------|-------|---------|
21
21
  | Scanner | `Explore` | `haiku` | Fast codebase scanning |
22
22
 
23
+ Follow `templates/explore-agent.md` for all Explore agent spawning. Scale: 1-2 agents per spec, cap 10.
24
+
23
25
  ## Spec File States
24
26
 
25
27
  ```
26
28
  specs/
27
29
  feature.md → Unplanned (skip)
28
- doing-auth.md → In progress (verify with --doing)
29
- done-upload.md → Completed (default verify target)
30
+ doing-auth.md → Executed, ready for verification (default target)
31
+ done-upload.md → Already verified and merged (--re-verify only)
30
32
  ```
31
33
 
32
34
  ## Behavior
33
35
 
34
36
  ### 1. LOAD CONTEXT
35
37
 
36
- ```
37
- Load:
38
- - specs/done-*.md (completed specs to verify)
39
- - specs/doing-*.md (if --doing flag)
40
- - Source code (actual implementation)
41
- ```
38
+ Load: `specs/doing-*.md`, `PLAN.md`, source code. Load `specs/done-*.md` only if `--re-verify`.
42
39
 
43
- If no done-* specs: report counts, suggest `--doing`.
40
+ **Readiness check:** For each `doing-*` spec, check PLAN.md:
41
+ - All tasks `[x]` → ready (proceed)
42
+ - Some tasks `[ ]` → warn: "⚠ {spec} has {n} incomplete tasks. Run /df:execute first."
44
43
 
45
- ### 1.5. DETECT PROJECT COMMANDS
44
+ If no `doing-*` specs found: report counts, suggest `/df:execute`.
46
45
 
47
- Detect build and test commands by inspecting project files in the worktree.
46
+ ### 1.5. DETECT PROJECT COMMANDS
48
47
 
49
48
  **Config override always wins.** If `.deepflow/config.yaml` has `quality.test_command` or `quality.build_command`, use those.
50
49
 
@@ -58,7 +57,6 @@ Detect build and test commands by inspecting project files in the worktree.
58
57
  | `go.mod` | `go build ./...` | `go test ./...` |
59
58
  | `Makefile` with `test` target | `make build` (if target exists) | `make test` |
60
59
 
61
- **Output:**
62
60
  - Commands found: `Build: npm run build | Test: npm test`
63
61
  - Nothing found: `⚠ No build/test commands detected. L0/L4 skipped. Set quality.test_command in .deepflow/config.yaml`
64
62
 
@@ -68,10 +66,7 @@ Detect build and test commands by inspecting project files in the worktree.
68
66
 
69
67
  Run the build command in the worktree:
70
68
  - Exit code 0 → L0 pass, continue to L1-L3
71
- - Exit code non-zero → L0 FAIL
72
- - Report: "✗ L0: Build failed" with last 30 lines of output
73
- - Add fix task: "Fix build errors" to PLAN.md
74
- - Do NOT proceed to L1-L4 (no point checking if code doesn't build)
69
+ - Exit code non-zero → L0 FAIL: report "✗ L0: Build failed" with last 30 lines, add fix task to PLAN.md, stop (skip L1-L4)
75
70
 
76
71
  **L1-L3: Static analysis** (via Explore agents)
77
72
 
@@ -80,24 +75,16 @@ Mark each: ✓ satisfied | ✗ missing | ⚠ partial
80
75
 
81
76
  **L4: Test execution** (if test command detected)
82
77
 
83
- Run AFTER L0 passes and L1-L3 complete. Run even if L1-L3 found issues — test failures reveal additional problems.
78
+ Run AFTER L0 passes and L1-L3 complete. Run even if L1-L3 found issues.
84
79
 
85
- - Run test command in the worktree (timeout from config, default 5 min)
86
80
  - Exit code 0 → L4 pass
87
- - Exit code non-zero → L4 FAIL
88
- - Capture last 50 lines of output
89
- - Report: "✗ L4: Tests failed (N of M)" with relevant output
90
- - Add fix task: "Fix failing tests" with test output in description
81
+ - Exit code non-zero → L4 FAIL: capture last 50 lines, report "✗ L4: Tests failed (N of M)", add fix task
91
82
 
92
83
  **Flaky test handling** (if `quality.test_retry_on_fail: true` in config):
93
- - If tests fail, re-run ONCE
94
- - Second run passes → L4 pass with note: "⚠ L4: Passed on retry (possible flaky test)"
95
- - Second run fails → genuine failure
84
+ - Re-run ONCE on failure. Second pass → "⚠ L4: Passed on retry (possible flaky test)". Second fail genuine failure.
96
85
 
97
86
  ### 3. GENERATE REPORT
98
87
 
99
- Report per spec with L0/L4 status, requirements count, acceptance count, quality issues.
100
-
101
88
  **Format on success:**
102
89
  ```
103
90
  done-upload.md: L0 ✓ | 4/4 reqs ✓, 5/5 acceptance ✓ | L4 ✓ (12 tests) | 0 quality issues
@@ -105,15 +92,21 @@ done-upload.md: L0 ✓ | 4/4 reqs ✓, 5/5 acceptance ✓ | L4 ✓ (12 tests) |
105
92
 
106
93
  **Format on failure:**
107
94
  ```
108
- done-upload.md: L0 ✓ | 4/4 reqs ✓, 5/5 acceptance | L4 ✗ (3 failed) | 0 quality issues
95
+ done-upload.md: L0 ✓ | 4/4 reqs ✓, 3/5 acceptance | L4 ✗ (3 failed) | 1 quality issue
109
96
 
110
97
  Issues:
98
+ ✗ AC-3: YAML parsing missing for consolation
111
99
  ✗ L4: 3 test failures
112
100
  FAIL src/upload.test.ts > should validate file type
113
101
  FAIL src/upload.test.ts > should reject oversized files
102
+ ⚠ Quality: TODO in parse_config()
114
103
 
115
104
  Fix tasks added to PLAN.md:
116
- T10: Fix 3 failing tests in upload module
105
+ T10: Add YAML parsing for consolation section
106
+ T11: Fix 3 failing tests in upload module
107
+ T12: Remove TODO in parse_config()
108
+
109
+ Run /df:execute --continue to fix in the same worktree.
117
110
  ```
118
111
 
119
112
  **Gate conditions (ALL must pass to merge):**
@@ -123,52 +116,18 @@ Fix tasks added to PLAN.md:
123
116
 
124
117
  **If all gates pass:** Proceed to Post-Verification merge.
125
118
 
126
- **If issues found:** Add fix tasks to PLAN.md in the worktree and register as native tasks, then loop back to execute:
127
-
119
+ **If issues found:** Add fix tasks to PLAN.md in the worktree and register as native tasks:
128
120
  1. Discover worktree (same logic as Post-Verification step 1)
129
- 2. Write new fix tasks to `{worktree_path}/PLAN.md` under the existing spec section
130
- - Task IDs continue from last (e.g. if T9 was last, fixes start at T10)
131
- - Format: `- [ ] **T10**: Fix {description}` with `Files:` and details
132
- 3. Register fix tasks as native tasks for immediate tracking:
133
- ```
134
- For each fix task added:
135
- TaskCreate(subject: "T10: Fix {description}", description: "...", activeForm: "Fixing {description}")
136
- TaskUpdate(addBlockedBy: [...]) if dependencies exist
137
- ```
138
- This allows `/df:execute --continue` to find fix tasks via TaskList immediately.
139
- 4. Output report + next step:
140
-
141
- ```
142
- done-upload.md: L0 ✓ | 4/4 reqs ✓, 3/5 acceptance ✗ | L4 ✗ (2 failed) | 1 quality issue
143
-
144
- Issues:
145
- ✗ AC-3: YAML parsing missing for consolation
146
- ✗ L4: 2 test failures
147
- FAIL src/upload.test.ts > should validate file type
148
- FAIL src/upload.test.ts > should reject oversized files
149
- ⚠ Quality: TODO in parse_config()
150
-
151
- Fix tasks added to PLAN.md:
152
- T10: Add YAML parsing for consolation section
153
- T11: Fix 2 failing tests in upload module
154
- T12: Remove TODO in parse_config()
155
-
156
- Run /df:execute --continue to fix in the same worktree.
157
- ```
121
+ 2. Write fix tasks to `{worktree_path}/PLAN.md` under existing spec section (IDs continue from last)
122
+ 3. Register each fix task: `TaskCreate(subject: "T10: Fix {description}", ...)` + `TaskUpdate(addBlockedBy: [...])` if dependencies exist
123
+ 4. Output report + "Run /df:execute --continue to fix in the same worktree."
158
124
 
159
125
  **Do NOT** create new specs, new worktrees, or merge with issues pending.
160
126
 
161
127
  ### 4. CAPTURE LEARNINGS
162
128
 
163
- On success, write significant learnings to `.deepflow/experiments/{domain}--{approach}--success.md`
164
-
165
- **Write when:**
166
- - Non-trivial approach used
167
- - Alternatives rejected during planning
168
- - Performance optimization made
169
- - Integration pattern discovered
129
+ On success, write to `.deepflow/experiments/{domain}--{approach}--success.md` when: non-trivial approach used, alternatives rejected, performance optimization made, or integration pattern discovered. Skip simple CRUD/standard patterns.
170
130
 
171
- **Format:**
172
131
  ```markdown
173
132
  # {Approach} [SUCCESS]
174
133
  Objective: ...
@@ -177,8 +136,6 @@ Why it worked: ...
177
136
  Files: ...
178
137
  ```
179
138
 
180
- **Skip:** Simple CRUD, standard patterns, user declines
181
-
182
139
  ## Verification Levels
183
140
 
184
141
  | Level | Check | Method | Runner |
@@ -189,104 +146,38 @@ Files: ...
189
146
  | L3: Wired | Integrated into system | Trace imports/calls | Explore agents |
190
147
  | L4: Tested | Tests pass | Run test command | Orchestrator (Bash) |
191
148
 
192
- **Default: L0 through L4.** L0 and L4 are skipped ONLY if no build/test command is detected (see step 1.5).
193
- L0 and L4 run directly via Bash — Explore agents cannot execute commands.
149
+ **Default: L0 through L4.** L0 and L4 skipped ONLY if no build/test command detected (see step 1.5). L0 and L4 run via Bash — Explore agents cannot execute commands.
194
150
 
195
151
  ## Rules
196
- - **Never use TaskOutput** — Returns full transcripts that explode context
197
- - **Never use run_in_background for Explore agents** — Causes late notifications that pollute output
198
152
  - Verify against spec, not assumptions
199
153
  - Flag partial implementations
200
154
  - Report TODO/FIXME as quality issues
201
155
  - Don't auto-fix — add fix tasks to PLAN.md, then `/df:execute --continue`
202
156
  - Capture learnings — Write experiments for significant approaches
203
157
 
204
- ## Agent Usage
205
-
206
- **NEVER use `run_in_background` for Explore agents** — causes late "Agent completed" notifications that pollute output after work is done.
207
-
208
- **NEVER use TaskOutput** — returns full agent transcripts (100KB+) that explode context.
209
-
210
- **Spawn ALL Explore agents in ONE message (non-background, parallel):**
211
-
212
- ```python
213
- # All in single message — runs in parallel, blocks until all complete:
214
- Task(subagent_type="Explore", model="haiku", prompt="Find: ...")
215
- Task(subagent_type="Explore", model="haiku", prompt="Find: ...")
216
- # Each returns agent's final message only (not full transcript)
217
- # No late notifications — agents complete before orchestrator proceeds
218
- ```
219
-
220
- Scale: 1-2 agents per spec, cap 10.
221
-
222
- ## Examples
223
-
224
- ### All pass → merge
225
- ```
226
- /df:verify
227
-
228
- Build: npm run build | Test: npm test
229
-
230
- done-upload.md: L0 ✓ | 4/4 reqs ✓, 5/5 acceptance ✓ | L4 ✓ (12 tests) | 0 quality issues
231
- done-auth.md: L0 ✓ | 2/2 reqs ✓, 3/3 acceptance ✓ | L4 ✓ (8 tests) | 0 quality issues
232
-
233
- ✓ All gates passed
234
-
235
- ✓ Merged df/upload to main
236
- ✓ Cleaned up worktree and branch
237
-
238
- Learnings captured:
239
- → experiments/perf--streaming-upload--success.md
240
- ```
241
-
242
- ### Issues found → fix tasks added
243
- ```
244
- /df:verify --doing
245
-
246
- Build: npm run build | Test: npm test
247
-
248
- doing-upload.md: L0 ✓ | 4/4 reqs ✓, 3/5 acceptance ✗ | L4 ✗ (3 failed) | 1 quality issue
249
-
250
- Issues:
251
- ✗ AC-3: YAML parsing missing for consolation
252
- ✗ L4: 3 test failures
253
- FAIL src/upload.test.ts > should validate file type
254
- FAIL src/upload.test.ts > should reject oversized files
255
- FAIL src/upload.test.ts > should handle empty input
256
- ⚠ Quality: TODO in parse_config()
257
-
258
- Fix tasks added to PLAN.md:
259
- T10: Add YAML parsing for consolation section
260
- T11: Fix 3 failing tests in upload module
261
- T12: Remove TODO in parse_config()
262
-
263
- Run /df:execute --continue to fix in the same worktree.
264
- ```
265
-
266
158
  ## Post-Verification: Worktree Merge & Cleanup
267
159
 
268
- **Only runs when ALL gates pass** (L0 build, L1-L3 static analysis, L4 tests). If any gate fails, fix tasks were added to PLAN.md instead (see step 3).
160
+ **Only runs when ALL gates pass.** If any gate fails, fix tasks were added to PLAN.md instead (see step 3).
269
161
 
270
162
  ### 1. DISCOVER WORKTREE
271
163
 
272
- Find worktree info using two strategies (checkpoint → fallback to git):
164
+ Find worktree info (checkpoint → fallback to git):
273
165
 
274
166
  ```bash
275
- # Strategy 1: checkpoint.json (from interrupted executions)
167
+ # Strategy 1: checkpoint.json
276
168
  if [ -f .deepflow/checkpoint.json ]; then
277
169
  WORKTREE_BRANCH=$(cat .deepflow/checkpoint.json | jq -r '.worktree_branch')
278
170
  WORKTREE_PATH=$(cat .deepflow/checkpoint.json | jq -r '.worktree_path')
279
171
  fi
280
172
 
281
- # Strategy 2: Infer from doing-* spec + git worktree list (no checkpoint needed)
173
+ # Strategy 2: Infer from doing-* spec + git worktree list
282
174
  if [ -z "${WORKTREE_BRANCH}" ]; then
283
175
  SPEC_NAME=$(basename specs/doing-*.md .md | sed 's/doing-//')
284
176
  WORKTREE_PATH=".deepflow/worktrees/${SPEC_NAME}"
285
- # Get branch from git worktree list
286
177
  WORKTREE_BRANCH=$(git worktree list --porcelain | grep -A2 "${WORKTREE_PATH}" | grep 'branch' | sed 's|branch refs/heads/||')
287
178
  fi
288
179
 
289
- # No worktree found — nothing to merge
180
+ # No worktree found
290
181
  if [ -z "${WORKTREE_BRANCH}" ]; then
291
182
  echo "No worktree found — nothing to merge. Workflow may already be on main."
292
183
  exit 0
@@ -296,48 +187,48 @@ fi
296
187
  ### 2. MERGE TO MAIN
297
188
 
298
189
  ```bash
299
- # Switch to main and merge
300
190
  git checkout main
301
191
  git merge "${WORKTREE_BRANCH}" --no-ff -m "feat({spec}): merge verified changes"
302
192
  ```
303
193
 
304
- **On merge conflict:**
305
- - Keep worktree intact for manual resolution
306
- - Output: "Merge conflict detected. Resolve manually, then run /df:verify --merge-only"
307
- - Exit without cleanup
194
+ **On merge conflict:** Keep worktree intact, output "Merge conflict detected. Resolve manually, then run /df:verify --merge-only", exit without cleanup.
308
195
 
309
196
  ### 3. CLEANUP WORKTREE
310
197
 
311
- After successful merge:
312
-
313
198
  ```bash
314
- # Remove worktree and branch
315
199
  git worktree remove --force "${WORKTREE_PATH}"
316
200
  git branch -d "${WORKTREE_BRANCH}"
317
-
318
- # Remove checkpoint if it exists
319
201
  rm -f .deepflow/checkpoint.json
320
202
  ```
321
203
 
322
- **Output on success:**
323
- ```
324
- ✓ Merged df/upload to main
325
- ✓ Cleaned up worktree and branch
326
- ✓ Spec complete: doing-upload → done-upload
204
+ ### 4. RENAME SPEC
327
205
 
328
- Workflow complete! Ready for next feature: /df:spec <name>
206
+ ```bash
207
+ # Rename spec to done
208
+ mv specs/doing-${SPEC_NAME}.md specs/done-${SPEC_NAME}.md
329
209
  ```
330
210
 
331
- ### 4. CAPTURE DECISIONS (success path only)
211
+ ### 5. EXTRACT DECISIONS
332
212
 
333
- Extract up to 4 candidate decisions (quality findings, patterns validated, lessons learned). Present via AskUserQuestion with `multiSelect: true`; tags: `[APPROACH]`, `[PROVISIONAL]`, `[ASSUMPTION]`.
213
+ Read the renamed `specs/done-${SPEC_NAME}.md` file. Model-extract architectural decisions:
214
+ - Explicit choices → `[APPROACH]`
215
+ - Unvalidated assumptions → `[ASSUMPTION]`
216
+ - "For now" decisions → `[PROVISIONAL]`
334
217
 
218
+ Append to `.deepflow/decisions.md`:
219
+ ```
220
+ ### {YYYY-MM-DD} — {spec-name}
221
+ - [TAG] decision text — rationale
335
222
  ```
336
- AskUserQuestion(question: "Which decisions to record?", multiSelect: true,
337
- options: [{ label: "[APPROACH] <decision>", description: "<rationale>" }, ...])
223
+
224
+ After successful append, delete `specs/done-${SPEC_NAME}.md`. If write fails, preserve the file.
225
+
226
+ Output:
338
227
  ```
228
+ ✓ Merged df/upload to main
229
+ ✓ Cleaned up worktree and branch
230
+ ✓ Spec complete: doing-upload → done-upload
339
231
 
340
- For each confirmed decision, append to `.deepflow/decisions.md` (create if missing):
341
- `### {YYYY-MM-DD} — verify` / `- [TAG] {decision text} — {rationale}`
232
+ Workflow complete! Ready for next feature: /df:spec <name>
233
+ ```
342
234
 
343
- Skip if user confirms none or declines.
@@ -0,0 +1,34 @@
1
+ # Explore Agent Pattern
2
+
3
+ ## Spawn Rules
4
+
5
+ **NEVER use `run_in_background`** — causes late "Agent completed" notifications.
6
+ **NEVER use TaskOutput** — returns full transcripts (100KB+) that explode context.
7
+
8
+ Spawn ALL agents in ONE message (non-background, parallel):
9
+ ```python
10
+ Task(subagent_type="Explore", model="haiku", prompt="Find: ...")
11
+ Task(subagent_type="Explore", model="haiku", prompt="Find: ...")
12
+ # Returns final message only; blocks until all complete; no late notifications
13
+ ```
14
+
15
+ ## Prompt Structure
16
+
17
+ ```
18
+ Find: [specific question]
19
+
20
+ Return ONLY:
21
+ - File paths matching criteria
22
+ - One-line description per file
23
+ - Integration points (if asked)
24
+
25
+ DO NOT: read/summarize specs, make recommendations, propose solutions, generate tables.
26
+
27
+ Max response: 500 tokens (configurable via .deepflow/config.yaml explore.max_tokens)
28
+ ```
29
+
30
+ ## Scope Restrictions
31
+
32
+ MUST only report factual findings: files found, patterns/conventions, integration points.
33
+
34
+ MUST NOT: make recommendations, propose architectures, summarize specs, draw conclusions.