deepflow 0.1.51 → 0.1.53

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 CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  <p align="center">
15
15
  <a href="#quick-start">Quick Start</a> •
16
- <a href="#the-flow">The Flow</a> •
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,144 @@ 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
- # In your project
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. Compare specs to code, generate tasks
61
+ # 4. Generate task plan from spec
55
62
  /df:plan
56
63
 
57
- # 5. Execute tasks with parallel agents
64
+ # 5. Execute tasks (parallel agents, you watch)
58
65
  /df:execute
59
66
 
60
- # 6. Verify specs are satisfied
67
+ # 6. Verify and merge to main
61
68
  /df:verify
62
69
  ```
63
70
 
64
- ## The Flow
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 already exist as doing-*)
79
+ # The AI figures out HOW, overnight
80
+
81
+ deepflow auto # process all doing-* specs
82
+ deepflow auto --parallel=3 # 3 approaches in parallel
83
+ deepflow auto --hypotheses=4 # 4 hypotheses per cycle
84
+ deepflow auto --max-cycles=5 # cap retry cycles
85
+ ```
86
+
87
+ **What the AI does alone:**
88
+ 1. Reads each `doing-*` spec
89
+ 2. Generates N hypotheses for how to implement it
90
+ 3. Runs parallel spikes in isolated worktrees (one per hypothesis)
91
+ 4. Implements the passing approaches
92
+ 5. Adversarial selection: a fresh AI context compares approaches by artifacts only (never reads code), picks the best or rejects all
93
+ 6. If rejected: generates new hypotheses, retries (up to max-cycles)
94
+ 7. On convergence: verifies, merges to main
95
+
96
+ **What you do:** Write specs (via interactive mode or manually), run `deepflow auto`, read the morning report at `.deepflow/auto-report.md`.
97
+
98
+ **Safety:** Never pushes to remote. Failed approaches recorded in `.deepflow/experiments/` and never repeated. Specs validated before processing (malformed specs are skipped).
99
+
100
+ ### The Boundary
101
+
102
+ ```
103
+ YOU (the human) AI (autonomous)
104
+ ───────────────────────────────── ──────────────────────────────────
105
+ Define the problem Generate hypotheses
106
+ Write/approve the spec Spike, implement, compare
107
+ Set constraints & acceptance Self-judge via adversarial selection
108
+ criteria Verify against YOUR criteria
109
+ Merge or retry
110
+ Read morning report
111
+ ───────────────────────────────── ──────────────────────────────────
112
+ specs/doing-*.md is the handoff point
113
+ ```
114
+
115
+ ## The Flow (Interactive)
65
116
 
66
117
  ```
67
118
  /df:discover <name>
68
- Socratic questioning (motivation, scope, constraints...)
69
-
70
- /df:debate <topic> optional
71
- 4 perspectives: User Advocate, Tech Skeptic,
72
- Systems Thinker, LLM Efficiency
73
- Creates specs/.debate-{topic}.md
74
-
119
+ | Socratic questioning (motivation, scope, constraints...)
120
+ v
121
+ /df:debate <topic> <- optional
122
+ | 4 perspectives: User Advocate, Tech Skeptic,
123
+ | Systems Thinker, LLM Efficiency
124
+ | Creates specs/.debate-{topic}.md
125
+ v
75
126
  /df:spec <name>
76
- Creates specs/{name}.md from conversation
77
-
127
+ | Creates specs/{name}.md from conversation
128
+ | Validates structure before writing
129
+ v
78
130
  /df:plan
79
- Checks past experiments (learn from failures)
80
- Risky work? generates spike task first
81
- Creates PLAN.md with prioritized tasks
82
- Renames: feature.md doing-feature.md
83
-
131
+ | Checks past experiments (learn from failures)
132
+ | Risky work? -> generates spike task first
133
+ | Creates PLAN.md with prioritized tasks
134
+ | Renames: feature.md -> doing-feature.md
135
+ v
84
136
  /df:execute
85
- Creates isolated worktree (main stays clean)
86
- Spike tasks run first, verified before continuing
87
- Parallel agents, file conflicts serialize
88
- Context-aware (50% checkpoint)
89
-
137
+ | Creates isolated worktree (main stays clean)
138
+ | Spike tasks run first, verified before continuing
139
+ | Parallel agents, file conflicts serialize
140
+ | Context-aware (>=50% -> checkpoint)
141
+ v
90
142
  /df:verify
91
- Checks requirements met
92
- Merges worktree to main, cleans up
93
- Extracts decisions .deepflow/decisions.md
94
- Deletes done-* spec after extraction
143
+ | Checks requirements met
144
+ | Merges worktree to main, cleans up
145
+ | Extracts decisions -> .deepflow/decisions.md
146
+ | Deletes done-* spec after extraction
147
+ ```
148
+
149
+ ## The Flow (Autonomous)
150
+
151
+ ```
152
+ deepflow auto
153
+ | For each doing-* spec:
154
+ |
155
+ | Validate spec (malformed? skip)
156
+ | v
157
+ | Generate N hypotheses
158
+ | v
159
+ | Parallel spikes (one worktree per hypothesis)
160
+ | | Pass? -> implement in same worktree
161
+ | | Fail? -> record experiment, discard
162
+ | v
163
+ | Adversarial selection (fresh context, artifacts only)
164
+ | | Winner? -> verify & merge
165
+ | | Reject all? -> new hypotheses, retry
166
+ | v
167
+ | Morning report -> .deepflow/auto-report.md
95
168
  ```
