@cliangdev/flux-plugin 0.2.0 → 0.3.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.
Files changed (108) hide show
  1. package/README.md +11 -7
  2. package/agents/coder.md +150 -25
  3. package/bin/install.cjs +171 -16
  4. package/commands/breakdown.md +47 -10
  5. package/commands/dashboard.md +29 -0
  6. package/commands/flux.md +92 -12
  7. package/commands/implement.md +166 -17
  8. package/commands/linear.md +6 -5
  9. package/commands/prd.md +996 -82
  10. package/manifest.json +2 -1
  11. package/package.json +9 -11
  12. package/skills/flux-orchestrator/SKILL.md +11 -3
  13. package/skills/prd-writer/SKILL.md +761 -0
  14. package/skills/ux-ui-design/SKILL.md +346 -0
  15. package/skills/ux-ui-design/references/design-tokens.md +359 -0
  16. package/src/__tests__/version.test.ts +37 -0
  17. package/src/adapters/local/.gitkeep +0 -0
  18. package/src/dashboard/__tests__/api.test.ts +211 -0
  19. package/src/dashboard/browser.ts +35 -0
  20. package/src/dashboard/public/app.js +869 -0
  21. package/src/dashboard/public/index.html +90 -0
  22. package/src/dashboard/public/styles.css +807 -0
  23. package/src/dashboard/public/vendor/highlight.css +10 -0
  24. package/src/dashboard/public/vendor/highlight.min.js +8422 -0
  25. package/src/dashboard/public/vendor/marked.min.js +2210 -0
  26. package/src/dashboard/server.ts +296 -0
  27. package/src/dashboard/watchers.ts +83 -0
  28. package/src/server/__tests__/config.test.ts +163 -0
  29. package/src/server/adapters/__tests__/a-client-linear.test.ts +197 -0
  30. package/src/server/adapters/__tests__/adapter-factory.test.ts +230 -0
  31. package/src/server/adapters/__tests__/dependency-ops.test.ts +429 -0
  32. package/src/server/adapters/__tests__/document-ops.test.ts +306 -0
  33. package/src/server/adapters/__tests__/linear-adapter.test.ts +91 -0
  34. package/src/server/adapters/__tests__/linear-config.test.ts +425 -0
  35. package/src/server/adapters/__tests__/linear-criteria-parser.test.ts +287 -0
  36. package/src/server/adapters/__tests__/linear-description-test.ts +238 -0
  37. package/src/server/adapters/__tests__/linear-epic-crud.test.ts +496 -0
  38. package/src/server/adapters/__tests__/linear-mappers-description.test.ts +276 -0
  39. package/src/server/adapters/__tests__/linear-mappers-epic.test.ts +294 -0
  40. package/src/server/adapters/__tests__/linear-mappers-prd.test.ts +300 -0
  41. package/src/server/adapters/__tests__/linear-mappers-task.test.ts +197 -0
  42. package/src/server/adapters/__tests__/linear-prd-crud.test.ts +620 -0
  43. package/src/server/adapters/__tests__/linear-stats.test.ts +450 -0
  44. package/src/server/adapters/__tests__/linear-task-crud.test.ts +534 -0
  45. package/src/server/adapters/__tests__/linear-types.test.ts +243 -0
  46. package/src/server/adapters/__tests__/status-ops.test.ts +441 -0
  47. package/src/server/adapters/factory.ts +90 -0
  48. package/src/server/adapters/index.ts +9 -0
  49. package/src/server/adapters/linear/adapter.ts +1141 -0
  50. package/src/server/adapters/linear/client.ts +169 -0
  51. package/src/server/adapters/linear/config.ts +152 -0
  52. package/src/server/adapters/linear/helpers/criteria-parser.ts +197 -0
  53. package/src/server/adapters/linear/helpers/index.ts +7 -0
  54. package/src/server/adapters/linear/index.ts +16 -0
  55. package/src/server/adapters/linear/mappers/description.ts +136 -0
  56. package/src/server/adapters/linear/mappers/epic.ts +81 -0
  57. package/src/server/adapters/linear/mappers/index.ts +27 -0
  58. package/src/server/adapters/linear/mappers/prd.ts +178 -0
  59. package/src/server/adapters/linear/mappers/task.ts +82 -0
  60. package/src/server/adapters/linear/types.ts +264 -0
  61. package/src/server/adapters/local-adapter.ts +1009 -0
  62. package/src/server/adapters/types.ts +293 -0
  63. package/src/server/config.ts +73 -0
  64. package/src/server/db/__tests__/queries.test.ts +473 -0
  65. package/src/server/db/ids.ts +17 -0
  66. package/src/server/db/index.ts +69 -0
  67. package/src/server/db/queries.ts +142 -0
  68. package/src/server/db/refs.ts +60 -0
  69. package/src/server/db/schema.ts +97 -0
  70. package/src/server/db/sqlite.ts +10 -0
  71. package/src/server/index.ts +81 -0
  72. package/src/server/tools/__tests__/crud.test.ts +411 -0
  73. package/src/server/tools/__tests__/get-version.test.ts +27 -0
  74. package/src/server/tools/__tests__/mcp-interface.test.ts +479 -0
  75. package/src/server/tools/__tests__/query.test.ts +405 -0
  76. package/src/server/tools/__tests__/z-configure-linear.test.ts +511 -0
  77. package/src/server/tools/__tests__/z-get-linear-url.test.ts +108 -0
  78. package/src/server/tools/configure-linear.ts +373 -0
  79. package/src/server/tools/create-epic.ts +44 -0
  80. package/src/server/tools/create-prd.ts +40 -0
  81. package/src/server/tools/create-task.ts +47 -0
  82. package/src/server/tools/criteria.ts +50 -0
  83. package/src/server/tools/delete-entity.ts +76 -0
  84. package/src/server/tools/dependencies.ts +55 -0
  85. package/src/server/tools/get-entity.ts +240 -0
  86. package/src/server/tools/get-linear-url.ts +28 -0
  87. package/src/server/tools/get-stats.ts +52 -0
  88. package/src/server/tools/get-version.ts +20 -0
  89. package/src/server/tools/index.ts +158 -0
  90. package/src/server/tools/init-project.ts +108 -0
  91. package/src/server/tools/query-entities.ts +167 -0
  92. package/src/server/tools/render-status.ts +219 -0
  93. package/src/server/tools/update-entity.ts +140 -0
  94. package/src/server/tools/update-status.ts +166 -0
  95. package/src/server/utils/__tests__/mcp-response.test.ts +331 -0
  96. package/src/server/utils/logger.ts +9 -0
  97. package/src/server/utils/mcp-response.ts +254 -0
  98. package/src/server/utils/status-transitions.ts +160 -0
  99. package/src/status-line/__tests__/status-line.test.ts +215 -0
  100. package/src/status-line/index.ts +147 -0
  101. package/src/utils/__tests__/chalk-import.test.ts +32 -0
  102. package/src/utils/__tests__/display.test.ts +97 -0
  103. package/src/utils/__tests__/status-renderer.test.ts +310 -0
  104. package/src/utils/display.ts +62 -0
  105. package/src/utils/status-renderer.ts +214 -0
  106. package/src/version.ts +5 -0
  107. package/dist/server/index.js +0 -87063
  108. package/skills/prd-template/SKILL.md +0 -242
