deepflow 0.1.26 → 0.1.27
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
|
@@ -59,22 +59,66 @@ summary: "one line"
|
|
|
59
59
|
|
|
60
60
|
## Checkpoint & Resume
|
|
61
61
|
|
|
62
|
-
**File:** `.deepflow/checkpoint.json` —
|
|
62
|
+
**File:** `.deepflow/checkpoint.json` — stored in WORKTREE directory, not main.
|
|
63
|
+
|
|
64
|
+
**Schema:**
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"completed_tasks": ["T1", "T2"],
|
|
68
|
+
"current_wave": 2,
|
|
69
|
+
"worktree_path": ".deepflow/worktrees/df/doing-upload/20260202-1430",
|
|
70
|
+
"worktree_branch": "df/doing-upload/20260202-1430"
|
|
71
|
+
}
|
|
72
|
+
```
|
|
63
73
|
|
|
64
|
-
**On checkpoint:** Complete wave → update PLAN.md → save → exit.
|
|
65
|
-
**Resume:** `--continue` loads checkpoint, skips completed tasks.
|
|
74
|
+
**On checkpoint:** Complete wave → update PLAN.md → save to worktree → exit.
|
|
75
|
+
**Resume:** `--continue` loads checkpoint, verifies worktree, skips completed tasks.
|
|
66
76
|
|
|
67
77
|
## Behavior
|
|
68
78
|
|
|
69
79
|
### 1. CHECK CHECKPOINT
|
|
70
80
|
|
|
71
81
|
```
|
|
72
|
-
--continue → Load
|
|
82
|
+
--continue → Load checkpoint
|
|
83
|
+
→ If worktree_path exists:
|
|
84
|
+
→ Verify worktree still exists on disk
|
|
85
|
+
→ If missing: Error "Worktree deleted. Use --fresh"
|
|
86
|
+
→ If exists: Use it, skip worktree creation
|
|
87
|
+
→ Resume execution with completed tasks
|
|
73
88
|
--fresh → Delete checkpoint, start fresh
|
|
74
89
|
checkpoint exists → Prompt: "Resume? (y/n)"
|
|
75
90
|
else → Start fresh
|
|
76
91
|
```
|
|
77
92
|
|
|
93
|
+
### 1.5. CREATE WORKTREE
|
|
94
|
+
|
|
95
|
+
Before spawning any agents, create an isolated worktree:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
# Check main is clean (ignore untracked)
|
|
99
|
+
git diff --quiet HEAD || Error: "Main has uncommitted changes. Commit or stash first."
|
|
100
|
+
|
|
101
|
+
# Generate worktree path
|
|
102
|
+
SPEC_NAME=$(basename spec/doing-*.md .md | sed 's/doing-//')
|
|
103
|
+
TIMESTAMP=$(date +%Y%m%d-%H%M)
|
|
104
|
+
BRANCH_NAME="df/${SPEC_NAME}/${TIMESTAMP}"
|
|
105
|
+
WORKTREE_PATH=".deepflow/worktrees/${BRANCH_NAME}"
|
|
106
|
+
|
|
107
|
+
# Create worktree
|
|
108
|
+
git worktree add -b "${BRANCH_NAME}" "${WORKTREE_PATH}"
|
|
109
|
+
|
|
110
|
+
# Store in checkpoint for resume
|
|
111
|
+
checkpoint.worktree_path = WORKTREE_PATH
|
|
112
|
+
checkpoint.worktree_branch = BRANCH_NAME
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Resume handling:**
|
|
116
|
+
- If checkpoint has worktree_path → verify it exists, use it
|
|
117
|
+
- If worktree missing → Error: "Worktree deleted. Use --fresh"
|
|
118
|
+
|
|
119
|
+
**Existing worktree handling:**
|
|
120
|
+
- If worktree exists for same spec → Prompt: "Resume existing worktree? (y/n/delete)"
|
|
121
|
+
|
|
78
122
|
### 2. LOAD PLAN
|
|
79
123
|
|
|
80
124
|
```
|
|
@@ -178,8 +222,17 @@ Task tool parameters:
|
|
|
178
222
|
Files: {target files}
|
|
179
223
|
Spec: {spec_name}
|
|
180
224
|
|
|
225
|
+
**IMPORTANT: Working Directory**
|
|
226
|
+
All file operations MUST use this absolute path as base:
|
|
227
|
+
{worktree_absolute_path}
|
|
228
|
+
|
|
229
|
+
Example: To edit src/foo.ts, use:
|
|
230
|
+
{worktree_absolute_path}/src/foo.ts
|
|
231
|
+
|
|
232
|
+
Do NOT write files to the main project directory.
|
|
233
|
+
|
|
181
234
|
Implement, test, commit as feat({spec}): {description}.
|
|
182
|
-
Write result to
|
|
235
|
+
Write result to {worktree_absolute_path}/.deepflow/results/{task_id}.yaml
|
|
183
236
|
```
|
|
184
237
|
|
|
185
238
|
**Spike Task:**
|
|
@@ -189,9 +242,18 @@ Type: spike
|
|
|
189
242
|
Method: {minimal steps to validate}
|
|
190
243
|
Success criteria: {how to know it passed}
|
|
191
244
|
Time-box: {duration}
|
|
192
|
-
Experiment file: {
|
|
245
|
+
Experiment file: {worktree_absolute_path}/.deepflow/experiments/{topic}--{hypothesis}--active.md
|
|
193
246
|
Spec: {spec_name}
|
|
194
247
|
|
|
248
|
+
**IMPORTANT: Working Directory**
|
|
249
|
+
All file operations MUST use this absolute path as base:
|
|
250
|
+
{worktree_absolute_path}
|
|
251
|
+
|
|
252
|
+
Example: To edit src/foo.ts, use:
|
|
253
|
+
{worktree_absolute_path}/src/foo.ts
|
|
254
|
+
|
|
255
|
+
Do NOT write files to the main project directory.
|
|
256
|
+
|
|
195
257
|
Execute the minimal validation:
|
|
196
258
|
1. Follow the method steps exactly
|
|
197
259
|
2. Measure against success criteria
|
|
@@ -199,21 +261,56 @@ Execute the minimal validation:
|
|
|
199
261
|
- If passed: rename to --passed.md, record findings
|
|
200
262
|
- If failed: rename to --failed.md, record conclusion with "next hypothesis"
|
|
201
263
|
4. Commit as spike({spec}): validate {hypothesis}
|
|
202
|
-
5. Write result to
|
|
264
|
+
5. Write result to {worktree_absolute_path}/.deepflow/results/{task_id}.yaml
|
|
203
265
|
|
|
204
266
|
Result status:
|
|
205
267
|
- success = hypothesis validated (passed)
|
|
206
268
|
- failed = hypothesis invalidated (failed experiment, NOT agent error)
|
|
207
269
|
```
|
|
208
270
|
|
|
209
|
-
### 8.
|
|
271
|
+
### 8. FAILURE HANDLING
|
|
272
|
+
|
|
273
|
+
When a task fails and cannot be auto-fixed:
|
|
274
|
+
|
|
275
|
+
**Behavior:**
|
|
276
|
+
1. Leave worktree intact at `{worktree_path}`
|
|
277
|
+
2. Keep checkpoint.json for potential resume
|
|
278
|
+
3. Output debugging instructions
|
|
279
|
+
|
|
280
|
+
**Output:**
|
|
281
|
+
```
|
|
282
|
+
✗ Task T3 failed after retry
|
|
283
|
+
|
|
284
|
+
Worktree preserved for debugging:
|
|
285
|
+
Path: .deepflow/worktrees/df/doing-upload/20260202-1430
|
|
286
|
+
Branch: df/doing-upload/20260202-1430
|
|
287
|
+
|
|
288
|
+
To investigate:
|
|
289
|
+
cd .deepflow/worktrees/df/doing-upload/20260202-1430
|
|
290
|
+
# examine files, run tests, etc.
|
|
291
|
+
|
|
292
|
+
To resume after fixing:
|
|
293
|
+
/df:execute --continue
|
|
294
|
+
|
|
295
|
+
To discard and start fresh:
|
|
296
|
+
git worktree remove --force .deepflow/worktrees/df/doing-upload/20260202-1430
|
|
297
|
+
git branch -D df/doing-upload/20260202-1430
|
|
298
|
+
/df:execute --fresh
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
**Key points:**
|
|
302
|
+
- Never auto-delete worktree on failure (cleanup_on_fail: false by default)
|
|
303
|
+
- Always provide the exact cleanup commands
|
|
304
|
+
- Checkpoint remains so --continue can work after manual fix
|
|
305
|
+
|
|
306
|
+
### 9. COMPLETE SPECS
|
|
210
307
|
|
|
211
308
|
When all tasks done for a `doing-*` spec:
|
|
212
309
|
1. Embed history in spec: `## Completed` section
|
|
213
310
|
2. Rename: `doing-upload.md` → `done-upload.md`
|
|
214
311
|
3. Remove section from PLAN.md
|
|
215
312
|
|
|
216
|
-
###
|
|
313
|
+
### 10. ITERATE
|
|
217
314
|
|
|
218
315
|
Repeat until: all done, all blocked, or checkpoint.
|
|
219
316
|
|
|
@@ -115,3 +115,46 @@ Learnings captured:
|
|
|
115
115
|
→ experiments/perf--streaming-upload--success.md
|
|
116
116
|
→ experiments/auth--jwt-refresh-rotation--success.md
|
|
117
117
|
```
|
|
118
|
+
|
|
119
|
+
## Post-Verification: Worktree Merge & Cleanup
|
|
120
|
+
|
|
121
|
+
After all verification passes:
|
|
122
|
+
|
|
123
|
+
### 1. MERGE TO MAIN
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Get worktree info from checkpoint
|
|
127
|
+
WORKTREE_BRANCH=$(cat .deepflow/checkpoint.json | jq -r '.worktree_branch')
|
|
128
|
+
|
|
129
|
+
# Switch to main and merge
|
|
130
|
+
git checkout main
|
|
131
|
+
git merge "${WORKTREE_BRANCH}" --no-ff -m "feat({spec}): merge verified changes"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**On merge conflict:**
|
|
135
|
+
- Keep worktree intact for manual resolution
|
|
136
|
+
- Output: "Merge conflict detected. Resolve manually, then run /df:verify --merge-only"
|
|
137
|
+
- Exit without cleanup
|
|
138
|
+
|
|
139
|
+
### 2. CLEANUP WORKTREE
|
|
140
|
+
|
|
141
|
+
After successful merge:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Get worktree path from checkpoint
|
|
145
|
+
WORKTREE_PATH=$(cat .deepflow/checkpoint.json | jq -r '.worktree_path')
|
|
146
|
+
|
|
147
|
+
# Remove worktree and branch
|
|
148
|
+
git worktree remove --force "${WORKTREE_PATH}"
|
|
149
|
+
git branch -d "${WORKTREE_BRANCH}"
|
|
150
|
+
|
|
151
|
+
# Remove checkpoint
|
|
152
|
+
rm .deepflow/checkpoint.json
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Output on success:**
|
|
156
|
+
```
|
|
157
|
+
✓ Merged df/doing-upload/20260202-1430 to main
|
|
158
|
+
✓ Cleaned up worktree and branch
|
|
159
|
+
✓ Spec complete: doing-upload → done-upload
|
|
160
|
+
```
|
|
@@ -43,3 +43,21 @@ commits:
|
|
|
43
43
|
format: "feat({spec}): {description}"
|
|
44
44
|
atomic: true # One task = one commit
|
|
45
45
|
push_after: complete # Or "each" for every commit
|
|
46
|
+
|
|
47
|
+
# Worktree isolation for /df:execute
|
|
48
|
+
# Isolates all agent work in a git worktree, keeping main clean
|
|
49
|
+
worktree:
|
|
50
|
+
# Enable worktree isolation (default: true)
|
|
51
|
+
enabled: true
|
|
52
|
+
|
|
53
|
+
# Base path for worktrees relative to project root
|
|
54
|
+
base_path: .deepflow/worktrees
|
|
55
|
+
|
|
56
|
+
# Branch name prefix for worktree branches
|
|
57
|
+
branch_prefix: df/
|
|
58
|
+
|
|
59
|
+
# Automatically cleanup worktree after successful verify
|
|
60
|
+
cleanup_on_success: true
|
|
61
|
+
|
|
62
|
+
# Keep worktree after failed execution for debugging
|
|
63
|
+
cleanup_on_fail: false
|