@curdx/flow 1.1.4 → 1.1.6

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.
Files changed (89) hide show
  1. package/.claude-plugin/marketplace.json +25 -0
  2. package/.claude-plugin/plugin.json +43 -0
  3. package/CHANGELOG.md +279 -0
  4. package/agent-preamble/preamble.md +214 -0
  5. package/agents/flow-adversary.md +216 -0
  6. package/agents/flow-architect.md +190 -0
  7. package/agents/flow-debugger.md +325 -0
  8. package/agents/flow-edge-hunter.md +273 -0
  9. package/agents/flow-executor.md +246 -0
  10. package/agents/flow-planner.md +204 -0
  11. package/agents/flow-product-designer.md +146 -0
  12. package/agents/flow-qa-engineer.md +276 -0
  13. package/agents/flow-researcher.md +155 -0
  14. package/agents/flow-reviewer.md +280 -0
  15. package/agents/flow-security-auditor.md +398 -0
  16. package/agents/flow-triage-analyst.md +290 -0
  17. package/agents/flow-ui-researcher.md +227 -0
  18. package/agents/flow-ux-designer.md +247 -0
  19. package/agents/flow-verifier.md +283 -0
  20. package/agents/persona-amelia.md +128 -0
  21. package/agents/persona-david.md +141 -0
  22. package/agents/persona-emma.md +179 -0
  23. package/agents/persona-john.md +105 -0
  24. package/agents/persona-mary.md +95 -0
  25. package/agents/persona-oliver.md +136 -0
  26. package/agents/persona-rachel.md +126 -0
  27. package/agents/persona-serena.md +175 -0
  28. package/agents/persona-winston.md +117 -0
  29. package/bin/curdx-flow.js +5 -2
  30. package/cli/install.js +44 -5
  31. package/commands/audit.md +170 -0
  32. package/commands/autoplan.md +184 -0
  33. package/commands/debug.md +199 -0
  34. package/commands/design.md +155 -0
  35. package/commands/discuss.md +162 -0
  36. package/commands/doctor.md +124 -0
  37. package/commands/fast.md +128 -0
  38. package/commands/help.md +119 -0
  39. package/commands/implement.md +381 -0
  40. package/commands/index.md +261 -0
  41. package/commands/init.md +105 -0
  42. package/commands/install-deps.md +128 -0
  43. package/commands/party.md +241 -0
  44. package/commands/plan-ceo.md +117 -0
  45. package/commands/plan-design.md +107 -0
  46. package/commands/plan-dx.md +104 -0
  47. package/commands/plan-eng.md +108 -0
  48. package/commands/qa.md +118 -0
  49. package/commands/requirements.md +146 -0
  50. package/commands/research.md +141 -0
  51. package/commands/review.md +168 -0
  52. package/commands/security.md +109 -0
  53. package/commands/sketch.md +118 -0
  54. package/commands/spec.md +135 -0
  55. package/commands/spike.md +181 -0
  56. package/commands/start.md +189 -0
  57. package/commands/status.md +139 -0
  58. package/commands/switch.md +95 -0
  59. package/commands/tasks.md +189 -0
  60. package/commands/triage.md +160 -0
  61. package/commands/verify.md +124 -0
  62. package/gates/adversarial-review-gate.md +219 -0
  63. package/gates/coverage-audit-gate.md +184 -0
  64. package/gates/devex-gate.md +255 -0
  65. package/gates/edge-case-gate.md +194 -0
  66. package/gates/karpathy-gate.md +130 -0
  67. package/gates/security-gate.md +218 -0
  68. package/gates/tdd-gate.md +188 -0
  69. package/gates/verification-gate.md +183 -0
  70. package/hooks/hooks.json +56 -0
  71. package/hooks/scripts/fail-tracker.sh +31 -0
  72. package/hooks/scripts/inject-karpathy.sh +52 -0
  73. package/hooks/scripts/quick-mode-guard.sh +64 -0
  74. package/hooks/scripts/session-start.sh +76 -0
  75. package/hooks/scripts/stop-watcher.sh +166 -0
  76. package/knowledge/atomic-commits.md +262 -0
  77. package/knowledge/epic-decomposition.md +307 -0
  78. package/knowledge/execution-strategies.md +278 -0
  79. package/knowledge/karpathy-guidelines.md +219 -0
  80. package/knowledge/planning-reviews.md +211 -0
  81. package/knowledge/poc-first-workflow.md +227 -0
  82. package/knowledge/spec-driven-development.md +183 -0
  83. package/knowledge/systematic-debugging.md +384 -0
  84. package/knowledge/two-stage-review.md +233 -0
  85. package/knowledge/wave-execution.md +387 -0
  86. package/package.json +14 -3
  87. package/schemas/config.schema.json +100 -0
  88. package/schemas/spec-frontmatter.schema.json +42 -0
  89. package/schemas/spec-state.schema.json +117 -0
