@curdx/flow 1.1.4 → 1.1.5
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/.claude-plugin/marketplace.json +25 -0
- package/.claude-plugin/plugin.json +43 -0
- package/CHANGELOG.md +279 -0
- package/agent-preamble/preamble.md +214 -0
- package/agents/flow-adversary.md +216 -0
- package/agents/flow-architect.md +190 -0
- package/agents/flow-debugger.md +325 -0
- package/agents/flow-edge-hunter.md +273 -0
- package/agents/flow-executor.md +246 -0
- package/agents/flow-planner.md +204 -0
- package/agents/flow-product-designer.md +146 -0
- package/agents/flow-qa-engineer.md +276 -0
- package/agents/flow-researcher.md +155 -0
- package/agents/flow-reviewer.md +280 -0
- package/agents/flow-security-auditor.md +398 -0
- package/agents/flow-triage-analyst.md +290 -0
- package/agents/flow-ui-researcher.md +227 -0
- package/agents/flow-ux-designer.md +247 -0
- package/agents/flow-verifier.md +283 -0
- package/agents/persona-amelia.md +128 -0
- package/agents/persona-david.md +141 -0
- package/agents/persona-emma.md +179 -0
- package/agents/persona-john.md +105 -0
- package/agents/persona-mary.md +95 -0
- package/agents/persona-oliver.md +136 -0
- package/agents/persona-rachel.md +126 -0
- package/agents/persona-serena.md +175 -0
- package/agents/persona-winston.md +117 -0
- package/bin/curdx-flow.js +5 -2
- package/cli/install.js +44 -5
- package/commands/audit.md +170 -0
- package/commands/autoplan.md +184 -0
- package/commands/debug.md +199 -0
- package/commands/design.md +155 -0
- package/commands/discuss.md +162 -0
- package/commands/doctor.md +124 -0
- package/commands/fast.md +128 -0
- package/commands/help.md +119 -0
- package/commands/implement.md +381 -0
- package/commands/index.md +261 -0
- package/commands/init.md +105 -0
- package/commands/install-deps.md +128 -0
- package/commands/party.md +241 -0
- package/commands/plan-ceo.md +117 -0
- package/commands/plan-design.md +107 -0
- package/commands/plan-dx.md +104 -0
- package/commands/plan-eng.md +108 -0
- package/commands/qa.md +118 -0
- package/commands/requirements.md +146 -0
- package/commands/research.md +141 -0
- package/commands/review.md +168 -0
- package/commands/security.md +109 -0
- package/commands/sketch.md +118 -0
- package/commands/spec.md +135 -0
- package/commands/spike.md +181 -0
- package/commands/start.md +189 -0
- package/commands/status.md +139 -0
- package/commands/switch.md +95 -0
- package/commands/tasks.md +189 -0
- package/commands/triage.md +160 -0
- package/commands/verify.md +124 -0
- package/gates/adversarial-review-gate.md +219 -0
- package/gates/coverage-audit-gate.md +184 -0
- package/gates/devex-gate.md +255 -0
- package/gates/edge-case-gate.md +194 -0
- package/gates/karpathy-gate.md +130 -0
- package/gates/security-gate.md +218 -0
- package/gates/tdd-gate.md +188 -0
- package/gates/verification-gate.md +183 -0
- package/hooks/hooks.json +56 -0
- package/hooks/scripts/fail-tracker.sh +31 -0
- package/hooks/scripts/inject-karpathy.sh +52 -0
- package/hooks/scripts/quick-mode-guard.sh +64 -0
- package/hooks/scripts/session-start.sh +76 -0
- package/hooks/scripts/stop-watcher.sh +166 -0
- package/knowledge/atomic-commits.md +262 -0
- package/knowledge/epic-decomposition.md +307 -0
- package/knowledge/execution-strategies.md +278 -0
- package/knowledge/karpathy-guidelines.md +219 -0
- package/knowledge/planning-reviews.md +211 -0
- package/knowledge/poc-first-workflow.md +227 -0
- package/knowledge/spec-driven-development.md +183 -0
- package/knowledge/systematic-debugging.md +384 -0
- package/knowledge/two-stage-review.md +233 -0
- package/knowledge/wave-execution.md +387 -0
- package/package.json +12 -2
- package/schemas/config.schema.json +100 -0
- package/schemas/spec-frontmatter.schema.json +42 -0
- package/schemas/spec-state.schema.json +117 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plan-dx
|
|
3
|
+
description: DevEx planning review — next maintainer's perspective, 8-dimension evaluation (naming/comments/structure/errors/setup/types/tests/dev loop)
|
|
4
|
+
argument-hint: "[spec-name]"
|
|
5
|
+
allowed-tools: [Read, Write, Bash, Task]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Flow Plan DX — Developer Experience Review
|
|
9
|
+
|
|
10
|
+
@${CLAUDE_PLUGIN_ROOT}/knowledge/planning-reviews.md
|
|
11
|
+
@${CLAUDE_PLUGIN_ROOT}/gates/devex-gate.md
|
|
12
|
+
|
|
13
|
+
Review from the **next maintainer's** perspective: in 6 months, can I or a colleague quickly pick this up?
|
|
14
|
+
|
|
15
|
+
## Step 1: Preflight
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
SPEC_NAME="${ARGUMENTS:-$(cat .flow/.active-spec 2>/dev/null)}"
|
|
19
|
+
[ -z "$SPEC_NAME" ] && { echo "✗ No active spec"; exit 1; }
|
|
20
|
+
[ ! -f ".flow/specs/$SPEC_NAME/design.md" ] && { echo "✗ Missing design.md"; exit 1; }
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Step 2: Dispatch DX Review
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
Task:
|
|
27
|
+
subagent_type: general-purpose
|
|
28
|
+
description: "DX Review: $SPEC_NAME"
|
|
29
|
+
prompt: |
|
|
30
|
+
**DevEx Review Mode**
|
|
31
|
+
|
|
32
|
+
You review design.md on DevEx dimensions. Reuse the flow-reviewer agent:
|
|
33
|
+
${CLAUDE_PLUGIN_ROOT}/agents/flow-reviewer.md
|
|
34
|
+
|
|
35
|
+
Gate definition:
|
|
36
|
+
${CLAUDE_PLUGIN_ROOT}/gates/devex-gate.md
|
|
37
|
+
|
|
38
|
+
Methodology:
|
|
39
|
+
${CLAUDE_PLUGIN_ROOT}/knowledge/planning-reviews.md (Review 4)
|
|
40
|
+
|
|
41
|
+
Review targets:
|
|
42
|
+
- .flow/specs/$SPEC_NAME/design.md
|
|
43
|
+
- Related source code (if design references existing code)
|
|
44
|
+
- .flow/codebase-index.md (if present)
|
|
45
|
+
|
|
46
|
+
8-dimension scoring (0-10 per dimension):
|
|
47
|
+
|
|
48
|
+
DX-01 Naming clarity
|
|
49
|
+
DX-02 Intent comments
|
|
50
|
+
DX-03 File structure
|
|
51
|
+
DX-04 Error messages
|
|
52
|
+
DX-05 Easy setup
|
|
53
|
+
DX-06 Clear types
|
|
54
|
+
DX-07 Tests as docs
|
|
55
|
+
DX-08 Fast dev loop
|
|
56
|
+
|
|
57
|
+
For each dimension:
|
|
58
|
+
- Observe relevant decisions in the design
|
|
59
|
+
- If the design specifically mentions a dimension (e.g., "we use strict TypeScript") → basis for scoring
|
|
60
|
+
- If the design does not mention it (e.g., no word about error-message design) → mark as "missing", score 5
|
|
61
|
+
|
|
62
|
+
Use sequential-thinking ≥ 4 rounds.
|
|
63
|
+
|
|
64
|
+
Output: .flow/specs/$SPEC_NAME/plan-review-dx.md
|
|
65
|
+
|
|
66
|
+
Format:
|
|
67
|
+
# DX Plan Review: $SPEC_NAME
|
|
68
|
+
|
|
69
|
+
## Scores
|
|
70
|
+
DX-01 Naming: 7/10
|
|
71
|
+
DX-02 Comments: 5/10 (not mentioned)
|
|
72
|
+
DX-03 Structure: 8/10
|
|
73
|
+
...
|
|
74
|
+
|
|
75
|
+
Total: N/80
|
|
76
|
+
|
|
77
|
+
## Findings
|
|
78
|
+
|
|
79
|
+
### DX-02 Intent comments
|
|
80
|
+
Observation: the design does not explicitly state a comment strategy
|
|
81
|
+
Risk: the implementer may under-comment
|
|
82
|
+
Recommendation: add a paragraph in the design "key decision points should have why comments"
|
|
83
|
+
|
|
84
|
+
...
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Step 3: Output
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
📐 DX Review complete
|
|
91
|
+
|
|
92
|
+
Total: N/80 ($([ $N -ge 40 ] && echo "pass" || echo "needs improvement"))
|
|
93
|
+
|
|
94
|
+
Weakest dimensions:
|
|
95
|
+
- <dimension 1> N/10
|
|
96
|
+
- <dimension 2> N/10
|
|
97
|
+
|
|
98
|
+
Report: .flow/specs/$SPEC_NAME/plan-review-dx.md
|
|
99
|
+
|
|
100
|
+
Next steps:
|
|
101
|
+
- Add strategies in design.md for low-scoring dimensions
|
|
102
|
+
- Or add "DX checkpoint" tasks in tasks.md
|
|
103
|
+
- Pass → /curdx-flow:tasks (execution breakdown)
|
|
104
|
+
```
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plan-eng
|
|
3
|
+
description: Engineering planning review — architecture lock-in, risk identification, technical debt assessment. Dispatches flow-architect in review mode.
|
|
4
|
+
argument-hint: "[spec-name]"
|
|
5
|
+
allowed-tools: [Read, Write, Bash, Task]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Flow Plan Engineering — Engineering-Layer Review
|
|
9
|
+
|
|
10
|
+
@${CLAUDE_PLUGIN_ROOT}/knowledge/planning-reviews.md
|
|
11
|
+
|
|
12
|
+
Review design.md once more from the **engineer's perspective**: will the architecture work? Is it maintainable long-term?
|
|
13
|
+
|
|
14
|
+
## Step 1: Preflight
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
SPEC_NAME="${ARGUMENTS:-$(cat .flow/.active-spec 2>/dev/null)}"
|
|
18
|
+
[ -z "$SPEC_NAME" ] && { echo "✗ No active spec"; exit 1; }
|
|
19
|
+
[ ! -f ".flow/specs/$SPEC_NAME/design.md" ] && { echo "✗ Missing design.md"; exit 1; }
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Step 2: Dispatch Eng Review
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
Task:
|
|
26
|
+
subagent_type: general-purpose
|
|
27
|
+
description: "Eng Review: $SPEC_NAME"
|
|
28
|
+
prompt: |
|
|
29
|
+
**Engineering Review Mode**
|
|
30
|
+
|
|
31
|
+
You are an independent engineering reviewer. You read design.md to find risks, holes, and unclarities.
|
|
32
|
+
|
|
33
|
+
Full methodology: ${CLAUDE_PLUGIN_ROOT}/knowledge/planning-reviews.md (Review 2)
|
|
34
|
+
|
|
35
|
+
Review targets:
|
|
36
|
+
- .flow/specs/$SPEC_NAME/design.md (main body)
|
|
37
|
+
- .flow/specs/$SPEC_NAME/requirements.md (NFR requirements)
|
|
38
|
+
- .flow/STATE.md (existing decisions)
|
|
39
|
+
|
|
40
|
+
Review checklist:
|
|
41
|
+
|
|
42
|
+
1. Architecture lock-in
|
|
43
|
+
- Does each AD-NN have a tradeoff explanation?
|
|
44
|
+
- Does the rationale reference sequential-thinking rounds?
|
|
45
|
+
- Is there an explicit cost ("we accepted X")?
|
|
46
|
+
|
|
47
|
+
2. Scalability
|
|
48
|
+
- What happens at 10x users / 10x data?
|
|
49
|
+
- Are bottlenecks identified?
|
|
50
|
+
|
|
51
|
+
3. Reasonable dependencies
|
|
52
|
+
- Is the library / service choice justified?
|
|
53
|
+
- Risk of deprecation?
|
|
54
|
+
- Known CVEs / issues?
|
|
55
|
+
|
|
56
|
+
4. Clear data flow
|
|
57
|
+
- Does the mermaid diagram reflect the real flow?
|
|
58
|
+
- Are all component boundaries explicit?
|
|
59
|
+
|
|
60
|
+
5. Error paths
|
|
61
|
+
- Handling of upstream failures?
|
|
62
|
+
- Handling of downstream failures?
|
|
63
|
+
- User input anomalies?
|
|
64
|
+
- Concurrency / retries?
|
|
65
|
+
|
|
66
|
+
6. Test strategy
|
|
67
|
+
- Reasonable unit / integration / E2E ratio?
|
|
68
|
+
- Core scenarios covered?
|
|
69
|
+
|
|
70
|
+
7. Deployment feasibility
|
|
71
|
+
- CI/CD pipeline?
|
|
72
|
+
- Monitoring / alerting?
|
|
73
|
+
- Rollback strategy?
|
|
74
|
+
|
|
75
|
+
Use sequential-thinking ≥ 6 rounds (adversarial-style review; "looks fine" is not accepted).
|
|
76
|
+
Must find ≥ 3 findings.
|
|
77
|
+
|
|
78
|
+
Output: .flow/specs/$SPEC_NAME/plan-review-eng.md
|
|
79
|
+
|
|
80
|
+
Format for each finding:
|
|
81
|
+
### [Category] Issue
|
|
82
|
+
Location: design.md section N / AD-NN
|
|
83
|
+
Observation: what was specifically seen
|
|
84
|
+
Risk: high / medium / low + consequences
|
|
85
|
+
Recommendation: concrete change (command or code snippet)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Step 3: Output
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
⚙ Engineering Review complete
|
|
92
|
+
|
|
93
|
+
Findings:
|
|
94
|
+
High: $HIGH
|
|
95
|
+
Medium: $MED
|
|
96
|
+
Low: $LOW
|
|
97
|
+
|
|
98
|
+
Verdict: <APPROVED / NEEDS_REVISION>
|
|
99
|
+
|
|
100
|
+
Key risks:
|
|
101
|
+
- <top 3>
|
|
102
|
+
|
|
103
|
+
Report: .flow/specs/$SPEC_NAME/plan-review-eng.md
|
|
104
|
+
|
|
105
|
+
Next steps:
|
|
106
|
+
- Fix high/medium → /curdx-flow:design to update (bump version)
|
|
107
|
+
- After pass → /curdx-flow:plan-design or /curdx-flow:tasks
|
|
108
|
+
```
|
package/commands/qa.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qa
|
|
3
|
+
description: Real-browser QA — run user flows with chrome-devtools MCP, capturing bugs / performance / accessibility. Dispatches flow-qa-engineer (Oliver).
|
|
4
|
+
argument-hint: "[spec-name] [--url=<dev-url>]"
|
|
5
|
+
allowed-tools: [Read, Write, Bash, Task, WebFetch]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Flow QA — Real-Browser Testing
|
|
9
|
+
|
|
10
|
+
Dispatches `flow-qa-engineer` (Oliver) to run user flows in real Chrome using **chrome-devtools MCP**.
|
|
11
|
+
|
|
12
|
+
## Step 1: Preflight check
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
[ ! -d ".flow" ] && { echo "✗ Not a CurDX-Flow project"; exit 1; }
|
|
16
|
+
|
|
17
|
+
ARGS="$ARGUMENTS"
|
|
18
|
+
URL=""
|
|
19
|
+
case "$ARGS" in
|
|
20
|
+
*--url=*)
|
|
21
|
+
URL=$(echo "$ARGS" | grep -oE -- '--url=[^[:space:]]+' | cut -d= -f2)
|
|
22
|
+
;;
|
|
23
|
+
esac
|
|
24
|
+
SPEC_NAME=$(echo "$ARGS" | sed 's/--url=[^ ]*//g' | xargs)
|
|
25
|
+
[ -z "$SPEC_NAME" ] && SPEC_NAME=$(cat .flow/.active-spec 2>/dev/null)
|
|
26
|
+
[ -z "$SPEC_NAME" ] && { echo "✗ No active spec"; exit 1; }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Step 2: Detect chrome-devtools MCP
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# If MCP is not up, flow-qa-engineer will fall back to static QA
|
|
33
|
+
# Do not block here; the agent will handle it
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Step 3: Confirm dev server URL
|
|
37
|
+
|
|
38
|
+
If `--url` is not given, ask:
|
|
39
|
+
```
|
|
40
|
+
AskUserQuestion:
|
|
41
|
+
question: "What is your dev server URL?"
|
|
42
|
+
options:
|
|
43
|
+
- http://localhost:3000 (common)
|
|
44
|
+
- http://localhost:5173 (Vite)
|
|
45
|
+
- Other (custom)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Step 4: Dispatch Oliver
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
Task:
|
|
52
|
+
subagent_type: general-purpose
|
|
53
|
+
description: "QA: $SPEC_NAME"
|
|
54
|
+
prompt: |
|
|
55
|
+
You are the flow-qa-engineer agent (Oliver). Full definition:
|
|
56
|
+
${CLAUDE_PLUGIN_ROOT}/agents/flow-qa-engineer.md
|
|
57
|
+
|
|
58
|
+
Target:
|
|
59
|
+
spec_name: $SPEC_NAME
|
|
60
|
+
URL: $URL
|
|
61
|
+
|
|
62
|
+
Prerequisites:
|
|
63
|
+
- .flow/specs/$SPEC_NAME/requirements.md (AC list)
|
|
64
|
+
- .flow/specs/$SPEC_NAME/design.md (error paths + NFR)
|
|
65
|
+
|
|
66
|
+
Workflow:
|
|
67
|
+
1. Detect chrome-devtools MCP (mcp__chrome-devtools__*)
|
|
68
|
+
- Available → real-browser QA
|
|
69
|
+
- Unavailable → static QA, clearly inform the user
|
|
70
|
+
2. Run the happy path (once per AC)
|
|
71
|
+
3. Run edge cases (at least 4 of the 7 categories in edge-case-gate)
|
|
72
|
+
4. Performance trace (LCP / INP / CLS)
|
|
73
|
+
5. Accessibility scan
|
|
74
|
+
6. Save screenshots to .flow/specs/$SPEC_NAME/qa-screenshots/
|
|
75
|
+
7. Generate .flow/specs/$SPEC_NAME/qa-report.md
|
|
76
|
+
|
|
77
|
+
Return to me:
|
|
78
|
+
- Bug count (categorized by severity)
|
|
79
|
+
- Performance data (measured, not estimated)
|
|
80
|
+
- Accessibility warnings
|
|
81
|
+
- Recommended next steps
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Step 5: Read + report
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
REPORT=".flow/specs/$SPEC_NAME/qa-report.md"
|
|
88
|
+
[ ! -f "$REPORT" ] && { echo "⚠ QA report was not generated"; exit 1; }
|
|
89
|
+
|
|
90
|
+
HIGH_BUGS=$(grep -c "\[high\]" "$REPORT" || echo 0)
|
|
91
|
+
MED_BUGS=$(grep -c "\[medium\]" "$REPORT" || echo 0)
|
|
92
|
+
LOW_BUGS=$(grep -c "\[low\]" "$REPORT" || echo 0)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Step 6: Output to user
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
🔬 QA complete: $SPEC_NAME
|
|
99
|
+
|
|
100
|
+
Findings:
|
|
101
|
+
[high]: $HIGH_BUGS
|
|
102
|
+
[medium]: $MED_BUGS
|
|
103
|
+
[low]: $LOW_BUGS
|
|
104
|
+
|
|
105
|
+
Report: .flow/specs/$SPEC_NAME/qa-report.md
|
|
106
|
+
Screenshots: .flow/specs/$SPEC_NAME/qa-screenshots/
|
|
107
|
+
|
|
108
|
+
Next steps:
|
|
109
|
+
- Fix high-severity bugs → /curdx-flow:implement --task=QA-fix
|
|
110
|
+
- Or add tasks to Phase 3.X in tasks.md
|
|
111
|
+
- Retest: /curdx-flow:qa
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Error recovery
|
|
115
|
+
|
|
116
|
+
- chrome-devtools MCP not installed → recommend `/curdx-flow:install-deps` or `claude mcp add chrome-devtools`
|
|
117
|
+
- Dev server not running → prompt the user to start it and rerun
|
|
118
|
+
- URL not accessible → prompt to check (`curl -I $URL`)
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: requirements
|
|
3
|
+
description: Run the requirements stage — dispatch the flow-product-designer agent to generate user stories + FR/NFR, producing requirements.md
|
|
4
|
+
argument-hint: "[spec-name]"
|
|
5
|
+
allowed-tools: [Read, Write, Bash, Task, AskUserQuestion]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Requirements Stage
|
|
9
|
+
|
|
10
|
+
Dispatch the `flow-product-designer` agent to translate research directions into user stories.
|
|
11
|
+
|
|
12
|
+
## Step 1: Resolve spec + preflight checks
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
SPEC_NAME="${ARGUMENTS:-$(cat .flow/.active-spec 2>/dev/null)}"
|
|
16
|
+
|
|
17
|
+
[ -z "$SPEC_NAME" ] && { echo "❌ Run /curdx-flow:start first"; exit 1; }
|
|
18
|
+
[ ! -f ".flow/specs/$SPEC_NAME/research.md" ] && {
|
|
19
|
+
echo "❌ research.md missing. Run /curdx-flow:research first"
|
|
20
|
+
exit 1
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Verify the status of research:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
python3 -c "
|
|
28
|
+
import re
|
|
29
|
+
fm = open('.flow/specs/$SPEC_NAME/research.md').read()[:500]
|
|
30
|
+
m = re.search(r'status:\s*(\w+)', fm)
|
|
31
|
+
status = m.group(1) if m else 'unknown'
|
|
32
|
+
if status not in ('completed', 'approved'):
|
|
33
|
+
print(f'⚠ research status: {status}')
|
|
34
|
+
print('Recommend completing the research stage before continuing')
|
|
35
|
+
"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Step 2: Open question check
|
|
39
|
+
|
|
40
|
+
If research.md lists open questions but no user answers are visible, prompt:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
⚠ research.md has unanswered open questions:
|
|
44
|
+
Q1: ...
|
|
45
|
+
Q2: ...
|
|
46
|
+
|
|
47
|
+
You can:
|
|
48
|
+
1. Answer the questions first (write them to STATE.md or state them), then run /curdx-flow:requirements
|
|
49
|
+
2. Let the agent continue based on reasonable assumptions (assumptions will be listed explicitly in requirements.md)
|
|
50
|
+
|
|
51
|
+
Continue? (continue / answer / skip)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Use AskUserQuestion.
|
|
55
|
+
|
|
56
|
+
## Step 3: Update state + dispatch agent
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
# Mark in_progress
|
|
60
|
+
import json
|
|
61
|
+
s = json.load(open(f'.flow/specs/{SPEC_NAME}/.state.json'))
|
|
62
|
+
s.setdefault('phase_status',{})['requirements']='in_progress'
|
|
63
|
+
s['phase']='requirements'
|
|
64
|
+
json.dump(s, open(f'.flow/specs/{SPEC_NAME}/.state.json','w'), indent=2, ensure_ascii=False)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Task dispatch:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
Task:
|
|
71
|
+
subagent_type: general-purpose
|
|
72
|
+
description: "Requirements design $SPEC_NAME"
|
|
73
|
+
prompt: |
|
|
74
|
+
You are the flow-product-designer agent. Full definition at:
|
|
75
|
+
${CLAUDE_PLUGIN_ROOT}/agents/flow-product-designer.md
|
|
76
|
+
|
|
77
|
+
Prerequisite files:
|
|
78
|
+
- .flow/specs/$SPEC_NAME/research.md (must read)
|
|
79
|
+
- .flow/PROJECT.md
|
|
80
|
+
- .flow/CONTEXT.md
|
|
81
|
+
|
|
82
|
+
Template:
|
|
83
|
+
${CLAUDE_PLUGIN_ROOT}/templates/requirements.md.tmpl
|
|
84
|
+
|
|
85
|
+
Output:
|
|
86
|
+
.flow/specs/$SPEC_NAME/requirements.md
|
|
87
|
+
|
|
88
|
+
Workflow:
|
|
89
|
+
1. Read research.md to understand recommended directions
|
|
90
|
+
2. Generate user stories (US-NN) — at least 2
|
|
91
|
+
3. At least 3 acceptance criteria per US (AC-X.Y), must cover happy path + edges + errors
|
|
92
|
+
4. Extract FR (functional requirements) + NFR (at least performance and security)
|
|
93
|
+
5. Explicit Out of Scope (at least 3 items)
|
|
94
|
+
6. List open questions (if user decisions are needed)
|
|
95
|
+
7. Update .state.json and .progress.md
|
|
96
|
+
|
|
97
|
+
If multiple reasonable interpretations exist, you MUST AskUserQuestion — do not silently pick a direction.
|
|
98
|
+
|
|
99
|
+
Success criteria:
|
|
100
|
+
- At least 2 US, all from the user's perspective (non-technical language)
|
|
101
|
+
- Each AC testable (can be written as curl / assert)
|
|
102
|
+
- At least 3 FR, NFR covers at least P and S
|
|
103
|
+
- Out of Scope lists at least 3 items
|
|
104
|
+
|
|
105
|
+
Return a brief when finished.
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Step 4: Output verification
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
REQ_FILE=".flow/specs/$SPEC_NAME/requirements.md"
|
|
112
|
+
|
|
113
|
+
# Count US / FR / AC
|
|
114
|
+
US_COUNT=$(grep -c "^### US-" "$REQ_FILE" || echo 0)
|
|
115
|
+
FR_COUNT=$(grep -c "^- \*\*FR-" "$REQ_FILE" || echo 0)
|
|
116
|
+
AC_COUNT=$(grep -c "^- AC-" "$REQ_FILE" || echo 0)
|
|
117
|
+
|
|
118
|
+
echo " US: $US_COUNT, FR: $FR_COUNT, AC: $AC_COUNT"
|
|
119
|
+
|
|
120
|
+
# Minimum requirements
|
|
121
|
+
[ "$US_COUNT" -lt 2 ] && echo "⚠ Fewer than 2 user stories"
|
|
122
|
+
[ "$FR_COUNT" -lt 3 ] && echo "⚠ Fewer than 3 functional requirements"
|
|
123
|
+
[ "$AC_COUNT" -lt 6 ] && echo "⚠ Fewer than 6 acceptance criteria (average < 3 per US)"
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Step 5: Output
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
✓ requirements stage complete
|
|
130
|
+
|
|
131
|
+
File: .flow/specs/$SPEC_NAME/requirements.md
|
|
132
|
+
User stories: N
|
|
133
|
+
Functional reqs: M
|
|
134
|
+
Acceptance criteria: K
|
|
135
|
+
|
|
136
|
+
Next steps:
|
|
137
|
+
- Review requirements.md
|
|
138
|
+
- If the agent listed open questions, answer them before entering design
|
|
139
|
+
- /curdx-flow:design — enter design stage
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Error recovery
|
|
143
|
+
|
|
144
|
+
- research.md missing → prompt to run /curdx-flow:research first
|
|
145
|
+
- Agent times out → requirements may be too complex, consider splitting into an Epic (/curdx-flow:triage, see Phase 4)
|
|
146
|
+
- Agent made a major interpretation without asking the user → the user can annotate requirements.md and request a correction
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: research
|
|
3
|
+
description: Run the research stage — dispatch the flow-researcher agent to deeply explore the problem, producing research.md
|
|
4
|
+
argument-hint: "[spec-name]"
|
|
5
|
+
allowed-tools: [Read, Write, Bash, Task]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Research Stage
|
|
9
|
+
|
|
10
|
+
Dispatch the `flow-researcher` agent to complete the research stage of a spec.
|
|
11
|
+
|
|
12
|
+
## Step 1: Resolve target spec
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Use the argument if provided; otherwise use the active spec
|
|
16
|
+
if [ -n "$ARGUMENTS" ]; then
|
|
17
|
+
SPEC_NAME="$ARGUMENTS"
|
|
18
|
+
else
|
|
19
|
+
SPEC_NAME=$(cat .flow/.active-spec 2>/dev/null)
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
if [ -z "$SPEC_NAME" ] || [ ! -d ".flow/specs/$SPEC_NAME" ]; then
|
|
23
|
+
echo "❌ Spec does not exist. Use /curdx-flow:start <name> \"<goal>\" to create a new spec"
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Step 2: Preflight checks
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# The research stage has no prerequisites; just verify the spec directory is ready
|
|
32
|
+
if [ ! -f ".flow/specs/$SPEC_NAME/.state.json" ]; then
|
|
33
|
+
echo "❌ Spec state file missing. Run /curdx-flow:start to re-initialize"
|
|
34
|
+
exit 1
|
|
35
|
+
fi
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
If research.md already exists with status=completed:
|
|
39
|
+
- Ask the user whether to overwrite (AskUserQuestion)
|
|
40
|
+
- Default: do not overwrite; suggest `/curdx-flow:requirements` to move to the next step
|
|
41
|
+
|
|
42
|
+
## Step 3: Update state
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Mark the research stage as in_progress
|
|
46
|
+
python3 <<'EOF'
|
|
47
|
+
import json
|
|
48
|
+
from pathlib import Path
|
|
49
|
+
state_file = Path(f".flow/specs/$SPEC_NAME/.state.json")
|
|
50
|
+
state = json.loads(state_file.read_text())
|
|
51
|
+
state.setdefault("phase_status", {})["research"] = "in_progress"
|
|
52
|
+
state["phase"] = "research"
|
|
53
|
+
state_file.write_text(json.dumps(state, indent=2, ensure_ascii=False))
|
|
54
|
+
EOF
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Step 4: Dispatch the flow-researcher agent
|
|
58
|
+
|
|
59
|
+
Using the Task tool:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
Task:
|
|
63
|
+
subagent_type: general-purpose
|
|
64
|
+
description: "Research $SPEC_NAME"
|
|
65
|
+
prompt: |
|
|
66
|
+
You are the flow-researcher agent. Your full responsibilities and workflow are at:
|
|
67
|
+
${CLAUDE_PLUGIN_ROOT}/agents/flow-researcher.md
|
|
68
|
+
|
|
69
|
+
Spec prerequisites to read:
|
|
70
|
+
- .flow/specs/$SPEC_NAME/.state.json (goal + state)
|
|
71
|
+
- .flow/PROJECT.md
|
|
72
|
+
- .flow/CONTEXT.md
|
|
73
|
+
- .flow/STATE.md
|
|
74
|
+
|
|
75
|
+
Template (you must populate and write to research.md):
|
|
76
|
+
${CLAUDE_PLUGIN_ROOT}/templates/research.md.tmpl
|
|
77
|
+
|
|
78
|
+
Output file:
|
|
79
|
+
.flow/specs/$SPEC_NAME/research.md
|
|
80
|
+
|
|
81
|
+
Workflow requirements:
|
|
82
|
+
1. Load context (Step 1)
|
|
83
|
+
2. Call mcp__claude_mem__search to retrieve history (Step 2)
|
|
84
|
+
3. sequential-thinking 5+ rounds for problem understanding (Step 3)
|
|
85
|
+
4. Glob/Grep to scan existing code (Step 4)
|
|
86
|
+
5. context7 to look up the latest docs for 2-3 technical options (Step 5)
|
|
87
|
+
6. WebSearch to supplement (Step 6, if needed)
|
|
88
|
+
7. Write research.md (based on the template, replacing placeholders)
|
|
89
|
+
8. Update .state.json and .progress.md (Step 8)
|
|
90
|
+
|
|
91
|
+
Success criteria:
|
|
92
|
+
- research.md exists and matches the template structure
|
|
93
|
+
- Problem understanding section has 3+ explicit assumptions
|
|
94
|
+
- 2-3 technical options, each referencing context7 results
|
|
95
|
+
- Code analysis includes actual file paths found
|
|
96
|
+
- Recommended direction + rationale is clear
|
|
97
|
+
- At least 1 open question (unless the research is fully unambiguous)
|
|
98
|
+
|
|
99
|
+
Forbidden:
|
|
100
|
+
- Writing library APIs from memory
|
|
101
|
+
- Skipping context7 queries
|
|
102
|
+
- sequentialthinking < 5 rounds
|
|
103
|
+
- Creating any new files outside research.md
|
|
104
|
+
|
|
105
|
+
When done, return a brief (findings, recommendations, open questions).
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Step 5: After the agent completes
|
|
109
|
+
|
|
110
|
+
Read the agent-generated research.md and verify that key sections exist:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
for section in "Problem Understanding" "Technical Options" "Existing Code Analysis" "Feasibility" "Recommended Direction"; do
|
|
114
|
+
if ! grep -q "$section" ".flow/specs/$SPEC_NAME/research.md" 2>/dev/null; then
|
|
115
|
+
echo "⚠ research.md missing section: $section"
|
|
116
|
+
fi
|
|
117
|
+
done
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
If any section is missing, emit a warning but do not block (the user decides whether to re-run).
|
|
121
|
+
|
|
122
|
+
## Step 6: Output suggestions
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
✓ research stage complete
|
|
126
|
+
|
|
127
|
+
File: .flow/specs/$SPEC_NAME/research.md
|
|
128
|
+
|
|
129
|
+
Next steps:
|
|
130
|
+
- Read research.md and confirm the recommended direction is reasonable
|
|
131
|
+
- Answer the open questions listed by the agent (if any)
|
|
132
|
+
- /curdx-flow:requirements — enter the requirements stage
|
|
133
|
+
|
|
134
|
+
To re-research, just run /curdx-flow:research again
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Error recovery
|
|
138
|
+
|
|
139
|
+
- research.md generation fails → check MCP status (/curdx-flow:doctor), retry
|
|
140
|
+
- Agent exceeds 40 turns → the research is too complex, narrow the target scope
|
|
141
|
+
- context7 unavailable → the agent falls back to WebSearch, but must explicitly inform the user
|