deepflow 0.1.5 → 0.1.7

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.
@@ -17,63 +17,34 @@ Implement tasks from PLAN.md with parallel agents, atomic commits, and context-e
17
17
  - Agent: `general-purpose` (Sonnet) — Task implementation
18
18
  - Agent: `reasoner` (Opus) — Debugging failures
19
19
 
20
- ## Context Budget
20
+ ## Context-Aware Execution
21
21
 
22
- | Threshold | Tokens | Action |
23
- |-----------|--------|--------|
24
- | Normal | <60k | Continue execution |
25
- | Warning | 60k | Display budget status |
26
- | Checkpoint | 80k | Save state, prompt resume |
27
- | Limit | 100k | Hard stop |
22
+ Statusline writes to `.deepflow/context.json`: `{"percentage": 45}`
28
23
 
29
- Display after each wave: `Budget: ~45k/100k tokens`
24
+ | Context % | Action |
25
+ |-----------|--------|
26
+ | < 50% | Full parallelism (up to 5 agents) |
27
+ | ≥ 50% | Wait for running agents, checkpoint, exit |
30
28
 
31
- Token estimates: ~650/task, ~200/wave overhead.
32
-
33
- ## Agent Output Protocol
34
-
35
- Agents MUST return exactly 5 lines:
29
+ ## Agent Protocol
36
30
 
31
+ Agents write results to `.deepflow/results/{task_id}.yaml`:
37
32
  ```yaml
38
33
  task: T3
39
- status: success|failed
34
+ status: success
40
35
  commit: abc1234
41
- duration: 45s
42
- error: "single line if failed"
43
- ```
44
-
45
- **Agent instructions (include in spawn):**
46
- ```
47
- Return ONLY 5-line YAML. No test output, git logs, or stack traces.
48
- Handle all verification internally. Fix issues before returning.
49
36
  ```
50
37
 
51
- If verbose output received: extract minimal data, discard rest.
38
+ **Spawn with:** `run_in_background: true`
39
+ **Poll:** `Glob(".deepflow/results/T*.yaml")`
40
+ **NEVER use TaskOutput** — returns full trace, wastes context.
52
41
 
53
42
  ## Checkpoint & Resume
54
43
 
55
- **File:** `.deepflow/checkpoint.json`
56
-
57
- ```json
58
- {
59
- "session_id": "exec_abc123",
60
- "completed_tasks": ["T1", "T2"],
61
- "current_wave": 2,
62
- "last_commit": "def5678",
63
- "estimated_tokens_used": 82000,
64
- "decisions_made": ["Used multer for uploads"],
65
- "resume_instructions": "Continue with Wave 3"
66
- }
67
- ```
68
-
69
- **Checkpoint protocol** (at 80k tokens):
70
- 1. Complete current task
71
- 2. Wait for parallel agents
72
- 3. Update PLAN.md
73
- 4. Write checkpoint atomically (.tmp → rename)
74
- 5. Print: `Context limit reached. Run /df:execute --continue`
44
+ **File:** `.deepflow/checkpoint.json` — stores completed tasks, current wave.
75
45
 
76
- **Resume** (`--continue`): Load checkpoint, skip completed tasks, reset token counter.
46
+ **On checkpoint:** Complete wave update PLAN.md save → exit.
47
+ **Resume:** `--continue` loads checkpoint, skips completed tasks.
77
48
 
78
49
  ## Behavior
79
50
 
@@ -89,44 +60,40 @@ else → Start fresh
89
60
  ### 2. LOAD PLAN
90
61
 
91
62
  ```
92
- Load: PLAN.md (required), specs/*.md, .deepflow/config.yaml
63
+ Load: PLAN.md (required), specs/doing-*.md, .deepflow/config.yaml
93
64
  If missing: "No PLAN.md found. Run /df:plan first."
94
65
  ```
95
66
 
96
- ### 3. IDENTIFY READY TASKS
67
+ ### 3. CHECK FOR UNPLANNED SPECS
68
+
69
+ Warn if `specs/*.md` (excluding doing-/done-) exist. Non-blocking.
70
+
71
+ ### 4. IDENTIFY READY TASKS
97
72
 