package/commands/prd.md CHANGED
@@ -1,140 +1,1054 @@
1
1
  ---
2
2
  name: flux:prd
3
- description: Create or refine PRDs through guided interview
4
- allowed-tools: mcp__flux__*, AskUserQuestion
3
+ description: Create comprehensive PRDs through discovery, research, and guided writing
4
+ allowed-tools: mcp__flux__*, AskUserQuestion, Read, Write, Glob, Grep, Task, WebSearch, Bash
5
5
  ---
6
6
 
7
- # PRD Interview
7
+ # PRD Creation Command
8
8
 
9
- You are a product requirements interviewer. Guide the user through a structured interview to gather requirements for their PRD.
9
+ You are a product requirements expert. Your job is to help users create PRDs that are:
10
+ 1. **Concise for humans** - Easy to read and approve
11
+ 2. **Precise for AI** - Detailed enough for autonomous implementation
12
+
13
+ The `flux:prd-writer` skill contains the full PRD template and guidelines. Follow its structure.
10
14
 
11
15
  ## Mode Detection
12
16
 
13
- Check if arguments were provided:
14
- - `/flux:prd` - Start new PRD interview
15
- - `/flux:prd refine` - Refine existing PRD
16
- - `/flux:prd resume` - Resume interrupted interview
17
+ Check arguments:
18
+ - `/flux:prd` or `/flux:prd new` - Start new PRD (full workflow)
19
+ - `/flux:prd refine` or `/flux:prd refine {ref}` - Refine existing PRD
17
20
  - `/flux:prd {ref}` - Edit specific PRD (e.g., `FLUX-P1`)
18
21
 
19
- ## New PRD Interview Flow
22
+ ---
23
+
24
+ ## New PRD Workflow
25
+
26
+ ### Pre-Flight Check
27
+
28
+ 1. **Detect adapter type** by calling `get_project_context`:
29
+ ```
30
+ mcp__flux__get_project_context()
31
+ → Returns: { adapter: { type: "local" | "linear" }, name, vision, ... }
32
+ ```
33
+ - If not initialized: Tell user to run `/flux` first, then exit
34
+ - Store `adapter.type` for use throughout the workflow (affects Step 3.4 storage)
35
+
36
+ 2. Call `query_entities` with `type: "prd"` to check existing PRDs
37
+ - If drafts exist, ask: "You have draft PRDs. Create a new one or continue with {ref}?"
38
+
39
+ ---
40
+
41
+ ### Phase 1: Discovery (Gather Intent)
20
42
 
21
- ### Pre-check
43
+ **Goal**: Understand what the user wants to build before asking structured questions.
22
44
 
23
- 1. Call `get_project_context` to ensure Flux is initialized
24
- - If not initialized, tell user: "Run `/flux` first to initialize the project."
45
+ #### Step 1.1: Open-Ended Start
25
46
 
26
- 2. Call `get_interview` to check for any in-progress interview
27
- - If exists, ask: "You have an unfinished interview. Resume it or start fresh?"
47
+ Begin with an open question:
48
+ ```
49
+ What are you trying to build?
50
+
51
+ Feel free to describe it however makes sense - the problem you're solving,
52
+ the solution you have in mind, or both.
53
+ ```
54
+
55
+ #### Step 1.2: Adaptive Follow-Up
56
+
57
+ Based on their response, ask follow-up questions to fill gaps. You need:
58
+ - **Problem**: What pain point does this solve?
59
+ - **Users**: Who experiences this problem?
60
+ - **Core solution**: What's the core functionality?
61
+ - **Scope**: What's the minimum viable version?
28
62
 
29
- ### Step 1: Project Type
63
+ Use AskUserQuestion for choices when helpful, but prefer conversational follow-ups.
30
64
 