@@ -0,0 +1,189 @@
1
+ ---
2
+ name: start
3
+ description: intelligent entry point — create a new spec or resume an existing one, entering the corresponding phase
4
+ argument-hint: "<spec-name> \"<goal>\""
5
+ allowed-tools: [Read, Write, Bash, AskUserQuestion]
6
+ ---
7
+
8
+ # Start a Spec
9
+
10
+ CurDX-Flow's main entry point. Based on context, automatically:
11
+ - New spec → create directory + templates + enter research phase
12
+ - Existing spec → resume from the last phase
13
+
14
+ ## Step 1: Preflight Check
15
+
16
+ ```bash
17
+ # Must be initialized
18
+ if [ ! -d ".flow" ]; then
19
+ echo "❌ Current directory is not a CurDX-Flow project. Run /curdx-flow:init first"
20
+ exit 1
21
+ fi
22
+ ```
23
+
24
+ ## Step 2: Parse Arguments
25
+
26
+ ```bash
27
+ ARGS="$ARGUMENTS"
28
+
29
+ # Extract spec-name and goal
30
+ # Format: flow-start my-feature "Add JWT auth to API"
31
+ # or: flow-start my-feature (resume existing spec)
32
+ SPEC_NAME=$(echo "$ARGS" | awk '{print $1}')
33
+ GOAL=$(echo "$ARGS" | sed -E "s/^[a-z0-9-]+\s*//" | sed 's/^["\x27]//;s/["\x27]$//')
34
+
35
+ if [ -z "$SPEC_NAME" ]; then
36
+ echo "Usage: /curdx-flow:start <spec-name> \"<goal>\""
37
+ echo "Example: /curdx-flow:start auth-system \"Add JWT authentication to REST API\""
38
+ exit 1
39
+ fi
40
+
41
+ # Validate that spec-name is kebab-case
42
+ if ! echo "$SPEC_NAME" | grep -Eq '^[a-z][a-z0-9-]*$'; then
43
+ echo "❌ spec-name must be kebab-case (start with lowercase letter, only letters, digits, hyphens)"
44
+ exit 1
45
+ fi
46
+ ```
47
+
48
+ ## Step 3: Determine New vs Resume
49
+
50
+ ```bash
51
+ SPEC_DIR=".flow/specs/$SPEC_NAME"
52
+
53
+ if [ -d "$SPEC_DIR" ]; then
54
+ # Resume mode
55
+ MODE="resume"
56
+ echo "🔄 Resuming spec: $SPEC_NAME"
57
+ else
58
+ # New mode
59
+ MODE="new"
60
+ echo "🆕 New spec: $SPEC_NAME"
61
+
62
+ if [ -z "$GOAL" ]; then
63
+ # If no goal given, ask the user
64
+ echo "Please provide a one-sentence goal, then continue."
65
+ exit 0
66
+ fi
67
+ fi
68
+ ```
69
+
70
+ ## Step 4a: New Path
71
+
72
+ If `MODE=new`:
73
+
74
+ ```bash
75
+ # Create directory
76
+ mkdir -p "$SPEC_DIR"
77
+
78
+ # Generate .state.json
79
+ TODAY=$(date +%Y-%m-%d)
80
+ CONFIG_MODE=$(python3 -c "import json; print(json.load(open('.flow/config.json')).get('mode','standard'))" 2>/dev/null || echo "standard")
81
+
82
+ cat > "$SPEC_DIR/.state.json" <<EOF
83
+ {
84
+ "version": "1.0",
85
+ "spec_name": "$SPEC_NAME",
86
+ "goal": "$GOAL",
87
+ "mode": "$CONFIG_MODE",
88
+ "strategy": "auto",
89
+ "phase": "research",
90
+ "phase_status": {
91
+ "research": "not_started",
92
+ "requirements": "not_started",
93
+ "design": "not_started",
94
+ "tasks": "not_started"
95
+ },
96
+ "decisions": [],
97
+ "created": "$TODAY",
98
+ "updated": "$TODAY"
99
+ }
100
+ EOF
101
+
102
+ # Generate progress.md (from template)
103
+ python3 <<PYEOF
104
+ from pathlib import Path
105
+ tmpl = Path("${CLAUDE_PLUGIN_ROOT}/templates/progress.md.tmpl").read_text()
106
+ content = tmpl.replace("{{SPEC_NAME}}", "$SPEC_NAME").replace("{{CREATED_DATE}}", "$TODAY")
107
+ Path("$SPEC_DIR/.progress.md").write_text(content)
108
+ PYEOF
109
+
110
+ # Set as active spec
111
+ echo "$SPEC_NAME" > ".flow/.active-spec"
112
+
113
+ echo "✓ Spec directory created: $SPEC_DIR"
114
+ echo " Goal: $GOAL"
115
+ echo ""
116
+ echo "Next step (automatically entering research):"
117
+ echo " /curdx-flow:research"
118
+ ```
119
+
120
+ ## Step 4b: Resume Path
121
+
122
+ If `MODE=resume`:
123
+
124
+ ```bash
125
+ # Read current phase
126
+ STATE_FILE="$SPEC_DIR/.state.json"
127
+ if [ ! -f "$STATE_FILE" ]; then
128
+ echo "✗ Spec directory exists but .state.json is missing. State may be corrupted."
129
+ # Ask user
130
+ # AskUserQuestion: "Rebuild state file?" (yes/no)
131
+ exit 0
132
+ fi
133
+
134
+ # Set as active
135
+ echo "$SPEC_NAME" > ".flow/.active-spec"
136
+
137
+ # Show current progress
138
+ python3 <<PYEOF
139
+ import json
140
+ s = json.load(open("$STATE_FILE"))
141
+ print(f"✓ Spec activated: $SPEC_NAME")
142
+ print(f" Goal: {s.get('goal','(undefined)')}")
143
+ print(f" Current phase: {s['phase']}")
144
+ print(f" Progress:")
145
+
146
+ ph_emoji = {"completed": "✓", "in_progress": "●", "not_started": "○", "failed": "✗", "skipped": "—"}
147
+ for phase, status in s.get('phase_status',{}).items():
148
+ emoji = ph_emoji.get(status, "?")
149
+ print(f" {emoji} {phase:<15} {status}")
150
+
151
+ print()
152
+
153
+ # Recommend next step
154
+ phase_order = ["research", "requirements", "design", "tasks", "execute", "verify", "ship"]
155
+ for p in phase_order:
156
+ st = s.get('phase_status',{}).get(p, 'not_started')
157
+ if st in ("not_started", "in_progress"):
158
+ print(f"Next step: /curdx-flow:{p}")
159
+ break
160
+ else:
161
+ print("All phases complete! Use /curdx-flow:status to see details.")
162
+ PYEOF
163
+ ```
164
+
165
+ ## Step 5: Summary Prompt
166
+
167
+ ```
168
+ ═══════════════════════════════════════════════
169
+ ✓ Spec ready: $SPEC_NAME
170
+
171
+ Workflow:
172
+ 1. /curdx-flow:research ← research (deep exploration)
173
+ 2. /curdx-flow:requirements ← requirements (user stories + acceptance criteria)
174
+ 3. /curdx-flow:design ← design (architectural decisions, freeze choices)
175
+ 4. /curdx-flow:tasks ← task decomposition (auto-verifiable tasks)
176
+
177
+ One-shot version: /curdx-flow:spec ← run research/req/design/tasks in sequence
178
+
179
+ Fast modes:
180
+ /curdx-flow:fast ← skip spec and implement directly
181
+ /curdx-flow:sketch ← UI prototype exploration
182
+ ═══════════════════════════════════════════════
183
+ ```
184
+
185
+ ## Error Recovery
186
+
187
+ - `.flow/` does not exist → prompt `/curdx-flow:init`
188
+ - spec-name invalid → provide kebab-case example
189
+ - Spec directory corrupted → ask user whether to delete-and-rebuild or repair
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: status
3
+ description: view the current state of the CurDX-Flow project (specs, phases, progress)
4
+ argument-hint: "[--all | <spec-name>]"
5
+ allowed-tools: [Read, Bash, Glob]
6
+ ---
7
+
8
+ # Project Status
9
+
10
+ Shows an overview of the current state of the CurDX-Flow project.
11
+
12
+ ## Execution Steps
13
+
14
+ ### Step 1: Confirm the Project
15
+
16
+ ```bash
17
+ if [ ! -d ".flow" ]; then
18
+ echo "✗ Current directory is not a CurDX-Flow project. Run /curdx-flow:init to initialize."
19
+ exit 0
20
+ fi
21
+ ```
22
+
23
+ ### Step 2: Load Global State
24
+
25
+ ```bash
26
+ # Active spec
27
+ ACTIVE=$(cat .flow/.active-spec 2>/dev/null || echo "(none)")
28
+
29
+ # Project config
30
+ if [ -f ".flow/config.json" ]; then
31
+ MODE=$(python3 -c "import json; print(json.load(open('.flow/config.json')).get('mode','standard'))")
32
+ fi
33
+ ```
34
+
35
+ ### Step 3: Scan Specs
36
+
37
+ ```bash
38
+ # List all specs
39
+ SPECS=$(ls -1 .flow/specs/ 2>/dev/null)
40
+
41
+ # List all Epics
42
+ EPICS=$(ls -1 .flow/_epics/ 2>/dev/null)
43
+ ```
44
+
45
+ For each spec, read `.state.json` to get phase and progress:
46
+
47
+ ```bash
48
+ for spec in $SPECS; do
49
+ STATE_FILE=".flow/specs/$spec/.state.json"
50
+ if [ -f "$STATE_FILE" ]; then
51
+ PHASE=$(python3 -c "import json; print(json.load(open('$STATE_FILE')).get('phase','unknown'))")
52
+ # Can also fetch task_index, total_tasks, etc.
53
+ fi
54
+ done
55
+ ```
56
+
57
+ ### Step 4: Output Format
58
+
59
+ **Default (no arguments)** — global overview:
60
+
61
+ ```
62
+ 📋 CurDX-Flow Project Status
63
+ ═══════════════════════════════════════
64
+
65
+ Project: my-awesome-app
66
+ Mode: standard
67
+ Active spec: auth-system
68
+
69
+ Spec list:
70
+ ● auth-system design (45% — tasks pending)
71
+ ○ user-profile execute (60% — 12/20 tasks)
72
+ ✓ onboarding-flow completed (archived)
73
+
74
+ Epic list:
75
+ ● payment-system 3/5 sub-specs (in progress)
76
+
77
+ Recent decisions (STATE.md):
78
+ D-05: use JWT instead of session cookie (2026-04-15)
79
+ D-06: bcrypt cost factor = 12 (2026-04-15)
80
+
81
+ ═══════════════════════════════════════
82
+ Next step suggestion: /curdx-flow:tasks — generate task list for auth-system
83
+ ```
84
+
85
+ **`<spec-name>`** — detail for a specific spec:
86
+
87
+ ```
88
+ 📋 Spec: auth-system
89
+ ═══════════════════════════════════════
90
+
91
+ Phase: design
92
+ Progress: 45%
93
+ Created: 2026-04-12
94
+
95
+ Completed phases:
96
+ ✓ research (research.md, 320 lines)
97
+ ✓ requirements (requirements.md, 8 stories)
98
+ ● design (design.md, in progress)
99
+ ○ tasks
100
+ ○ execute
101
+
102
+ Related decisions:
103
+ D-05: use JWT instead of session cookie
104
+
105
+ .progress.md summary:
106
+ - Confirmed JWT + refresh token architecture
107
+ - Researched bcrypt vs argon2, chose bcrypt (team familiarity)
108
+ - TODO: design token refresh flow
109
+
110
+ Next step: /curdx-flow:tasks — generate task list
111
+ ```
112
+
113
+ **`--all`** — detailed mode, every spec expanded.
114
+
115
+ ### Step 5: Empty-State Handling
116
+
117
+ If `.flow/` exists but no specs:
118
+
119
+ ```
120
+ 📋 CurDX-Flow Project
121
+ ═══════════════════════════════════════
122
+
123
+ Project: my-awesome-app (just initialized)
124
+ Mode: standard
125
+ Active spec: (none)
126
+
127
+ No specs yet.
128
+
129
+ Start your first feature:
130
+ /curdx-flow:start <name> "<describe what you want to do>"
131
+
132
+ Example:
133
+ /curdx-flow:start auth-system "Add JWT authentication to API"
134
+ ```
135
+
136
+ ## Notes
137
+
138
+ - State data is read-only; this command does not modify any files
139
+ - If `.state.json` is corrupted or missing, degrade gracefully (show "state unknown" instead of failing)
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: switch
3
+ description: switch the active spec (updates .flow/.active-spec)
4
+ argument-hint: "<spec-name>"
5
+ allowed-tools: [Read, Write, Bash]
6
+ ---
7
+
8
+ # Switch Active Spec
9
+
10
+ Switch between multiple specs. The active spec is the default target for commands like `/curdx-flow:research`, `/curdx-flow:requirements`, etc.
11
+
12
+ ## Step 1: Preflight Check
13
+
14
+ ```bash
15
+ [ ! -d ".flow" ] && { echo "❌ Not a CurDX-Flow project. Run /curdx-flow:init first"; exit 1; }
16
+
17
+ SPEC_NAME="$ARGUMENTS"
18
+ if [ -z "$SPEC_NAME" ]; then
19
+ # No arguments → list all specs and prompt
20
+ echo "Current spec list:"
21
+ if [ -d ".flow/specs" ]; then
22
+ for spec in .flow/specs/*/; do
23
+ name=$(basename "$spec")
24
+ active=""
25
+ [ "$name" = "$(cat .flow/.active-spec 2>/dev/null)" ] && active=" ← currently active"
26
+
27
+ # Read phase
28
+ phase=$(python3 -c "import json; print(json.load(open('$spec/.state.json')).get('phase','?'))" 2>/dev/null || echo "?")
29
+ echo " • $name (phase: $phase)$active"
30
+ done
31
+ fi
32
+ echo ""
33
+ echo "Usage: /curdx-flow:switch <spec-name>"
34
+ exit 0
35
+ fi
36
+ ```
37
+
38
+ ## Step 2: Verify Target Spec Exists
39
+
40
+ ```bash
41
+ SPEC_DIR=".flow/specs/$SPEC_NAME"
42
+ if [ ! -d "$SPEC_DIR" ]; then
43
+ echo "❌ Spec does not exist: $SPEC_NAME"
44
+ echo ""
45
+ echo "Existing specs:"
46
+ ls .flow/specs/ 2>/dev/null || echo " (none)"
47
+ echo ""
48
+ echo "Create a new spec: /curdx-flow:start $SPEC_NAME \"<goal>\""
49
+ exit 1
50
+ fi
51
+ ```
52
+
53
+ ## Step 3: Perform the Switch
54
+
55
+ ```bash
56
+ # Save old one for reference
57
+ OLD_ACTIVE=$(cat .flow/.active-spec 2>/dev/null || echo "(none)")
58
+
59
+ # Update
60
+ echo "$SPEC_NAME" > .flow/.active-spec
61
+
62
+ echo "✓ Active spec: $OLD_ACTIVE → $SPEC_NAME"
63
+ ```
64
+
65
+ ## Step 4: Display New Spec Status
66
+
67
+ ```python
68
+ import json, os
69
+ s = json.load(open(f"$SPEC_DIR/.state.json"))
70
+
71
+ print(f"\n📋 {s['spec_name']}")
72
+ print(f" Goal: {s.get('goal','(undefined)')}")
73
+ print(f" Current phase: {s['phase']}")
74
+
75
+ # Phase progress bar
76
+ phases = ["research","requirements","design","tasks","execute","verify","ship"]
77
+ ph_status = s.get('phase_status', {})
78
+ bar = []
79
+ for p in phases:
80
+ st = ph_status.get(p, 'not_started')
81
+ bar.append({"completed":"✓","in_progress":"●","not_started":"○","failed":"✗","skipped":"—"}.get(st,"?"))
82
+ print(f" Progress: {' → '.join(bar)}")
83
+ print(f" {' → '.join(phases)}")
84
+
85
+ # Suggest next step
86
+ for p in phases:
87
+ if ph_status.get(p, 'not_started') in ("not_started","in_progress"):
88
+ print(f"\n Suggested next step: /curdx-flow:{p}")
89
+ break
90
+ ```
91
+
92
+ ## Error Recovery
93
+
94
+ - `.flow/.active-spec` permission error → check write permissions on `.flow/`
95
+ - .state.json corrupted → prompt `/curdx-flow:start <name>` to rebuild
@@ -0,0 +1,189 @@
1
+ ---
2
+ name: tasks
3
+ description: run the task decomposition phase — dispatch the flow-planner agent to decompose along POC-First 5 Phases and perform multi-source coverage audit. Produces tasks.md
4
+ argument-hint: "[spec-name] [--fine | --coarse]"
5
+ allowed-tools: [Read, Write, Bash, Task]
6
+ ---
7
+
8
+ # Task Decomposition Phase
9
+
10
+ Dispatch the `flow-planner` agent to decompose the design into an auto-verifiable task list.
11
+
12
+ ## Step 1: Parse Arguments
13
+
14
+ ```bash
15
+ # Support --fine / --coarse to override project default
16
+ TASK_SIZE="fine"
17
+ ARGS="$ARGUMENTS"
18
+ case "$ARGS" in
19
+ *--coarse*) TASK_SIZE="coarse" ;;
20
+ *--fine*) TASK_SIZE="fine" ;;
21
+ *)
22
+ # Read default from .flow/config.json
23
+ TASK_SIZE=$(python3 -c "
24
+ import json
25
+ try:
26
+ c = json.load(open('.flow/config.json'))
27
+ print(c.get('specs',{}).get('default_task_size','fine'))
28
+ except: print('fine')
29
+ ")
30
+ ;;
31
+ esac
32
+
33
+ SPEC_NAME="$(echo "$ARGS" | sed 's/--[a-z]*//g' | xargs)"
34
+ [ -z "$SPEC_NAME" ] && SPEC_NAME=$(cat .flow/.active-spec 2>/dev/null)
35
+ ```
36
+
37
+ ## Step 2: Preflight Check
38
+
39
+ ```bash
40
+ DIR=".flow/specs/$SPEC_NAME"
41
+ for f in research.md requirements.md design.md; do
42
+ [ ! -f "$DIR/$f" ] && { echo "❌ Missing $f"; exit 1; }
43
+ done
44
+ ```
45
+
46
+ ## Step 3: Detect Project Commands (for planner reference)
47
+
48
+ ```bash
49
+ # Collect actual project commands
50
+ PKG_MGR="npm"; TEST_CMD=""; LINT_CMD=""; BUILD_CMD=""
51
+ if [ -f "package.json" ]; then
52
+ command -v pnpm >/dev/null && [ -f "pnpm-lock.yaml" ] && PKG_MGR="pnpm"
53
+ command -v bun >/dev/null && [ -f "bun.lockb" ] && PKG_MGR="bun"
54
+ command -v yarn >/dev/null && [ -f "yarn.lock" ] && PKG_MGR="yarn"
55
+
56
+ # Parse scripts
57
+ TEST_CMD=$(python3 -c "import json; print(json.load(open('package.json')).get('scripts',{}).get('test',''))" 2>/dev/null)
58
+ LINT_CMD=$(python3 -c "import json; print(json.load(open('package.json')).get('scripts',{}).get('lint',''))" 2>/dev/null)
59
+ BUILD_CMD=$(python3 -c "import json; print(json.load(open('package.json')).get('scripts',{}).get('build',''))" 2>/dev/null)
60
+ fi
61
+
62
+ cat > "/tmp/flow-cmds.txt" <<EOF
63
+ Package Manager: $PKG_MGR
64
+ Test: ${TEST_CMD:-<no test script>}
65
+ Lint: ${LINT_CMD:-<no lint script>}
66
+ Build: ${BUILD_CMD:-<no build script>}
67
+ EOF
68
+ ```
69
+
70
+ ## Step 4: Update State + Dispatch
71
+
72
+ ```python
73
+ import json
74
+ p = f'.flow/specs/{SPEC_NAME}/.state.json'
75
+ s = json.load(open(p))
76
+ s.setdefault('phase_status',{})['tasks']='in_progress'
77
+ s['phase']='tasks'
78
+ s['task_size'] = TASK_SIZE # 'fine' or 'coarse'
79
+ json.dump(s, open(p,'w'), indent=2, ensure_ascii=False)
80
+ ```
81
+
82
+ Dispatch Task:
83
+
84
+ ```
85
+ Task:
86
+ subagent_type: general-purpose
87
+ description: "task decomposition $SPEC_NAME"
88
+ prompt: |
89
+ You are the flow-planner agent. Full definition at:
90
+ ${CLAUDE_PLUGIN_ROOT}/agents/flow-planner.md
91
+
92
+ Prerequisites (must read):
93
+ - .flow/specs/$SPEC_NAME/research.md
94
+ - .flow/specs/$SPEC_NAME/requirements.md
95
+ - .flow/specs/$SPEC_NAME/design.md
96
+ - .flow/STATE.md
97
+ - .flow/CONTEXT.md
98
+
99
+ Template:
100
+ ${CLAUDE_PLUGIN_ROOT}/templates/tasks.md.tmpl
101
+
102
+ Knowledge base:
103
+ - ${CLAUDE_PLUGIN_ROOT}/knowledge/poc-first-workflow.md (**must read**)
104
+
105
+ Project-detected commands (use these, do not assume):
106
+ ---
107
+ $(cat /tmp/flow-cmds.txt)
108
+ ---
109
+
110
+ Task size: $TASK_SIZE (fine=40-60 tasks, coarse=10-20 tasks)
111
+
112
+ Output:
113
+ .flow/specs/$SPEC_NAME/tasks.md
114
+
115
+ Mandatory requirements:
116
+ 1. Decompose along POC-First 5 Phases (Phase 1-5)
117
+ 2. Each task has 5 fields: Do / Files / Done-when / Verify / Commit
118
+ 3. Verify **must be an automated command** (no "manual testing")
119
+ 4. At least 1 [VERIFY] checkpoint per Phase
120
+ 5. Mark independent tasks with [P]
121
+ 6. Must end with a **coverage audit table**:
122
+ - Which tasks correspond to each FR?
123
+ - Which tasks correspond to each AC?
124
+ - Which tasks correspond to each AD?
125
+ - Uncovered items must state the reason
126
+
127
+ Success criteria:
128
+ - Task count matches task_size requirement
129
+ - All Verify values are executable commands
130
+ - Coverage audit table complete
131
+ - Commit messages follow conventional format
132
+
133
+ Forbidden:
134
+ - Writing TODO or "manual" in Verify field
135
+ - Assuming project commands (use the ones detected above)
136
+ - Skipping FRs for "simplicity"
137
+
138
+ When done, return a brief: task count, Phase distribution, coverage audit result.
139
+ ```
140
+
141
+ ## Step 5: Coverage Audit Verification
142
+
143
+ ```bash
144
+ TASKS=".flow/specs/$SPEC_NAME/tasks.md"
145
+
146
+ # Check that the coverage audit table exists
147
+ grep -q "coverage audit" "$TASKS" || echo "✗ Missing coverage audit table"
148
+
149
+ # Check that every task has Verify
150
+ # Rough: within 10 lines after each "- [ ]" there should be "Verify:"
151
+ TASKS_COUNT=$(grep -c "^- \[ \] \*\*" "$TASKS" || echo 0)
152
+ VERIFY_COUNT=$(grep -c "^\s*\*\*Verify\*\*:" "$TASKS" || echo 0)
153
+
154
+ if [ "$VERIFY_COUNT" -lt "$TASKS_COUNT" ]; then
155
+ echo "⚠ Task count $TASKS_COUNT vs Verify count $VERIFY_COUNT (some tasks may be missing the Verify field)"
156
+ fi
157
+
158
+ # Check for forbidden words
159
+ if grep -iE "(manual|manual test|todo|tbd)" "$TASKS" > /dev/null; then
160
+ echo "✗ tasks.md contains forbidden words (manual/TODO/TBD); check the Verify field"
161
+ fi
162
+ ```
163
+
164
+ ## Step 6: Output
165
+
166
+ ```
167
+ ✓ tasks phase complete
168
+
169
+ File: .flow/specs/$SPEC_NAME/tasks.md
170
+ Task size: $TASK_SIZE
171
+ Total tasks: N
172
+ Phase distribution:
173
+ POC: X
174
+ Refactor: Y
175
+ Testing: Z
176
+ Quality: W
177
+ PR: V
178
+
179
+ Coverage audit: FR / AC / AD all ✓
180
+
181
+ ⚠ Phase 2 (Execution Engine) not yet released. tasks.md can be executed manually in order.
182
+ The /curdx-flow:implement command will be available in the next version.
183
+ ```
184
+
185
+ ## Error Recovery
186
+
187
+ - design.md missing or status is not completed → return to /curdx-flow:design
188
+ - Agent missed some FRs → rerun or manually append tasks at the end of tasks.md
189
+ - Verify contains the word "manual" → rerun and explicitly state "all Verify must be automated"