98
- Ready = `[ ]` status + all `blocked_by` complete + not in checkpoint.
73
+ Ready = `[ ]` + all `blocked_by` complete + not in checkpoint.
99
74
 
100
- ### 4. EXECUTE IN PARALLEL
75
+ ### 5. CHECK CONTEXT & EXECUTE
101
76
 
102
- | Ready | Strategy |
103
- |-------|----------|
104
- | 1-3 | All parallel |
105
- | 4+ | 5 parallel, queue rest |
77
+ If context ≥50%: wait for agents, checkpoint, exit.
106
78
 
107
- **Critical:** 1 writer per file. If T1 and T2 both modify `src/api.ts`, execute sequentially.
79
+ All ready tasks run in parallel. File conflicts execute sequentially.
108
80
 
109
- **On failure:** Spawn `reasoner` (Opus) for debugging.
81
+ On failure: spawn `reasoner`.
110
82
 
111
- ### 5. PER-TASK EXECUTION
83
+ ### 6. PER-TASK (agent)
112
84
 
113
- Each agent internally:
114
- 1. Read spec requirements
115
- 2. Implement completely (no stubs/TODOs)
116
- 3. Verify (tests, types, lint) — fix issues
117
- 4. Commit atomically: `feat({spec}): {description}`
118
- 5. Return 5-line YAML only
85
+ Implement verify → commit → write result file.
119
86
 
120
- ### 6. UPDATE & CHECK BUDGET
87
+ ### 7. COMPLETE SPECS
121
88
 
122
- - Mark task complete in PLAN.md with commit hash
123
- - Update token estimate
124
- - If >80k: checkpoint and exit
125
- - If >60k: show warning
89
+ When all tasks done for a `doing-*` spec:
90
+ 1. Embed history in spec: `## Completed` section
91
+ 2. Rename: `doing-upload.md` `done-upload.md`
92
+ 3. Remove section from PLAN.md
126
93
 
127
- ### 7. ITERATE
94
+ ### 8. ITERATE
128
95
 
129
- Repeat until: all done, all blocked, or budget reached.
96
+ Repeat until: all done, all blocked, or checkpoint.
130
97
 
131
98
  ## Rules
132
99
 
@@ -141,24 +108,21 @@ Repeat until: all done, all blocked, or budget reached.
141
108
  ## Example
142
109
 
143
110
  ```
144
- /df:execute
111
+ /df:execute (context: 12%)
145
112
 
146
- Loading PLAN.md...
147
- Found 5 tasks, 3 ready
113
+ Wave 1: T1, T2 parallel (context: 25%)
114
+ T1: success (abc1234)
115
+ T2: success (def5678)
148
116
 
149
- Wave 1: T1, T2, T5 in parallel...
150
- T1: success (abc1234) 45s
151
- T2: success (def5678) 32s
152
- T5: success (ghi9012) 28s
153
- Budget: ~32k/100k tokens
117
+ Wave 2: T3 (context: 48%)
118
+ T3: success (ghi9012)
154
119
 
155
- Wave 2: T3, T4 unblocked
156
- T3: success (jkl3456) 67s
157
- T4: success (mno7890) 41s
158
- Budget: ~52k/100k tokens
159
-
160
- ✓ Execution complete
161
- Tasks: 5/5 | Commits: 5
120
+ doing-upload done-upload
121
+ ✓ Complete: 3/3 tasks
122
+ ```
162
123
 
163
- Run /df:verify to confirm specs satisfied.
124
+ With checkpoint:
125
+ ```
126
+ Wave 1 complete (context: 52%)
127
+ Checkpoint saved. Run /df:execute --continue
164
128
  ```
@@ -5,26 +5,43 @@ Compare specs against codebase, identify gaps, generate prioritized task list.
5
5
 
6
6
  ## Usage
7
7
  ```
8
- /df:plan
8
+ /df:plan # Plan all new specs
9
+ /df:plan feature.md # Plan specific spec
9
10
  ```
10
11
 
11
12
  ## Skills & Agents
12
13
  - Skill: `code-completeness` — Find TODOs, stubs, incomplete work
13
14
  - Agent: `reasoner` (Opus) — Complex analysis and prioritization
14
15
 
