deepflow 0.1.52 → 0.1.54
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/README.md +156 -55
- package/bin/deepflow-auto.sh +1264 -0
- package/bin/install.js +21 -0
- package/hooks/df-spec-lint.js +197 -0
- package/package.json +1 -1
- package/src/commands/df/plan.md +4 -0
- package/src/commands/df/spec.md +7 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
<p align="center">
|
|
15
15
|
<a href="#quick-start">Quick Start</a> •
|
|
16
|
-
<a href="#
|
|
16
|
+
<a href="#two-modes">Two Modes</a> •
|
|
17
17
|
<a href="#commands">Commands</a>
|
|
18
18
|
</p>
|
|
19
19
|
|
|
@@ -21,13 +21,11 @@
|
|
|
21
21
|
|
|
22
22
|
## Philosophy
|
|
23
23
|
|
|
24
|
-
- **Stay in flow** — Minimize context switches, maximize deep work
|
|
25
|
-
- **Conversational ideation** with proactive gap discovery
|
|
26
24
|
- **Specs define intent**, tasks close reality gaps
|
|
25
|
+
- **You decide WHAT to build** — the AI decides HOW
|
|
26
|
+
- **Two modes:** interactive (human-in-the-loop) and autonomous (overnight, unattended)
|
|
27
27
|
- **Spike-first planning** — Validate risky hypotheses before full implementation
|
|
28
28
|
- **Worktree isolation** — Main branch stays clean during execution
|
|
29
|
-
- **Parallel execution** with context-aware checkpointing
|
|
30
|
-
- **Automatic decision capture** on spec completion, periodic consolidation
|
|
31
29
|
- **Atomic commits** for clean rollback
|
|
32
30
|
|
|
33
31
|
## Quick Start
|
|
@@ -38,69 +36,160 @@ npx deepflow
|
|
|
38
36
|
|
|
39
37
|
# Uninstall
|
|
40
38
|
npx deepflow --uninstall
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Two Modes
|
|
42
|
+
|
|
43
|
+
deepflow has two modes of operation. Both start from the same artifact: a **spec**.
|
|
44
|
+
|
|
45
|
+
### Interactive Mode (human-in-the-loop)
|
|
41
46
|
|
|
42
|
-
|
|
47
|
+
You drive each step inside a Claude Code session. Good for when you want control over the process, are exploring a new domain, or want to iterate on the spec.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
43
50
|
claude
|
|
44
51
|
|
|
45
|
-
# 1. Explore the problem space
|
|
52
|
+
# 1. Explore the problem space (conversation with you)
|
|
46
53
|
/df:discover image-upload
|
|
47
54
|
|
|
48
|
-
# 2. Debate tradeoffs (optional)
|
|
55
|
+
# 2. Debate tradeoffs (optional, 4 AI perspectives)
|
|
49
56
|
/df:debate upload-strategy
|
|
50
57
|
|
|
51
58
|
# 3. Generate spec from conversation
|
|
52
59
|
/df:spec image-upload
|
|
53
60
|
|
|
54
|
-
# 4.
|
|
61
|
+
# 4. Generate task plan from spec
|
|
55
62
|
/df:plan
|
|
56
63
|
|
|
57
|
-
# 5. Execute tasks
|
|
64
|
+
# 5. Execute tasks (parallel agents, you watch)
|
|
58
65
|
/df:execute
|
|
59
66
|
|
|
60
|
-
# 6. Verify
|
|
67
|
+
# 6. Verify and merge to main
|
|
61
68
|
/df:verify
|
|
62
69
|
```
|
|
63
70
|
|
|
64
|
-
|
|
71
|
+
**What requires you:** Steps 1-3 (defining the problem and approving the spec). Steps 4-6 run autonomously but you trigger each one and can intervene.
|
|
72
|
+
|
|
73
|
+
### Autonomous Mode (unattended)
|
|
74
|
+
|
|
75
|
+
You write the specs, then walk away. The AI runs the full pipeline — hypothesis generation, parallel spikes, implementation, adversarial self-selection, verification — without any human intervention.
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# You define WHAT (the specs), the AI figures out HOW, overnight
|
|
79
|
+
|
|
80
|
+
deepflow auto # process all specs in specs/
|
|
81
|
+
deepflow auto --parallel=3 # 3 approaches in parallel
|
|
82
|
+
deepflow auto --hypotheses=4 # 4 hypotheses per cycle
|
|
83
|
+
deepflow auto --max-cycles=5 # cap retry cycles
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**What the AI does alone:**
|
|
87
|
+
1. Discovers specs (auto-promotes plain specs to `doing-*`)
|
|
88
|
+
2. Generates N hypotheses for how to implement each spec
|
|
89
|
+
3. Runs parallel spikes in isolated worktrees (one per hypothesis)
|
|
90
|
+
4. Implements the passing approaches
|
|
91
|
+
5. Adversarial selection: a fresh AI context compares approaches by artifacts only (never reads code), picks the best or rejects all
|
|
92
|
+
6. If rejected: generates new hypotheses, retries (up to max-cycles)
|
|
93
|
+
7. On convergence: verifies, merges to main
|
|
94
|
+
|
|
95
|
+
**What you do:** Write specs (via interactive mode or manually) in `specs/`, run `deepflow auto`, read the morning report at `.deepflow/auto-report.md`. No need to run `/df:plan` first — auto mode promotes plain specs to `doing-*` automatically.
|
|
96
|
+
|
|
97
|
+
**How to use:**
|
|
98
|
+
```bash
|
|
99
|
+
# In Claude Code — create and approve a spec
|
|
100
|
+
$ claude
|
|
101
|
+
> /df:discover auth
|
|
102
|
+
> /df:spec auth # creates specs/auth.md
|
|
103
|
+
> /exit
|
|
104
|
+
|
|
105
|
+
# In your terminal — run auto mode and walk away
|
|
106
|
+
$ deepflow auto
|
|
107
|
+
|
|
108
|
+
# Next morning — check what happened
|
|
109
|
+
$ cat .deepflow/auto-report.md
|
|
110
|
+
$ git log --oneline
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Safety:** Never pushes to remote. Failed approaches recorded in `.deepflow/experiments/` and never repeated. Specs validated before processing (malformed specs are skipped).
|
|
114
|
+
|
|
115
|
+
### The Boundary
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
YOU (the human) AI (autonomous)
|
|
119
|
+
───────────────────────────────── ──────────────────────────────────
|
|
120
|
+
Define the problem Generate hypotheses
|
|
121
|
+
Write/approve the spec Spike, implement, compare
|
|
122
|
+
Set constraints & acceptance Self-judge via adversarial selection
|
|
123
|
+
criteria Verify against YOUR criteria
|
|
124
|
+
Merge or retry
|
|
125
|
+
Read morning report
|
|
126
|
+
───────────────────────────────── ──────────────────────────────────
|
|
127
|
+
specs/*.md is the handoff point
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## The Flow (Interactive)
|
|
65
131
|
|
|
66
132
|
```
|
|
67
133
|
/df:discover <name>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
/df:debate <topic>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
134
|
+
| Socratic questioning (motivation, scope, constraints...)
|
|
135
|
+
v
|
|
136
|
+
/df:debate <topic> <- optional
|
|
137
|
+
| 4 perspectives: User Advocate, Tech Skeptic,
|
|
138
|
+
| Systems Thinker, LLM Efficiency
|
|
139
|
+
| Creates specs/.debate-{topic}.md
|
|
140
|
+
v
|
|
75
141
|
/df:spec <name>
|
|
76
|
-
|
|
77
|
-
|
|
142
|
+
| Creates specs/{name}.md from conversation
|
|
143
|
+
| Validates structure before writing
|
|
144
|
+
v
|
|
78
145
|
/df:plan
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
146
|
+
| Checks past experiments (learn from failures)
|
|
147
|
+
| Risky work? -> generates spike task first
|
|
148
|
+
| Creates PLAN.md with prioritized tasks
|
|
149
|
+
| Renames: feature.md -> doing-feature.md
|
|
150
|
+
v
|
|
84
151
|
/df:execute
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
152
|
+
| Creates isolated worktree (main stays clean)
|
|
153
|
+
| Spike tasks run first, verified before continuing
|
|
154
|
+
| Parallel agents, file conflicts serialize
|
|
155
|
+
| Context-aware (>=50% -> checkpoint)
|
|
156
|
+
v
|
|
90
157
|
/df:verify
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
158
|
+
| Checks requirements met
|
|
159
|
+
| Merges worktree to main, cleans up
|
|
160
|
+
| Extracts decisions -> .deepflow/decisions.md
|
|
161
|
+
| Deletes done-* spec after extraction
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## The Flow (Autonomous)
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
deepflow auto
|
|
168
|
+
| Discover specs (auto-promote plain specs to doing-*)
|
|
169
|
+
| For each doing-* spec:
|
|
170
|
+
|
|
|
171
|
+
| Validate spec (malformed? skip)
|
|
172
|
+
| v
|
|
173
|
+
| Generate N hypotheses
|
|
174
|
+
| v
|
|
175
|
+
| Parallel spikes (one worktree per hypothesis)
|
|
176
|
+
| | Pass? -> implement in same worktree
|
|
177
|
+
| | Fail? -> record experiment, discard
|
|
178
|
+
| v
|
|
179
|
+
| Adversarial selection (fresh context, artifacts only)
|
|
180
|
+
| | Winner? -> verify & merge
|
|
181
|
+
| | Reject all? -> new hypotheses, retry
|
|
182
|
+
| v
|
|
183
|
+
| Morning report -> .deepflow/auto-report.md
|
|
95
184
|
```
|
|
96
185
|
|
|
97
186
|
## Spec Lifecycle
|
|
98
187
|
|
|
99
188
|
```
|
|
100
189
|
specs/
|
|
101
|
-
feature.md
|
|
102
|
-
doing-feature.md
|
|
103
|
-
done-feature.md
|
|
190
|
+
feature.md -> new, needs /df:plan
|
|
191
|
+
doing-feature.md -> in progress (active contract between you and the AI)
|
|
192
|
+
done-feature.md -> transient (decisions extracted, then deleted)
|
|
104
193
|
```
|
|
105
194
|
|
|
106
195
|
## Works With Any Project
|
|
@@ -115,9 +204,9 @@ For risky or uncertain work, `/df:plan` generates a **spike task** first:
|
|
|
115
204
|
|
|
116
205
|
```
|
|
117
206
|
Spike: Validate streaming upload handles 10MB+ files
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
207
|
+
| Run minimal experiment
|
|
208
|
+
| Pass? -> Unblock implementation tasks
|
|
209
|
+
| Fail? -> Record learning, generate new hypothesis
|
|
121
210
|
```
|
|
122
211
|
|
|
123
212
|
Experiments are tracked in `.deepflow/experiments/`. Failed approaches won't be repeated.
|
|
@@ -140,9 +229,18 @@ deepflow automatically enables Claude Code's LSP tools during install, giving ag
|
|
|
140
229
|
|
|
141
230
|
Agents prefer LSP tools when available and fall back to Grep/Glob silently. You'll need a language server installed for your language (e.g. `typescript-language-server`, `pyright`, `rust-analyzer`, `gopls`).
|
|
142
231
|
|
|
232
|
+
## Spec Validation
|
|
233
|
+
|
|
234
|
+
Specs are validated before downstream consumption by `/df:spec`, `/df:plan`, and `deepflow auto`:
|
|
235
|
+
|
|
236
|
+
- **Hard invariants** (block on failure): required sections present, REQ-N prefixes, checkbox ACs, no duplicate IDs
|
|
237
|
+
- **Advisory warnings** (warn interactively, block in auto mode): long specs, orphaned requirements, excessive technical notes
|
|
238
|
+
|
|
239
|
+
Run manually: `node hooks/df-spec-lint.js specs/my-spec.md`
|
|
240
|
+
|
|
143
241
|
## Context-Aware Execution
|
|
144
242
|
|
|
145
|
-
Statusline shows context usage. At
|
|
243
|
+
Statusline shows context usage. At >=50%:
|
|
146
244
|
- Waits for running agents
|
|
147
245
|
- Checkpoints state
|
|
148
246
|
- Resume with `/df:execute --continue`
|
|
@@ -161,23 +259,26 @@ Statusline shows context usage. At ≥50%:
|
|
|
161
259
|
| `/df:consolidate` | Deduplicate and clean up decisions.md |
|
|
162
260
|
| `/df:resume` | Session continuity briefing |
|
|
163
261
|
| `/df:update` | Update deepflow to latest |
|
|
262
|
+
| `deepflow auto` | Autonomous overnight execution (no human needed) |
|
|
164
263
|
|
|
165
264
|
## File Structure
|
|
166
265
|
|
|
167
266
|
```
|
|
168
267
|
your-project/
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
268
|
+
+-- specs/
|
|
269
|
+
| +-- auth.md # new spec
|
|
270
|
+
| +-- doing-upload.md # in progress
|
|
271
|
+
+-- PLAN.md # active tasks
|
|
272
|
+
+-- .deepflow/
|
|
273
|
+
+-- config.yaml # project settings
|
|
274
|
+
+-- decisions.md # auto-extracted + ad-hoc decisions
|
|
275
|
+
+-- auto-report.md # morning report (autonomous mode)
|
|
276
|
+
+-- auto-decisions.log # AI decision log (autonomous mode)
|
|
277
|
+
+-- last-consolidated.json # consolidation timestamp
|
|
278
|
+
+-- context.json # context % tracking
|
|
279
|
+
+-- experiments/ # spike results (pass/fail)
|
|
280
|
+
+-- worktrees/ # isolated execution
|
|
281
|
+
+-- upload/ # one worktree per spec
|
|
181
282
|
```
|
|
182
283
|
|
|
183
284
|
## Configuration
|
|
@@ -200,7 +301,7 @@ worktree:
|
|
|
200
301
|
|
|
201
302
|
## Principles
|
|
202
303
|
|
|
203
|
-
1. **
|
|
304
|
+
1. **You define WHAT, AI figures out HOW** — Specs are the contract
|
|
204
305
|
2. **Confirm before assume** — Search code before marking "missing"
|
|
205
306
|
3. **Complete implementations** — No stubs, no placeholders
|
|
206
307
|
4. **Atomic commits** — One task = one commit
|