deepflow 0.1.34 → 0.1.36

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepflow",
3
- "version": "0.1.34",
3
+ "version": "0.1.36",
4
4
  "description": "Stay in flow state - lightweight spec-driven task orchestration for Claude Code",
5
5
  "keywords": [
6
6
  "claude",
@@ -4,11 +4,9 @@
4
4
 
5
5
  You are a coordinator. Spawn agents, wait for results, update PLAN.md. Never implement code yourself.
6
6
 
7
- **NEVER:** Read source files, edit code, run tests, run git commands (except status), process TaskOutput content
7
+ **NEVER:** Read source files, edit code, run tests, run git commands (except status), use TaskOutput
8
8
 
9
- **ONLY:** Read PLAN.md, read specs/doing-*.md, spawn background agents, use TaskOutput to wait (ignore its content), read `.deepflow/results/*.yaml` for outcomes, update PLAN.md
10
-
11
- **CONTEXT CRITICAL:** TaskOutput returns FULL agent transcripts (100KB+). NEVER include this in context. Agents write results to `.deepflow/results/{task_id}.yaml`. Read those files instead.
9
+ **ONLY:** Read PLAN.md, read specs/doing-*.md, spawn background agents, wait with Bash monitor, read `.deepflow/results/*.yaml` for outcomes, update PLAN.md
12
10
 
13
11
  ---
14
12
 
@@ -45,28 +43,53 @@ Statusline writes to `.deepflow/context.json`: `{"percentage": 45}`
45
43
 
46
44
  ## Agent Protocol
47
45
 
48
- Each task = one background agent. **TaskOutput blocks until agent completes.** Never poll, loop, or repeatedly check for results.
46
+ Each task = one background agent. **NEVER use TaskOutput** it returns full transcripts (100KB+) that explode context.
49
47
 
50
- **CRITICAL: Context Management**
51
- - TaskOutput returns the FULL agent transcript (all tool calls, messages, etc.)
52
- - **DO NOT** process or include TaskOutput response in context — it will explode your token usage
53
- - **ONLY** use TaskOutput to wait for completion (ignore its content)
54
- - **ALWAYS** read the result file directly to get the actual outcome
48
+ **Wait Strategy: Bash Monitor**
49
+ - One Bash call that monitors result files
50
+ - Shows progress via streaming (user sees in real-time)
51
+ - Minimal context (just the final output)
52
+ - User can react/cancel if needed
55
53
 
56
54
  ```python
57
- # Spawn agents in parallel (single message, multiple Task calls)
58
- task_id_1 = Task(subagent_type="general-purpose", run_in_background=True, prompt="T1: ...")
59
- task_id_2 = Task(subagent_type="general-purpose", run_in_background=True, prompt="T2: ...")
60
-
61
- # Wait for completion (single message, multiple TaskOutput calls)
62
- # TaskOutput BLOCKS no polling needed
63
- # IGNORE the response content — read result files instead
64
- TaskOutput(task_id=task_id_1)
65
- TaskOutput(task_id=task_id_2)
66
-
67
- # Read actual results from files (minimal context usage)
55
+ # 1. Spawn agents in parallel (single message, multiple Task calls)
56
+ Task(subagent_type="general-purpose", run_in_background=True, prompt="T1: ...")
57
+ Task(subagent_type="general-purpose", run_in_background=True, prompt="T2: ...")
58
+ Task(subagent_type="general-purpose", run_in_background=True, prompt="T3: ...")
59
+
60
+ # 2. Wait with Bash monitor (ONE call, streams progress to user)
61
+ Bash("""
62
+ RESULTS_DIR="{worktree}/.deepflow/results"
63
+ EXPECTED=3
64
+ TIMEOUT=300
65
+
66
+ timeout $TIMEOUT bash -c '
67
+ seen=""
68
+ while [ $(ls "$0"/*.yaml 2>/dev/null | wc -l) -lt '$EXPECTED' ]; do
69
+ for f in "$0"/*.yaml 2>/dev/null; do
70
+ if [ -f "$f" ] && [[ ! "$seen" =~ "$f" ]]; then
71
+ echo "✓ $(basename "$f" .yaml)"
72
+ seen="$seen $f"
73
+ fi
74
+ done
75
+ sleep 5
76
+ done
77
+ echo "ALL COMPLETE"
78
+ ' "$RESULTS_DIR" || echo "TIMEOUT: some tasks did not complete"
79
+ """)
80
+
81
+ # 3. Read actual results (minimal context)
68
82
  Read("{worktree}/.deepflow/results/T1.yaml")
69
83
  Read("{worktree}/.deepflow/results/T2.yaml")
84
+ Read("{worktree}/.deepflow/results/T3.yaml")
85
+ ```
86
+
87
+ **User sees streaming:**
88
+ ```
89
+ ✓ T1
90
+ ✓ T3
91
+ ✓ T2
92
+ ALL COMPLETE
70
93
  ```
71
94
 
72
95
  Result file `.deepflow/results/{task_id}.yaml`:
@@ -395,17 +418,15 @@ When all tasks done for a `doing-*` spec:
395
418
 
396
419
  ### 10. ITERATE
397
420
 
398
- After spawning agents, call TaskOutput for ALL running agents in a SINGLE message. **TaskOutput blocksdo NOT loop, poll, or check repeatedly.** One call per agent.
399
-
400
- **CRITICAL:** TaskOutput returns FULL agent transcripts. **IGNORE the response content** — it will explode context. Read result files instead.
421
+ After spawning agents, use Bash monitor to wait. **NEVER use TaskOutput** — it explodes context.
401
422
 
402
423
  ```python
403
- # After spawning T1, T2, T3 in parallel, wait for all in parallel:
404
- TaskOutput(task_id=t1_id) # BLOCKS until done — IGNORE response content
405
- TaskOutput(task_id=t2_id) # BLOCKS until done IGNORE response content
406
- TaskOutput(task_id=t3_id) # BLOCKS until done IGNORE response content
424
+ # After spawning T1, T2, T3 in parallel:
425
+
426
+ # 1. Wait with Bash monitor (streams progress to user)
427
+ Bash("timeout 300 bash -c '...' ") # See Agent Protocol for full script
407
428
 
408
- # Then read actual results (minimal context):
429
+ # 2. Read results
409
430
  Read("{worktree}/.deepflow/results/T1.yaml")
410
431
  Read("{worktree}/.deepflow/results/T2.yaml")
411
432
  Read("{worktree}/.deepflow/results/T3.yaml")
@@ -81,15 +81,19 @@ Include patterns in task descriptions for agents to follow.
81
81
 
82
82
  ### 4. ANALYZE CODEBASE
83
83
 
84
- **Spawn ALL Explore agents in ONE message, then wait for ALL with TaskOutput in ONE message:**
85
- ```
86
- // Spawn all in single message:
87
- t1 = Task(subagent_type="Explore", model="haiku", run_in_background=true, prompt="...")
88
- t2 = Task(subagent_type="Explore", model="haiku", run_in_background=true, prompt="...")
84
+ **NEVER use `run_in_background` for Explore agents** causes late "Agent completed" notifications that pollute output after work is done.
85
+
86
+ **NEVER use TaskOutput** returns full agent transcripts (100KB+) that explode context.
89
87
 
90
- // Wait all in single message:
91
- TaskOutput(task_id=t1)
92
- TaskOutput(task_id=t2)
88
+ **Spawn ALL Explore agents in ONE message (non-background, parallel):**
89
+
90
+ ```python
91
+ # All in single message — runs in parallel, blocks until all complete:
92
+ Task(subagent_type="Explore", model="haiku", prompt="Find: ...")
93
+ Task(subagent_type="Explore", model="haiku", prompt="Find: ...")
94
+ Task(subagent_type="Explore", model="haiku", prompt="Find: ...")
95
+ # Each returns agent's final message only (not full transcript)
96
+ # No late notifications — agents complete before orchestrator proceeds
93
97
  ```
94
98
 
95
99
  Scale agent count based on codebase size:
@@ -104,6 +108,7 @@ Scale agent count based on codebase size:
104
108
  **Explore Agent Prompt Structure:**
105
109
  ```
106
110
  Find: [specific question]
111
+
107
112
  Return ONLY:
108
113
  - File paths matching criteria
109
114
  - One-line description per file
@@ -216,6 +221,8 @@ Append tasks grouped by `### doing-{spec-name}`. Include spec gaps and validatio
216
221
  `✓ Plan generated — {n} specs, {n} tasks. Run /df:execute`
217
222
 
218
223
  ## Rules
224
+ - **Never use TaskOutput** — Returns full transcripts that explode context
225
+ - **Never use run_in_background for Explore agents** — Causes late notifications that pollute output
219
226
  - **Spike-first** — Generate spike task before full implementation if no `--passed.md` experiment exists
220
227
  - **Block on spike** — Full implementation tasks MUST be blocked by spike validation
221
228
  - **Learn from failures** — Extract "next hypothesis" from failed experiments, never repeat same approach
@@ -4,9 +4,9 @@
4
4
 
5
5
  You coordinate agents and ask questions. You never search code directly.
6
6
 
7
- **NEVER:** Read source files, use Glob/Grep directly, run git
7
+ **NEVER:** Read source files, use Glob/Grep directly, run git, use TaskOutput
8
8
 
9
- **ONLY:** Spawn agents, use TaskOutput to get results, ask user questions, write spec file
9
+ **ONLY:** Spawn agents (non-background), ask user questions, write spec file
10
10
 
11
11
  ---
12
12
 
@@ -31,15 +31,19 @@ Transform conversation context into a structured specification file.
31
31
 
32
32
  ### 1. GATHER CODEBASE CONTEXT
33
33
 
34
- **Spawn ALL Explore agents in ONE message, then wait for ALL with TaskOutput in ONE message:**
35
- ```
36
- // Spawn all in single message:
37
- t1 = Task(subagent_type="Explore", model="haiku", run_in_background=true, prompt="...")
38
- t2 = Task(subagent_type="Explore", model="haiku", run_in_background=true, prompt="...")
34
+ **NEVER use `run_in_background` for Explore agents** causes late "Agent completed" notifications that pollute output after work is done.
35
+
36
+ **NEVER use TaskOutput** returns full agent transcripts (100KB+) that explode context.
39
37
 
40
- // Wait all in single message:
41
- TaskOutput(task_id=t1)
42
- TaskOutput(task_id=t2)
38
+ **Spawn ALL Explore agents in ONE message (non-background, parallel):**
39
+
40
+ ```python
41
+ # All in single message — runs in parallel, blocks until all complete:
42
+ Task(subagent_type="Explore", model="haiku", prompt="Find: ...")
43
+ Task(subagent_type="Explore", model="haiku", prompt="Find: ...")
44
+ Task(subagent_type="Explore", model="haiku", prompt="Find: ...")
45
+ # Each returns agent's final message only (not full transcript)
46
+ # No late notifications — agents complete before orchestrator proceeds
43
47
  ```
44
48
 
45
49
  Find:
@@ -57,6 +61,7 @@ Find:
57
61
  **Explore Agent Prompt Structure:**
58
62
  ```
59
63
  Find: [specific question]
64
+
60
65
  Return ONLY:
61
66
  - File paths matching criteria
62
67
  - One-line description per file
@@ -83,6 +83,8 @@ Files: ...
83
83
  Default: L1-L3 (L4 optional, can be slow)
84
84
 
85
85
  ## Rules
86
+ - **Never use TaskOutput** — Returns full transcripts that explode context
87
+ - **Never use run_in_background for Explore agents** — Causes late notifications that pollute output
86
88
  - Verify against spec, not assumptions
87
89
  - Flag partial implementations
88
90
  - Report TODO/FIXME as quality issues
@@ -91,15 +93,18 @@ Default: L1-L3 (L4 optional, can be slow)
91
93
 
92
94
  ## Agent Usage
93
95
 
94
- **Spawn ALL Explore agents in ONE message, then wait for ALL with TaskOutput in ONE message:**
95
- ```
96
- // Spawn all in single message:
97
- t1 = Task(subagent_type="Explore", model="haiku", run_in_background=true, prompt="...")
98
- t2 = Task(subagent_type="Explore", model="haiku", run_in_background=true, prompt="...")
96
+ **NEVER use `run_in_background` for Explore agents** causes late "Agent completed" notifications that pollute output after work is done.
97
+
98
+ **NEVER use TaskOutput** returns full agent transcripts (100KB+) that explode context.
99
+
100
+ **Spawn ALL Explore agents in ONE message (non-background, parallel):**
99
101
 
100
- // Wait all in single message:
101
- TaskOutput(task_id=t1)
102
- TaskOutput(task_id=t2)
102
+ ```python
103
+ # All in single message — runs in parallel, blocks until all complete:
104
+ Task(subagent_type="Explore", model="haiku", prompt="Find: ...")
105
+ Task(subagent_type="Explore", model="haiku", prompt="Find: ...")
106
+ # Each returns agent's final message only (not full transcript)
107
+ # No late notifications — agents complete before orchestrator proceeds
103
108
  ```
104
109
 
105
110
  Scale: 1-2 agents per spec, cap 10.