16
+ ## Spec File States
17
+
18
+ ```
19
+ specs/
20
+ feature.md → New, needs planning (this command reads these)
21
+ doing-auth.md → In progress, has tasks in PLAN.md
22
+ done-payments.md → Completed, history embedded
23
+ ```
24
+
25
+ **Filtering:**
26
+ - New: `specs/*.md` excluding `doing-*` and `done-*`
27
+ - In progress: `specs/doing-*.md`
28
+ - Completed: `specs/done-*.md`
29
+
15
30
  ## Behavior
16
31
 
17
32
  ### 1. LOAD CONTEXT
18
33
 
19
34
  ```
20
35
  Load:
21
- - specs/*.md (all spec files)
22
- - PLAN.md (if exists, prior state)
23
- - .specflow/config.yaml (if exists)
36
+ - specs/*.md EXCLUDING doing-* and done-* (only new specs)
37
+ - PLAN.md (if exists, for appending)
38
+ - .deepflow/config.yaml (if exists)
24
39
 
25
40
  Determine source_dir from config or default to src/
26
41
  ```
27
42
 
43
+ If no new specs: report counts, suggest `/df:execute`.
44
+
28
45
  ### 2. ANALYZE CODEBASE
29
46
 
30
47
  **Spawn Explore agents** (haiku, read-only) with dynamic count:
@@ -44,68 +61,33 @@ Determine source_dir from config or default to src/
44
61
 
45
62
  ### 3. COMPARE & PRIORITIZE
46
63
 
47
- **Spawn `reasoner` agent** (Opus) for complex analysis:
48
-
49
- | Status | Meaning | Action |
50
- |--------|---------|--------|
51
- | DONE | Fully implemented | Mark complete |
52
- | PARTIAL | Stub or incomplete | Task to complete |
53
- | MISSING | Not found in code | Task to implement |
54
- | CONFLICT | Code contradicts spec | Flag for review |
55
-
56
- Reasoner prioritizes by dependencies, impact, and risk.
57
-
58
- ### 4. PRIORITIZE
64
+ **Spawn `reasoner` agent** (Opus) for analysis:
59
65
 
60
- Order tasks by:
61
- 1. **Dependencies** — Blockers first
62
- 2. **Impact** Core features before enhancements
63
- 3. **Risk** Unknowns early (reduce risk)
66
+ | Status | Action |
67
+ |--------|--------|
68
+ | DONE | Skip |
69
+ | PARTIAL | Task to complete |
70
+ | MISSING | Task to implement |
71
+ | CONFLICT | Flag for review |
64
72
 
