@curdx/flow 3.0.0 → 3.1.0
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/CHANGELOG.md +21 -87
- package/LICENSE +1 -1
- package/README.md +28 -129
- package/dist/index.mjs +995 -0
- package/package.json +33 -44
- package/.claude-plugin/marketplace.json +0 -48
- package/.claude-plugin/plugin.json +0 -52
- package/agent-preamble/preamble.md +0 -314
- package/agents/flow-adversary.md +0 -203
- package/agents/flow-architect.md +0 -198
- package/agents/flow-brownfield-analyst.md +0 -143
- package/agents/flow-debugger.md +0 -321
- package/agents/flow-edge-hunter.md +0 -289
- package/agents/flow-executor.md +0 -269
- package/agents/flow-orchestrator.md +0 -145
- package/agents/flow-planner.md +0 -247
- package/agents/flow-product-designer.md +0 -159
- package/agents/flow-qa-engineer.md +0 -282
- package/agents/flow-researcher.md +0 -166
- package/agents/flow-reviewer.md +0 -304
- package/agents/flow-security-auditor.md +0 -401
- package/agents/flow-triage-analyst.md +0 -272
- package/agents/flow-ui-researcher.md +0 -230
- package/agents/flow-ux-designer.md +0 -221
- package/agents/flow-verifier.md +0 -350
- package/bin/curdx-flow +0 -5
- package/bin/curdx-flow-state +0 -104
- package/bin/curdx-flow.js +0 -54
- package/cli/README.md +0 -104
- package/cli/doctor-workflow.js +0 -483
- package/cli/doctor.js +0 -73
- package/cli/help.js +0 -59
- package/cli/install-bundled-mcps.js +0 -37
- package/cli/install-companions.js +0 -19
- package/cli/install-context7-config.js +0 -80
- package/cli/install-curdx-plugin.js +0 -96
- package/cli/install-language.js +0 -35
- package/cli/install-next-steps.js +0 -29
- package/cli/install-options.js +0 -9
- package/cli/install-paths.js +0 -52
- package/cli/install-recommended-plugins.js +0 -104
- package/cli/install-required-plugins.js +0 -57
- package/cli/install-self-update.js +0 -62
- package/cli/install-workflow.js +0 -209
- package/cli/install.js +0 -101
- package/cli/lib/claude-commands.js +0 -41
- package/cli/lib/claude-ops.js +0 -47
- package/cli/lib/claude.js +0 -183
- package/cli/lib/config.js +0 -24
- package/cli/lib/doctor-claude-settings.js +0 -1186
- package/cli/lib/doctor-report.js +0 -978
- package/cli/lib/doctor-runtime-environment.js +0 -196
- package/cli/lib/frontmatter.js +0 -44
- package/cli/lib/json-schema.js +0 -57
- package/cli/lib/logging.js +0 -25
- package/cli/lib/process.js +0 -60
- package/cli/lib/prompts.js +0 -135
- package/cli/lib/runtime.js +0 -107
- package/cli/lib/semver.js +0 -109
- package/cli/lib/version.js +0 -12
- package/cli/protocols-body.md +0 -22
- package/cli/protocols.js +0 -162
- package/cli/registry.js +0 -123
- package/cli/router.js +0 -49
- package/cli/uninstall-actions.js +0 -360
- package/cli/uninstall-workflow.js +0 -146
- package/cli/uninstall.js +0 -42
- package/cli/upgrade-workflow.js +0 -80
- package/cli/upgrade.js +0 -91
- package/cli/utils.js +0 -40
- package/gates/adversarial-review-gate.md +0 -219
- package/gates/coverage-audit-gate.md +0 -182
- package/gates/devex-gate.md +0 -254
- package/gates/edge-case-gate.md +0 -194
- package/gates/karpathy-gate.md +0 -130
- package/gates/security-gate.md +0 -218
- package/gates/tdd-gate.md +0 -182
- package/gates/test-quality-gate.md +0 -59
- package/gates/verification-gate.md +0 -179
- package/hooks/hooks.json +0 -130
- package/hooks/scripts/common.sh +0 -237
- package/hooks/scripts/config-change-guard.sh +0 -94
- package/hooks/scripts/flow-context-watch.sh +0 -94
- package/hooks/scripts/inject-karpathy.sh +0 -53
- package/hooks/scripts/quick-mode-guard.sh +0 -69
- package/hooks/scripts/session-start.sh +0 -94
- package/hooks/scripts/session-title.sh +0 -87
- package/hooks/scripts/stop-watcher.sh +0 -231
- package/hooks/scripts/subagent-artifact-guard.sh +0 -92
- package/hooks/scripts/subagent-statusline.sh +0 -111
- package/hooks/scripts/task-lifecycle-guard.sh +0 -106
- package/hooks/scripts/teammate-idle-guard.sh +0 -83
- package/knowledge/artifact-output-discipline.md +0 -24
- package/knowledge/artifact-summary-contracts.md +0 -50
- package/knowledge/atomic-commits.md +0 -262
- package/knowledge/claude-code-runtime-contracts.md +0 -240
- package/knowledge/epic-decomposition.md +0 -307
- package/knowledge/execution-strategies.md +0 -303
- package/knowledge/karpathy-guidelines.md +0 -219
- package/knowledge/planning-reviews.md +0 -211
- package/knowledge/poc-first-workflow.md +0 -223
- package/knowledge/review-feedback-intake.md +0 -57
- package/knowledge/spec-driven-development.md +0 -180
- package/knowledge/systematic-debugging.md +0 -378
- package/knowledge/two-stage-review.md +0 -249
- package/knowledge/wave-execution.md +0 -403
- package/monitors/monitors.json +0 -8
- package/monitors/scripts/flow-state-monitor.sh +0 -102
- package/output-styles/curdx-evidence-first.md +0 -34
- package/output-styles/curdx-fast-mode.md +0 -42
- package/output-styles/curdx-spec-mode.md +0 -46
- package/schemas/agent-frontmatter.schema.json +0 -66
- package/schemas/config.schema.json +0 -134
- package/schemas/gate-frontmatter.schema.json +0 -30
- package/schemas/hooks.schema.json +0 -115
- package/schemas/output-style-frontmatter.schema.json +0 -22
- package/schemas/plugin-manifest.schema.json +0 -436
- package/schemas/plugin-settings.schema.json +0 -29
- package/schemas/skill-frontmatter.schema.json +0 -177
- package/schemas/spec-frontmatter.schema.json +0 -42
- package/schemas/spec-state.schema.json +0 -165
- package/settings.json +0 -8
- package/skills/brownfield-index/SKILL.md +0 -53
- package/skills/brownfield-index/references/applicability.md +0 -12
- package/skills/brownfield-index/references/handoff.md +0 -8
- package/skills/brownfield-index/references/index-contract.md +0 -10
- package/skills/browser-qa/SKILL.md +0 -39
- package/skills/browser-qa/references/handoff.md +0 -6
- package/skills/browser-qa/references/prerequisites.md +0 -10
- package/skills/browser-qa/references/qa-contract.md +0 -20
- package/skills/cancel/SKILL.md +0 -41
- package/skills/cancel/references/destructive-mode.md +0 -17
- package/skills/cancel/references/reporting.md +0 -18
- package/skills/cancel/references/state-recovery.md +0 -30
- package/skills/cancel/references/target-resolution.md +0 -7
- package/skills/debug/SKILL.md +0 -45
- package/skills/debug/references/context-gathering.md +0 -11
- package/skills/debug/references/failure-guard.md +0 -25
- package/skills/debug/references/intake.md +0 -12
- package/skills/debug/references/phase-workflow.md +0 -34
- package/skills/debug/references/reporting.md +0 -20
- package/skills/epic/SKILL.md +0 -39
- package/skills/epic/references/epic-artifacts.md +0 -20
- package/skills/epic/references/epic-intake.md +0 -9
- package/skills/epic/references/slice-handoff.md +0 -16
- package/skills/fast/SKILL.md +0 -62
- package/skills/fast/references/applicability.md +0 -25
- package/skills/fast/references/clarification.md +0 -20
- package/skills/fast/references/execution-contract.md +0 -56
- package/skills/help/SKILL.md +0 -55
- package/skills/help/references/dispatch.md +0 -20
- package/skills/help/references/overview.md +0 -39
- package/skills/help/references/troubleshoot.md +0 -47
- package/skills/help/references/workflow.md +0 -37
- package/skills/implement/SKILL.md +0 -104
- package/skills/implement/references/error-recovery.md +0 -36
- package/skills/implement/references/linear-execution.md +0 -43
- package/skills/implement/references/native-task-sync.md +0 -107
- package/skills/implement/references/preflight.md +0 -43
- package/skills/implement/references/progress-contract.md +0 -36
- package/skills/implement/references/state-init.md +0 -36
- package/skills/implement/references/stop-hook-execution.md +0 -50
- package/skills/implement/references/strategy-router.md +0 -38
- package/skills/implement/references/subagent-execution.md +0 -57
- package/skills/implement/references/wave-execution.md +0 -180
- package/skills/init/SKILL.md +0 -49
- package/skills/init/references/gitignore-and-health.md +0 -26
- package/skills/init/references/next-steps.md +0 -22
- package/skills/init/references/preflight.md +0 -15
- package/skills/init/references/scaffold-contract.md +0 -27
- package/skills/review/SKILL.md +0 -82
- package/skills/review/references/optional-passes.md +0 -48
- package/skills/review/references/preflight.md +0 -38
- package/skills/review/references/report-contract.md +0 -49
- package/skills/review/references/reporting.md +0 -20
- package/skills/review/references/stage-execution.md +0 -32
- package/skills/security-audit/SKILL.md +0 -47
- package/skills/security-audit/references/audit-contract.md +0 -21
- package/skills/security-audit/references/gate-handoff.md +0 -8
- package/skills/security-audit/references/scope-and-depth.md +0 -9
- package/skills/spec/SKILL.md +0 -100
- package/skills/spec/references/artifact-landing.md +0 -31
- package/skills/spec/references/phase-execution.md +0 -50
- package/skills/spec/references/planning-review.md +0 -31
- package/skills/spec/references/preflight-and-routing.md +0 -46
- package/skills/spec/references/reporting.md +0 -21
- package/skills/start/SKILL.md +0 -84
- package/skills/start/references/branch-routing.md +0 -51
- package/skills/start/references/mode-semantics.md +0 -12
- package/skills/start/references/preflight.md +0 -13
- package/skills/start/references/reporting.md +0 -20
- package/skills/start/references/state-seeding.md +0 -44
- package/skills/start/references/workflow-handoff.md +0 -26
- package/skills/status/SKILL.md +0 -41
- package/skills/status/references/gather-contract.md +0 -30
- package/skills/status/references/health-rules.md +0 -27
- package/skills/status/references/output-contract.md +0 -25
- package/skills/status/references/preflight.md +0 -10
- package/skills/status/references/recovery-hints.md +0 -18
- package/skills/ui-sketch/SKILL.md +0 -39
- package/skills/ui-sketch/references/brief-intake.md +0 -10
- package/skills/ui-sketch/references/iteration-handoff.md +0 -5
- package/skills/ui-sketch/references/variant-contract.md +0 -15
- package/skills/verify/SKILL.md +0 -56
- package/skills/verify/references/evidence-workflow.md +0 -39
- package/skills/verify/references/output-contract.md +0 -23
- package/skills/verify/references/preflight.md +0 -11
- package/skills/verify/references/report-handoff.md +0 -35
- package/skills/verify/references/strict-mode.md +0 -12
- package/templates/CONTEXT.md.tmpl +0 -53
- package/templates/PROJECT.md.tmpl +0 -59
- package/templates/ROADMAP.md.tmpl +0 -50
- package/templates/STATE.md.tmpl +0 -49
- package/templates/config.json.tmpl +0 -51
- package/templates/design.md.tmpl +0 -83
- package/templates/progress.md.tmpl +0 -77
- package/templates/requirements.md.tmpl +0 -76
- package/templates/research.md.tmpl +0 -83
- package/templates/tasks.md.tmpl +0 -107
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
# Epic Decomposition — Vertical Slicing of Epics
|
|
2
|
-
|
|
3
|
-
> How do you break down a large feature? The core principle is **vertical slicing** (by user value), not **horizontal layering** (by technical layer).
|
|
4
|
-
>
|
|
5
|
-
> Agents reference this via `@${CLAUDE_PLUGIN_ROOT}/knowledge/epic-decomposition.md`.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## What is an Epic?
|
|
10
|
-
|
|
11
|
-
An Epic = **a collection of sub-specs** that together deliver a large user goal.
|
|
12
|
-
|
|
13
|
-
Typical scenarios:
|
|
14
|
-
- "Add payment system"
|
|
15
|
-
- "Refactor authentication module"
|
|
16
|
-
- "Migrate from REST to GraphQL"
|
|
17
|
-
- "Add internationalization support"
|
|
18
|
-
|
|
19
|
-
These are all too large to do as a single spec. They must be broken down.
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Vertical Slicing vs Horizontal Layering
|
|
24
|
-
|
|
25
|
-
### ✗ Horizontal layering (bad)
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
Epic: Add payment system
|
|
29
|
-
Spec 1: Frontend (all payment UI)
|
|
30
|
-
Spec 2: Backend (all payment APIs)
|
|
31
|
-
Spec 3: DB (orders / transactions / refunds tables)
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
**Problems**:
|
|
35
|
-
- Each spec alone delivers **no user value** (frontend cannot call a non-existent backend)
|
|
36
|
-
- All 3 must ship together — no incremental release
|
|
37
|
-
- If spec 2 is abandoned halfway, spec 1 and 3 are wasted
|
|
38
|
-
- Hard to test (no frontend-only E2E without a backend)
|
|
39
|
-
|
|
40
|
-
### ✓ Vertical slicing (good)
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
Epic: Add payment system
|
|
44
|
-
Spec 1: Credit card payment (UI + API + DB, end-to-end)
|
|
45
|
-
Spec 2: Alipay payment (UI + API + DB)
|
|
46
|
-
Spec 3: Refund flow (UI + API + DB)
|
|
47
|
-
Spec 4: Transaction history query (UI + API)
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
**Advantages**:
|
|
51
|
-
- Each spec ships independently = real user value
|
|
52
|
-
- Incremental release (credit card first, Alipay a week later)
|
|
53
|
-
- Failure isolation (delaying refunds doesn't block payments)
|
|
54
|
-
- Each spec is independently E2E testable
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Deciding When to Break Into an Epic
|
|
59
|
-
|
|
60
|
-
Ask yourself:
|
|
61
|
-
|
|
62
|
-
1. **Effort**: Can this be done in 1-2 weeks?
|
|
63
|
-
- Yes → single spec
|
|
64
|
-
- No → Epic
|
|
65
|
-
|
|
66
|
-
2. **Independent delivery**: Can it be split into multiple parts "the user can perceive separately"?
|
|
67
|
-
- Yes → Epic (split along those)
|
|
68
|
-
- No → keep refining, or it shouldn't be split
|
|
69
|
-
|
|
70
|
-
3. **Dependencies**: Are sub-parts hard or soft dependencies?
|
|
71
|
-
- All hard (must serialize) → consider not splitting; do as one large spec
|
|
72
|
-
- Mostly soft (can parallelize) → Epic
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## Slicing Dimensions
|
|
77
|
-
|
|
78
|
-
### 1. By user type
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
Epic: Multi-user payment system
|
|
82
|
-
Spec 1: Personal user credit card payment
|
|
83
|
-
Spec 2: Enterprise user bank transfer
|
|
84
|
-
Spec 3: Platform merchant collection
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### 2. By use case
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
Epic: Order management
|
|
91
|
-
Spec 1: Checkout flow
|
|
92
|
-
Spec 2: Post-payment shipping
|
|
93
|
-
Spec 3: Refund flow
|
|
94
|
-
Spec 4: After-sales support
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### 3. By channel
|
|
98
|
-
|
|
99
|
-
```
|
|
100
|
-
Epic: Multi-channel payment
|
|
101
|
-
Spec 1: Credit card (Stripe)
|
|
102
|
-
Spec 2: Alipay
|
|
103
|
-
Spec 3: WeChat Pay
|
|
104
|
-
Spec 4: Apple Pay
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### 4. By data dimension
|
|
108
|
-
|
|
109
|
-
```
|
|
110
|
-
Epic: User profile system
|
|
111
|
-
Spec 1: Basic info profile
|
|
112
|
-
Spec 2: Behavior profile
|
|
113
|
-
Spec 3: Preference profile
|
|
114
|
-
Spec 4: Profile query API
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### 5. By business phase (MVP → Full)
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
Epic: Recommendation system
|
|
121
|
-
Spec 1: Hot list (minimal MVP)
|
|
122
|
-
Spec 2: Collaborative filtering
|
|
123
|
-
Spec 3: Deep learning model
|
|
124
|
-
Spec 4: Personalized re-rank
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
## Dependency Identification
|
|
130
|
-
|
|
131
|
-
### Hard Dependency
|
|
132
|
-
|
|
133
|
-
B needs A's data structures or interfaces to work. A must be completed first.
|
|
134
|
-
|
|
135
|
-
```
|
|
136
|
-
A: define Order type + create orders table
|
|
137
|
-
B: consume Order to implement payment logic
|
|
138
|
-
→ B hard-depends on A
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### Soft Dependency
|
|
142
|
-
|
|
143
|
-
B's **final integration** needs A, but can be stubbed earlier.
|
|
144
|
-
|
|
145
|
-
```
|
|
146
|
-
A: payment gateway integration
|
|
147
|
-
B: refund flow
|
|
148
|
-
→ B can mock the payment API and build the happy path first
|
|
149
|
-
→ integrate with the real API once A is done
|
|
150
|
-
→ B soft-depends on A
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### Parallel
|
|
154
|
-
|
|
155
|
-
A and B do not depend on each other. Can fully parallelize.
|
|
156
|
-
|
|
157
|
-
```
|
|
158
|
-
A: credit card payment
|
|
159
|
-
B: Alipay payment
|
|
160
|
-
→ independent UI/API/DB
|
|
161
|
-
→ two teams can work in parallel
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
### Express with mermaid
|
|
165
|
-
|
|
166
|
-
```mermaid
|
|
167
|
-
flowchart LR
|
|
168
|
-
A[Spec 1: Order basics] --> B[Spec 2: Credit card]
|
|
169
|
-
A --> C[Spec 3: Alipay]
|
|
170
|
-
B -.software-dep.-> D[Spec 4: Refund]
|
|
171
|
-
C -.software-dep.-> D
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
Solid line = hard dependency; dashed line + "software-dep" = soft dependency.
|
|
175
|
-
|
|
176
|
-
---
|
|
177
|
-
|
|
178
|
-
## Freezing Shared Interfaces
|
|
179
|
-
|
|
180
|
-
Multiple sub-specs use the same type (e.g., `Order`). That type must be frozen at the Epic level.
|
|
181
|
-
|
|
182
|
-
### Define in epic.md
|
|
183
|
-
|
|
184
|
-
```typescript
|
|
185
|
-
// All sub-specs must comply
|
|
186
|
-
interface Order {
|
|
187
|
-
id: string;
|
|
188
|
-
userId: string;
|
|
189
|
-
amount: number; // cents (integer)
|
|
190
|
-
currency: "CNY" | "USD";
|
|
191
|
-
status: OrderStatus;
|
|
192
|
-
paymentMethod: PaymentMethod;
|
|
193
|
-
createdAt: string;
|
|
194
|
-
updatedAt: string;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
type OrderStatus =
|
|
198
|
-
| "pending"
|
|
199
|
-
| "paid"
|
|
200
|
-
| "refunded"
|
|
201
|
-
| "failed";
|
|
202
|
-
|
|
203
|
-
type PaymentMethod =
|
|
204
|
-
| { kind: "credit_card"; lastFour: string }
|
|
205
|
-
| { kind: "alipay"; openId: string }
|
|
206
|
-
| { kind: "wechat"; openId: string };
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
### Change rules
|
|
210
|
-
|
|
211
|
-
- During Epic development, the interface is **frozen**
|
|
212
|
-
- If a change is unavoidable, bump the Epic version (1.0 → 1.1)
|
|
213
|
-
- Re-review all completed sub-specs
|
|
214
|
-
- Avoid "one spec changed the interface, another didn't know"
|
|
215
|
-
|
|
216
|
-
---
|
|
217
|
-
|
|
218
|
-
## Execution Order Suggestions
|
|
219
|
-
|
|
220
|
-
### Topological sort
|
|
221
|
-
|
|
222
|
-
```
|
|
223
|
-
1. Specs with no dependencies can start in parallel
|
|
224
|
-
2. Hard-dependent specs wait for upstream to complete
|
|
225
|
-
3. Soft-dependent specs can start early (using mocks)
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### Typical pattern
|
|
229
|
-
|
|
230
|
-
```
|
|
231
|
-
Week 1-2: Spec 1 (Order basics) [critical path]
|
|
232
|
-
Week 3-4: Spec 2 (credit card) + Spec 3 (Alipay) in parallel
|
|
233
|
-
Week 5-6: Spec 4 (refund) + Spec 5 (query)
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
---
|
|
237
|
-
|
|
238
|
-
## Epic Lifecycle
|
|
239
|
-
|
|
240
|
-
```
|
|
241
|
-
1. Invoke the `epic` skill with "Epic goal" (auto-invoked; or say "break this big feature down")
|
|
242
|
-
↓ flow-triage-analyst decomposes
|
|
243
|
-
2. Generates .flow/_epics/<name>/epic.md + sub-spec skeletons
|
|
244
|
-
3. User reviews epic.md
|
|
245
|
-
↓
|
|
246
|
-
4. For each sub-spec:
|
|
247
|
-
/curdx-flow:start <sub-spec-name>
|
|
248
|
-
/curdx-flow:spec
|
|
249
|
-
/curdx-flow:implement
|
|
250
|
-
/curdx-flow:review
|
|
251
|
-
↓
|
|
252
|
-
5. All sub-specs done → Epic complete
|
|
253
|
-
6. Record an epic-level retrospective in `.flow/_epics/<name>/epic.md`
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
---
|
|
257
|
-
|
|
258
|
-
## Anti-patterns
|
|
259
|
-
|
|
260
|
-
### 1. "Treating the mermaid diagram as the spec"
|
|
261
|
-
|
|
262
|
-
The Epic dependency graph is only high-level planning. Each sub-spec still needs a full research / requirements / design / tasks cycle.
|
|
263
|
-
|
|
264
|
-
### 2. Too many sub-specs (> 10)
|
|
265
|
-
|
|
266
|
-
Granularity is too fine. Merge. Or this is not one Epic but multiple Epics.
|
|
267
|
-
|
|
268
|
-
### 3. Too few sub-specs (< 3)
|
|
269
|
-
|
|
270
|
-
Not split finely enough, or shouldn't be split at all. Treat as a single large spec.
|
|
271
|
-
|
|
272
|
-
### 4. Sub-specs form a hard-dep chain
|
|
273
|
-
|
|
274
|
-
```
|
|
275
|
-
A → B → C → D → E
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
A "serial chain" is no different from not splitting. Rethink the slicing approach.
|
|
279
|
-
|
|
280
|
-
### 5. Interface not frozen
|
|
281
|
-
|
|
282
|
-
"Each spec defines its own Order type" → incompatibility surfaces at integration time. The interface must be defined once, at the Epic level.
|
|
283
|
-
|
|
284
|
-
---
|
|
285
|
-
|
|
286
|
-
## Real Example: Migrating to GraphQL
|
|
287
|
-
|
|
288
|
-
Wrong decomposition (horizontal):
|
|
289
|
-
```
|
|
290
|
-
Spec 1: Write all GraphQL schema
|
|
291
|
-
Spec 2: Write all resolvers
|
|
292
|
-
Spec 3: Adapt frontend to GraphQL client
|
|
293
|
-
```
|
|
294
|
-
→ Users see nothing until all 3 are done
|
|
295
|
-
|
|
296
|
-
Correct decomposition (vertical):
|
|
297
|
-
```
|
|
298
|
-
Spec 1: User module migration (schema + resolver + 1 frontend page)
|
|
299
|
-
Spec 2: Order module migration
|
|
300
|
-
Spec 3: Product module migration
|
|
301
|
-
Spec 4: Retire old REST
|
|
302
|
-
```
|
|
303
|
-
→ Spec 1 can partially ship, users start experiencing GraphQL benefits
|
|
304
|
-
|
|
305
|
-
---
|
|
306
|
-
|
|
307
|
-
_Sources: XP's User Story Splitting + BMAD-METHOD's Epic design._
|
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
# Execution Strategies — 4 Execution Strategies Explained
|
|
2
|
-
|
|
3
|
-
> `/curdx-flow:implement`'s Strategy Router picks a strategy based on task characteristics. This doc describes how each strategy works, its trade-offs, and when to use it.
|
|
4
|
-
>
|
|
5
|
-
> Agents reference this via `@${CLAUDE_PLUGIN_ROOT}/knowledge/execution-strategies.md`.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Overview
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
Task list (tasks.md)
|
|
13
|
-
↓
|
|
14
|
-
┌──────────────────────────────────────────────┐
|
|
15
|
-
│ Strategy Router │
|
|
16
|
-
│ │
|
|
17
|
-
│ Task count < 5 and strong deps? → linear │
|
|
18
|
-
│ [P] markers and independent? → wave │
|
|
19
|
-
│ Task count > 10 and quality-first? → subagent │
|
|
20
|
-
│ Long chain, unattended? → stop-hook │
|
|
21
|
-
│ No explicit preference? → auto (picks sub) │
|
|
22
|
-
└──────────────────────────────────────────────┘
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## Strategy 1: Linear (sequential, inline)
|
|
28
|
-
|
|
29
|
-
### How it works
|
|
30
|
-
The main agent runs all tasks sequentially **in the current session**. When one task ends, it starts the next — no subagent is dispatched.
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
main agent → task 1 → task 2 → task 3 → ... → done
|
|
34
|
-
(same context)
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### When to use
|
|
38
|
-
- ✓ Task count < 5
|
|
39
|
-
- ✓ Strong dependencies between tasks (the next must read the previous result)
|
|
40
|
-
- ✓ Debugging scenarios (you want to see the full process)
|
|
41
|
-
- ✓ Simple bug fixes
|
|
42
|
-
- ✓ Phase 0 / Phase 5 (few tasks)
|
|
43
|
-
|
|
44
|
-
### Advantages
|
|
45
|
-
- Full context is visible, debugging-friendly
|
|
46
|
-
- No subagent communication overhead
|
|
47
|
-
- Easy for a human to take over on failure
|
|
48
|
-
|
|
49
|
-
### Disadvantages
|
|
50
|
-
- A long task chain exhausts context
|
|
51
|
-
- Cannot parallelize
|
|
52
|
-
- Quality decay curve (output degrades after 50% context)
|
|
53
|
-
|
|
54
|
-
### Enable
|
|
55
|
-
```bash
|
|
56
|
-
/curdx-flow:implement --strategy=linear
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## Strategy 2: Subagent (isolated context per task)
|
|
62
|
-
|
|
63
|
-
### How it works
|
|
64
|
-
The main agent reads tasks.md and **dispatches a fresh flow-executor subagent per task**. Each subagent has a clean context — it does not inherit the main agent's history.
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
main agent
|
|
68
|
-
├─ Agent() → subagent(task 1) → TASK_COMPLETE
|
|
69
|
-
├─ Agent() → subagent(task 2) → TASK_COMPLETE
|
|
70
|
-
└─ ...
|
|
71
|
-
(each subagent has isolated context)
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### When to use
|
|
75
|
-
- ✓ Task count > 10
|
|
76
|
-
- ✓ Quality-first (every task must be high-quality, avoid context pollution)
|
|
77
|
-
- ✓ Moderate task size (2-15 minutes)
|
|
78
|
-
- ✓ Tasks relatively independent, no complex shared context needed
|
|
79
|
-
- ✓ Stable per-task quality matters more than dispatch overhead
|
|
80
|
-
|
|
81
|
-
### Advantages
|
|
82
|
-
- Each subagent uses at most ~30% context → stable quality
|
|
83
|
-
- Debugging a failed task doesn't pollute the main agent
|
|
84
|
-
- Composable: subagents share files (tasks.md / .progress.md)
|
|
85
|
-
|
|
86
|
-
### Disadvantages
|
|
87
|
-
- Dispatch overhead (each subagent reloads context)
|
|
88
|
-
- Cross-task info sharing goes through files (.progress.md)
|
|
89
|
-
- Not parallel (a single Agent call is serial)
|
|
90
|
-
|
|
91
|
-
### Enable
|
|
92
|
-
```bash
|
|
93
|
-
/curdx-flow:implement --strategy=subagent
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
Or (default):
|
|
97
|
-
```bash
|
|
98
|
-
/curdx-flow:implement # auto routing picks subagent
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## Strategy 3: Stop-Hook (auto-loop)
|
|
104
|
-
|
|
105
|
-
### How it works
|
|
106
|
-
- Main agent executes 1 task → ends naturally (Stop event)
|
|
107
|
-
- `stop-watcher.sh` hook fires
|
|
108
|
-
- Checks whether `.state.json` still has unfinished tasks
|
|
109
|
-
- Cross-checks `tasks.md`; completion requires zero unchecked tasks as well as completed state
|
|
110
|
-
- Allows stop when Claude Code reports `stop_hook_active=true` to avoid recursive stop-hook loops
|
|
111
|
-
- If yes, it outputs `{"decision": "block", "reason": "continue task N"}`
|
|
112
|
-
- Claude Code treats `decision=block` as "issue another response round", and the main agent automatically continues with the next task
|
|
113
|
-
- Repeats until `TASK_FAILED` or `ALL_TASKS_COMPLETE`
|
|
114
|
-
|
|
115
|
-
```
|
|
116
|
-
main agent → task N → Stop → stop-watcher.sh
|
|
117
|
-
↓
|
|
118
|
-
still tasks? → "block, continue task N+1"
|
|
119
|
-
→ main agent continues (new round)
|
|
120
|
-
↓
|
|
121
|
-
no tasks? → allow stop
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
Safety invariant: `ALL_TASKS_COMPLETE` is advisory, not authoritative. If `tasks.md` still has unchecked tasks, the hook blocks and tells the agent to continue those tasks instead of advancing to verify.
|
|
125
|
-
|
|
126
|
-
### When to use
|
|
127
|
-
- ✓ Long task chains (20+)
|
|
128
|
-
- ✓ Unattended execution (overnight automation)
|
|
129
|
-
- ✓ You don't want to trigger each step manually
|
|
130
|
-
- ✓ Long-running sequential work with checkpointed continuation
|
|
131
|
-
|
|
132
|
-
### Advantages
|
|
133
|
-
- Truly autonomous execution — the user can walk away
|
|
134
|
-
- Each "round" session has an independent context (auto-cleaned)
|
|
135
|
-
- On failure the hook can halt the loop, preventing infinite failure
|
|
136
|
-
|
|
137
|
-
### Disadvantages
|
|
138
|
-
- Each round reloads context (.progress.md, tasks.md)
|
|
139
|
-
- Needs `quick-mode-guard` to disable AskUserQuestion (otherwise it stalls)
|
|
140
|
-
- Harder to debug (Stop events are asynchronous)
|
|
141
|
-
|
|
142
|
-
### Enable
|
|
143
|
-
```bash
|
|
144
|
-
/curdx-flow:implement --strategy=stop-hook --quick
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
`--quick` is the recommended pairing, otherwise the agent will ask on ambiguities and the loop will stall.
|
|
148
|
-
|
|
149
|
-
---
|
|
150
|
-
|
|
151
|
-
## Strategy 4: Wave (DAG parallel)
|
|
152
|
-
|
|
153
|
-
### How it works
|
|
154
|
-
- Tasks in tasks.md marked `[P]` are "parallel-safe"
|
|
155
|
-
- The main agent identifies consecutive `[P]` tasks as one wave
|
|
156
|
-
- **In a single message**, it dispatches multiple Agent() tool calls simultaneously
|
|
157
|
-
- All tasks within a wave run in parallel
|
|
158
|
-
- Waves run serially relative to each other
|
|
159
|
-
|
|
160
|
-
```
|
|
161
|
-
main agent
|
|
162
|
-
├─ Wave 1: [P] task1, [P] task2, [P] task3 ← parallel
|
|
163
|
-
├─ Wave 2: [VERIFY] task4 ← serial checkpoint
|
|
164
|
-
├─ Wave 3: [P] task5, [P] task6 ← parallel again
|
|
165
|
-
└─ ...
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### When to use
|
|
169
|
-
- ✓ Many `[P]` markers in tasks.md
|
|
170
|
-
- ✓ Tasks are independent (different files, different components)
|
|
171
|
-
- ✓ Time-pressured (parallelism is faster)
|
|
172
|
-
- ✓ Parallel-safe delivery work
|
|
173
|
-
|
|
174
|
-
### Advantages
|
|
175
|
-
- Wall-clock time greatly reduced (N parallel tasks at once)
|
|
176
|
-
- DAG analysis makes dependencies explicit
|
|
177
|
-
- Precise failure localization (which task in which wave)
|
|
178
|
-
|
|
179
|
-
### Disadvantages
|
|
180
|
-
- Parallel conflict risk (e.g., two tasks editing the same file)
|
|
181
|
-
- Requires flow-planner to have tagged `[P]` (Phase 1-generated tasks.md should)
|
|
182
|
-
- Main agent manages many Agent calls, high context pressure
|
|
183
|
-
|
|
184
|
-
### Enable
|
|
185
|
-
```bash
|
|
186
|
-
/curdx-flow:implement --strategy=wave
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### Parallel-safety rules
|
|
190
|
-
`[P]` tasks must:
|
|
191
|
-
- Not edit the same file
|
|
192
|
-
- Not read output of another `[P]` task
|
|
193
|
-
- `[VERIFY]` checkpoints break the parallel group
|
|
194
|
-
- `[SEQUENTIAL]` forces serial execution (overrides `[P]`)
|
|
195
|
-
|
|
196
|
-
---
|
|
197
|
-
|
|
198
|
-
## Strategy 5 (default): Auto
|
|
199
|
-
|
|
200
|
-
### Decision tree
|
|
201
|
-
|
|
202
|
-
```python
|
|
203
|
-
if args.strategy:
|
|
204
|
-
return args.strategy
|
|
205
|
-
|
|
206
|
-
if majority "[SEQUENTIAL]" or strong task dependencies:
|
|
207
|
-
return "linear"
|
|
208
|
-
|
|
209
|
-
if "[P]" markers >= 40% of tasks:
|
|
210
|
-
return "wave"
|
|
211
|
-
|
|
212
|
-
if task count >= 20 and user requests unattended:
|
|
213
|
-
return "stop-hook"
|
|
214
|
-
|
|
215
|
-
if task count >= 8:
|
|
216
|
-
return "subagent"
|
|
217
|
-
|
|
218
|
-
return "linear"
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
### Configuration
|
|
222
|
-
`.flow/config.json`'s `execution.strategy` can override the default:
|
|
223
|
-
- `"auto"` — use the decision tree above (default)
|
|
224
|
-
- Other concrete strategies
|
|
225
|
-
|
|
226
|
-
Execution failure recovery is explicit:
|
|
227
|
-
- `recovery_mode: "manual"` — default; never skip a failed task, retry from the first unchecked task after root-cause analysis.
|
|
228
|
-
- `recovery_mode: "fix-task"` — insert a targeted `[FIX <task_id>]` task before retrying the original failure.
|
|
229
|
-
- `max_fix_tasks_per_original` — hard ceiling for generated fix tasks per original task.
|
|
230
|
-
|
|
231
|
-
---
|
|
232
|
-
|
|
233
|
-
## Failure Handling (common to all strategies)
|
|
234
|
-
|
|
235
|
-
`flow-executor` agent's retry ladder — each step escalates only when the prior is honestly exhausted, not on a fixed count:
|
|
236
|
-
|
|
237
|
-
```
|
|
238
|
-
Step A: autonomous retry (edit + rerun Verify) — only for shallow failures
|
|
239
|
-
Step B: sequential-thinking root-cause analysis proportional to the hypothesis space
|
|
240
|
-
Step C: read related source + trace data flow
|
|
241
|
-
Step D: if ≥3 retries fail with no new hypothesis, stop and challenge the architecture (see preamble L3)
|
|
242
|
-
Step E: report TASK_FAILED
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
If fix-task recovery is enabled, the coordinator turns a `TASK_FAILED` into a ledgered repair task before doing more work:
|
|
246
|
-
|
|
247
|
-
```markdown
|
|
248
|
-
- [ ] **<task_id>.<n>** [FIX <task_id>] Fix: <root cause>
|
|
249
|
-
- **Do**: <repair steps>
|
|
250
|
-
- **Files**: <same files as the original task or narrower>
|
|
251
|
-
- **Done when**: Original failure no longer reproduces
|
|
252
|
-
- **Verify**: <original verify command or tighter reproduction>
|
|
253
|
-
- **Commit**: `fix(<scope>): address <failure>`
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
The fix task must be written to `tasks.md` and tracked in `.state.json` `execute_state.fix_task_map` before it is executed. Executors do not invent and execute recovery work in the same turn.
|
|
257
|
-
|
|
258
|
-
### Extra protections for Stop-Hook strategy
|
|
259
|
-
- 3 consecutive TASK_FAILED → stop-watcher.sh halts the loop
|
|
260
|
-
- 10 consecutive Stop triggers with no progress → halt (anti-deadlock)
|
|
261
|
-
- A single spec exceeding 100 rounds → force halt (requires user check)
|
|
262
|
-
|
|
263
|
-
### Subagent strategy
|
|
264
|
-
- Each subagent at most 30 turns (beyond flow-executor's maxTurns)
|
|
265
|
-
- Timed-out subagents get marked failed by the main agent, which moves on (or halts, depending on strategy)
|
|
266
|
-
|
|
267
|
-
---
|
|
268
|
-
|
|
269
|
-
## Switching Strategies
|
|
270
|
-
|
|
271
|
-
Can you switch strategies mid-execution? Not recommended.
|
|
272
|
-
|
|
273
|
-
- Linear → Subagent: wastes existing context, better to stay linear
|
|
274
|
-
- Subagent → Stop-Hook: needs to clean `execute_state`, messy
|
|
275
|
-
- Any → Wave: needs `[P]` markers in tasks.md
|
|
276
|
-
|
|
277
|
-
If you really must switch, do it manually:
|
|
278
|
-
1. `npx @curdx/flow doctor` to check status
|
|
279
|
-
2. Manually edit `.flow/specs/<name>/.state.json`'s `strategy` field
|
|
280
|
-
3. Rerun `/curdx-flow:implement`
|
|
281
|
-
|
|
282
|
-
---
|
|
283
|
-
|
|
284
|
-
## Monitoring and Interruption
|
|
285
|
-
|
|
286
|
-
### View progress
|
|
287
|
-
```bash
|
|
288
|
-
/curdx-flow:start --list # global
|
|
289
|
-
# For single-spec details, inspect .flow/specs/<name>/.progress.md
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
### Interrupt
|
|
293
|
-
- `Ctrl+C` interrupts the current session → Stop event triggers, state is saved
|
|
294
|
-
- Next `/curdx-flow:start <name>` (or `/curdx-flow:start --resume`) resumes from `task_index`
|
|
295
|
-
|
|
296
|
-
### Snapshots
|
|
297
|
-
Claude Code checkpoints plus `.flow/specs/<name>/.progress.md` are the current recovery surface. Use `/curdx-flow:status` to inspect recoverability.
|
|
298
|
-
|
|
299
|
-
---
|
|
300
|
-
|
|
301
|
-
This document defines CurDX-Flow's shipped strategy semantics: stop-hook for
|
|
302
|
-
checkpointed continuation, subagent for serial isolated execution, and wave for
|
|
303
|
-
parallel batches.
|