agileflow 2.76.0 → 2.78.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 (124) hide show
  1. package/README.md +3 -3
  2. package/package.json +6 -1
  3. package/scripts/agileflow-configure.js +185 -13
  4. package/scripts/agileflow-statusline.sh +266 -27
  5. package/scripts/agileflow-welcome.js +160 -52
  6. package/scripts/auto-self-improve.js +63 -20
  7. package/scripts/check-update.js +1 -4
  8. package/scripts/damage-control-bash.js +232 -0
  9. package/scripts/damage-control-edit.js +243 -0
  10. package/scripts/damage-control-write.js +243 -0
  11. package/scripts/get-env.js +15 -7
  12. package/scripts/lib/frontmatter-parser.js +4 -1
  13. package/scripts/obtain-context.js +59 -48
  14. package/scripts/ralph-loop.js +25 -13
  15. package/scripts/validate-expertise.sh +19 -15
  16. package/src/core/agents/accessibility.md +124 -53
  17. package/src/core/agents/adr-writer.md +192 -52
  18. package/src/core/agents/analytics.md +139 -60
  19. package/src/core/agents/api.md +173 -63
  20. package/src/core/agents/ci.md +139 -57
  21. package/src/core/agents/compliance.md +159 -68
  22. package/src/core/agents/configuration/damage-control.md +356 -0
  23. package/src/core/agents/database.md +162 -61
  24. package/src/core/agents/datamigration.md +179 -66
  25. package/src/core/agents/design.md +179 -57
  26. package/src/core/agents/devops.md +160 -3
  27. package/src/core/agents/documentation.md +204 -60
  28. package/src/core/agents/epic-planner.md +147 -55
  29. package/src/core/agents/integrations.md +197 -69
  30. package/src/core/agents/mentor.md +158 -57
  31. package/src/core/agents/mobile.md +159 -67
  32. package/src/core/agents/monitoring.md +154 -65
  33. package/src/core/agents/multi-expert.md +115 -43
  34. package/src/core/agents/orchestrator.md +77 -24
  35. package/src/core/agents/performance.md +130 -75
  36. package/src/core/agents/product.md +151 -55
  37. package/src/core/agents/qa.md +162 -74
  38. package/src/core/agents/readme-updater.md +178 -76
  39. package/src/core/agents/refactor.md +148 -95
  40. package/src/core/agents/research.md +143 -72
  41. package/src/core/agents/security.md +154 -65
  42. package/src/core/agents/testing.md +176 -97
  43. package/src/core/agents/ui.md +170 -79
  44. package/src/core/commands/adr/list.md +171 -0
  45. package/src/core/commands/adr/update.md +235 -0
  46. package/src/core/commands/adr/view.md +252 -0
  47. package/src/core/commands/adr.md +207 -50
  48. package/src/core/commands/agent.md +16 -0
  49. package/src/core/commands/assign.md +148 -44
  50. package/src/core/commands/auto.md +18 -1
  51. package/src/core/commands/babysit.md +361 -36
  52. package/src/core/commands/baseline.md +14 -0
  53. package/src/core/commands/blockers.md +170 -51
  54. package/src/core/commands/board.md +144 -66
  55. package/src/core/commands/changelog.md +15 -0
  56. package/src/core/commands/ci.md +179 -69
  57. package/src/core/commands/compress.md +18 -0
  58. package/src/core/commands/configure.md +16 -0
  59. package/src/core/commands/context/export.md +193 -4
  60. package/src/core/commands/context/full.md +191 -18
  61. package/src/core/commands/context/note.md +248 -4
  62. package/src/core/commands/debt.md +17 -0
  63. package/src/core/commands/deploy.md +208 -65
  64. package/src/core/commands/deps.md +15 -0
  65. package/src/core/commands/diagnose.md +16 -0
  66. package/src/core/commands/docs.md +196 -64
  67. package/src/core/commands/epic/list.md +170 -0
  68. package/src/core/commands/epic/view.md +242 -0
  69. package/src/core/commands/epic.md +192 -69
  70. package/src/core/commands/feedback.md +191 -71
  71. package/src/core/commands/handoff.md +162 -48
  72. package/src/core/commands/help.md +9 -0
  73. package/src/core/commands/ideate.md +446 -0
  74. package/src/core/commands/impact.md +16 -0
  75. package/src/core/commands/metrics.md +141 -37
  76. package/src/core/commands/multi-expert.md +77 -0
  77. package/src/core/commands/packages.md +16 -0
  78. package/src/core/commands/pr.md +161 -67
  79. package/src/core/commands/readme-sync.md +16 -0
  80. package/src/core/commands/research/analyze.md +568 -0
  81. package/src/core/commands/research/ask.md +345 -20
  82. package/src/core/commands/research/import.md +562 -19
  83. package/src/core/commands/research/list.md +173 -5
  84. package/src/core/commands/research/view.md +181 -8
  85. package/src/core/commands/retro.md +135 -48
  86. package/src/core/commands/review.md +219 -47
  87. package/src/core/commands/session/end.md +209 -0
  88. package/src/core/commands/session/history.md +210 -0
  89. package/src/core/commands/session/init.md +116 -0
  90. package/src/core/commands/session/new.md +296 -0
  91. package/src/core/commands/session/resume.md +166 -0
  92. package/src/core/commands/session/status.md +166 -0
  93. package/src/core/commands/skill/create.md +115 -17
  94. package/src/core/commands/skill/delete.md +117 -0
  95. package/src/core/commands/skill/edit.md +104 -0
  96. package/src/core/commands/skill/list.md +128 -0
  97. package/src/core/commands/skill/test.md +135 -0
  98. package/src/core/commands/skill/upgrade.md +542 -0
  99. package/src/core/commands/sprint.md +17 -1
  100. package/src/core/commands/status.md +133 -21
  101. package/src/core/commands/story/list.md +176 -0
  102. package/src/core/commands/story/view.md +265 -0
  103. package/src/core/commands/story-validate.md +101 -1
  104. package/src/core/commands/story.md +204 -51
  105. package/src/core/commands/template.md +16 -1
  106. package/src/core/commands/tests.md +226 -64
  107. package/src/core/commands/update.md +17 -1
  108. package/src/core/commands/validate-expertise.md +16 -0
  109. package/src/core/commands/velocity.md +140 -36
  110. package/src/core/commands/verify.md +14 -0
  111. package/src/core/commands/whats-new.md +30 -0
  112. package/src/core/skills/_learnings/README.md +91 -0
  113. package/src/core/skills/_learnings/_template.yaml +106 -0
  114. package/src/core/skills/_learnings/commit.yaml +69 -0
  115. package/src/core/templates/damage-control-patterns.yaml +234 -0
  116. package/src/core/templates/skill-template.md +53 -11
  117. package/tools/cli/commands/list.js +3 -1
  118. package/tools/cli/commands/start.js +180 -0
  119. package/tools/cli/commands/uninstall.js +4 -5
  120. package/tools/cli/commands/update.js +11 -3
  121. package/tools/cli/lib/content-injector.js +6 -1
  122. package/tools/cli/tui/Dashboard.js +66 -0
  123. package/tools/cli/tui/StoryList.js +69 -0
  124. package/tools/cli/tui/index.js +16 -0