65
- ### 5. OUTPUT PLAN.md
73
+ **Spec gaps:** If spec is ambiguous or missing details, note in output (don't silently assume).
66
74
 
67
- ```markdown
68
- # Plan
69
-
70
- Generated: {timestamp}
71
- Specs analyzed: {count}
75
+ **Priority order:**
76
+ 1. Dependencies — blockers first
77
+ 2. Impact — core features before enhancements
78
+ 3. Risk — unknowns early
72
79
 
73
- ## Spec Gaps
74
- [If any specs need updates, list here]
75
- - [ ] specs/X.md: Missing error handling definition
80
+ ### 4. OUTPUT PLAN.md
76
81
 
77
- ## Tasks
82
+ Append tasks grouped by `### doing-{spec-name}`. Include spec gaps if any.
78
83
 
79
- ### {spec-name}
80
-
81
- - [ ] **T1**: {task description}
82
- - Files: {files to create/modify}
83
- - Blocked by: none
84
+ ### 5. RENAME SPECS
84
85
 
85
- - [ ] **T2**: {task description}
86
- - Files: {files}
87
- - Blocked by: T1
88
-
89
- ### {another-spec}
90
-
91
- - [ ] **T3**: {task description}
92
- - Files: {files}
93
- - Blocked by: none
94
- ```
86
+ `mv specs/feature.md specs/doing-feature.md`
95
87
 
96
88
  ### 6. REPORT
97
89
 
98
- ```
99
- ✓ Plan generated
100
-
101
- Specs analyzed: {n}
102
- Tasks created: {n}
103
- Spec gaps found: {n}
104
-
105
- Ready to execute: {n} tasks (no blockers)
106
-
107
- Next: Run /df:execute to start implementation
108
- ```
90
+ `✓ Plan generated — {n} specs, {n} tasks. Run /df:execute`
109
91
 
110
92
  ## Rules
111
93
  - **Plan only** — Do NOT implement anything
@@ -114,58 +96,25 @@ Next: Run /df:execute to start implementation
114
96
  - Prefer existing utilities over new code
115
97
  - Flag spec gaps, don't silently ignore
116
98
 
117
- ## Agent Spawning Rules
118
-
119
- ```yaml
120
- search_agents:
121
- base: 10
122
- per_files: 20 # 1 agent per 20 files
123
- cap: 100
99
+ ## Agent Scaling
124
100
 
125
- analyze_agents:
126
- base: 5
127
- per_specs: 2 # 1 agent per 2 specs
128
- cap: 20
129
-
130
- model_selection:
131
- search: sonnet
132
- analyze: opus
133
- ```
101
+ | Agent | Base | Scale |
102
+ |-------|------|-------|
103
+ | Explore (search) | 10 | +1 per 20 files |
104
+ | Reasoner (analyze) | 5 | +1 per 2 specs |
134
105
 
135
- ## Example Output
106
+ ## Example
136
107
 
137
108
  ```markdown
138
109
  # Plan
139
110
 
140
- Generated: 2025-01-28 14:30
141
- Specs analyzed: 2
111
+ ### doing-upload
142
112
 
143
- ## Spec Gaps
144
- - [ ] specs/image-upload.md: No error handling for S3 failures defined
145
-
146
- ## Tasks
147
-
148
- ### image-upload
149
-
150
- - [ ] **T1**: Create upload API endpoint
151
- - Files: src/api/upload.ts (create)
152
- - Blocked by: none
153
-
154
- - [ ] **T2**: Add file validation middleware
155
- - Files: src/middleware/validate.ts (create)
113
+ - [ ] **T1**: Create upload endpoint
114
+ - Files: src/api/upload.ts
156
115
  - Blocked by: none
157
116
 
158
- - [ ] **T3**: Implement S3 upload service
159
- - Files: src/services/storage.ts (create)
160
- - Blocked by: T1
161
-
162
- - [ ] **T4**: Complete thumbnail generation
163
- - Files: src/services/image.ts:45 (stub found)
164
- - Blocked by: T3
165
-
166
- ### color-extraction
167
-
168
- - [ ] **T5**: Integrate color-thief library
169
- - Files: src/services/color.ts (create)
117
+ - [ ] **T2**: Add S3 service
118
+ - Files: src/services/storage.ts
170
119
  - Blocked by: T1
171
120
  ```
@@ -5,108 +5,46 @@ Check that implemented code satisfies spec requirements and acceptance criteria.
5
5
 
6
6
  ## Usage
7
7
  ```
8
- /df:verify
9
- /df:verify image-upload # Verify specific spec only
8
+ /df:verify # Verify all done-* specs
9
+ /df:verify --doing # Also verify in-progress specs
10
+ /df:verify done-upload # Verify specific spec
10
11
  ```
11
12
 
12
13
  ## Skills & Agents
13
14
  - Skill: `code-completeness` — Find incomplete implementations
14
15
  - Agent: `Explore` (Haiku) — Fast codebase scanning
15
16
 
16
- ## Behavior
17
-
18
- ### 1. LOAD CONTEXT
17
+ ## Spec File States
19
18
 
20
19
  ```
21
- Load:
22
- - specs/*.md (requirements to verify)
23
- - PLAN.md (task completion status)
24
- - Source code (actual implementation)
20
+ specs/
21
+ feature.md Unplanned (skip)
22
+ doing-auth.md In progress (verify with --doing)
23
+ done-upload.md → Completed (default verify target)
25
24
  ```
26
25
 
27
- ### 2. VERIFY EACH SPEC
26
+ ## Behavior
28
27
 
29
- For each spec file, check:
28
+ ### 1. LOAD CONTEXT
30
29
 
31
- #### Requirements Coverage
32
30
  ```
33
- For each REQ-N in spec:
34
- - Find implementation in code
35
- - Verify it meets the requirement
36
- - Mark: satisfied | ✗ missing | ⚠ partial
31
+ Load:
32
+ - specs/done-*.md (completed specs to verify)
33
+ - specs/doing-*.md (if --doing flag)
34
+ - Source code (actual implementation)
37
35
  ```
38
36
 
39
- #### Acceptance Criteria
40
- ```
41
- For each criterion:
42
- - Can it be verified? (testable)
43
- - Is there evidence it passes?
44
- - Mark: ✓ | ✗ | ⚠
45
- ```
37
+ If no done-* specs: report counts, suggest `--doing`.
46
38
 
47
- #### Implementation Quality
39
+ ### 2. VERIFY EACH SPEC
48
40
 
49
- Use `code-completeness` skill patterns to check for:
50
- - Stub functions (not fully implemented)
51
- - TODO/FIXME comments (incomplete work)
52
- - Placeholder returns (fake implementations)
53
- - Skipped tests (untested code)
41
+ Check requirements, acceptance criteria, and quality (stubs/TODOs).
42
+ Mark each: satisfied | ✗ missing | ⚠ partial
54
43
 
55
44
  ### 3. GENERATE REPORT
56
45
 
57
- **If all pass:**
58
- ```
59
- ✓ Verification complete
60
-
61
- specs/image-upload.md
62
- Requirements: 4/4 ✓
63
- Acceptance criteria: 5/5 ✓
64
- Quality: No stubs or TODOs
65
-
66
- specs/color-extraction.md
67
- Requirements: 2/2 ✓
68
- Acceptance criteria: 3/3 ✓
69
- Quality: No stubs or TODOs
70
-
71
- All specs satisfied.
72
- ```
73
-
74
- **If issues found:**
75
- ```
76
- ⚠ Verification found issues
77
-
78
- specs/image-upload.md
79
- Requirements: 3/4
80
- ✗ REQ-4: Error handling for S3 failures
81
- Expected: Graceful error with retry option
82
- Found: No error handling in src/services/storage.ts
83
-
84
- Acceptance criteria: 4/5
85
- ⚠ "Upload shows progress bar"
86
- Found: Progress callback exists but UI not connected
87
-
88
- Quality:
89
- ⚠ src/services/image.ts:67 — TODO: optimize for large files
90
-
91
- Action needed:
92
- 1. Add S3 error handling (REQ-4)
93
- 2. Connect progress UI
94
- 3. Complete TODO in image.ts
95
-
96
- Run /df:plan to generate fix tasks, or fix manually.
97
- ```
98
-
99
- ### 4. UPDATE STATE
100
-
101
- Write findings to STATE.md:
102
- ```markdown
103
- ## Verification Log
104
-
105
- ### 2025-01-28 15:30
106
- Verified: image-upload, color-extraction
107
- Result: 1 spec gap, 2 quality issues
108
- Action: Generated fix tasks
109
- ```
46
+ Report per spec: requirements count, acceptance count, quality issues.
47
+ If issues: suggest creating fix spec or reopening (`mv done-* doing-*`).
110
48
 
111
49
  ## Verification Levels
112
50
 
@@ -127,43 +65,15 @@ Default: L1-L3 (L4 optional, can be slow)
127
65
 
128
66
  ## Agent Usage
129
67
 
130
- Spawn `Explore` agents (Haiku) for fast read-only scanning:
131
- - 1-2 agents per spec (based on spec size)
132
- - Cap: 10 parallel agents
133
- - Read-only: safe to parallelize heavily
68
+ Spawn `Explore` agents (Haiku), 1-2 per spec, cap 10.
134
69
 
135
70
  ## Example
136
71
 
137
72
  ```
138
73
  /df:verify
139
74
 
140
- Verifying 2 specs...
141
-
142
- specs/image-upload.md
143
- ├─ REQ-1: Upload endpoint ✓
144
- │ src/api/upload.ts exports POST /api/upload
145
- ├─ REQ-2: File validation ✓
146
- │ src/middleware/validate.ts checks type, size
147
- ├─ REQ-3: S3 storage ✓
148
- │ src/services/storage.ts implements uploadToS3()
149
- └─ REQ-4: Thumbnails ✓
150
- src/services/image.ts implements generateThumbnail()
151
-
152
- Acceptance: 5/5 ✓
153
- Quality: Clean
154
-
155
- specs/color-extraction.md
156
- ├─ REQ-1: Extract colors ✓
157
- └─ REQ-2: Palette display ⚠
158
- Found: Component exists but not exported
159
-
160
- Acceptance: 2/3
161
- Quality: 1 TODO found
162
-
163
- Summary:
164
- Specs: 2
165
- Passed: 1
166
- Issues: 1
75
+ done-upload.md: 4/4 reqs ✓, 5/5 acceptance ✓, clean
76
+ done-auth.md: 2/2 reqs ✓, 3/3 acceptance ✓, clean
167
77
 
168
- Run /df:plan to generate fix tasks.
78
+ All specs verified
169
79
  ```
@@ -0,0 +1,12 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(git add:*)",
5
+ "Bash(git commit -m \"$\\(cat <<''EOF''\nfeat: add spec lifecycle states and context-aware execution\n\nSpec file states \\(doing-/done- prefixes\\):\n- New specs: specs/*.md \\(no prefix\\)\n- In progress: specs/doing-*.md \\(has tasks in PLAN.md\\)\n- Completed: specs/done-*.md \\(history embedded\\)\n\nPlan command:\n- Only reads new specs \\(excludes doing-/done-\\)\n- Renames to doing-* after creating tasks\n- Appends to PLAN.md \\(preserves existing\\)\n\nExecute command:\n- Context-aware via .deepflow/context.json\n- At ≥50% context: stop spawning, wait, checkpoint\n- File-based agent results \\(no TaskOutput\\)\n- Completes specs: embed history, rename done-*, clean PLAN.md\n\nVerify command:\n- Verifies done-* specs by default\n- --doing flag for in-progress specs\n\nStatusline hook:\n- Writes context % to .deepflow/context.json\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")",
6
+ "Bash(git push)",
7
+ "Bash(npm version:*)",
8
+ "Bash(git commit:*)",
9
+ "Bash(npm publish:*)"
10
+ ]
11
+ }
12
+ }
package/README.md CHANGED
@@ -14,8 +14,7 @@
14
14
  <p align="center">
15
15
  <a href="#quick-start">Quick Start</a> •
16
16
  <a href="#the-flow">The Flow</a> •
17
- <a href="#commands">Commands</a>
18
- <a href="docs/getting-started.md">Docs</a>
17
+ <a href="#commands">Commands</a>
19
18
  </p>
20
19
 
21
20
  ---
@@ -25,9 +24,8 @@
25
24
  - **Stay in flow** — Minimize context switches, maximize deep work
26
25
  - **Conversational ideation** with proactive gap discovery
27
26
  - **Specs define intent**, tasks close reality gaps
28
- - **Parallel execution** with dependency awareness
27
+ - **Parallel execution** with context-aware checkpointing
29
28
  - **Atomic commits** for clean rollback
30
- - **Minimal ceremony** — 4 commands, not 27
31
29
 
32
30
  ## Quick Start
33
31
 
@@ -38,7 +36,7 @@ npx deepflow
38
36
  # In your project
39
37
  claude
40
38
 
41
- # 1. Discuss what you want to build (conversation)
39
+ # 1. Discuss what you want to build
42
40
  # 2. Generate spec when ready
43
41
  /df:spec image-upload
44
42
 
@@ -57,39 +55,42 @@ claude
57
55
  ```
58
56
  CONVERSATION
59
57
  │ Describe what you want
60
- │ LLM asks gap questions (scope, edge cases, constraints)
58
+ │ LLM asks gap questions
61
59
 
62
60
  /df:spec <name>
63
- Generates specs/{name}.md
61
+ Creates specs/{name}.md
64
62
 
65
63
  /df:plan
66
- Compares specs to codebase
67
- Finds TODOs, stubs, missing implementations
68
- Outputs PLAN.md with prioritized tasks
64
+ Analyzes specs vs codebase
65
+ Creates PLAN.md with tasks
66
+ Renames: feature.md doing-feature.md
69
67
 
70
68
  /df:execute
71
- Runs tasks respecting dependencies
72
- Parallel for independent tasks
69
+ Parallel agents per wave
70
+ Context-aware (≥50% checkpoint)
73
71
  │ Atomic commit per task
74
72
 
75
73
  /df:verify
76
- │ Checks spec requirements met
77
- Updates PLAN.md status
74
+ │ Checks requirements met
75
+ Renames: doing-feature.md → done-feature.md
78
76
  ```
79
77
 
80
- ## File Structure
81
-
82
- After running deepflow, your project will have:
78
+ ## Spec Lifecycle
83
79
 
84
80
  ```
85
- your-project/
86
- ├── specs/
87
- │ ├── feature-a.md
88
- │ └── feature-b.md
89
- ├── PLAN.md # Task checklist
90
- └── STATE.md # Decisions & learnings
81
+ specs/
82
+ feature.md → new, needs /df:plan
83
+ doing-feature.md → in progress, has tasks in PLAN.md
84
+ done-feature.md → completed, history embedded
91
85
  ```
92
86
 
87
+ ## Context-Aware Execution
88
+
89
+ Statusline shows context usage. At ≥50%:
90
+ - Waits for running agents
91
+ - Checkpoints state
92
+ - Resume with `/df:execute --continue`
93
+
93
94
  ## Commands
94
95
 
95
96
  | Command | Purpose |
@@ -98,40 +99,40 @@ your-project/
98
99
  | `/df:plan` | Compare specs to code, create tasks |
99
100
  | `/df:execute` | Run tasks with parallel agents |
100
101
  | `/df:verify` | Check specs satisfied |
102
+ | `/df:update` | Update deepflow to latest |
103
+
104
+ ## File Structure
105
+
106
+ ```
107
+ your-project/
108
+ ├── specs/
109
+ │ ├── auth.md # new spec
110
+ │ ├── doing-upload.md # in progress
111
+ │ └── done-payments.md # completed
112
+ ├── PLAN.md # active tasks only
113
+ └── .deepflow/
114
+ ├── context.json # context % for execution
115
+ ├── checkpoint.json # resume state
116
+ └── results/ # agent results
117
+ ```
101
118
 
102
119
  ## Configuration
103
120
 
104
- Create `.deepflow/config.yaml` in your project:
121
+ Create `.deepflow/config.yaml`:
105
122
 
106
123
  ```yaml
107
124
  project:
108
125
  source_dir: src/
109
126
  specs_dir: specs/
110
-
111
- planning:
112
- search_patterns:
113
- - "TODO"
114
- - "FIXME"
115
- - "stub"
116
- - "placeholder"
117
-
118
- parallelism:
119
- max_search_agents: 50
120
- max_write_agents: 5
121
-
122
- models:
123
- search: sonnet
124
- implement: sonnet
125
- reason: opus
126
127
  ```
127
128
 
128
129
  ## Principles
129
130
 
130
131
  1. **Stay in flow** — Uninterrupted deep work
131
- 2. **Confirm before assume** — Search code before creating "missing" tasks
132
+ 2. **Confirm before assume** — Search code before marking "missing"
132
133
  3. **Complete implementations** — No stubs, no placeholders
133
134
  4. **Atomic commits** — One task = one commit
134
- 5. **Single writer per file** — Avoid race conditions
135
+ 5. **Context-aware** — Checkpoint before limits
135
136
 
136
137
  ## License
137
138
 
@@ -74,6 +74,9 @@ function buildContextMeter(contextWindow) {
74
74
 
75
75
  percentage = Math.min(100, Math.round(percentage));
76
76
 
77
+ // Write context usage to file for deepflow commands
78
+ writeContextUsage(percentage);
79
+
77
80
  // Build 10-segment bar
78
81
  const segments = 10;
79
82
  const filled = Math.round((percentage / 100) * segments);
@@ -107,3 +110,19 @@ function checkForUpdate() {
107
110
  return null;
108
111
  }
109
112
  }
113
+
114
+ function writeContextUsage(percentage) {
115
+ try {
116
+ const deepflowDir = path.join(process.cwd(), '.deepflow');
117
+ if (!fs.existsSync(deepflowDir)) {
118
+ fs.mkdirSync(deepflowDir, { recursive: true });
119
+ }
120
+ const contextPath = path.join(deepflowDir, 'context.json');
121
+ fs.writeFileSync(contextPath, JSON.stringify({
122
+ percentage,
123
+ timestamp: Date.now()
124
+ }));
125
+ } catch (e) {
126
+ // Fail silently
127
+ }
128
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepflow",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Stay in flow state - lightweight spec-driven task orchestration for Claude Code",
5
5
  "keywords": [
6
6
  "claude",