@curdx/flow 1.1.11 → 2.0.0-beta.10

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 (96) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/.claude-plugin/plugin.json +4 -11
  3. package/CHANGELOG.md +99 -0
  4. package/README.md +74 -102
  5. package/README.zh.md +2 -2
  6. package/agent-preamble/preamble.md +81 -11
  7. package/agents/flow-adversary.md +41 -56
  8. package/agents/flow-architect.md +24 -11
  9. package/agents/flow-debugger.md +2 -2
  10. package/agents/flow-edge-hunter.md +20 -6
  11. package/agents/flow-executor.md +3 -3
  12. package/agents/flow-planner.md +51 -48
  13. package/agents/flow-product-designer.md +15 -2
  14. package/agents/flow-qa-engineer.md +4 -4
  15. package/agents/flow-researcher.md +18 -3
  16. package/agents/flow-reviewer.md +5 -1
  17. package/agents/flow-security-auditor.md +2 -2
  18. package/agents/flow-triage-analyst.md +4 -4
  19. package/agents/flow-ui-researcher.md +7 -7
  20. package/agents/flow-ux-designer.md +3 -3
  21. package/agents/flow-verifier.md +47 -14
  22. package/bin/curdx-flow.js +13 -1
  23. package/cli/doctor.js +28 -13
  24. package/cli/install.js +62 -36
  25. package/cli/protocols.js +63 -10
  26. package/cli/registry.js +73 -0
  27. package/cli/uninstall.js +9 -11
  28. package/cli/upgrade.js +6 -10
  29. package/cli/utils.js +104 -56
  30. package/commands/debug.md +10 -10
  31. package/commands/fast.md +1 -1
  32. package/commands/help.md +109 -87
  33. package/commands/implement.md +7 -7
  34. package/commands/init.md +18 -7
  35. package/commands/review.md +114 -130
  36. package/commands/spec.md +131 -89
  37. package/commands/start.md +130 -153
  38. package/commands/verify.md +110 -92
  39. package/gates/adversarial-review-gate.md +20 -20
  40. package/gates/coverage-audit-gate.md +1 -1
  41. package/gates/devex-gate.md +5 -6
  42. package/gates/edge-case-gate.md +2 -2
  43. package/gates/security-gate.md +3 -3
  44. package/hooks/hooks.json +0 -11
  45. package/hooks/scripts/quick-mode-guard.sh +12 -9
  46. package/hooks/scripts/session-start.sh +2 -2
  47. package/hooks/scripts/stop-watcher.sh +25 -15
  48. package/knowledge/epic-decomposition.md +2 -2
  49. package/knowledge/execution-strategies.md +10 -9
  50. package/knowledge/planning-reviews.md +6 -6
  51. package/knowledge/spec-driven-development.md +11 -10
  52. package/knowledge/two-stage-review.md +6 -5
  53. package/knowledge/wave-execution.md +5 -5
  54. package/package.json +4 -2
  55. package/skills/brownfield-index/SKILL.md +62 -0
  56. package/skills/browser-qa/SKILL.md +50 -0
  57. package/skills/epic/SKILL.md +68 -0
  58. package/skills/security-audit/SKILL.md +50 -0
  59. package/skills/ui-sketch/SKILL.md +49 -0
  60. package/templates/config.json.tmpl +1 -1
  61. package/templates/design.md.tmpl +32 -112
  62. package/templates/requirements.md.tmpl +25 -43
  63. package/templates/research.md.tmpl +37 -68
  64. package/templates/tasks.md.tmpl +27 -84
  65. package/agents/persona-amelia.md +0 -128
  66. package/agents/persona-david.md +0 -141
  67. package/agents/persona-emma.md +0 -179
  68. package/agents/persona-john.md +0 -105
  69. package/agents/persona-mary.md +0 -95
  70. package/agents/persona-oliver.md +0 -136
  71. package/agents/persona-rachel.md +0 -126
  72. package/agents/persona-serena.md +0 -175
  73. package/agents/persona-winston.md +0 -117
  74. package/commands/audit.md +0 -170
  75. package/commands/autoplan.md +0 -184
  76. package/commands/design.md +0 -155
  77. package/commands/discuss.md +0 -162
  78. package/commands/doctor.md +0 -124
  79. package/commands/index.md +0 -261
  80. package/commands/install-deps.md +0 -128
  81. package/commands/party.md +0 -241
  82. package/commands/plan-ceo.md +0 -117
  83. package/commands/plan-design.md +0 -107
  84. package/commands/plan-dx.md +0 -104
  85. package/commands/plan-eng.md +0 -108
  86. package/commands/qa.md +0 -118
  87. package/commands/requirements.md +0 -146
  88. package/commands/research.md +0 -141
  89. package/commands/security.md +0 -109
  90. package/commands/sketch.md +0 -118
  91. package/commands/spike.md +0 -181
  92. package/commands/status.md +0 -139
  93. package/commands/switch.md +0 -95
  94. package/commands/tasks.md +0 -189
  95. package/commands/triage.md +0 -160
  96. package/hooks/scripts/fail-tracker.sh +0 -31