@@ -0,0 +1,568 @@
1
+ ---
2
+ description: Analyze existing research for implementation in your project
3
+ argument-hint: [FILE=<filename>]
4
+ compact_context:
5
+ priority: high
6
+ preserve_rules:
7
+ - "ACTIVE COMMAND: /agileflow:research:analyze - Analyze saved research for project implementation"
8
+ - "MUST use EnterPlanMode to gather project context before analyzing"
9
+ - "MUST be project-specific: reference actual files and patterns from user's codebase"
10
+ - "MUST show benefits FIRST before asking for implementation commitment"
11
+ - "MUST intelligently recommend artifact type (ADR/Epic/Stories/Practice) based on scope"
12
+ - "DO NOT assume a one-size-fits-all artifact type"
13
+ - "Research type + analysis determines artifact: Architecture decision→ADR, Large feature→Epic+Stories, Focused improvement→Story"
14
+ state_fields:
15
+ - selected_research_file
16
+ - research_topic
17
+ - plan_mode_active
18
+ - implementation_analysis
19
+ ---
20
+
21
+ # /agileflow:research:analyze
22
+
23
+ Revisit existing research and analyze how it could be implemented in your project.
24
+
25
+ ---
26
+
27
+ ## Purpose
28
+
29
+ After importing research with `/agileflow:research:import`, you may not be ready to implement immediately. Use this command later to:
30
+ - Revisit saved research with fresh context
31
+ - Get a detailed implementation analysis for YOUR project
32
+ - See benefits, changes, and impact before committing
33
+ - Create appropriate artifacts (ADR, Epic, Story) when ready
34
+
35
+ **This is the "I want to do something with that research now" command.**
36
+
37
+ ---
38
+
39
+ <!-- COMPACT_SUMMARY_START -->
40
+
41
+ ## ⚠️ COMPACT SUMMARY - /agileflow:research:analyze IS ACTIVE
42
+
43
+ **CRITICAL**: You are running `/agileflow:research:analyze`. This command bridges saved research to implementation.
44
+
45
+ **ROLE**: Analyze research with project context, show benefits, recommend artifact type.
46
+
47
+ ---
48
+
49
+ ### 🚨 RULE #1: ALWAYS ENTER PLAN MODE FIRST
50
+
51
+ **Before analyzing research, ALWAYS call `EnterPlanMode`.** This gathers project context:
52
+
53
+ ```xml
54
+ <invoke name="EnterPlanMode"/>
55
+ ```
56
+
57
+ Then immediately:
58
+ ```bash
59
+ node .agileflow/scripts/obtain-context.js babysit
60
+ ```
61
+
62
+ **Why**: Generic analysis is worthless. You need to know their specific codebase, patterns, files, tech stack.
63
+
64
+ **❌ WRONG**: Show generic benefits without project context
65
+ **✅ RIGHT**: Reference actual files, patterns, and architecture from their codebase
66
+
67
+ ---
68
+
69
+ ### 🚨 RULE #2: PROJECT-SPECIFIC ANALYSIS ONLY
70
+
71
+ **Every analysis must reference ACTUAL FILES from their codebase.**
72
+
73
+ ```
74
+ ❌ WRONG: "This would improve performance by adding caching"
75
+ ✅ RIGHT: "In src/api/users.ts, you could add Redis caching to getUserById()
76
+ which is called 50+ times per request in the admin dashboard"
77
+ ```
78
+
79
+ **What makes analysis project-specific:**
80
+ - References actual file paths (src/components/Button.tsx, not just "components")
81
+ - Mentions current patterns ("You're using React Query for data fetching, so we'd add a cache layer here")
82
+ - Estimates impact on THEIR code ("Your homepage renders 200+ components, this would fix the 2-second load time")
83
+ - Addresses THEIR tech stack (mentions Next.js if they use it, not generic React)
84
+
85
+ ---
86
+
87
+ ### 🚨 RULE #3: SHOW BENEFITS FIRST, THEN CHANGES
88
+
89
+ **Order matters. Benefits first, implementation complexity second.**
90
+
91
+ Format:
92
+ ```
93
+ 1. What they GAIN (benefits, problems solved)
94
+ 2. How it would be implemented (changes, effort)
95
+ 3. Risks and considerations
96
+ 4. Effort estimate
97
+ 5. Should we implement? (ask for commitment)
98
+ ```
99
+
100
+ **❌ WRONG**: "We'd need to modify 5 files, refactor the auth system, add 2 new dependencies..."
101
+ **✅ RIGHT**: "You'd gain: 40% faster authentication, better session management, reduced security issues.
102
+ To implement, we'd modify 5 files, refactor the auth system..."
103
+
104
+ ---
105
+
106
+ ### 🚨 RULE #4: INTELLIGENT ARTIFACT SELECTION
107
+
108
+ **Research type determines artifact. DON'T default to Epic.**
109
+
110
+ | Research Type | Artifact | Indicators |
111
+ |---|---|---|
112
+ | Architecture/tech decision | **ADR** | "Should we use X or Y?", trade-offs, alternatives, one-time decision |
113
+ | Large feature (5+ steps) | **Epic + Stories** | Multiple files, multiple domains, 3+ day effort |
114
+ | Single focused task | **Story** | 1-3 files, 1-4 hours effort, single domain |
115
+ | Best practices/guidelines | **Practice doc** | "How to do X properly", no feature work |
116
+ | Code quality | **Tech debt item** | Refactoring, no user-facing change |
117
+
118
+ **Example recommendations:**
119
+ - "Upgrade to Next.js 15" → ADR (architecture decision with trade-offs)
120
+ - "Add OAuth integration" → Epic + Stories (multiple files, auth + UI + API)
121
+ - "Fix memory leak in cache" → Story (single issue, focused fix)
122
+ - "Establish error handling patterns" → Practice doc (guidelines, not a feature)
123
+
124
+ ---
125
+
126
+ ### 🚨 RULE #5: ANALYSIS STRUCTURE (MANDATORY)
127
+
128
+ Every implementation analysis must include:
129
+
130
+ ```
131
+ ## 🎯 Benefits of Implementing This Research
132
+ - What they gain (specific to their project)
133
+ - Problems this solves (reference current issues)
134
+ - Why now (relevant to project state)
135
+
136
+ ## 🔧 How It Would Be Implemented
137
+ - Files to modify (with impact table)
138
+ - New files to create
139
+ - Step-by-step implementation
140
+
141
+ ## 🔄 What Would Change
142
+ - Behavior changes (user-facing)
143
+ - Architecture impact (how it affects current design)
144
+ - Dependencies (new packages needed)
145
+
146
+ ## ⚠️ Risks & Considerations
147
+ - Migration complexity
148
+ - Learning curve
149
+ - Breaking changes
150
+
151
+ ## ⏱️ Effort Estimate
152
+ - Scope: Small/Medium/Large
153
+ - Suggested approach: Epic/Story/Quick fix
154
+ ```
155
+
156
+ ---
157
+
158
+ ### ANTI-PATTERNS (DON'T DO THESE)
159
+
160
+ ❌ Skip plan mode and analyze without project context
161
+ ❌ Show generic benefits ("better performance") instead of specific gains
162
+ ❌ Reference files that don't exist in their codebase
163
+ ❌ Assume one artifact type for all research (Epic for everything)
164
+ ❌ Create artifacts without user asking first
165
+ ❌ Finish without asking "Should we implement this?"
166
+
167
+ ### DO THESE INSTEAD
168
+
169
+ ✅ ALWAYS enter plan mode first
170
+ ✅ Get project context (obtain-context.js)
171
+ ✅ Reference actual files and patterns from their codebase
172
+ ✅ Show specific, quantifiable benefits
173
+ ✅ Recommend artifact type based on research scope
174
+ ✅ Confirm user wants to implement before creating anything
175
+
176
+ ---
177
+
178
+ ### WORKFLOW
179
+
180
+ **Phase 1: Select Research**
181
+ 1. List research files if FILE not provided
182
+ 2. User selects which research to analyze
183
+ 3. Read and display the research summary
184
+
185
+ **Phase 2: Gather Context**
186
+ 4. Enter plan mode
187
+ 5. Run obtain-context.js to understand project
188
+ 6. Read relevant source files
189
+ 7. Understand current patterns and architecture
190
+
191
+ **Phase 3: Analyze & Present**
192
+ 8. Write detailed implementation analysis
193
+ 9. Show benefits first, then complexity
194
+ 10. Include project-specific file references
195
+
196
+ **Phase 4: Decide on Artifacts**
197
+ 11. Ask if user wants to proceed
198
+ 12. Recommend artifact type (ADR/Epic/Story/Practice/Tech debt)
199
+ 13. Create artifact if user confirms
200
+
201
+ **Phase 5: Finish**
202
+ 14. Exit plan mode
203
+ 15. Confirm artifact created
204
+ 16. Research is now tracked and ready to implement
205
+
206
+ ---
207
+
208
+ ### KEY FILES TO REMEMBER
209
+
210
+ | File | Purpose |
211
+ |------|---------|
212
+ | `docs/10-research/` | Saved research notes |
213
+ | `.agileflow/scripts/obtain-context.js` | Gather project context |
214
+ | `docs/09-agents/status.json` | Where artifacts are created |
215
+ | `CLAUDE.md` or `README.md` | Project overview |
216
+
217
+ ---
218
+
219
+ ### RESEARCH TYPE TO ARTIFACT MAPPING
220
+
221
+ **Decision/Architecture Research** → ADR
222
+ - Contains "should we use X or Y?"
223
+ - Trade-offs between options
224
+ - Long-term architectural impact
225
+ - One-time decision
226
+
227
+ **Feature/Implementation Research** → Epic + Stories OR Story
228
+ - Step-by-step implementation
229
+ - Spans multiple files/domains → Epic + Stories
230
+ - Single focused task → Story
231
+ - Clear acceptance criteria
232
+
233
+ **Pattern/Best Practice Research** → Practice doc
234
+ - "How to do X properly"
235
+ - Applies to many future tasks
236
+ - Guidelines, not a feature
237
+ - No specific artifact tracking needed
238
+
239
+ ---
240
+
241
+ ### REMEMBER AFTER COMPACTION
242
+
243
+ - `/agileflow:research:analyze` IS ACTIVE - you're analyzing research for implementation
244
+ - ALWAYS enter plan mode and gather context first
245
+ - ALWAYS make analysis project-specific (reference actual files)
246
+ - Show benefits FIRST, then implementation complexity
247
+ - Recommend artifact type based on research scope (not always Epic)
248
+ - Confirm user wants to implement before creating artifacts
249
+
250
+ <!-- COMPACT_SUMMARY_END -->
251
+
252
+ ---
253
+
254
+ ## Arguments
255
+
256
+ | Argument | Required | Description |
257
+ |----------|----------|-------------|
258
+ | FILE | No | Filename of research note (will prompt if not provided) |
259
+
260
+ ---
261
+
262
+ ## IMMEDIATE ACTIONS
263
+
264
+ Upon invocation, execute these steps:
265
+
266
+ ### Step 1: Create Todo List
267
+
268
+ ```xml
269
+ <invoke name="TodoWrite">
270
+ <parameter name="todos">[
271
+ {"content": "Select research note", "status": "in_progress", "activeForm": "Selecting research"},
272
+ {"content": "Display research summary", "status": "pending", "activeForm": "Showing summary"},
273
+ {"content": "Enter plan mode and gather context", "status": "pending", "activeForm": "Gathering context"},
274
+ {"content": "Analyze implementation approach", "status": "pending", "activeForm": "Analyzing approach"},
275
+ {"content": "Present benefits and changes", "status": "pending", "activeForm": "Presenting analysis"},
276
+ {"content": "Confirm interest in implementing", "status": "pending", "activeForm": "Confirming interest"},
277
+ {"content": "Suggest and create artifact", "status": "pending", "activeForm": "Creating artifact"}
278
+ ]</parameter>
279
+ </invoke>
280
+ ```
281
+
282
+ ### Step 2: Select Research Note
283
+
284
+ If FILE not provided, list available research and ask:
285
+
286
+ ```bash
287
+ # Get list of research files
288
+ ls docs/10-research/*.md
289
+ ```
290
+
291
+ ```xml
292
+ <invoke name="AskUserQuestion">
293
+ <parameter name="questions">[{
294
+ "question": "Which research would you like to analyze for implementation?",
295
+ "header": "Select",
296
+ "multiSelect": false,
297
+ "options": [
298
+ {"label": "[Most recent research file]", "description": "[Topic from filename]"},
299
+ {"label": "[Second most recent]", "description": "[Topic]"},
300
+ {"label": "[Third most recent]", "description": "[Topic]"},
301
+ {"label": "Show full list", "description": "See all research notes"}
302
+ ]
303
+ }]</parameter>
304
+ </invoke>
305
+ ```
306
+
307
+ ### Step 3: Read and Summarize Research
308
+
309
+ Read the selected research file:
310
+
311
+ ```bash
312
+ # Read the research note
313
+ cat docs/10-research/[SELECTED_FILE]
314
+ ```
315
+
316
+ Display a brief summary:
317
+
318
+ ```markdown
319
+ ## Research: [Topic]
320
+
321
+ **Imported**: [Date from file]
322
+ **Source**: [Source if available]
323
+
324
+ ### Key Findings
325
+ - [Point 1]
326
+ - [Point 2]
327
+ - [Point 3]
328
+
329
+ ### Action Items from Research
330
+ - [ ] [Item 1]
331
+ - [ ] [Item 2]
332
+ ```
333
+
334
+ ### Step 4: Offer Implementation Analysis
335
+
336
+ ```xml
337
+ <invoke name="AskUserQuestion">
338
+ <parameter name="questions">[{
339
+ "question": "Would you like me to analyze how this research could be implemented in your project?",
340
+ "header": "Analyze",
341
+ "multiSelect": false,
342
+ "options": [
343
+ {"label": "Yes - Enter plan mode and explore (Recommended)", "description": "I'll analyze your codebase and show benefits, implementation steps, and what would change"},
344
+ {"label": "Just view the full research", "description": "Display without analysis"},
345
+ {"label": "Cancel", "description": "Exit"}
346
+ ]
347
+ }]</parameter>
348
+ </invoke>
349
+ ```
350
+
351
+ **If "Just view"**: Display full research content, exit.
352
+ **If "Cancel"**: Exit.
353
+ **If "Yes"**: Continue to Step 5.
354
+
355
+ ### Step 5: Enter Plan Mode and Gather Context
356
+
357
+ ```xml
358
+ <invoke name="EnterPlanMode"/>
359
+ ```
360
+
361
+ Gather project context:
362
+
363
+ ```bash
364
+ node .agileflow/scripts/obtain-context.js babysit
365
+ ```
366
+
367
+ Also read key files to understand the project:
368
+ - `CLAUDE.md` or `README.md` for project overview
369
+ - Relevant source files based on research topic
370
+ - Existing architecture/pattern files
371
+
372
+ **Goal**: Understand:
373
+ - Current project structure
374
+ - Existing patterns that apply
375
+ - Files that would be affected
376
+ - Current tech stack
377
+ - How research findings apply to THIS specific project
378
+
379
+ ### Step 6: Analyze and Present Implementation Plan
380
+
381
+ Based on the research content AND project context, prepare a detailed analysis:
382
+
383
+ ```markdown
384
+ ## Implementation Analysis for "[Research Topic]"
385
+
386
+ ### 🎯 Benefits of Implementing This Research
387
+
388
+ **What you would gain:**
389
+ - [Benefit 1 - specific to this project]
390
+ - [Benefit 2 - quantifiable if possible]
391
+ - [Benefit 3 - addresses current gaps/pain points]
392
+
393
+ **Problems this solves:**
394
+ - [Current issue 1 this addresses]
395
+ - [Current issue 2 this addresses]
396
+
397
+ **Why now?**
398
+ - [Reason this is relevant to current project state]
399
+
400
+ ---
401
+
402
+ ### 🔧 How It Would Be Implemented
403
+
404
+ **Files to modify:**
405
+ | File | Change | Effort |
406
+ |------|--------|--------|
407
+ | `path/to/file1.ts` | [What changes] | Low |
408
+ | `path/to/file2.ts` | [What changes] | Medium |
409
+
410
+ **New files to create:**
411
+ - `path/to/new/file.ts` - [Purpose]
412
+
413
+ **Implementation steps:**
414
+ 1. [Step 1 - specific action]
415
+ 2. [Step 2 - specific action]
416
+ 3. [Step 3 - specific action]
417
+
418
+ ---
419
+
420
+ ### 🔄 What Would Change
421
+
422
+ **Behavior changes:**
423
+ - [User-facing change 1]
424
+ - [Developer experience change]
425
+
426
+ **Architecture impact:**
427
+ - [How this affects current architecture]
428
+ - [New patterns introduced]
429
+
430
+ **Dependencies:**
431
+ - [New packages needed, if any]
432
+ - [Internal dependencies affected]
433
+
434
+ ---
435
+
436
+ ### ⚠️ Risks & Considerations
437
+
438
+ - [Risk 1 - migration complexity, breaking changes, etc.]
439
+ - [Risk 2 - learning curve, team adoption]
440
+ - [Mitigation strategy for each]
441
+
442
+ ---
443
+
444
+ ### ⏱️ Effort Estimate
445
+
446
+ **Scope**: [Small/Medium/Large]
447
+ **Suggested approach**: [Epic with stories / Single story / Quick fix]
448
+ **Estimated effort**: [Low/Medium/High]
449
+ ```
450
+
451
+ Present this analysis to the user.
452
+
453
+ ### Step 7: Confirm Interest in Implementing
454
+
455
+ ```xml
456
+ <invoke name="AskUserQuestion">
457
+ <parameter name="questions">[{
458
+ "question": "Based on this analysis, would you like to proceed with implementation?",
459
+ "header": "Proceed?",
460
+ "multiSelect": false,
461
+ "options": [
462
+ {"label": "Yes - Create implementation artifacts", "description": "I'll suggest the best artifact type based on scope"},
463
+ {"label": "Modify approach first", "description": "Let's adjust the plan before creating artifacts"},
464
+ {"label": "Save analysis to research file", "description": "Append this analysis to the research note for later"},
465
+ {"label": "Cancel", "description": "Exit plan mode, no changes"}
466
+ ]
467
+ }]</parameter>
468
+ </invoke>
469
+ ```
470
+
471
+ **If "Modify approach"**: Discuss changes, update analysis, re-ask.
472
+ **If "Save analysis"**: Append the analysis section to the research file, exit plan mode.
473
+ **If "Cancel"**: Exit plan mode, done.
474
+ **If "Yes"**: Continue to Step 8.
475
+
476
+ ### Step 8: Intelligently Suggest Artifact Type
477
+
478
+ Based on the research content and analysis, determine the BEST artifact to create:
479
+
480
+ | Research Type | Suggested Artifact | Indicators |
481
+ |---------------|-------------------|------------|
482
+ | Architecture/technology decision | **ADR** | "Should we use X or Y?", trade-offs, alternatives |
483
+ | Large feature with multiple parts | **Epic + Stories** | 5+ implementation steps, multiple domains |
484
+ | Single focused improvement | **Story** | Clear scope, 1-3 files, can be done in one session |
485
+ | Best practices/patterns | **Practice doc** | "How to do X", guidelines, not feature work |
486
+ | Code quality improvement | **Tech debt item** | Refactoring, cleanup, no user-facing change |
487
+
488
+ Present the recommendation:
489
+
490
+ ```xml
491
+ <invoke name="AskUserQuestion">
492
+ <parameter name="questions">[{
493
+ "question": "Based on the scope, I recommend creating: [ARTIFACT TYPE]. What would you like to do?",
494
+ "header": "Create",
495
+ "multiSelect": false,
496
+ "options": [
497
+ {"label": "[Recommended artifact] (Recommended)", "description": "[Why this is the right choice]"},
498
+ {"label": "Create ADR instead", "description": "Document this as an architecture decision"},
499
+ {"label": "Create Epic + Stories instead", "description": "Break down into trackable work items"},
500
+ {"label": "Create single Story instead", "description": "Track as a single work item"},
501
+ {"label": "Skip artifact creation", "description": "Analysis is enough for now"}
502
+ ]
503
+ }]</parameter>
504
+ </invoke>
505
+ ```
506
+
507
+ ### Step 9: Create Selected Artifact
508
+
509
+ **If ADR selected**:
510
+ - Use `/agileflow:adr` command format
511
+ - Reference the research file
512
+ - Include key decisions from analysis
513
+
514
+ **If Epic + Stories selected**:
515
+ - Create epic in status.json
516
+ - Generate stories based on implementation steps
517
+ - Reference research in epic
518
+
519
+ **If Story selected**:
520
+ - Create single story with ACs from implementation steps
521
+ - Reference research
522
+
523
+ **If Practice doc selected**:
524
+ - Create doc in `docs/02-practices/`
525
+ - Format as guidelines/best practices
526
+
527
+ After creation, exit plan mode and confirm:
528
+
529
+ ```
530
+ ✅ Created [ARTIFACT] from research "[TOPIC]"
531
+
532
+ - Research: docs/10-research/[filename]
533
+ - Analysis: [appended to research file / separate]
534
+ - [Artifact]: [path or ID]
535
+
536
+ The implementation plan is now tracked and ready to execute.
537
+ ```
538
+
539
+ ---
540
+
541
+ ## Example Usage
542
+
543
+ ```bash
544
+ # Analyze specific research
545
+ /agileflow:research:analyze FILE=20260106-nextjs-best-practices.md
546
+
547
+ # Let command prompt for selection
548
+ /agileflow:research:analyze
549
+ ```
550
+
551
+ ---
552
+
553
+ ## Rules
554
+
555
+ - **Plan mode required**: Always use EnterPlanMode for proper context gathering
556
+ - **Project-specific analysis**: Reference actual files, not generic advice
557
+ - **Benefits first**: Show value before asking for commitment
558
+ - **Intelligent artifacts**: Recommend based on scope, not one-size-fits-all
559
+ - **Preserve research**: Never modify original research content (only append analysis)
560
+
561
+ ---
562
+
563
+ ## Related Commands
564
+
565
+ - `/agileflow:research:import` - Import new research (includes analysis option)
566
+ - `/agileflow:research:view` - Read-only view of research
567
+ - `/agileflow:research:list` - Show all research notes
568
+ - `/agileflow:research:ask` - Generate research prompt for web AI