@curdx/flow 2.0.0-beta.1 → 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 (57) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +3 -10
  3. package/CHANGELOG.md +20 -0
  4. package/README.zh.md +2 -2
  5. package/agent-preamble/preamble.md +81 -11
  6. package/agents/flow-adversary.md +40 -55
  7. package/agents/flow-architect.md +23 -10
  8. package/agents/flow-debugger.md +2 -2
  9. package/agents/flow-edge-hunter.md +20 -6
  10. package/agents/flow-executor.md +3 -3
  11. package/agents/flow-planner.md +51 -48
  12. package/agents/flow-product-designer.md +14 -1
  13. package/agents/flow-qa-engineer.md +1 -1
  14. package/agents/flow-researcher.md +17 -2
  15. package/agents/flow-reviewer.md +5 -1
  16. package/agents/flow-security-auditor.md +1 -1
  17. package/agents/flow-triage-analyst.md +1 -1
  18. package/agents/flow-ui-researcher.md +2 -2
  19. package/agents/flow-ux-designer.md +1 -1
  20. package/agents/flow-verifier.md +47 -14
  21. package/bin/curdx-flow.js +13 -1
  22. package/cli/doctor.js +28 -13
  23. package/cli/install.js +62 -36
  24. package/cli/protocols.js +63 -10
  25. package/cli/registry.js +73 -0
  26. package/cli/uninstall.js +9 -11
  27. package/cli/upgrade.js +6 -10
  28. package/cli/utils.js +104 -56
  29. package/commands/fast.md +1 -1
  30. package/commands/implement.md +4 -4
  31. package/commands/init.md +14 -3
  32. package/commands/review.md +14 -5
  33. package/commands/spec.md +26 -2
  34. package/commands/start.md +47 -17
  35. package/commands/verify.md +13 -0
  36. package/gates/adversarial-review-gate.md +19 -19
  37. package/gates/devex-gate.md +4 -5
  38. package/gates/edge-case-gate.md +1 -1
  39. package/hooks/hooks.json +0 -11
  40. package/hooks/scripts/quick-mode-guard.sh +12 -9
  41. package/hooks/scripts/session-start.sh +1 -1
  42. package/hooks/scripts/stop-watcher.sh +25 -15
  43. package/knowledge/execution-strategies.md +6 -5
  44. package/knowledge/spec-driven-development.md +8 -7
  45. package/knowledge/two-stage-review.md +4 -3
  46. package/package.json +4 -2
  47. package/skills/brownfield-index/SKILL.md +62 -0
  48. package/skills/browser-qa/SKILL.md +50 -0
  49. package/skills/epic/SKILL.md +68 -0
  50. package/skills/security-audit/SKILL.md +50 -0
  51. package/skills/ui-sketch/SKILL.md +49 -0
  52. package/templates/config.json.tmpl +1 -1
  53. package/templates/design.md.tmpl +32 -112
  54. package/templates/requirements.md.tmpl +25 -43
  55. package/templates/research.md.tmpl +37 -68
  56. package/templates/tasks.md.tmpl +27 -84
  57. package/hooks/scripts/fail-tracker.sh +0 -31
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: epic
3
+ description: Invoke when user wants to break a large feature into multiple smaller specs with a dependency graph. Triggers on "epic", "big feature", "too big", "decompose", "break down", "break into", "split into", "multi-spec", "multiple features", "sub-features", "vertical slice", "parent feature", "large scope", "won't fit in one sprint", "needs splitting".
4
+ allowed-tools: [Read, Write, Grep, Glob, Bash]
5
+ ---
6
+
7
+ # Epic Decomposition
8
+
9
+ You are invoked when the user wants to break a large feature into multiple vertical-slice specs.
10
+
11
+ ## Preconditions
12
+
13
+ 1. A `.flow/` project must exist (run `/curdx-flow:init` first if missing).
14
+ 2. The user has stated a feature scope that is too large for a single spec.
15
+
16
+ ## Workflow
17
+
18
+ ### Step 1: Clarify the epic scope
19
+
20
+ Ask the user (or infer from context) for:
21
+ - **Epic name** (short identifier, kebab-case)
22
+ - **One-sentence goal** of the whole epic
23
+ - **Hard boundary**: what is explicitly out of scope for this epic
24
+
25
+ ### Step 2: Dispatch `flow-triage-analyst`
26
+
27
+ Delegate to the `flow-triage-analyst` agent with the epic name + goal + boundary. The agent returns:
28
+ - A vertical-slice decomposition (not horizontal by layer)
29
+ - Dependency graph between slices
30
+ - Shared interfaces that must be frozen before parallel work begins
31
+ - Suggested slice ordering (MVP → iteration → polish)
32
+
33
+ ### Step 3: Write epic manifest
34
+
35
+ Create `.flow/_epics/<epic-name>/epic.md` with:
36
+
37
+ ```markdown
38
+ # Epic: <name>
39
+
40
+ ## Goal
41
+ <one sentence>
42
+
43
+ ## Slices (vertical)
44
+ | ID | Slice | Depends on | Shared interface |
45
+ |----|-------|-----------|------------------|
46
+ | S1 | ... | — | — |
47
+ | S2 | ... | S1 | `types/auth.ts` |
48
+ | S3 | ... | S1 | — |
49
+
50
+ ## Frozen Interfaces
51
+ (contracts that must not change once slices start)
52
+
53
+ ## Out of Scope
54
+ - ...
55
+ ```
56
+
57
+ ### Step 4: Scaffold sub-spec skeletons
58
+
59
+ For each slice, create `.flow/specs/<epic-name>-<slice-id>/` with a minimal `.state.json` linking back to the epic manifest.
60
+
61
+ ### Step 5: Report to user
62
+
63
+ Summarize: "Epic `<name>` decomposed into N vertical slices. Start any slice with `/curdx-flow:start <epic-name>-<slice-id>`. Suggested order: S1 → S2 → S3."
64
+
65
+ ## References
66
+
67
+ - Vertical-slice methodology: `@${CLAUDE_PLUGIN_ROOT}/knowledge/epic-decomposition.md`
68
+ - Spec skeleton: `@${CLAUDE_PLUGIN_ROOT}/templates/`
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: security-audit
3
+ description: Invoke when the user wants a security review — OWASP Top 10, STRIDE threat modeling, credential handling, injection, secrets, sensitive data handling. Triggers on "security", "auth", "authentication", "credential", "password", "secret", "API key", "token", "OWASP", "STRIDE", "CVE", "vulnerability", "injection", "XSS", "CSRF", "SSRF", "SQL injection", "hardcoded secret", "sensitive data", "leak", "will my API key leak", "is this safe".
4
+ allowed-tools: [Read, Grep, Glob, Bash, WebSearch]
5
+ ---
6
+
7
+ # Security Audit
8
+
9
+ You are invoked when the user wants a systematic security review of the current spec or codebase.
10
+
11
+ ## Preconditions
12
+
13
+ 1. The code or spec under review is reachable from the current working directory.
14
+ 2. The user has identified the scope (current spec, specific module, or whole repo).
15
+
16
+ ## Workflow
17
+
18
+ ### Step 1: Clarify audit scope
19
+
20
+ Confirm:
21
+ - **Scope** (current spec / specific paths / whole repo)
22
+ - **Depth** (OWASP-only / OWASP + STRIDE / + dependency CVE scan)
23
+ - **Risk tolerance** (block on any SR / only block on SR with POC / advisory only)
24
+
25
+ ### Step 2: Dispatch `flow-security-auditor`
26
+
27
+ Delegate to the `flow-security-auditor` agent. It will:
28
+ 1. Scan for hardcoded secrets, weak crypto, unsanitized inputs
29
+ 2. Apply OWASP Top 10 (A01 Broken Access Control → A10 SSRF)
30
+ 3. Apply STRIDE threat modeling (Spoofing, Tampering, Repudiation, Information disclosure, DoS, Elevation)
31
+ 4. Run dependency CVE scan (`npm audit` / equivalent)
32
+ 5. Produce a findings report with severity labels (SR = Blocking Red line, SW = Warning, SM = Mandatory-to-address)
33
+
34
+ ### Step 3: Write security report
35
+
36
+ Output `.flow/specs/<active>/security-audit.md` containing:
37
+ - **SR (blocking)** — must fix before ship
38
+ - **SW (warning)** — should fix, won't block
39
+ - **SM (mandatory)** — baseline items that must be present
40
+ - **CVE hits** — direct / transitive dependencies with known vulns
41
+ - **Recommended fixes** — concrete patches, not generic advice
42
+
43
+ ### Step 4: Enforce gate
44
+
45
+ Apply the `security-gate` (`@${CLAUDE_PLUGIN_ROOT}/gates/security-gate.md`) — if any SR findings exist, block completion until remediated or explicitly waived with a D-NN decision in STATE.md.
46
+
47
+ ## References
48
+
49
+ - `flow-security-auditor` agent: `@${CLAUDE_PLUGIN_ROOT}/agents/flow-security-auditor.md`
50
+ - security-gate: `@${CLAUDE_PLUGIN_ROOT}/gates/security-gate.md`
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: ui-sketch
3
+ description: Invoke when the user wants UI design drafts — components, layouts, variants, mockups, CSS/theme/styling decisions. Triggers on "design UI", "UI design", "component layout", "variants", "wireframe", "mockup", "prototype", "sketch", "draft layout", "visual design", "styling", "CSS", "theming", "dark mode", "responsive design", "color scheme", "build me a UI", "show several variants", "try different colors".
4
+ allowed-tools: [Read, Write, Bash, WebSearch]
5
+ ---
6
+
7
+ # UI Sketch
8
+
9
+ You are invoked when the user wants fresh UI design drafts — typically 2–4 variants for comparison, or a single iterative refinement.
10
+
11
+ ## Preconditions
12
+
13
+ 1. The `frontend-design` skill (Anthropic official) should be installed. Without it, fall back to Tailwind + shadcn/ui defaults.
14
+ 2. The user provides a description of the UI goal (component, page, or flow).
15
+
16
+ ## Workflow
17
+
18
+ ### Step 1: Clarify design brief
19
+
20
+ Confirm with the user:
21
+ - **What is being designed** (component / page / full screen)
22
+ - **Context** (consumer product / enterprise tool / marketing site / internal dashboard)
23
+ - **Must-haves** (brand colors / existing design system / responsive breakpoints)
24
+ - **Variant count** (default: 3 variants with distinct design directions)
25
+
26
+ ### Step 2: Dispatch `flow-ux-designer`
27
+
28
+ Delegate to the `flow-ux-designer` agent with the brief. It will:
29
+ 1. Invoke the `frontend-design` skill with the brief
30
+ 2. Generate N variant HTML/JSX files under `.flow/specs/<active>/sketches/`
31
+ 3. For each variant, produce a rationale: typography, color, layout decisions
32
+ 4. Open the variants for user preview if a dev server is running
33
+
34
+ ### Step 3: Present variants
35
+
36
+ Show the user:
37
+ - **Variant preview URLs** or file paths
38
+ - **Design rationale** per variant (what's different, why)
39
+ - **Accessibility notes** (contrast ratios, focus states)
40
+
41
+ ### Step 4: Iterate or finalize
42
+
43
+ - If user picks a variant: move the chosen file into the spec's `design.md` asset section.
44
+ - If user wants a hybrid: dispatch `flow-ux-designer` again with "merge variant A layout + variant B color scheme".
45
+
46
+ ## References
47
+
48
+ - `flow-ux-designer` agent: `@${CLAUDE_PLUGIN_ROOT}/agents/flow-ux-designer.md`
49
+ - `flow-ui-researcher` agent (for competitive reference scraping): `@${CLAUDE_PLUGIN_ROOT}/agents/flow-ui-researcher.md`
@@ -32,7 +32,7 @@
32
32
  "specs": {
33
33
  "directories": ["./.flow/specs"],
34
34
  "default_task_size": "fine",
35
- "_task_size_options": "fine (40-60 tasks) | coarse (10-20 tasks)"
35
+ "_task_size_hint": "as-needed decomposition (no fixed count) see agents/flow-planner.md"
36
36
  },
37
37
 
38
38
  "addons": {
@@ -9,155 +9,75 @@ depends_on: requirements.md
9
9
 
10
10
  # Technical Design: {{SPEC_NAME}}
11
11
 
12
- > Conclusions from the flow-architect agent using at least 8 rounds of `sequential-thinking` reasoning.
13
- > This document freezes the technical choices. Subsequent tasks / implementation strictly follow this design.
12
+ > Conclusions from flow-architect. Sequential-thinking is invoked proportional to the genuine tradeoff surface — the chain lives in the thinking tool, not this document.
13
+ >
14
+ > **Fill only the sections that carry real design information for this feature.** Well-known stack assemblies legitimately compress to a stack list + data model + a few real ADs. Delete sections whose honest answer would be "N/A" or "standard for this stack". A forced 13-section template is the bloat pattern this is designed to prevent.
14
15
 
15
16
  ---
16
17
 
17
18
  ## Design Overview (one paragraph)
18
19
 
19
- <!-- One-sentence summary of the architecture -->
20
+ <!-- One sentence summary of the approach. -->
20
21
 
21
22
  ## Architecture Decisions
22
23
 
23
- <!-- Each major decision gets an ID and is written to the decisions array in .flow/STATE.md -->
24
+ <!-- Each real decision gets an AD-NN. If a decision is "obvious, no alternative worth listing," use one line and move on. -->
24
25
 
25
26
  ### AD-01: ...
26
- - **Decision**: Use X instead of Y
27
+ - **Decision**: Use X
27
28
  - **Rationale**: ...
28
- - **Trade-off**: Accepted [downside] in exchange for [upside]
29
- - **sequentialthinking rounds**: rounds 3-5
30
-
31
- ### AD-02: ...
32
-
33
- ## System Architecture Diagram
34
-
35
- ```mermaid
36
- flowchart TB
37
- <!-- actual data flow generated by flow-architect -->
38
- User[User] --> API[API Gateway]
39
- API --> Auth[Auth Service]
40
- Auth --> DB[(Database)]
41
- ```
29
+ - **Trade-off**: ... (omit if there is no genuine tradeoff)
42
30
 
43
31
  ## Component Design
44
32
 
45
- <!-- Each component is independently testable. Interfaces are explicit. -->
33
+ <!-- Each component: responsibility, input type, output type, dependencies, error path. Skip if the feature is a single module with no internal boundaries worth naming. -->
46
34
 
47
- ### Component: {{COMP_NAME_1}}
35
+ ### Component: {{COMP_NAME}}
48
36
  - **Responsibility**: ...
49
- - **Input**:
50
- ```ts
51
- interface Input {
52
- field: Type;
53
- }
54
- ```
55
- - **Output**:
56
- ```ts
57
- interface Output {
58
- field: Type;
59
- }
60
- ```
61
- - **Dependencies**: Component X, Library Y
62
- - **Errors**:
63
- - `ErrorCode.X` — when ... happens
64
- - `ErrorCode.Y` — when ... happens
65
-
66
- ### Component: {{COMP_NAME_2}}
67
- <!-- ... -->
68
-
69
- ## Data Model
70
-
71
- <!-- Database schema / data structures -->
72
-
73
- ### Entity: ...
74
- ```sql
75
- CREATE TABLE ... (
76
- id UUID PRIMARY KEY,
77
- ...
78
- );
79
- ```
37
+ - **Input**: `interface Input { ... }`
38
+ - **Output**: `interface Output { ... }`
39
+ - **Dependencies**: ...
40
+ - **Errors**: ...
80
41
 
81
- ### Or TypeScript types:
82
- ```ts
83
- interface Entity {
84
- id: string;
85
- ...
86
- }
87
- ```
42
+ ## Data Model (if the feature touches persistence or structured data)
88
43
 
89
- ## State Machine (if applicable)
44
+ <!-- SQL schema, TypeScript types, or API payload shape. Delete if the feature has no meaningful data shape. -->
45
+
46
+ ## Architecture Diagram (include only when it clarifies; prose often suffices)
90
47
 
91
48
  ```mermaid
92
- stateDiagram-v2
93
- [*] --> Pending
94
- Pending --> Active: approve
95
- Pending --> Rejected: reject
96
- Active --> Completed: finish
49
+ flowchart TB
50
+ ...
97
51
  ```
98
52
 
99
- ## Error Path Design
53
+ ## State Machine (include only if the feature has non-trivial state transitions)
100
54
 
101
- <!-- Full flow on failure -->
55
+ ## Error Path Design (include when error behavior is not obvious)
102
56
 
103
- | Scenario | Upstream Behavior | System Response | User-visible |
104
- |-----|--------|---------|---------|
105
- | DB connection lost | retry 3 times | return 503 | "Temporarily unavailable, retry in 1 minute" |
106
- | Rate limit hit | none | return 429 | "Too many requests, retry in 60 seconds" |
57
+ | Scenario | System Response | User-visible |
58
+ |-----|---------|---------|
59
+ | ... | ... | ... |
107
60
 
108
- ## API Contract
109
-
110
- <!-- If this is an API project -->
61
+ ## API Contract (include only if this feature exposes or changes an API)
111
62
 
112
63
  ```yaml
113
- POST /api/v1/...
114
- Request:
115
- body:
116
- field: string
117
- Response:
118
- 200:
119
- body:
120
- field: string
121
- 400:
122
- body:
123
- error: string
64
+ ...
124
65
  ```
125
66
 
126
- ## Test Matrix
67
+ ## Test Matrix (brief — one line per layer)
127
68
 
128
69
  | Layer | Coverage | Tool |
129
70
  |---|-----|------|
130
- | Unit | All pure functions | vitest |
131
- | Integration | Between components | vitest + supertest |
132
- | E2E | Complete user flows | playwright / chrome-devtools MCP |
133
-
134
- ### Key Test Scenarios
135
- 1. Happy path: ...
136
- 2. Edge case 1: ...
137
- 3. Error recovery: ...
138
-
139
- ## Suggested Implementation Order
140
-
141
- <!-- Reference for decomposition in the tasks phase -->
142
-
143
- 1. Build skeleton first (Component A → empty implementation)
144
- 2. Then wire up the real logic (core logic of Component A)
145
- 3. Connect DB (persistence for Component A)
146
- 4. Then do Component B ...
147
-
148
- ## Risks and Mitigations
71
+ | ... | ... | ... |
149
72
 
150
- | Risk | Level | Mitigation |
151
- |-----|-----|------|
152
- | ... | medium | ... |
73
+ ## Risks and Mitigations (include only if risks exist that aren't obvious from the ADs)
153
74
 
154
75
  ## Defer to Implementation
155
76
 
156
- <!-- Decisions not worth spending time on in the design phase -->
77
+ <!-- Decisions explicitly deferred to when the executor writes the code. -->
157
78
 
158
- - Logging library choice → reuse project's existing one during implementation
159
- - Caching strategy → no caching initially, adjust based on data after launch
79
+ - ...
160
80
 
161
81
  ---
162
82
 
163
- _Generated by flow-architect agent on {{CREATED_DATE}}. After user reviews and approves AD-01~N, proceed to the tasks phase._
83
+ _Generated by flow-architect on {{CREATED_DATE}}._
@@ -9,86 +9,68 @@ depends_on: research.md
9
9
 
10
10
  # Requirements Spec: {{SPEC_NAME}}
11
11
 
12
- > **Recommended direction from the research phase**: {{RESEARCH_CONCLUSION}}
12
+ > **Recommended direction from research**: {{RESEARCH_CONCLUSION}}
13
13
  >
14
- > This phase: translate "technically feasible" into "concrete behaviors users benefit from".
14
+ > **Fill only the sections that carry real information for this feature.** Delete or collapse any section whose honest content would be "N/A" or "same as usual". Padding sections with "TBD" is worse than omitting them.
15
15
 
16
16
  ---
17
17
 
18
18
  ## User Stories
19
19
 
20
- <!-- Each story follows the format: As X, I want Y, so that Z -->
21
-
22
20
  ### US-01: ...
23
- **As** [user role],
24
- **I want** [capability],
25
- **so that** [business value].
21
+ **As** [user role], **I want** [capability], **so that** [business value].
26
22
 
27
23
  **Acceptance criteria**:
28
24
  - AC-1.1: [verifiable behavior]
29
- - AC-1.2: [verifiable behavior]
30
- - AC-1.3: [edge case handling]
25
+ - AC-1.2: ...
31
26
 
32
- ### US-02: ...
33
- <!-- ... -->
27
+ <!-- Add more US-NN blocks only if the feature genuinely has multiple independent user flows. -->
34
28
 
35
29
  ## Functional Requirements
36
30
 
37
- <!-- FR-NN format. Each FR must be a verifiable statement of "the system must X". -->
38
-
39
31
  - **FR-01**: The system must ...
40
- - **FR-02**: The system must ...
41
- - **FR-03**: ...
32
+ - **FR-02**: ...
42
33
 
43
34
  ## Non-Functional Requirements
44
35
 
45
- ### Performance
46
- - **NFR-P-01**: [e.g. P95 response time < 200ms]
47
- - **NFR-P-02**: ...
36
+ <!--
37
+ Include ONLY the NFR categories that this feature is actually constrained by.
38
+ For a small internal CRUD feature, "Performance / Security / Maintainability / Compatibility" as a four-bucket grid is usually padding.
39
+ Delete categories that have no real requirement, or collapse into one line: "NFR: standard for this stack, no special constraints."
40
+ -->
48
41
 
49
- ### Security
50
- - **NFR-S-01**: ...
51
- - **NFR-S-02**: ...
42
+ ### Performance (if applicable)
43
+ - **NFR-P-01**: ...
52
44
 
53
- ### Maintainability
54
- - **NFR-M-01**: ...
45
+ ### Security (if applicable)
46
+ - **NFR-S-01**: ...
55
47
 
56
- ### Compatibility
57
- - **NFR-C-01**: ...
48
+ <!-- Delete Maintainability / Compatibility sections unless they carry a real constraint. -->
58
49
 
59
50
  ## Edge Cases and Error Handling
60
51
 
61
- <!-- Must be explicit: what happens on failure? how are abnormal inputs handled? -->
52
+ <!-- Include rows only for scenarios that actually apply. -->
62
53
 
63
54
  | Scenario | Expected behavior |
64
55
  |-----|--------|
65
- | Network disconnected | ... |
66
- | Database exception | ... |
67
- | Invalid input | ... |
68
- | Concurrent conflict | ... |
56
+ | ... | ... |
69
57
 
70
58
  ## Out of Scope
71
59
 
72
- <!-- Karpathy principle 2: simplicity first. Explicitly list "not this time" to prevent scope creep. -->
73
-
74
- - ✗ Feature A — deferred to the next version
75
- - ✗ Feature B — out of budget
76
- - ✗ Feature C — needs its own spec
60
+ - ...
77
61
 
78
- ## Success Metrics
62
+ ## Success Metrics (if the feature has measurable outcomes)
79
63
 
80
- <!-- Must be quantifiable -->
64
+ <!-- Delete this section for internal tools or refactors with no user-visible metric. -->
81
65
 
82
- - Metric 1: [e.g. user signup completion rate > 80%]
83
- - Metric 2: [e.g. complaint rate < 1%]
66
+ - Metric 1: ...
84
67
 
85
68
  ## Open Questions
86
69
 
87
- <!-- Questions that need user answers -->
70
+ <!-- Include only if there are genuinely unresolved questions. Delete when empty. -->
88
71
 
89
- 1. **Question 1**: ...
90
- 2. **Question 2**: ...
72
+ 1. ...
91
73
 
92
74
  ---
93
75
 
94
- _Generated by flow-product-designer agent on {{CREATED_DATE}}. After user review, proceed to the design phase._
76
+ _Generated by flow-product-designer on {{CREATED_DATE}}._
@@ -10,105 +10,74 @@ status: in_progress
10
10
 
11
11
  > **Goal**: {{SPEC_GOAL}}
12
12
  >
13
- > Output of this phase. Subsequent requirements / design / tasks are all based on the conclusions of this document.
13
+ > **Fill only the sections that carry real information.** For a well-understood feature on a known stack, research legitimately compresses to: goal, one recommended direction, known constraints. Delete sections whose honest content would be "N/A" or "first time, nothing to fetch". Padding this document with "TBD" is worse than omitting sections.
14
14
 
15
15
  ---
16
16
 
17
- ## Prior Experience (from claude-mem)
18
-
19
- <!--
20
- flow-researcher first calls mcp__claude_mem__search to retrieve relevant history.
21
- If there are relevant observations, summarize them here; if not, write "(first research on this topic)".
22
- -->
17
+ ## Prior Experience (from claude-mem, if relevant)
23
18
 
24
19
  {{CLAUDE_MEM_FINDINGS}}
25
20
 
26
- ## Problem Understanding
21
+ <!-- Delete this section if there are no relevant prior observations. -->
27
22
 
28
- <!-- Translate the user's goal into technical language. Explicitly list assumptions. -->
23
+ ## Problem Understanding
29
24
 
30
25
  ### Core Problem
31
- <!-- One-line description of what we are solving -->
26
+ <!-- One sentence. What are we solving? -->
32
27
 
33
28
  ### Explicit Assumptions
34
- <!-- Karpathy principle 1: think before coding. List all assumptions for the user to confirm -->
29
+ <!-- Only real assumptions that matter. Don't list "assumption: we will write code." -->
30
+
35
31
  - Assumption 1: ...
36
- - Assumption 2: ...
37
32
 
38
33
  ### Known Constraints
39
- - Tech stack:
40
- - Budget / time:
41
- - Team capability:
42
- - Compliance requirements:
43
-
44
- ## Technical Solution Space
34
+ <!-- Include only the constraints that actually shape the solution. -->
45
35
 
46
- <!-- List 2-3 possible approaches with their pros and cons. Pick one in the design phase. -->
36
+ - Tech stack: ...
37
+ - Time budget: ...
38
+ - (Compliance, team capability, etc — only if they constrain this feature)
47
39
 
48
- ### Option A: ...
49
- - **Pros**:
50
- - **Cons**:
51
- - **Complexity**: low / medium / high
52
- - **Docs (context7 queries)**:
53
- - `library-name@version`: ...
40
+ ## Technical Solution Space
54
41
 
55
- ### Option B: ...
56
- - **Pros**:
57
- - **Cons**:
58
- - **Complexity**: low / medium / high
42
+ <!--
43
+ If one approach is clearly the right call for this stack, write only that approach with its rationale.
44
+ Include alternative options ONLY when there is a genuine tradeoff a thoughtful engineer might disagree on.
45
+ Do not invent Option B and Option C just to fill the template.
46
+ -->
59
47
 
60
- ### Option C (optional): ...
48
+ ### Recommended Approach: ...
49
+ - **Why**: ...
50
+ - **Complexity**: ...
51
+ - **Key APIs verified via context7**: ...
61
52
 
62
- ## Existing Code Analysis
53
+ ### Alternative: ... (include only if a real alternative exists)
63
54
 
64
- <!-- Codebase scan results. Which existing modules can be reused? Which need to be new? -->
55
+ ## Existing Code Analysis (include only if the codebase has relevant prior work)
65
56
 
66
57
  ### Reusable Modules
67
- - `path/to/existing-module.ts` — ...
68
-
69
- ### Modules to Create
70
- - `path/to/new-module.ts` — ...
71
-
72
- ### Modules to Modify
73
- - `path/to/modify.ts` — ...
74
-
75
- ## Latest Documentation Summary (context7)
76
-
77
- <!-- Latest APIs / best practices found by flow-researcher via mcp__context7__* -->
78
-
79
- ### {{LIBRARY_1}}
80
- - Version:
81
- - Relevant APIs:
82
- - Gotchas / changes:
83
-
84
- ### {{LIBRARY_2}}
85
- - ...
86
-
87
- ## Feasibility Assessment
58
+ - `path/to/module` — ...
88
59
 
89
- <!-- Explicitly answer: can this be done? how hard is it? -->
60
+ ### New Modules Required
61
+ - `path/to/new` — ...
90
62
 
91
- - **Feasibility**: feasible / ⚠ risky / ✗ not recommended
92
- - **Estimated complexity**: 1-10
93
- - **Main risks**:
94
- - Risk 1: ...
95
- - Risk 2: ...
63
+ ## Latest Documentation Summary
96
64
 
97
- ## Recommended Direction
65
+ <!-- Only include libraries whose API is version-sensitive AND used by this feature. Do not cite every library in the stack. -->
98
66
 
99
- <!-- Research conclusion: which option is recommended and why. If multiple options need discussion, explain here. -->
67
+ ### {{LIBRARY}}
68
+ - Version: ...
69
+ - Relevant APIs: ...
70
+ - Gotchas: ...
100
71
 
101
- **Recommendation**: Option ?
102
- **Rationale**:
103
- **To confirm in the design phase**:
72
+ ## Feasibility
104
73
 
105
- ## Open Questions
74
+ - **Verdict**: feasible / risky / not recommended
75
+ - **Main risks**: (only if real risks exist)
106
76
 
107
- <!-- Questions the research phase couldn't answer, to be deferred to later phases or asked of the user -->
77
+ ## Open Questions (delete if none)
108
78
 
109
79
  1. ...
110
- 2. ...
111
80
 
112
81
  ---
113
82
 
114
- _Generated by flow-researcher agent on {{CREATED_DATE}}. Subsequent phases continue from this document._
83
+ _Generated by flow-researcher on {{CREATED_DATE}}._