31
- Ask using AskUserQuestion:
65
+ **Examples of good follow-ups**:
66
+ - "Who specifically has this problem? Developers? End users? Admins?"
67
+ - "What would success look like for an MVP?"
68
+ - "Are there any constraints I should know about? (timeline, tech stack, etc.)"
69
+
70
+ #### Step 1.3: Project Type Detection
71
+
72
+ Infer project type from context, or ask if unclear:
32
73
  ```
33
- What type of project are you building?
34
- - Web Application (Recommended)
74
+ Based on what you've described, this sounds like a {detected type}. Is that right?
75
+
76
+ Options:
77
+ - Web Application
35
78
  - CLI Tool
36
79
  - API/Backend Service
37
- - Mobile App
38
80
  - Library/Package
81
+ - Mobile App
82
+ - Other (describe)
83
+ ```
84
+
85
+ Store the project type - it affects research and structure.
86
+
87
+ #### Step 1.4: Scope Assessment
88
+
89
+ **Goal**: Determine if the scope fits a single PRD or needs to be split.
90
+
91
+ ##### Step 1.4.1: Scope Scoring
92
+
93
+ Score the project using these indicators (1 point each if Multi-PRD threshold is met):
94
+
95
+ | Indicator | Single PRD (0 pts) | Multi-PRD (1 pt) |
96
+ |-----------|-------------------|------------------|
97
+ | User flows | 1-2 main flows | 3+ distinct flows |
98
+ | Major features | 3-5 features | 6+ major features |
99
+ | Technical domains | 1-2 domains | Frontend + Backend + Infra |
100
+ | Estimated tasks | < 25 tasks | 25+ tasks |
101
+ | Timeline | 1-2 weeks | Months of work |
102
+ | User types | 1-2 personas | Multiple distinct personas |
103
+ | External integrations | 0-1 integrations | 2+ integrations |
104
+
105
+ **Scoring interpretation:**
106
+ - **0-2 points**: Single PRD appropriate → proceed to Phase 2
107
+ - **3-4 points**: Consider splitting → discuss with user
108
+ - **5+ points**: Multi-PRD required → actively guide splitting
109
+
110
+ ##### Step 1.4.2: Multi-PRD Project Proposal
111
+
112
+ **If score >= 5**, present a structured breakdown with visual hierarchy:
113
+
114
+ ```
115
+ ## Project Analysis
116
+
117
+ This project scores {X}/7 on scope indicators, suggesting we split it into focused PRDs.
118
+
119
+ ### Recommended PRD Structure
120
+
121
+ ┌─────────────────────────────────────────────────────────────┐
122
+ │ PROJECT: {Project Name} │
123
+ ├─────────────────────────────────────────────────────────────┤
124
+ │ │
125
+ │ PHASE 1: FOUNDATION [tag: foundation] │
126
+ │ ┌─────────────────┐ ┌─────────────────┐ │
127
+ │ │ PRD-1: Setup │───▶│ PRD-2: Auth │ │
128
+ │ │ • CI/CD, deploy │ │ • Login/signup │ │
129
+ │ │ • Base structure│ │ • User model │ │
130
+ │ └─────────────────┘ └────────┬────────┘ │
131
+ │ │ │
132
+ │ PHASE 2: MVP [tag: mvp] ▼ │
133
+ │ ┌─────────────────┐ ┌─────────────────┐ │
134
+ │ │ PRD-3: {Core A} │ │ PRD-4: {Core B} │ │
135
+ │ │ • {feature} │ │ • {feature} │ │
136
+ │ └────────┬────────┘ └────────┬────────┘ │
137
+ │ │ │ │
138
+ │ PHASE 3: ENHANCEMENTS [tag: post-mvp] │
139
+ │ ▼ ▼ │
140
+ │ ┌─────────────────┐ ┌─────────────────┐ │
141
+ │ │ PRD-5: {Enh A} │ │ PRD-6: {Enh B} │ │
142
+ │ └─────────────────┘ └─────────────────┘ │
143
+ │ │
144
+ └─────────────────────────────────────────────────────────────┘
145
+
146
+ ### Dependency Chain
147
+ PRD-1 → PRD-2 → [PRD-3 || PRD-4] → PRD-5, PRD-6
148
+ ```
149
+
150
+ Use AskUserQuestion:
151
+ - "Start with PRD-1 ({foundation PRD name})" (Recommended)
152
+ - "Modify this structure first"
153
+ - "Just create PRD-1 and plan the rest later"
154
+ - "Proceed with single PRD anyway" (not recommended for this scope)
155
+
156
+ ##### Step 1.4.3: Multi-PRD Creation Workflow
157
+
158
+ **When user confirms multi-PRD approach:**
159
+
160
+ 1. **Store project context** for continuation:
161
+ - Project name
162
+ - Full PRD breakdown with dependencies
163
+ - Current position in sequence
164
+
165
+ 2. **Create first PRD** with proper metadata:
166
+ - Set `tag` field (foundation/mvp/post-mvp)
167
+ - Document dependencies in Constraints section
168
+ - Reference future PRDs in Out of Scope ("Authentication is handled in PRD-2")
169
+
170
+ 3. **Track progress** for continuation workflow (Step 3.6)
171
+
172
+ ##### Step 1.4.4: Continuation Workflow
173
+
174
+ After completing any PRD in a multi-PRD project, show progress and offer to continue:
175
+
176
+ ```
177
+ ## PRD Saved: {ref} ({title})
178
+
179
+ ### Project Progress: {Project Name}
180
+ ┌─────────────────────────────────────────────────┐
181
+ │ ✓ PRD-1: Project Setup [foundation] │
182
+ │ ✓ PRD-2: Authentication [foundation] ← Done │
183
+ │ → PRD-3: {Next Feature} [mvp] ← Ready │
184
+ │ ○ PRD-4: {Future Feature} [mvp] │
185
+ │ ○ PRD-5: {Enhancement} [post-mvp] │
186
+ └─────────────────────────────────────────────────┘
187
+
188
+ Next up: PRD-3 "{Next Feature}"
189
+ - Dependencies met: PRD-1, PRD-2 ✓
190
+ - Estimated scope: 15-20 tasks
191
+ ```
192
+
193
+ Use AskUserQuestion:
194
+ - "Continue with PRD-3" (Recommended)
195
+ - "I'll create it later"
196
+ - "Show full project roadmap"
197
+ - "Modify the remaining plan"
198
+
199
+ **When continuing with next PRD:**
200
+ 1. Skip Discovery Phase - context already gathered
201
+ 2. Pre-populate metadata from project plan
202
+ 3. Reference completed PRDs in Technical Context
203
+ 4. Run targeted research for specific scope
204
+ 5. Generate PRD with proper dependency references
205
+
206
+ **Tag Conventions:**
207
+ - `foundation` - Infrastructure, setup, core systems (implement first)
208
+ - `mvp` - Minimum viable product features
209
+ - `mvp-phase-2` - Second wave of core features
210
+ - `post-mvp` - Nice-to-have, future enhancements
211
+ - `experimental` - Exploratory features
212
+
213
+ ---
214
+
215
+ ### Phase 2: Research (Understand Context)
216
+
217
+ **Goal**: Gather technical context to make the PRD specific and implementable.
218
+
219
+ #### Step 2.0: Greenfield Detection & Essential Setup
220
+
221
+ **Before exploring the codebase, check if this is a greenfield project.**
222
+
223
+ ##### Detection
224
+
225
+ Check for project indicators using Glob:
226
+ ```
227
+ - .git directory exists?
228
+ - package.json / go.mod / pyproject.toml / Cargo.toml / etc.?
229
+ - src/ or lib/ directories with code files?
230
+ ```
231
+
232
+ **If ALL indicators are missing → Greenfield project → Trigger setup flow**
233
+
234
+ ##### Essential Setup Flow
235
+
236
+ When greenfield is detected, present:
237
+
238
+ ```
239
+ This looks like a new project without existing setup.
240
+
241
+ Before we create the PRD, let's establish the foundation:
242
+
243
+ **Git Setup**
244
+ - Initialize repository with .gitignore for {detected/chosen tech stack}
245
+ - Create branching structure: main + develop (git flow ready)
246
+ - Initial commit with project structure
247
+
248
+ **Project Structure** (based on {project type from Phase 1})
249
+ {Show recommended minimal structure}
250
+
251
+ **Package Setup**
252
+ - Initialize {package.json / pyproject.toml / go.mod / etc.}
253
+
254
+ Proceed with this setup?
255
+ ```
256
+
257
+ Use AskUserQuestion:
258
+ - "Yes, set up essentials" (Recommended)
259
+ - "Customize setup first"
260
+ - "Skip - I'll set up manually"
261
+
262
+ ##### Essential Setup by Project Type
263
+
264
+ | Project Type | Git | Structure | Package Init |
265
+ |--------------|-----|-----------|--------------|
266
+ | **Web App (Node)** | .gitignore (node) | `src/`, `tests/`, `public/` | package.json |
267
+ | **Web App (Python)** | .gitignore (python) | `src/`, `tests/` | pyproject.toml |
268
+ | **CLI Tool (Node)** | .gitignore (node) | `src/`, `bin/`, `tests/` | package.json with bin |
269
+ | **CLI Tool (Go)** | .gitignore (go) | `cmd/`, `internal/`, `pkg/` | go.mod |
270
+ | **API/Backend** | .gitignore (lang) | `src/`, `tests/`, `config/` | Language-specific |
271
+ | **Library** | .gitignore (lang) | `src/`, `tests/`, `examples/` | Language-specific |
272
+
273
+ ##### Executing Essential Setup
274
+
275
+ When user confirms, execute via Bash:
276
+
277
+ ```bash
278
+ # Git initialization
279
+ git init
280
+ git checkout -b main
281
+ git checkout -b develop
282
+
283
+ # Create .gitignore (use appropriate template for language)
284
+ # Create initial directory structure (mkdir -p)
285
+ # Initialize package manager (npm init -y / go mod init / etc.)
286
+
287
+ # Initial commit
288
+ git add .
289
+ git commit -m "Initial project setup
290
+
291
+ - Initialize git with main/develop branches
292
+ - Add .gitignore for {language}
293
+ - Create project structure
294
+ - Initialize {package manager}
295
+
296
+ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"
297
+
298
+ # Return to develop for feature work
299
+ git checkout develop
300
+ ```
301
+
302
+ ##### Foundation PRD Offer
303
+
304
+ After essential setup completes (or if user skipped), offer comprehensive setup as a tracked PRD:
305
+
306
+ ```
307
+ Foundation is ready. Would you like to track additional setup as a PRD?
308
+
309
+ A Foundation PRD would cover:
310
+ - CI/CD pipeline (GitHub Actions / GitLab CI)
311
+ - Linting & formatting (ESLint+Prettier / Biome / Ruff)
312
+ - Testing framework setup
313
+ - Environment configuration (.env patterns)
314
+ - Pre-commit hooks
315
+
316
+ This gets tracked in Flux so you can implement it systematically.
317
+ ```
318
+
319
+ Use AskUserQuestion:
320
+ - "Create Foundation PRD" - Creates PRD with [tag: foundation], then continues to feature PRD
321
+ - "Skip - continue to feature PRD" (Recommended for simple projects)
322
+
323
+ ##### Foundation PRD Template
324
+
325
+ If user wants a Foundation PRD, create it with this structure:
326
+
327
+ ```markdown
328
+ # Project Foundation
329
+
330
+ > **Tag**: foundation
331
+ > **Depends on**: None
332
+ > **Blocks**: All feature PRDs
333
+
334
+ ## Problem
335
+
336
+ New projects without proper tooling lead to inconsistent code quality,
337
+ manual testing overhead, and deployment friction.
338
+
339
+ ## Users
340
+
341
+ Developers working on this codebase.
342
+
343
+ ## Solution
344
+
345
+ Establish development infrastructure: CI/CD, code quality tools, testing
346
+ framework, and environment management.
347
+
348
+ ## Features
349
+
350
+ ### P0: Must Have
351
+
352
+ - **CI Pipeline**: Automated testing on push/PR
353
+ - **What**: GitHub Actions workflow for test/lint/build
354
+ - **Not**: Deployment pipelines, complex matrix builds
355
+ - **Acceptance Criteria**:
356
+ - [ ] Push to any branch triggers CI
357
+ - [ ] PR cannot merge if CI fails
358
+ - [ ] CI runs tests, linting, and type checking
359
+
360
+ - **Code Quality**: Linting and formatting
361
+ - **What**: {ESLint+Prettier / Biome / Ruff} with pre-commit hooks
362
+ - **Not**: Custom rules beyond standard configs
363
+ - **Acceptance Criteria**:
364
+ - [ ] Lint command runs without errors
365
+ - [ ] Pre-commit hook prevents unlinted commits
366
+ - [ ] Editor integration documented
367
+
368
+ - **Testing Framework**: Test infrastructure
369
+ - **What**: {Jest/Vitest / Pytest / Go test} with coverage
370
+ - **Not**: E2E tests, integration infrastructure
371
+ - **Acceptance Criteria**:
372
+ - [ ] Test command runs and reports coverage
373
+ - [ ] Example test demonstrates patterns
374
+ - [ ] Coverage threshold set (70%)
375
+
376
+ ### P1: Should Have
377
+
378
+ - **Environment Config**: .env management
379
+ - **Documentation**: README with setup instructions
380
+
381
+ ### Out of Scope
382
+ - Deployment pipelines
383
+ - Production infrastructure
384
+ - Monitoring/observability
39
385
  ```