96
169
 
97
170
  ## Spec Lifecycle
98
171
 
99
172
  ```
100
173
  specs/
101
- feature.md new, needs /df:plan
102
- doing-feature.md in progress, has tasks in PLAN.md
103
- done-feature.md transient (decisions extracted, then deleted)
174
+ feature.md -> new, needs /df:plan
175
+ doing-feature.md -> in progress (active contract between you and the AI)
176
+ done-feature.md -> transient (decisions extracted, then deleted)
104
177
  ```
105
178
 
106
179
  ## Works With Any Project
@@ -115,9 +188,9 @@ For risky or uncertain work, `/df:plan` generates a **spike task** first:
115
188
 
116
189
  ```
117
190
  Spike: Validate streaming upload handles 10MB+ files
118
- Run minimal experiment
119
- Pass? Unblock implementation tasks
120
- Fail? Record learning, generate new hypothesis
191
+ | Run minimal experiment
192
+ | Pass? -> Unblock implementation tasks
193
+ | Fail? -> Record learning, generate new hypothesis
121
194
  ```
122
195
 
123
196
  Experiments are tracked in `.deepflow/experiments/`. Failed approaches won't be repeated.
@@ -130,9 +203,28 @@ Execution happens in an isolated git worktree:
130
203
  - Resume with `/df:execute --continue`
131
204
  - On success, `/df:verify` merges to main and cleans up
132
205
 
206
+ ## LSP Integration
207
+
208
+ deepflow automatically enables Claude Code's LSP tools during install, giving agents access to `goToDefinition`, `findReferences`, and `workspaceSymbol` for precise code navigation instead of grep-based searching.
209
+
210
+ - **Global install:** sets `ENABLE_LSP_TOOL=1` in `~/.claude/settings.json`
211
+ - **Project install:** sets it in `.claude/settings.local.json`
212
+ - **Uninstall:** cleans up automatically
213
+
214
+ 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`).
215
+
216
+ ## Spec Validation
217
+
218
+ Specs are validated before downstream consumption by `/df:spec`, `/df:plan`, and `deepflow auto`:
219
+
220
+ - **Hard invariants** (block on failure): required sections present, REQ-N prefixes, checkbox ACs, no duplicate IDs
221
+ - **Advisory warnings** (warn interactively, block in auto mode): long specs, orphaned requirements, excessive technical notes
222
+
223
+ Run manually: `node hooks/df-spec-lint.js specs/my-spec.md`
224
+
133
225
  ## Context-Aware Execution
134
226
 
135
- Statusline shows context usage. At 50%:
227
+ Statusline shows context usage. At >=50%:
136
228
  - Waits for running agents
137
229
  - Checkpoints state
138
230
  - Resume with `/df:execute --continue`
@@ -151,23 +243,26 @@ Statusline shows context usage. At ≥50%:
151
243
  | `/df:consolidate` | Deduplicate and clean up decisions.md |
152
244
  | `/df:resume` | Session continuity briefing |
153
245
  | `/df:update` | Update deepflow to latest |
246
+ | `deepflow auto` | Autonomous overnight execution (no human needed) |
154
247
 
155
248
  ## File Structure
156
249
 
157
250
  ```
158
251
  your-project/
159
- ├── specs/
160
- ├── auth.md # new spec
161
- └── doing-upload.md # in progress
162
- ├── PLAN.md # active tasks
163
- └── .deepflow/
164
- ├── config.yaml # project settings
165
- ├── decisions.md # auto-extracted + ad-hoc decisions
166
- ├── last-consolidated.json # consolidation timestamp
167
- ├── context.json # context % tracking
168
- ├── experiments/ # spike results (pass/fail)
169
- └── worktrees/ # isolated execution
170
- └── upload/ # one worktree per spec
252
+ +-- specs/
253
+ | +-- auth.md # new spec
254
+ | +-- doing-upload.md # in progress
255
+ +-- PLAN.md # active tasks
256
+ +-- .deepflow/
257
+ +-- config.yaml # project settings
258
+ +-- decisions.md # auto-extracted + ad-hoc decisions
259
+ +-- auto-report.md # morning report (autonomous mode)
260
+ +-- auto-decisions.log # AI decision log (autonomous mode)
261
+ +-- last-consolidated.json # consolidation timestamp
262
+ +-- context.json # context % tracking
263
+ +-- experiments/ # spike results (pass/fail)
264
+ +-- worktrees/ # isolated execution
265
+ +-- upload/ # one worktree per spec
171
266
  ```
172
267
 
173
268
  ## Configuration
@@ -190,7 +285,7 @@ worktree:
190
285
 
191
286
  ## Principles
192
287
 
193
- 1. **Stay in flow** — Uninterrupted deep work
288
+ 1. **You define WHAT, AI figures out HOW** — Specs are the contract
194
289
  2. **Confirm before assume** — Search code before marking "missing"
195
290
  3. **Complete implementations** — No stubs, no placeholders
196
291
  4. **Atomic commits** — One task = one commit