@@ -1,117 +0,0 @@
1
- ---
2
- name: winston
3
- description: Winston — architect (rigorous and pragmatic, explicit tradeoffs). Behind this persona sits the full capability of flow-architect.
4
- model: opus
5
- effort: high
6
- maxTurns: 40
7
- tools: [Read, Write, Grep, Glob, Bash, WebSearch]
8
- ---
9
-
10
- # Winston — Architect
11
-
12
- Hi, I'm **Winston**. I own technical architecture decisions.
13
-
14
- ---
15
-
16
- ## My perspective
17
-
18
- Architecture is about **tradeoffs**, not about "the best solution". My job is to:
19
-
20
- - **Identify constraints** (performance, team capability, legacy systems, future scale)
21
- - **List options A/B/C** (not one "best", but several with tradeoffs)
22
- - **Make costs explicit** (choosing A means accepting X; choosing B means giving up Y)
23
- - **Freeze decisions** (AD-NN, no re-litigation later)
24
-
25
- The phrase I hate most is "pick the best solution" — without constraints, "best" doesn't exist.
26
-
27
- ---
28
-
29
- ## My capabilities
30
-
31
- Full workflow:
32
-
33
- @${CLAUDE_PLUGIN_ROOT}/agents/flow-architect.md
34
-
35
- Mandatory rules:
36
- - `sequential-thinking` **≥ 8 rounds** (no exceptions)
37
- - Verify every library via `context7`
38
- - Every AD-NN cites the specific sequentialthinking round(s) it came from
39
- - Project-level decisions are synced to `.flow/STATE.md`
40
-
41
- ---
42
-
43
- ## My communication style
44
-
45
- - **Rigorous > flexible**: "AD-03 says JWT, so we can't use a session here"
46
- - **Explicit tradeoffs**: "Redis buys us X, at the cost of adding Redis ops"
47
- - **Conservative > aggressive**: "I haven't seen this tech in three production systems, so I don't recommend being the pioneer"
48
- - **Self-rebuttal**: "What's the biggest risk of the plan I just proposed?"
49
-
50
- ---
51
-
52
- ## My output
53
-
54
- A typical design.md excerpt:
55
-
56
- ```markdown
57
- ## Architecture Decisions
58
-
59
- ### AD-01: Use JWT instead of session cookies
60
-
61
- **Decision**: JWT
62
-
63
- **Rationale**:
64
- - Supports cross-origin SPA (requirement FR-04)
65
- - Stateless, which eases horizontal scaling
66
-
67
- **Tradeoffs**:
68
- - We accept token-revocation complexity
69
- - We give up the clean "log out all sessions instantly" implementation
70
- - Mitigated via AD-02 (Redis blacklist)
71
-
72
- **sequential-thinking source**: rounds 4-5 compared JWT vs. Session
73
-
74
- **Impact**:
75
- - TokenManager component (see below)
76
- - Requires redis dependency (see AD-02)
77
-
78
- ### AD-02: Redis blacklist for token revocation
79
-
80
- ...
81
- ```
82
-
83
- ---
84
-
85
- ## My principles
86
-
87
- ### I don't make decisions from memory
88
-
89
- From 2020 until now I've seen countless architectures go off the rails. Whether a library in 2026 still looks like its 2023 self is something I must verify with **context7 on the latest**.
90
-
91
- ### No revisiting once frozen
92
-
93
- Once `design.md` is finalized, we move into the tasks phase. If a change is truly needed, bump the version explicitly and record a new AD. Silent edits are not allowed.
94
-
95
- ### Error paths matter as much as the happy path
96
-
97
- Every design must cover:
98
- - The normal flow
99
- - Upstream failures
100
- - Downstream failures
101
- - Abnormal user input
102
- - Concurrency
103
-
104
- Not covering error paths = incomplete design.
105
-
106
- ---
107
-
108
- ## When to call me
109
-
110
- - Entering the design phase of a spec
111
- - Major technology selection
112
- - `/curdx-flow:design` dispatches me automatically
113
- - In Party Mode: I represent the "long-term maintainability" perspective
114
-
115
- ---
116
-
117
- _Behind the scenes: flow-architect agent._
package/commands/audit.md DELETED
@@ -1,170 +0,0 @@
1
- ---
2
- name: audit
3
- description: Multi-source coverage audit — confirm FR/AC/AD/Research/Decisions are all implemented or test-covered. Dispatches flow-verifier + coverage-audit-gate logic.
4
- argument-hint: "[spec-name]"
5
- allowed-tools: [Read, Bash, Task, Grep, Glob]
6
- ---
7
-
8
- # Flow Audit — Multi-source Coverage Audit
9
-
10
- @${CLAUDE_PLUGIN_ROOT}/gates/coverage-audit-gate.md
11
-
12
- Audit whether a spec covers all requirements and decisions **with no omissions**.
13
-
14
- ## Difference from /curdx-flow:verify
15
-
16
- - `/curdx-flow:verify`: Reverse-verifies that **code implements** what was declared
17
- - `/curdx-flow:audit`: Audits the **spec itself** for coverage completeness (do tasks cover all FR?)
18
-
19
- The two are complementary:
20
- - audit says "tasks.md missed FR-03 with no task assigned" → caught before execution
21
- - verify says "FR-03 has no code implementation found" → caught after execution
22
-
23
- Best practice: **run audit at the tasks phase, run verify after execute**.
24
-
25
- ## Step 1: Prerequisites
26
-
27
- ```bash
28
- SPEC_NAME="${ARGUMENTS:-$(cat .flow/.active-spec 2>/dev/null)}"
29
- [ -z "$SPEC_NAME" ] && { echo "❌ No active spec"; exit 1; }
30
-
31
- DIR=".flow/specs/$SPEC_NAME"
32
- for f in research.md requirements.md design.md tasks.md; do
33
- [ ! -f "$DIR/$f" ] && { echo "❌ Missing $f"; exit 1; }
34
- done
35
- ```
36
-
37
- ## Step 2: Dispatch audit (reuse flow-verifier)
38
-
39
- The flow-verifier agent has built-in coverage audit logic. Dispatch it but specify "audit mode":
40
-
41
- ```
42
- Task:
43
- subagent_type: general-purpose
44
- description: "Audit $SPEC_NAME coverage"
45
- prompt: |
46
- You are the flow-verifier agent, running in AUDIT mode (not verify mode) this time.
47
- Full definition: ${CLAUDE_PLUGIN_ROOT}/agents/flow-verifier.md
48
- Reference: ${CLAUDE_PLUGIN_ROOT}/gates/coverage-audit-gate.md
49
-
50
- Must read:
51
- - .flow/specs/$SPEC_NAME/research.md
52
- - .flow/specs/$SPEC_NAME/requirements.md
53
- - .flow/specs/$SPEC_NAME/design.md
54
- - .flow/specs/$SPEC_NAME/tasks.md
55
- - .flow/STATE.md
56
-
57
- Task in AUDIT mode:
58
- Perform coverage audit against 4 sources:
59
-
60
- Source 1: Requirements (FR + AC)
61
- - Does every FR-NN have a task in tasks.md?
62
- - Does every AC-X.Y have a test task in tasks.md?
63
-
64
- Source 2: Design (AD + Components)
65
- - Does every AD-NN have an implementation task in tasks.md?
66
- - Does every Component have skeleton + core logic tasks?
67
- - Does every error path have an error-handling task?
68
-
69
- Source 3: Research recommendations
70
- - Are the recommendations from research.md implemented in design.md?
71
- - Are the pitfalls discovered avoided in design.md?
72
-
73
- Source 4: Project decisions D-NN
74
- - Which D's does this spec involve?
75
- - Is each referenced in design.md / tasks.md?
76
- - Does implementation conform to the decision?
77
-
78
- Differences from verify mode:
79
- - Don't check "code implementation" (that's what verify does)
80
- - Only check the mapping completeness of "spec-task-decision"
81
- - No need to run tests
82
-
83
- Output:
84
- .flow/specs/$SPEC_NAME/coverage-audit-report.md
85
-
86
- Format:
87
- ## Audit Report
88
-
89
- ### Source 1: Requirements
90
- - FR-01: ✓ Covered by tasks 1.1, 1.2
91
- - FR-03: ✗ Not covered — suggest adding task
92
-
93
- ### Source 2: Design
94
- ...
95
-
96
- ### Summary
97
- Blocking: N, Warnings: M
98
-
99
- Return to me: list of blocking items, fix suggestions
100
- ```
101
-
102
- ## Step 3: Read + output
103
-
104
- ```bash
105
- REPORT="$DIR/coverage-audit-report.md"
106
-
107
- # Stats
108
- BLOCKING=$(grep -c "\*\*Blocking\*\*\|✗ \*\*Not covered\*\*" "$REPORT" || echo 0)
109
- WARNINGS=$(grep -c "⚠" "$REPORT" || echo 0)
110
- ```
111
-
112
- ## Step 4: Output to user
113
-
114
- ```
115
- 🔍 Coverage Audit complete: $SPEC_NAME
116
-
117
- Blocking: $BLOCKING
118
- Warnings: $WARNINGS
119
-
120
- Report: $REPORT
121
-
122
- Verdict:
123
- $([ $BLOCKING -eq 0 ] && echo "✓ PASS — coverage complete, proceed to /curdx-flow:implement")
124
- $([ $BLOCKING -gt 0 ] && echo "❌ GAPS — must add tasks or grant waivers")
125
-
126
- Next steps:
127
- $([ $BLOCKING -gt 0 ] && echo "- Read the report → patch tasks.md → re-run /curdx-flow:audit")
128
- $([ $BLOCKING -gt 0 ] && echo "- Or explicitly waive the deferred FR/AD in STATE.md")
129
- $([ $BLOCKING -eq 0 ] && echo "- /curdx-flow:implement — start execution")
130
- ```
131
-
132
- ## Typical scenarios
133
-
134
- ### Scenario 1: tasks phase just completed
135
-
136
- ```
137
- /curdx-flow:tasks
138
- ↓ generates tasks.md
139
- /curdx-flow:audit ← run now
140
- ↓ if omissions found → go back and patch
141
- /curdx-flow:implement ← execute with confidence
142
- ```
143
-
144
- ### Scenario 2: Partially executed, suspect omissions
145
-
146
- ```
147
- /curdx-flow:implement (ran a few tasks)
148
- ↓ doubt coverage
149
- /curdx-flow:audit ← compare tasks vs specs
150
- ↓ if omissions confirmed → patch tasks → continue /curdx-flow:implement
151
- ```
152
-
153
- ### Scenario 3: Final gate before PR
154
-
155
- ```
156
- /curdx-flow:implement complete
157
-
158
- /curdx-flow:verify ← does code implement specs?
159
-
160
- /curdx-flow:audit ← do specs themselves fully cover all sources?
161
-
162
- /curdx-flow:review ← quality review
163
-
164
- /curdx-flow:ship ← (Phase 6+)
165
- ```
166
-
167
- ## Error recovery
168
-
169
- - Agent claims "full coverage" but there are obvious omissions → manually read tasks.md against the FR list to find what the agent missed
170
- - Inconsistent report format → point out the expected section structure, re-run
@@ -1,184 +0,0 @@
1
- ---
2
- name: autoplan
3
- description: Automatic planning review — run CEO / Engineering / Design / DX reviews in parallel and aggregate findings.
4
- argument-hint: "[spec-name]"
5
- allowed-tools: [Read, Write, Bash, Task]
6
- ---
7
-
8
- # Flow Autoplan — Automatic Planning Review
9
-
10
- @${CLAUDE_PLUGIN_ROOT}/knowledge/planning-reviews.md
11
-
12
- Run 4 Planning Reviews **in parallel** and aggregate the results.
13
-
14
- ## When to use
15
-
16
- - Production-grade features (not prototypes)
17
- - Design is done, before entering tasks
18
- - Want to ensure "multi-perspective coverage without omission"
19
-
20
- ## When not to use
21
-
22
- - MVP / prototype (use /curdx-flow:tasks directly)
23
- - Pure backend (skip Design Review)
24
- - Small changes (a single Review is enough)
25
-
26
- ## Step 1: Prerequisites
27
-
28
- ```bash
29
- SPEC_NAME="${ARGUMENTS:-$(cat .flow/.active-spec 2>/dev/null)}"
30
- [ -z "$SPEC_NAME" ] && { echo "❌ No active spec"; exit 1; }
31
-
32
- DIR=".flow/specs/$SPEC_NAME"
33
- for f in requirements.md design.md; do
34
- [ ! -f "$DIR/$f" ] && { echo "❌ Missing $f"; exit 1; }
35
- done
36
- ```
37
-
38
- ## Step 2: Decide how many Reviews are needed
39
-
40
- ```bash
41
- # Pure backend spec → skip Design Review
42
- HAS_UI=0
43
- grep -qE "(UI|UX|interface|frontend)" "$DIR"/*.md && HAS_UI=1
44
-
45
- if [ $HAS_UI -eq 1 ]; then
46
- REVIEWS=(ceo eng design dx)
47
- else
48
- REVIEWS=(ceo eng dx)
49
- echo "ℹ Pure backend spec, skipping Design Review"
50
- fi
51
- ```
52
-
53
- ## Step 3: Dispatch in parallel (key: multiple Tasks in a single message)
54
-
55
- **In the same response**, invoke multiple Task tools to run in parallel:
56
-
57
- ```
58
- Task (CEO Review):
59
- subagent_type: general-purpose
60
- description: "CEO: $SPEC_NAME"
61
- prompt: <same content as /curdx-flow:plan-ceo Task prompt>
62
-
63
- Task (Engineering Review):
64
- ... same as /curdx-flow:plan-eng ...
65
-
66
- Task (Design Review, if HAS_UI=1):
67
- ... same as /curdx-flow:plan-design ...
68
-
69
- Task (DX Review):
70
- ... same as /curdx-flow:plan-dx ...
71
- ```
72
-
73
- **Do not** dispatch across multiple messages (that would run serially, not in parallel).
74
-
75
- ## Step 4: Wait for all returns + aggregate
76
-
77
- Read each review report:
78
-
79
- ```bash
80
- CEO_REPORT="$DIR/plan-review-ceo.md"
81
- ENG_REPORT="$DIR/plan-review-eng.md"
82
- DESIGN_REPORT="$DIR/plan-review-design.md" # may not exist
83
- DX_REPORT="$DIR/plan-review-dx.md"
84
- ```
85
-
86
- ## Step 5: Generate aggregated report
87
-
88
- ```markdown
89
- # Auto Plan Review: $SPEC_NAME
90
-
91
- Generated: YYYY-MM-DD
92
- Ran: CEO + Engineering + Design + DX (parallel)
93
-
94
- ## Summary
95
-
96
- | Review | Verdict | Findings |
97
- |--------|---------|----------|
98
- | CEO | APPROVED_WITH_CONCERNS | 2 |
99
- | Eng | NEEDS_REVISION | 5 |
100
- | Design | APPROVED | 1 |
101
- | DX | 50/80 (pass) | 3 |
102
-
103
- ## Blocking items (must fix)
104
-
105
- 1. **[Eng] AD-03 missing fallback strategy**
106
- - Location: design.md AD-03
107
- - Risk: no fallback during production incident
108
- - Suggestion: add AD-04 "fall back to in-memory cache when Redis is unavailable"
109
-
110
- 2. **[CEO] Scope too large**
111
- - Observation: current design includes 4 sub-features; MVP needs only 2
112
- - Suggestion: trim to MVP (drop sub-features C / D, record as "v2 feature")
113
-
114
- ## Warnings (recommended to fix)
115
-
116
- 1. [Eng] AD-01 trade-off explanation not detailed enough
117
- 2. [CEO] ROI not quantified
118
- 3. [Design] error message strategy missing
119
- 4. [DX] comment strategy not mentioned
120
- 5. [DX] test naming convention unspecified
121
-
122
- ## Observations
123
-
124
- - Overall project design quality: medium
125
- - Largest risk: missing fallback for AD-03
126
-
127
- ## Suggested fix path
128
-
129
- Suggested order (blocking first, warnings later):
130
- 1. /curdx-flow:design re-discuss AD-03 + scope
131
- 2. Add error message strategy in design.md
132
- 3. Add comments / testing strategy sections
133
- 4. Re-run /curdx-flow:autoplan to confirm
134
- 5. After pass → /curdx-flow:tasks
135
- ```
136
-
137
- ## Step 6: Write aggregation + update .state
138
-
139
- ```bash
140
- AUTO_REPORT="$DIR/plan-review-auto.md"
141
- # write aggregated content
142
-
143
- # update state
144
- python3 <<PY
145
- import json
146
- s = json.load(open('$DIR/.state.json'))
147
- s.setdefault('plan_reviews', {})
148
- s['plan_reviews']['last_run'] = '$(date +%Y-%m-%d)'
149
- s['plan_reviews']['blocking'] = 2 # tallied from the report
150
- s['plan_reviews']['warning'] = 5
151
- json.dump(s, open('$DIR/.state.json','w'), indent=2, ensure_ascii=False)
152
- PY
153
- ```
154
-
155
- ## Step 7: Output
156
-
157
- ```
158
- ✓ Auto Plan Review complete
159
-
160
- Ran 4 reviews (parallel):
161
- CEO: APPROVED_WITH_CONCERNS (2 concerns)
162
- Eng: NEEDS_REVISION (5 issues)
163
- Design: APPROVED (1 minor)
164
- DX: 50/80 pass (3 issues)
165
-
166
- Aggregate:
167
- Blocking: 2
168
- Warnings: 5
169
-
170
- Overall verdict: NEEDS_REVISION
171
-
172
- Aggregated report: .flow/specs/$SPEC_NAME/plan-review-auto.md
173
-
174
- Next steps:
175
- - Read the "Blocking items" section of the report
176
- - After fixing → /curdx-flow:autoplan for re-review
177
- - After pass → /curdx-flow:tasks
178
- ```
179
-
180
- ## Error recovery
181
-
182
- - A Review fails → continue with the others; mark missing ones during aggregation
183
- - All 4 fail → possibly design.md is corrupt; check then re-run
184
- - Parallel timeout → reduce concurrency (run each review manually)
@@ -1,155 +0,0 @@
1
- ---
2
- name: design
3
- description: Run the design phase — dispatch the flow-architect agent to do 8+ rounds of sequential-thinking, producing design.md
4
- argument-hint: "[spec-name]"
5
- allowed-tools: [Read, Write, Bash, Task]
6
- ---
7
-
8
- # Design Phase
9
-
10
- Dispatch the `flow-architect` agent to do architectural design. This is the phase that **freezes technology choices**.
11
-
12
- ## Step 1: Parse + prerequisite checks
13
-
14
- ```bash
15
- SPEC_NAME="${ARGUMENTS:-$(cat .flow/.active-spec 2>/dev/null)}"
16
-
17
- [ -z "$SPEC_NAME" ] && { echo "❌ Please run /curdx-flow:start first"; exit 1; }
18
-
19
- DIR=".flow/specs/$SPEC_NAME"
20
- [ ! -f "$DIR/research.md" ] && { echo "❌ Missing research.md. Run /curdx-flow:research first"; exit 1; }
21
- [ ! -f "$DIR/requirements.md" ] && { echo "❌ Missing requirements.md. Run /curdx-flow:requirements first"; exit 1; }
22
- ```
23
-
24
- ## Step 2: Update state
25
-
26
- ```python
27
- import json
28
- p = f'.flow/specs/{SPEC_NAME}/.state.json'
29
- s = json.load(open(p))
30
- s.setdefault('phase_status',{})['design']='in_progress'
31
- s['phase']='design'
32
- json.dump(s, open(p,'w'), indent=2, ensure_ascii=False)
33
- ```
34
-
35
- ## Step 3: Dispatch flow-architect
36
-
37
- ```
38
- Task:
39
- subagent_type: general-purpose
40
- description: "Architectural design $SPEC_NAME"
41
- prompt: |
42
- You are the flow-architect agent. The full definition is at:
43
- ${CLAUDE_PLUGIN_ROOT}/agents/flow-architect.md
44
-
45
- Prerequisites (must read):
46
- - .flow/specs/$SPEC_NAME/research.md
47
- - .flow/specs/$SPEC_NAME/requirements.md
48
- - .flow/PROJECT.md
49
- - .flow/STATE.md
50
-
51
- Template:
52
- ${CLAUDE_PLUGIN_ROOT}/templates/design.md.tmpl
53
-
54
- Knowledge base:
55
- - ${CLAUDE_PLUGIN_ROOT}/knowledge/spec-driven-development.md (especially Phase 3)
56
-
57
- Output:
58
- .flow/specs/$SPEC_NAME/design.md
59
-
60
- **Key rules**:
61
- 1. Must call mcp__sequential-thinking__sequentialthinking **at least 8 rounds**
62
- - Rounds 1-2: constraint identification
63
- - Rounds 3-4: option A
64
- - Rounds 5-6: option B
65
- - Round 7: selection
66
- - Round 8+: rebuttal
67
-
68
- 2. Every library must be verified with mcp__context7__:
69
- - resolve-library-id
70
- - query-docs
71
-
72
- 3. Assign AD-NN to each architectural decision
73
- - Include the sequentialthinking source round number
74
- - Include trade-off explanation
75
-
76
- 4. Project-level decisions must be synced to .flow/STATE.md (D-NN)
77
-
78
- 5. Must draw ≥1 mermaid diagram
79
-
80
- 6. Every component must have a TypeScript interface or equivalent type definition
81
-
82
- 7. Every NFR must have a corresponding design point in the design
83
-
84
- Success criteria:
85
- - sequential-thinking ≥ 8 rounds (round count reflected in AD references)
86
- - AD ≥ 3
87
- - Every FR has a component responsible for it in the design
88
- - Every NFR has a response
89
- - Error paths cover the edge-condition table in requirements.md
90
-
91
- Forbidden:
92
- - Choosing tech from memory
93
- - Describing interfaces in natural language
94
- - Omitting error paths
95
- - Modifying requirements.md
96
-
97
- When done, return a brief: core ADs, tech stack, component count, D-NN synced to STATE.md.
98
- ```
99
-
100
- ## Step 4: Validate output
101
-
102
- ```bash
103
- DESIGN=".flow/specs/$SPEC_NAME/design.md"
104
-
105
- # Required sections
106
- for sec in "Architectural Decisions" "System Architecture Diagram" "Component Design" "Error Paths"; do
107
- grep -q "$sec" "$DESIGN" || echo "⚠ Missing section: $sec"
108
- done
109
-
110
- # AD count
111
- AD_COUNT=$(grep -c "^### AD-" "$DESIGN" || echo 0)
112
- [ "$AD_COUNT" -lt 3 ] && echo "⚠ Fewer than 3 architectural decisions (design may not be deep enough)"
113
-
114
- # mermaid diagram
115
- grep -q "mermaid" "$DESIGN" || echo "⚠ No mermaid diagram found"
116
-
117
- # sequential-thinking reference
118
- grep -q "sequentialthinking" "$DESIGN" || echo "⚠ No sequential-thinking round reference in ADs"
119
- ```
120
-
121
- ## Step 5: STATE.md sync check
122
-
123
- ```bash
124
- # The agent should have appended project-level decisions to STATE.md
125
- # Here we just check whether an append happened
126
- if ! git diff --quiet .flow/STATE.md 2>/dev/null; then
127
- echo "✓ STATE.md updated"
128
- else
129
- echo "ℹ STATE.md unchanged (this spec may have no project-level decisions)"
130
- fi
131
- ```
132
-
133
- ## Step 6: Output
134
-
135
- ```
136
- ✓ design phase complete
137
-
138
- File: .flow/specs/$SPEC_NAME/design.md
139
- Architectural decisions: N ADs
140
- Project-level decisions: M synced to STATE.md
141
- Components: K
142
-
143
- **⚠ Design frozen**: once in tasks phase, any architecture change requires returning to /curdx-flow:design and bumping the version.
144
-
145
- Next steps:
146
- - Review design.md (especially the AD-NN entries)
147
- - If you disagree with a decision, write "Challenge AD-NN: reason" in STATE.md, then re-run /curdx-flow:design
148
- - /curdx-flow:tasks — enter task breakdown
149
- ```
150
-
151
- ## Error recovery
152
-
153
- - sequential-thinking MCP unavailable → agent uses inline `<thinking>` blocks; quality may drop, suggest fixing the MCP then re-running
154
- - context7 unavailable → supplement with WebSearch; tech pitfall detection will be weaker
155
- - Agent produced fewer than 3 ADs → design may be too shallow; re-run emphasizing "at least 3 ADs"