40
386
 
41
- ### Step 2: Problem Statement
387
+ After creating Foundation PRD:
388
+ 1. Save it with `tag: foundation`
389
+ 2. Continue to the user's feature PRD
390
+ 3. Set feature PRD's `Depends on: {Foundation PRD ref}`
391
+
392
+ ---
393
+
394
+ #### Step 2.1: Codebase Research
42
395
 
43
- Ask: "What problem does this solve? (1-2 sentences describing the pain point)"
396
+ Check if there's an existing codebase to analyze:
44
397
 
45
- Store the answer and proceed.
398
+ ```typescript
399
+ // Check for common project indicators
400
+ const hasPackageJson = await glob("package.json");
401
+ const hasGo = await glob("go.mod");
402
+ const hasPython = await glob("pyproject.toml") || await glob("setup.py");
403
+ const hasCargo = await glob("Cargo.toml");
404
+ ```
46
405
 
47
- ### Step 3: Target Users
406
+ If codebase exists, spawn a codebase exploration agent:
48
407
 
49
- Ask: "Who experiences this problem? (Describe your target users)"
408
+ ```
409
+ Use the Task tool with subagent_type="Explore" to research:
50
410
 
51
- Store the answer and proceed.
411
+ 1. Project structure - What's the overall architecture?
412
+ 2. Existing patterns - How are similar features implemented?
413
+ 3. Tech stack - What frameworks, libraries, testing tools?
414
+ 4. Relevant files - What modules might be extended?
52
415
 
53
- ### Step 4: MVP Scope
416
+ Focus on patterns relevant to: {user's described feature}
417
+ ```
54
418
 
55
- Ask: "What's the simplest version that would be useful? (Minimum viable solution)"
419
+ #### Step 2.2: Technology Research (Researcher Agent)
56
420
 
57
- Store the answer and proceed.
421
+ **Spawn the `flux-researcher` agent** when ANY of these conditions apply:
58
422
 
