deepflow 0.1.38 → 0.1.40
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/execute.md +79 -68
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ You are a coordinator. Spawn agents, wait for results, update PLAN.md. Never imp
|
|
|
6
6
|
|
|
7
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,
|
|
9
|
+
**ONLY:** Read PLAN.md, read specs/doing-*.md, spawn background agents, read `.deepflow/results/*.yaml` on completion notifications, update PLAN.md
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
@@ -43,53 +43,54 @@ Statusline writes to `.deepflow/context.json`: `{"percentage": 45}`
|
|
|
43
43
|
|
|
44
44
|
## Agent Protocol
|
|
45
45
|
|
|
46
|
-
Each task = one background agent.
|
|
46
|
+
Each task = one background agent. Use agent completion notifications as the feedback loop.
|
|
47
47
|
|
|
48
|
-
**
|
|
49
|
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
**NEVER use TaskOutput** — returns full agent transcripts (100KB+) that explode context.
|
|
49
|
+
|
|
50
|
+
### Notification-Driven Execution
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
1. Spawn ALL wave agents with run_in_background=true in ONE message
|
|
54
|
+
2. STOP. End your turn. Do NOT run Bash monitors or poll for results.
|
|
55
|
+
3. Wait for "Agent X completed" notifications (they arrive automatically)
|
|
56
|
+
4. On EACH notification:
|
|
57
|
+
a. Read the result file: Read("{worktree}/.deepflow/results/{task_id}.yaml")
|
|
58
|
+
b. Report: "✓ T1: success (abc123)" or "✗ T1: failed"
|
|
59
|
+
c. Update PLAN.md for that task
|
|
60
|
+
d. Check: all wave agents done?
|
|
61
|
+
- No → end turn, wait for next notification
|
|
62
|
+
- Yes → proceed to next wave or write final summary
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**CRITICAL: After spawning agents, your turn ENDS. Do NOT:**
|
|
66
|
+
- Run Bash commands to poll/monitor
|
|
67
|
+
- Try to read result files before notifications arrive
|
|
68
|
+
- Write summaries before all wave agents complete
|
|
69
|
+
|
|
70
|
+
**On notification, respond briefly:**
|
|
71
|
+
- ONE line per completed agent: "✓ T1: success (abc123)"
|
|
72
|
+
- Only write full summary after ALL wave agents complete
|
|
73
|
+
- Do NOT repeat the full execution status on every notification
|
|
53
74
|
|
|
54
75
|
```python
|
|
55
|
-
# 1
|
|
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
|
-
|
|
61
|
-
#
|
|
62
|
-
Bash("""
|
|
63
|
-
RESULTS_DIR="{worktree}/.deepflow/results"
|
|
64
|
-
EXPECTED=3
|
|
65
|
-
SEEN=""
|
|
66
|
-
for i in $(seq 1 60); do
|
|
67
|
-
for f in $(find "$RESULTS_DIR" -name '*.yaml' 2>/dev/null); do
|
|
68
|
-
name=$(basename "$f" .yaml)
|
|
69
|
-
if ! echo "$SEEN" | grep -q "$name"; then
|
|
70
|
-
echo "✓ $name"
|
|
71
|
-
SEEN="$SEEN $name"
|
|
72
|
-
fi
|
|
73
|
-
done
|
|
74
|
-
COUNT=$(find "$RESULTS_DIR" -name '*.yaml' 2>/dev/null | wc -l | tr -d ' ')
|
|
75
|
-
if [ "$COUNT" -ge "$EXPECTED" ]; then echo "ALL COMPLETE"; exit 0; fi
|
|
76
|
-
sleep 5
|
|
77
|
-
done
|
|
78
|
-
echo "TIMEOUT: some tasks did not complete"
|
|
79
|
-
""")
|
|
80
|
-
|
|
81
|
-
# 3. Read actual results (minimal context)
|
|
76
|
+
# Step 1: Spawn wave (ONE message, then STOP)
|
|
77
|
+
Task(subagent_type="general-purpose", model="sonnet", run_in_background=True, prompt="T1: ...")
|
|
78
|
+
Task(subagent_type="general-purpose", model="sonnet", run_in_background=True, prompt="T2: ...")
|
|
79
|
+
Task(subagent_type="general-purpose", model="sonnet", run_in_background=True, prompt="T3: ...")
|
|
80
|
+
# Turn ends here. Wait for notifications.
|
|
81
|
+
|
|
82
|
+
# Step 2: On "Agent T1 completed" notification:
|
|
82
83
|
Read("{worktree}/.deepflow/results/T1.yaml")
|
|
84
|
+
# Output: "✓ T1: success (abc123)" — then STOP, wait for next
|
|
85
|
+
|
|
86
|
+
# Step 3: On "Agent T2 completed" notification:
|
|
83
87
|
Read("{worktree}/.deepflow/results/T2.yaml")
|
|
84
|
-
|
|
85
|
-
```
|
|
88
|
+
# Output: "✓ T2: success (def456)" — then STOP, wait for next
|
|
86
89
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
✓
|
|
90
|
-
|
|
91
|
-
✓ T2
|
|
92
|
-
ALL COMPLETE
|
|
90
|
+
# Step 4: On "Agent T3 completed" notification (last one):
|
|
91
|
+
Read("{worktree}/.deepflow/results/T3.yaml")
|
|
92
|
+
# Output: "✓ T3: success (ghi789)"
|
|
93
|
+
# All done → proceed to next wave or final summary
|
|
93
94
|
```
|
|
94
95
|
|
|
95
96
|
Result file `.deepflow/results/{task_id}.yaml`:
|
|
@@ -256,14 +257,15 @@ DO NOT spawn one task, wait, then spawn another. Instead, call Task tool multipl
|
|
|
256
257
|
Example: If T1, T2, T3 are ready, send ONE message containing THREE Task tool invocations:
|
|
257
258
|
|
|
258
259
|
```
|
|
259
|
-
// In a SINGLE assistant message, invoke Task
|
|
260
|
+
// In a SINGLE assistant message, invoke Task with run_in_background=true:
|
|
260
261
|
Task(subagent_type="general-purpose", model="sonnet", run_in_background=true, prompt="T1: ...")
|
|
261
262
|
Task(subagent_type="general-purpose", model="sonnet", run_in_background=true, prompt="T2: ...")
|
|
262
263
|
Task(subagent_type="general-purpose", model="sonnet", run_in_background=true, prompt="T3: ...")
|
|
264
|
+
// Turn ends here. Wait for completion notifications.
|
|
263
265
|
```
|
|
264
266
|
|
|
265
267
|
**WRONG (sequential):** Send message with Task for T1 → wait → send message with Task for T2 → wait → ...
|
|
266
|
-
**RIGHT (parallel):** Send ONE message with Task for T1, T2, T3 all together
|
|
268
|
+
**RIGHT (parallel):** Send ONE message with Task for T1, T2, T3 all together, then STOP
|
|
267
269
|
|
|
268
270
|
Same-file conflicts: spawn sequentially instead.
|
|
269
271
|
|
|
@@ -416,25 +418,21 @@ When all tasks done for a `doing-*` spec:
|
|
|
416
418
|
2. Rename: `doing-upload.md` → `done-upload.md`
|
|
417
419
|
3. Remove section from PLAN.md
|
|
418
420
|
|
|
419
|
-
### 10. ITERATE
|
|
420
|
-
|
|
421
|
-
After spawning agents, use Bash monitor to wait. **NEVER use TaskOutput** — it explodes context.
|
|
421
|
+
### 10. ITERATE (Notification-Driven)
|
|
422
422
|
|
|
423
|
-
|
|
424
|
-
# After spawning T1, T2, T3 in parallel:
|
|
423
|
+
After spawning wave agents, your turn ENDS. Completion notifications drive the loop.
|
|
425
424
|
|
|
426
|
-
|
|
427
|
-
Bash("timeout 300 bash -c '...' ") # See Agent Protocol for full script
|
|
425
|
+
**NEVER use TaskOutput** — it explodes context.
|
|
428
426
|
|
|
429
|
-
|
|
430
|
-
Read
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
427
|
+
**Per notification:**
|
|
428
|
+
1. Read result file for the completed agent
|
|
429
|
+
2. Report ONE line: "✓ Tx: status (commit)"
|
|
430
|
+
3. If NOT all wave agents done → end turn, wait
|
|
431
|
+
4. If ALL wave agents done → check context, update PLAN.md, spawn next wave or finish
|
|
434
432
|
|
|
435
|
-
|
|
433
|
+
**Between waves:** Check context %. If ≥50%, checkpoint and exit.
|
|
436
434
|
|
|
437
|
-
Repeat until: all done, all blocked, or context ≥50% (checkpoint).
|
|
435
|
+
**Repeat** until: all done, all blocked, or context ≥50% (checkpoint).
|
|
438
436
|
|
|
439
437
|
## Rules
|
|
440
438
|
|
|
@@ -450,13 +448,18 @@ Repeat until: all done, all blocked, or context ≥50% (checkpoint).
|
|
|
450
448
|
|
|
451
449
|
```
|
|
452
450
|
/df:execute (context: 12%)
|
|
451
|
+
Spawning Wave 1: T1, T2, T3 parallel...
|
|
452
|
+
|
|
453
|
+
[Agent "T1" completed]
|
|
454
|
+
✓ T1: success (abc1234)
|
|
455
|
+
|
|
456
|
+
[Agent "T2" completed]
|
|
457
|
+
✓ T2: success (def5678)
|
|
453
458
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
T2: success (def5678)
|
|
459
|
+
[Agent "T3" completed]
|
|
460
|
+
✓ T3: success (ghi9012)
|
|
457
461
|
|
|
458
|
-
Wave
|
|
459
|
-
T3: success (ghi9012)
|
|
462
|
+
Wave 1 complete (3/3). Context: 35%
|
|
460
463
|
|
|
461
464
|
✓ doing-upload → done-upload
|
|
462
465
|
✓ Complete: 3/3 tasks
|
|
@@ -474,16 +477,24 @@ Checking experiment status...
|
|
|
474
477
|
T2: Blocked by T1 (spike not validated)
|
|
475
478
|
T3: Blocked by T1 (spike not validated)
|
|
476
479
|
|
|
477
|
-
Wave 1: T1 [SPIKE]
|
|
478
|
-
|
|
480
|
+
Spawning Wave 1: T1 [SPIKE]...
|
|
481
|
+
|
|
482
|
+
[Agent "T1 SPIKE" completed]
|
|
483
|
+
✓ T1: complete, verifying...
|
|
479
484
|
|
|
480
485
|
Verifying T1...
|
|
481
486
|
✓ Spike T1 verified (throughput 8500 >= 7000)
|
|
482
487
|
→ upload--streaming--passed.md
|
|
483
488
|
|
|
484
|
-
Wave 2: T2, T3 parallel
|
|
485
|
-
|
|
486
|
-
|
|
489
|
+
Spawning Wave 2: T2, T3 parallel...
|
|
490
|
+
|
|
491
|
+
[Agent "T2" completed]
|
|
492
|
+
✓ T2: success (def5678)
|
|
493
|
+
|
|
494
|
+
[Agent "T3" completed]
|
|
495
|
+
✓ T3: success (ghi9012)
|
|
496
|
+
|
|
497
|
+
Wave 2 complete (2/2). Context: 40%
|
|
487
498
|
|
|
488
499
|
✓ doing-upload → done-upload
|
|
489
500
|
✓ Complete: 3/3 tasks
|