59
- ### Step 5: Core Features
423
+ | Trigger Condition | Example |
424
+ |-------------------|---------|
425
+ | Unfamiliar technology mentioned | "We'll use tRPC" (if you're < 70% confident about it) |
426
+ | External APIs or SDKs involved | "Integrate with Stripe", "Use OpenAI API" |
427
+ | User explicitly asks for research | "Research the best auth library for Node" |
428
+ | Technology comparison needed | "Should we use Prisma or Drizzle?" |
429
+ | Best practices research needed | "What's the standard way to handle file uploads?" |
430
+
431
+ **Spawning the researcher:**
60
432
 
61
- Ask using AskUserQuestion with multiSelect:
62
433
  ```
63
- What are the core features for MVP? (Select all that apply)
64
- - User Authentication
65
- - Data Storage/Persistence
66
- - API Integration
67
- - Real-time Updates
434
+ Task({
435
+ subagent_type: "flux:flux-researcher",
436
+ prompt: `Research the following technologies for PRD context:
437
+
438
+ ## Technologies to Research
439
+ - {technology 1}
440
+ - {technology 2}
441
+
442
+ ## Context
443
+ The user is building: {brief project description}
444
+ Project type: {web app / CLI / API / etc.}
445
+
446
+ ## Questions to Answer
447
+ 1. What is this technology and what problem does it solve?
448
+ 2. Is it actively maintained? What's the ecosystem like?
449
+ 3. What are the key features relevant to this project?
450
+ 4. Are there alternatives we should consider?
451
+ 5. What are common pitfalls to avoid?
452
+
453
+ Return findings in the standard research output format with sources.`,
454
+ description: "Research: {technologies}"
455
+ })
68
456
  ```
69
- Also allow free text for custom features.
70
457
 
71
- ### Step 6: Technical Constraints
458
+ **When NOT to spawn researcher:**
459
+ - Quick fact checks → Use inline WebSearch
460
+ - Looking up syntax → Use Context7 directly
461
+ - Known, mainstream technologies (React, Express, PostgreSQL)
72
462
 
73
- Ask: "Any technical constraints or preferences? (Framework, language, hosting, etc.)"
74
- - If blank, that's fine - proceed with defaults
463
+ #### Step 2.3: Synthesize Findings
75
464
 
76
- ### Step 7: Review & Confirm
465
+ Combine codebase exploration and technology research into actionable context:
77
466
 
78
- Summarize the interview answers:
79
467
  ```
80
- ## PRD Summary
468
+ Based on my research:
469
+
470
+ **Existing Patterns**:
471
+ - {Pattern 1}: Found in {files}
472
+ - {Pattern 2}: Used for {purpose}
81
473
 
82
- **Project Type:** {type}
83
- **Problem:** {problem}
84
- **Target Users:** {users}
85
- **MVP Scope:** {mvp}
86
- **Core Features:** {features}
87
- **Constraints:** {constraints}
474
+ **Tech Stack**:
475
+ - {Framework}: {version}
476
+ - Testing: {approach}
88
477
 
89
- Ready to generate PRD outline?
478
+ **Relevant Code**:
479
+ - {module}: Could be extended for this feature
480
+ - {file}: Contains related functionality
481
+
482
+ **Technology Research** (if researcher agent was used):
483
+ - {Technology}: {key finding}
484
+ - Recommendation: {use/avoid and why}
485
+
486
+ This context will inform the PRD structure.
90
487
  ```
91
488
 
92
- Use AskUserQuestion to confirm:
93
- - Generate PRD Outline (Recommended)
94
- - Edit Answers
95
- - Start Over
489
+ Ask if the user wants to add or correct anything.
96
490
 
97
- ## After Interview Complete
491
+ ---
98
492
 
99
- The `get_project_context` call from Pre-check returns the adapter type. Use this to determine storage behavior.
493
+ ### Phase 3: Generate (Create AI-Ready PRD)
100
494
 
101
- ### For Local Adapter (`adapter.type === "local"`):
495
+ **Goal**: Produce a complete PRD following the prd-writer skill template.
102
496
 
103
- 1. Generate a slug from the PRD title (e.g., "Flux Plugin Versioning" → "flux-plugin-versioning")
104
- 2. Call `create_prd` with title and a short 1-2 sentence description
105
- 3. Write the full PRD markdown to `.flux/prds/{slug}/prd.md`
106
- 4. Call `update_entity` with `folder_path`: `.flux/prds/{slug}`
107
- 5. Inform user of the created PRD ref and file location
497
+ #### Step 3.1: Draft PRD Outline
108
498
 
109
- ### For External Adapters (`adapter.type === "linear"`, `"notion"`, etc.):
499
+ Before writing the full PRD, present an outline for approval:
500
+
501
+ ```
502
+ ## PRD Outline: {Title}
110
503
 
111
- 1. Call `create_prd` with title and a short 1-2 sentence description
112
- 2. Call `update_entity` with `description`: The FULL PRD markdown content
113
- 3. Inform user of the created PRD ref (no local file created)
504
+ **Problem**: {1 sentence}
114
505
 
115
- **Note**: External adapters store PRD content in the external system (Linear issue description, Notion page, etc.). No local files are written.
506
+ **Users**: {Target segment}
116
507
 
117
- ## Resume Interview Flow
508
+ **Solution**: {Core approach}
509
+
510
+ **P0 Features**:
511
+ 1. {Feature 1}: {Brief description}
512
+ 2. {Feature 2}: {Brief description}
513
+ 3. {Feature 3}: {Brief description}
514
+
515
+ **Out of Scope**: {Key exclusions}
516
+
517
+ Does this capture your vision? I can adjust before writing the full PRD.
518
+ ```
118
519
 
119
- 1. Call `get_interview` to get current state
120
- 2. Show progress: "Resuming interview at step {step}/6"
121
- 3. Continue from the last unanswered question
520
+ Use AskUserQuestion:
521
+ - "Looks good, write the full PRD" (Recommended)
522
+ - "Adjust the scope"
523
+ - "Add/remove features"
524
+ - "Start over"
525
+
526
+ #### Step 3.2: Write Full PRD
527
+
528
+ Follow the prd-writer skill template exactly:
529
+ - Include all required sections
530
+ - Write testable acceptance criteria
531
+ - Add edge cases for complex features
532
+ - Include Technical Context from research
533
+ - Mark Open Questions for unresolved items
534
+
535
+ #### Step 3.3: Review with User
536
+
537
+ Present the full PRD and ask for feedback:
538
+ ```
539
+ Here's the complete PRD. Please review:
540
+
541
+ {Full PRD content}
542
+
543
+ ---
544
+
545
+ Any changes needed before I save it?
546
+ ```
547
+
548
+ Use AskUserQuestion:
549
+ - "Save as-is" (Recommended)
550
+ - "Make changes" (then ask what)
551
+ - "Discard and start over"
552
+
553
+ #### Step 3.3a: PRD Critique (Critic Agent)
554
+
555
+ **Before final save**, spawn the `flux-critic` agent to provide objective analysis.
556
+
557
+ **Auto-trigger critique when ANY of these apply:**
558
+
559
+ | Trigger | Threshold |
560
+ |---------|-----------|
561
+ | Scope score from Step 1.4 | >= 3 points |
562
+ | Estimated task count | > 25 tasks |
563
+ | External dependencies | 2+ third-party services |
564
+ | Unfamiliar technologies | Multiple new-to-user techs |
565
+ | User requests review | "Is this feasible?" / "What are the risks?" |
566
+
567
+ **Skip critique when:**
568
+ - Very simple PRD (1-2 features, single domain)
569
+ - User explicitly requests to skip
570
+ - PRD is a refinement of an already-critiqued version
571
+
572
+ **Spawning the critic:**
573
+
574
+ ```
575
+ Task({
576
+ subagent_type: "flux:flux-critic",
577
+ prompt: `Critique this PRD before final approval:
578
+
579
+ ## PRD Content
580
+ ${fullPrdMarkdown}
581
+
582
+ ## Context
583
+ - Project type: ${projectType}
584
+ - Existing codebase: ${hasCodebase ? 'Yes' : 'No (greenfield)'}
585
+ - Scope score: ${scopeScore}/7 from assessment
586
+ - Technologies: ${keyTechnologies}
587
+
588
+ Analyze across these dimensions:
589
+ 1. **Feasibility** - Can this be built with stated constraints?
590
+ 2. **Scope** - Is it right-sized? (Target: 15-25 tasks)
591
+ 3. **Risks** - What could go wrong? What's missing?
592
+ 4. **Alternatives** - Are there simpler approaches?
593
+
594
+ Output your critique in the standard format.`,
595
+ description: "Critique PRD: ${prdTitle}"
596
+ })
597
+ ```
598
+
599
+ **Present critique to user:**
600
+
601
+ ```
602
+ ## PRD Review
603
+
604
+ | Dimension | Assessment | Notes |
605
+ |-----------|------------|-------|
606
+ | Feasibility | {Good/Caution/Concern} | {1-line reason} |
607
+ | Scope | {Good/Caution/Concern} | {1-line reason} |
608
+ | Risks | {Good/Caution/Concern} | {1-line reason} |
609
+
610
+ ### Issues to Address
611
+ {List any critical or high-severity issues from the critique}
612
+
613
+ ### Recommendation
614
+ {Approve / Revise / Rethink}
615
+ ```
616
+
617
+ Use AskUserQuestion:
618
+ - "Save PRD as-is"
619
+ - "Address the issues first" (then iterate)
620
+ - "Skip critique and save" (if user wants to proceed anyway)
621
+
622
+ #### Step 3.4: Store PRD
623
+
624
+ **CRITICAL: Detect adapter type FIRST** by calling `get_project_context`:
625
+
626
+ ```
627
+ mcp__flux__get_project_context()
628
+ → Returns: { adapter: { type: "local" | "linear" | ... }, ... }
629
+ ```
630
+
631
+ **Branch workflow based on `adapter.type`:**
632
+
633
+ ---
634
+
635
+ **For Linear Adapter** (`adapter.type === "linear"`):
636
+
637
+ The Linear adapter stores PRD content in Linear issues. **Do NOT create local files.**
638
+
639
+ 1. Call `create_prd` with title and brief description (1-2 sentences)
640
+ 2. Call `update_entity` with `description: {full PRD markdown}` - this stores the content in Linear
641
+ 3. Confirm: "PRD saved as {ref} in Linear"
642
+
643
+ **Do NOT:**
644
+ - Create local directories
645
+ - Write local `.md` files
646
+ - Set `folder_path`
647
+
648
+ ---
649
+
650
+ **For Local Adapter** (`adapter.type === "local"`):
651
+
652
+ The local adapter stores PRD content in local files. Create the folder structure.
653
+
654
+ 1. Generate slug from title (e.g., "User Auth Flow" → "user-auth-flow")
655
+ 2. Call `create_prd` with title and brief description (1-2 sentences)
656
+ 3. Create directory: `.flux/prds/{slug}/`
657
+ 4. Write full PRD to `.flux/prds/{slug}/prd.md`
658
+ 5. Call `update_entity` with `folder_path: ".flux/prds/{slug}"`
659
+ 6. Confirm: "PRD saved as {ref} at `.flux/prds/{slug}/prd.md`"
660
+
661
+ ---
662
+
663
+ **Adapter Detection Summary:**
664
+
665
+ | Adapter Type | PRD Content Storage | Local Files? |
666
+ |--------------|---------------------|--------------|
667
+ | `local` | `.flux/prds/{slug}/prd.md` | Yes - create folder and files |
668
+ | `linear` | Linear issue description | No - never create local files |
669
+ | `notion` | Notion page | No - never create local files |
670
+ | `specflux` | SpecFlux API | No - never create local files |
671
+
672
+ #### Step 3.5: Offer Supporting Documents
673
+
674
+ Based on project type and complexity, systematically offer relevant supporting documents.
675
+
676
+ ##### Document Recommendation Matrix
677
+
678
+ | Project Type | Recommended | Optional |
679
+ |--------------|-------------|----------|
680
+ | Web Application | Architecture, Wireframes | Data Model, User Flows |
681
+ | API/Backend | Architecture, Data Model | API Contract |
682
+ | CLI Tool | (PRD sufficient) | Architecture (if complex) |
683
+ | Mobile App | Architecture, Wireframes | Data Model, User Flows |
684
+ | Library/Package | Architecture | API Surface |
685
+
686
+ ##### Decision Tree
687
+
688
+ After PRD is approved, ask based on project characteristics:
689
+
690
+ ```
691
+ 1. Is this a UI-heavy feature? (Web/Mobile with 3+ screens)
692
+ → Offer: Wireframes
693
+
694
+ 2. Does it have custom data storage? (New tables, schemas)
695
+ → Offer: Data Model
696
+
697
+ 3. Is it a multi-component system? (Frontend + Backend, or microservices)
698
+ → Offer: Architecture Diagram
699
+
700
+ 4. Are there complex user journeys? (3+ step flows, conditional paths)
701
+ → Offer: User Flow Diagrams
702
+ ```
703
+
704
+ ##### Template: ASCII Wireframes
705
+
706
+ When user wants wireframes, generate using Unicode box-drawing characters:
707
+
708
+ ```markdown
709
+ # Wireframes: {Feature Name}
710
+
711
+ ## {Screen/View Name}
712
+
713
+ ### Desktop Layout (1200px+)
714
+ ┌─────────────────────────────────────────────────────────────────┐
715
+ │ ┌──────────────────────────────────────────────────────────┐ │
716
+ │ │ HEADER: Logo Navigation [User Menu ▼] │ │
717
+ │ └──────────────────────────────────────────────────────────┘ │
718
+ │ │
719
+ │ ┌───────────────────────┐ ┌───────────────────────────────┐ │
720
+ │ │ │ │ │ │
721
+ │ │ SIDEBAR │ │ MAIN CONTENT │ │
722
+ │ │ │ │ │ │
723
+ │ │ ○ Nav Item 1 │ │ ┌─────────────────────────┐ │ │
724
+ │ │ ● Nav Item 2 (active)│ │ │ Card Component │ │ │
725
+ │ │ ○ Nav Item 3 │ │ │ │ │ │
726
+ │ │ │ │ │ [Action] [Secondary] │ │ │
727
+ │ │ │ │ └─────────────────────────┘ │ │
728
+ │ └───────────────────────┘ └───────────────────────────────┘ │
729
+ │ │
730
+ │ ┌──────────────────────────────────────────────────────────┐ │
731
+ │ │ FOOTER: Links | Copyright │ │
732
+ │ └──────────────────────────────────────────────────────────┘ │
733
+ └─────────────────────────────────────────────────────────────────┘
734
+
735
+ ### Mobile Layout (<768px)
736
+ ┌─────────────────────┐
737
+ │ ☰ Logo [User] │
738
+ ├─────────────────────┤
739
+ │ │
740
+ │ Main Content │
741
+ │ │
742
+ │ ┌───────────────┐ │
743
+ │ │ Card │ │
744
+ │ │ │ │
745
+ │ │ [Action] │ │
746
+ │ └───────────────┘ │
747
+ │ │
748
+ ├─────────────────────┤
749
+ │ Tab | Tab | Tab │
750
+ └─────────────────────┘
751
+
752
+ ### Element Descriptions
753
+
754
+ | Element | Type | Behavior |
755
+ |---------|------|----------|
756
+ | Header | Fixed | Sticky top, collapses to hamburger on mobile |
757
+ | Sidebar | Collapsible | Hidden by default on mobile |
758
+ | Card | Interactive | Hover: elevate with shadow; Click: navigate to detail |
759
+ | Nav Item | Button | ● = active, ○ = inactive |
760
+
761
+ ### Interactive States
762
+ - **Hover**: Cards elevate, buttons change color
763
+ - **Active**: Nav items show ● indicator
764
+ - **Loading**: Skeleton placeholders
765
+ - **Empty**: Illustrated empty state with CTA
766
+ ```
767
+
768
+ ##### Template: Mermaid Architecture Diagrams
769
+
770
+ When user wants architecture diagrams, generate using Mermaid syntax:
771
+
772
+ ```markdown
773
+ # Architecture: {System Name}
774
+
775
+ ## System Overview
776
+
777
+ \`\`\`mermaid
778
+ flowchart TB
779
+ subgraph Client["Client Layer"]
780
+ WEB[Web App]
781
+ MOB[Mobile App]
782
+ end
783
+
784
+ subgraph Gateway["API Gateway"]
785
+ GW[Load Balancer]
786
+ end
787
+
788
+ subgraph Services["Service Layer"]
789
+ AUTH[Auth Service]
790
+ API[Core API]
791
+ NOTIFY[Notification Service]
792
+ end
793
+
794
+ subgraph Data["Data Layer"]
795
+ DB[(PostgreSQL)]
796
+ CACHE[(Redis)]
797
+ QUEUE[Message Queue]
798
+ end
799
+
800
+ subgraph External["External Services"]
801
+ EMAIL[Email Provider]
802
+ STORAGE[Cloud Storage]
803
+ end
804
+
805
+ WEB --> GW
806
+ MOB --> GW
807
+ GW --> AUTH
808
+ GW --> API
809
+ API --> DB
810
+ API --> CACHE
811
+ API --> QUEUE
812
+ QUEUE --> NOTIFY
813
+ NOTIFY --> EMAIL
814
+ API --> STORAGE
815
+ \`\`\`
816
+
817
+ ## Key Flow: {Primary User Journey}
818
+
819
+ \`\`\`mermaid
820
+ sequenceDiagram
821
+ participant U as User
822
+ participant C as Client
823
+ participant G as Gateway
824
+ participant A as Auth
825
+ participant API as Core API
826
+ participant DB as Database
827
+
828
+ U->>C: Action
829
+ C->>G: Request
830
+ G->>A: Validate Token
831
+ A-->>G: Valid
832
+ G->>API: Forward Request
833
+ API->>DB: Query/Mutation
834
+ DB-->>API: Result
835
+ API-->>G: Response
836
+ G-->>C: Response
837
+ C-->>U: Update UI
838
+ \`\`\`
839
+
840
+ ## Component Responsibilities
841
+
842
+ | Component | Responsibility | Technology |
843
+ |-----------|---------------|------------|
844
+ | Gateway | Routing, rate limiting, auth validation | nginx/Kong |
845
+ | Auth Service | JWT, sessions, user management | Node.js |
846
+ | Core API | Business logic, data access | {tech stack} |
847
+ | Database | Persistence | PostgreSQL |
848
+ | Cache | Sessions, hot data | Redis |
849
+ ```
850
+
851
+ ##### Template: Data Model Documentation
852
+
853
+ When user wants data model documentation, generate ERD and schema:
854
+
855
+ ```markdown
856
+ # Data Model: {System Name}
857
+
858
+ ## Entity Relationship Diagram
859
+
860
+ \`\`\`mermaid
861
+ erDiagram
862
+ USER {
863
+ uuid id PK
864
+ string email UK
865
+ string password_hash
866
+ string name
867
+ timestamp created_at
868
+ timestamp updated_at
869
+ }
870
+
871
+ RESOURCE {
872
+ uuid id PK
873
+ uuid user_id FK
874
+ string title
875
+ text content
876
+ enum status
877
+ timestamp created_at
878
+ }
879
+
880
+ USER ||--o{ RESOURCE : owns
881
+ \`\`\`
882
+
883
+ ## Table Definitions
884
+
885
+ ### users
886
+ | Column | Type | Constraints | Description |
887
+ |--------|------|-------------|-------------|
888
+ | id | UUID | PK, DEFAULT uuid_generate_v4() | Unique identifier |
889
+ | email | VARCHAR(255) | UNIQUE, NOT NULL | Login email |
890
+ | password_hash | VARCHAR(255) | NOT NULL | Bcrypt hash |
891
+ | name | VARCHAR(100) | NOT NULL | Display name |
892
+ | created_at | TIMESTAMP | DEFAULT NOW() | Creation time |
893
+ | updated_at | TIMESTAMP | DEFAULT NOW() | Last update |
894
+
895
+ ### Indexes
896
+
897
+ | Table | Index | Columns | Type | Purpose |
898
+ |-------|-------|---------|------|---------|
899
+ | users | idx_users_email | email | UNIQUE | Login lookup |
900
+ | resources | idx_resources_user | user_id | BTREE | User's resources |
901
+ | resources | idx_resources_status | status, user_id | BTREE | Filtered queries |
902
+
903
+ ### Enums
904
+
905
+ | Enum | Values | Description |
906
+ |------|--------|-------------|
907
+ | resource_status | pending, active, archived | Lifecycle states |
908
+ ```
909
+
910
+ ##### Saving Supporting Documents
911
+
912
+ **Check `adapter.type` from Pre-Flight Check before creating documents:**
913
+
914
+ **Local Adapter** (`adapter.type === "local"`):
915
+ ```
916
+ .flux/prds/{prd-slug}/
917
+ ├── prd.md # Main PRD
918
+ ├── wireframes.md # UI mockups (if created)
919
+ ├── architecture.md # System diagrams (if created)
920
+ └── data-model.md # Schema design (if created)
921
+ ```
922
+ - Create files using Write tool
923
+ - All documents live in the same folder
924
+
925
+ **Linear/External Adapter** (`adapter.type === "linear"` or other):
926
+ - **Do NOT create local files**
927
+ - Include diagrams inline in the PRD description (Mermaid renders in Linear)
928
+ - Or offer to show the content for the user to copy elsewhere
929
+ - For wireframes, include ASCII art directly in the PRD
930
+
931
+ #### Step 3.6: Multi-PRD Continuation
932
+
933
+ If this PRD was part of a multi-PRD breakdown:
934
+
935
+ ```
936
+ PRD saved: {ref} ({title}) [tag: {tag}]
937
+
938
+ This is part of your {project name} project:
939
+ ✅ {completed PRD} [foundation] - DONE
940
+ → {next PRD} [foundation] - Ready to create
941
+ ○ {future PRD} [mvp] - Waiting on dependencies
942
+
943
+ Would you like to continue with the next PRD?
944
+ ```
945
+
946
+ Use AskUserQuestion:
947
+ - "Continue with {next PRD}" (Recommended)
948
+ - "I'll create it later"
949
+ - "Show full project roadmap"
950
+
951
+ When continuing with next PRD:
952
+ 1. Skip Phase 1 (Discovery) - context is already gathered
953
+ 2. Do targeted research for the specific PRD scope
954
+ 3. Generate PRD with proper dependency references
955
+
956
+ ---
122
957
 
123
958
  ## Refine PRD Flow
124
959
 
125
- 1. Query existing PRDs: `query_entities` with type=prd
126
- 2. If multiple, ask which one to refine
127
- 3. Load PRD content:
128
- - **Local adapter**: Read from `folder_path` (e.g., `.flux/prds/{slug}/prd.md`)
129
- - **External adapters**: Use `description` field from `get_entity`
130
- 4. Ask: "What would you like to change?"
131
- 5. Apply changes and update (follow same adapter-specific flow as creation)
960
+ For `/flux:prd refine` or `/flux:prd refine {ref}`:
961
+
962
+ 1. **Detect adapter**: Call `get_project_context` → store `adapter.type`
963
+ 2. Query existing PRDs: `query_entities` with `type: "prd"`
964
+ 3. If no ref provided and multiple exist, ask which to refine
965
+ 4. Load PRD content based on adapter type:
966
+ - **Local** (`adapter.type === "local"`): Read from `folder_path + "/prd.md"`
967
+ - **Linear/External** (`adapter.type !== "local"`): Get from `description` field via `get_entity`
968
+ 5. Ask: "What would you like to change?"
969
+ 6. Make changes following the same quality standards
970
+ 7. Save using the appropriate method for detected adapter type
971
+
972
+ ---
973
+
974
+ ## Edit Specific PRD
975
+
976
+ For `/flux:prd {ref}` (e.g., `/flux:prd FLUX-P1`):
977
+
978
+ 1. **Detect adapter**: Call `get_project_context` → store `adapter.type`
979
+ 2. Call `get_entity` with ref and `include: ["epics", "tasks", "criteria"]`
980
+ 3. Load full content based on adapter type:
981
+ - **Local**: Read from `folder_path + "/prd.md"`
982
+ - **Linear/External**: Content is in `description` field from `get_entity`
983
+ 4. Present current PRD
984
+ 5. Ask: "What would you like to edit?"
985
+ 6. Apply changes, maintaining structure
986
+ 7. Save using appropriate method for detected adapter type
987
+
988
+ ---
132
989
 
133
990
  ## Guidelines
134
991
 
135
- - One question at a time - don't overwhelm
136
- - Show progress indicators
137
- - Allow going back to previous questions
138
- - Save answers incrementally for resume capability
139
- - Keep it conversational, not robotic
992
+ ### Conversation Quality
993
+ - Be conversational, not robotic
994
+ - Ask one question at a time
140
995
  - If user seems stuck, offer examples
996
+ - Adapt questioning based on their expertise level
997
+
998
+ ### Research Quality
999
+ - Always explore the codebase before drafting (if exists)
1000
+ - Reference specific files and patterns found
1001
+ - Note existing code that can be reused
1002
+
1003
+ ### PRD Quality
1004
+ - Every P0 feature needs the What/Not pattern and testable acceptance criteria
1005
+ - Edge cases should be explicit with expected behavior
1006
+ - Technical context should reference real code paths
1007
+ - Out of Scope prevents scope creep
1008
+
1009
+ ### Autonomy Levels
1010
+ - **High confidence** (clear requirements, familiar domain): Move quickly, fewer questions
1011
+ - **Low confidence** (vague requirements, unfamiliar domain): Ask more questions, do more research
1012
+
1013
+ ---
1014
+
1015
+ ## Agent Spawning Reference
1016
+
1017
+ ### When to Spawn `flux-researcher`
1018
+
1019
+ | Trigger | Action |
1020
+ |---------|--------|
1021
+ | User mentions unfamiliar technology | Spawn with tech research prompt |
1022
+ | Confidence < 70% about approach | Spawn to validate understanding |
1023
+ | External APIs/SDKs involved | Spawn to research integration patterns |
1024
+ | "What is X?" or "Research X" | Spawn explicitly |
1025
+ | Technology comparison needed | Spawn with comparison prompt |
1026
+
1027
+ **Don't spawn for:** Quick fact checks (use WebSearch), known technologies
1028
+
1029
+ ### When to Spawn `flux-critic`
1030
+
1031
+ | Trigger | Action |
1032
+ |---------|--------|
1033
+ | Scope score >= 3 | Auto-trigger after PRD draft |
1034
+ | Estimated tasks > 25 | Auto-trigger after PRD draft |
1035
+ | 2+ external dependencies | Auto-trigger after PRD draft |
1036
+ | User asks "Is this feasible?" | Spawn explicitly |
1037
+ | Multiple unfamiliar technologies | Auto-trigger after PRD draft |
1038
+
1039
+ **Don't spawn for:** Simple PRDs (1-2 features), already-critiqued refinements
1040
+
1041
+ ### Spawning Pattern
1042
+
1043
+ ```
1044
+ Task({
1045
+ subagent_type: "flux:flux-{agent}",
1046
+ prompt: "{detailed prompt with context}",
1047
+ description: "{short description}: {subject}"
1048
+ })
1049
+ ```
1050
+
1051
+ Always include in prompt:
1052
+ - Project context (type, codebase status)
1053
+ - Specific questions to answer
1054
+ - Expected output format