agileflow 2.99.8 → 3.0.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 (65) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/lib/cache-provider.js +155 -0
  3. package/lib/codebase-indexer.js +1 -1
  4. package/lib/content-sanitizer.js +1 -0
  5. package/lib/dashboard-protocol.js +25 -0
  6. package/lib/dashboard-server.js +184 -133
  7. package/lib/errors.js +18 -0
  8. package/lib/file-cache.js +1 -1
  9. package/lib/flag-detection.js +11 -20
  10. package/lib/git-operations.js +15 -33
  11. package/lib/merge-operations.js +40 -34
  12. package/lib/process-executor.js +199 -0
  13. package/lib/registry-cache.js +13 -47
  14. package/lib/skill-loader.js +206 -0
  15. package/lib/smart-json-file.js +2 -4
  16. package/package.json +1 -1
  17. package/scripts/agileflow-configure.js +13 -12
  18. package/scripts/agileflow-statusline.sh +30 -0
  19. package/scripts/agileflow-welcome.js +181 -212
  20. package/scripts/auto-self-improve.js +3 -3
  21. package/scripts/claude-smart.sh +67 -0
  22. package/scripts/claude-tmux.sh +248 -161
  23. package/scripts/damage-control-multi-agent.js +227 -0
  24. package/scripts/lib/bus-utils.js +471 -0
  25. package/scripts/lib/configure-detect.js +5 -6
  26. package/scripts/lib/configure-features.js +44 -0
  27. package/scripts/lib/configure-repair.js +5 -6
  28. package/scripts/lib/configure-utils.js +2 -3
  29. package/scripts/lib/context-formatter.js +87 -8
  30. package/scripts/lib/damage-control-utils.js +37 -3
  31. package/scripts/lib/file-lock.js +392 -0
  32. package/scripts/lib/ideation-index.js +2 -5
  33. package/scripts/lib/lifecycle-detector.js +123 -0
  34. package/scripts/lib/process-cleanup.js +55 -81
  35. package/scripts/lib/scale-detector.js +357 -0
  36. package/scripts/lib/signal-detectors.js +779 -0
  37. package/scripts/lib/story-state-machine.js +1 -1
  38. package/scripts/lib/sync-ideation-status.js +2 -3
  39. package/scripts/lib/task-registry.js +7 -1
  40. package/scripts/lib/team-events.js +357 -0
  41. package/scripts/messaging-bridge.js +79 -36
  42. package/scripts/migrate-ideation-index.js +37 -14
  43. package/scripts/obtain-context.js +37 -19
  44. package/scripts/ralph-loop.js +3 -4
  45. package/scripts/smart-detect.js +390 -0
  46. package/scripts/team-manager.js +174 -30
  47. package/src/core/commands/audit.md +13 -11
  48. package/src/core/commands/babysit.md +162 -115
  49. package/src/core/commands/changelog.md +21 -4
  50. package/src/core/commands/configure.md +105 -2
  51. package/src/core/commands/debt.md +12 -2
  52. package/src/core/commands/feedback.md +7 -6
  53. package/src/core/commands/ideate/history.md +1 -1
  54. package/src/core/commands/ideate/new.md +5 -5
  55. package/src/core/commands/logic/audit.md +2 -2
  56. package/src/core/commands/pr.md +7 -6
  57. package/src/core/commands/research/analyze.md +28 -20
  58. package/src/core/commands/research/ask.md +43 -0
  59. package/src/core/commands/research/import.md +29 -21
  60. package/src/core/commands/research/list.md +8 -7
  61. package/src/core/commands/research/synthesize.md +356 -20
  62. package/src/core/commands/research/view.md +8 -5
  63. package/src/core/commands/review.md +24 -6
  64. package/src/core/commands/skill/create.md +34 -0
  65. package/tools/cli/lib/docs-setup.js +4 -0
@@ -226,7 +226,7 @@ Be SPECIFIC - reference actual file paths, function names, and code patterns.
226
226
  **Write** (save report):
227
227
  ```xml
228
228
  <invoke name="Write">
229
- <parameter name="file_path">/path/to/docs/08-project/ideation-YYYYMMDD.md</parameter>
229
+ <parameter name="file_path">/path/to/docs/08-project/ideation/ideation-YYYYMMDD.md</parameter>
230
230
  <parameter name="content"># Ideation Report...</parameter>
231
231
  </invoke>
232
232
  ```
@@ -240,7 +240,7 @@ Be SPECIFIC - reference actual file paths, function names, and code patterns.
240
240
 
241
241
  **Categories**: Security, Performance, Code Quality, UX/Design, Testing, API/Architecture
242
242
  **Confidence**: High (2+ experts agree; 3+ for ultradeep), Medium (1 expert with evidence)
243
- **Output**: `docs/08-project/ideation-<YYYYMMDD>.md` | Optional stories
243
+ **Output**: `docs/08-project/ideation/ideation-<YYYYMMDD>.md` | Optional stories
244
244
  <!-- COMPACT_SUMMARY_END -->
245
245
 
246
246
  ---
@@ -664,7 +664,7 @@ For each idea:
664
664
  5. Run `/agileflow:ideate:history` to see full idea backlog
665
665
  ```
666
666
 
667
- **Save report to**: `docs/08-project/ideation-{YYYYMMDD}.md`
667
+ **Save report to**: `docs/08-project/ideation/ideation-{YYYYMMDD}.md`
668
668
 
669
669
  **Update ideation index**: Save the updated index to `docs/00-meta/ideation-index.json`
670
670
 
@@ -735,7 +735,7 @@ After generating output, present options:
735
735
  - 8 ideas with specific evidence → MEDIUM confidence
736
736
  - 6 ideas too vague → excluded
737
737
 
738
- **Step 5**: Generate report with 12 ideas, saved to `docs/08-project/ideation-20260106.md`
738
+ **Step 5**: Generate report with 12 ideas, saved to `docs/08-project/ideation/ideation-20260106.md`
739
739
 
740
740
  **Step 6**: Skipped (OUTPUT=report only)
741
741
 
@@ -758,7 +758,7 @@ After generating output, present options:
758
758
  - 25 ideas with 1-2 experts + evidence → MEDIUM confidence
759
759
  - 32 ideas too vague or single expert without evidence → excluded
760
760
 
761
- **Step 5**: Generate report with 33 ideas, saved to `docs/08-project/ideation-20260106.md`
761
+ **Step 5**: Generate report with 33 ideas, saved to `docs/08-project/ideation/ideation-20260106.md`
762
762
 
763
763
  **Step 6**: Generate 8 stories for HIGH-confidence items
764
764
 
@@ -299,7 +299,7 @@ Total: 7 findings (2 false positives excluded)
299
299
  2. Empty cart not handled in checkout [CONFIRMED by Edge, Flow]
300
300
  3. Type coercion in price calculation [LIKELY - Type]
301
301
 
302
- [Full report saved to docs/08-project/logic-audit-20260203.md]
302
+ [Full report saved to docs/08-project/logic-audits/logic-audit-20260203.md]
303
303
  ```
304
304
 
305
305
  ---
@@ -330,7 +330,7 @@ Total: 7 findings (2 false positives excluded)
330
330
  - LIKELY: 1 analyzer with evidence → Medium priority
331
331
  - INVESTIGATE: 1 analyzer, weak evidence → Low priority
332
332
 
333
- **Output**: `docs/08-project/logic-audit-{YYYYMMDD}.md`
333
+ **Output**: `docs/08-project/logic-audits/logic-audit-{YYYYMMDD}.md`
334
334
  <!-- COMPACT_SUMMARY_END -->
335
335
 
336
336
  ---
@@ -168,17 +168,18 @@ Suggest a commit message following conventional format:
168
168
  </invoke>
169
169
  ```
170
170
 
171
- **AskUserQuestion** (for confirmation):
171
+ **AskUserQuestion** (for confirmation - include context from story):
172
172
  ```xml
173
173
  <invoke name="AskUserQuestion">
174
174
  <parameter name="questions">[{
175
- "question": "Use this PR description?",
176
- "header": "Confirm",
175
+ "question": "PR description ready for [STORY]: [N] files changed, [AC_count] AC items. What next?",
176
+ "header": "PR Action",
177
177
  "multiSelect": false,
178
178
  "options": [
179
- {"label": "Copy to clipboard", "description": "Ready to paste into GitHub"},
180
- {"label": "Edit it", "description": "Let me modify sections"},
181
- {"label": "Cancel", "description": "Don't create PR now"}
179
+ {"label": "Create PR with gh CLI (Recommended)", "description": "Push branch and create PR linking [STORY] with [N] files changed"},
180
+ {"label": "Edit description first", "description": "Modify summary, add test evidence, or adjust sections"},
181
+ {"label": "Add test plan section", "description": "Include testing instructions before creating PR"},
182
+ {"label": "Cancel", "description": "PR description saved, create later"}
182
183
  ]
183
184
  }]</parameter>
184
185
  </invoke>
@@ -367,19 +367,21 @@ ls docs/10-research/*.md
367
367
  ```xml
368
368
  <invoke name="AskUserQuestion">
369
369
  <parameter name="questions">[{
370
- "question": "Which research would you like to analyze for implementation?",
370
+ "question": "Found [N] research notes. Which would you like to analyze for implementation?",
371
371
  "header": "Select",
372
372
  "multiSelect": false,
373
373
  "options": [
374
- {"label": "[Most recent research file]", "description": "[Topic from filename]"},
375
- {"label": "[Second most recent]", "description": "[Topic]"},
376
- {"label": "[Third most recent]", "description": "[Topic]"},
377
- {"label": "Show full list", "description": "See all research notes"}
374
+ {"label": "[actual-filename.md] (Recommended)", "description": "[Actual topic] - imported [date], [N] action items"},
375
+ {"label": "[second-filename.md]", "description": "[Actual topic] - imported [date]"},
376
+ {"label": "[third-filename.md]", "description": "[Actual topic] - imported [date]"},
377
+ {"label": "Show full list", "description": "Browse all [N] research notes"}
378
378
  ]
379
379
  }]</parameter>
380
380
  </invoke>
381
381
  ```
382
382
 
383
+ **Key**: Always populate with ACTUAL filenames and topics from `docs/10-research/`, sorted most-recent first. Include import date and action item count if visible from the index. Mark the most recent as "(Recommended)". If an active story/epic relates to a research topic, prioritize that file instead.
384
+
383
385
  ### Step 3: Assess and Read Research
384
386
 
385
387
  First, assess the research file size and complexity:
@@ -434,18 +436,20 @@ Display a brief summary:
434
436
  ```xml
435
437
  <invoke name="AskUserQuestion">
436
438
  <parameter name="questions">[{
437
- "question": "Would you like me to analyze how this research could be implemented in your project?",
439
+ "question": "'[TOPIC]' has [N] findings and [M] action items. Analyze for implementation?",
438
440
  "header": "Analyze",
439
441
  "multiSelect": false,
440
442
  "options": [
441
- {"label": "Yes - Implementation ideation with multi-expert analysis (Recommended)", "description": "Deploy 3-5 domain experts to analyze from security, performance, testing, and architecture perspectives"},
442
- {"label": "Just view the full research", "description": "Display without analysis"},
443
- {"label": "Cancel", "description": "Exit"}
443
+ {"label": "Implementation ideation with [detected-type] experts (Recommended)", "description": "Deploy [3-5] [expert list] to map [N] findings to your codebase"},
444
+ {"label": "View full research ([SIZE])", "description": "Display the complete note ([LINE_COUNT] lines) for reading"},
445
+ {"label": "Skip for now", "description": "Research saved at docs/10-research/[FILENAME]"}
444
446
  ]
445
447
  }]</parameter>
446
448
  </invoke>
447
449
  ```
448
450
 
451
+ **Key**: Populate `[TOPIC]` with research topic, `[N]`/`[M]` with actual finding and action item counts from the file. Auto-detect research type from content keywords to determine expert list. `[SIZE]` shows file size context (e.g., "12KB" or "small"). `[FILENAME]` is the actual filename. For RLM-needed files (50k+), add "(using RLM for targeted extraction)" to the view description.
452
+
449
453
  **If "Just view"**: Display full research content, exit.
450
454
  **If "Cancel"**: Exit.
451
455
  **If "Yes"**: Continue to Step 5.
@@ -671,19 +675,21 @@ Based on expert consensus: **{ADR/Epic/Story/Practice}**
671
675
  ```xml
672
676
  <invoke name="AskUserQuestion">
673
677
  <parameter name="questions">[{
674
- "question": "Based on this multi-expert analysis, would you like to proceed with implementation?",
678
+ "question": "[N] experts analyzed '[TOPIC]' ([CONSENSUS_LEVEL] consensus, [STEPS] implementation steps). Proceed?",
675
679
  "header": "Proceed?",
676
680
  "multiSelect": false,
677
681
  "options": [
678
- {"label": "Yes - Create implementation artifacts", "description": "I'll create the recommended artifact based on expert consensus"},
679
- {"label": "Modify approach first", "description": "Let's adjust the plan before creating artifacts"},
680
- {"label": "Save analysis to research file", "description": "Append Implementation Ideation Report to the research note for later"},
681
- {"label": "Cancel", "description": "Exit plan mode, no changes"}
682
+ {"label": "Yes - Create [RECOMMENDED_ARTIFACT] (Recommended)", "description": "[STEPS] high-confidence steps across [M] files, ~[EFFORT] effort"},
683
+ {"label": "Modify approach first", "description": "Adjust [specific disagreement or concern area]"},
684
+ {"label": "Save analysis to research file", "description": "Append ideation report to docs/10-research/[FILENAME]"},
685
+ {"label": "Cancel", "description": "Exit plan mode, research unchanged"}
682
686
  ]
683
687
  }]</parameter>
684
688
  </invoke>
685
689
  ```
686
690
 
691
+ **Key**: Populate `[N]` with expert count, `[CONSENSUS_LEVEL]` with High/Medium/Low, `[STEPS]` with count of high-confidence steps, `[M]` with files affected, `[EFFORT]` with consensus effort estimate. For "Modify", reference the specific area where experts had lowest agreement.
692
+
687
693
  **If "Modify approach"**: Discuss changes, update analysis, re-ask.
688
694
  **If "Save analysis"**: Append the Implementation Ideation Report to the research file, exit plan mode.
689
695
  **If "Cancel"**: Exit plan mode, done.
@@ -698,20 +704,22 @@ Based on expert consensus, present the recommendation:
698
704
  ```xml
699
705
  <invoke name="AskUserQuestion">
700
706
  <parameter name="questions">[{
701
- "question": "Based on expert consensus, I recommend creating: [ARTIFACT TYPE]. What would you like to do?",
707
+ "question": "Expert consensus recommends [ARTIFACT_TYPE] for '[TOPIC]'. What would you like to create?",
702
708
  "header": "Create",
703
709
  "multiSelect": false,
704
710
  "options": [
705
- {"label": "[Recommended artifact] (Recommended)", "description": "[Why experts agreed on this choice]"},
706
- {"label": "Create ADR instead", "description": "Document this as an architecture decision"},
707
- {"label": "Create Epic + Stories instead", "description": "Break down into trackable work items"},
708
- {"label": "Create single Story instead", "description": "Track as a single work item"},
709
- {"label": "Skip artifact creation", "description": "Analysis is enough for now"}
711
+ {"label": "[Recommended artifact]: [suggested title] (Recommended)", "description": "[N] experts agreed - [brief reason from consensus]"},
712
+ {"label": "Create Epic + Stories instead", "description": "Break into [estimated N] stories across [domains detected]"},
713
+ {"label": "Create single Story instead", "description": "Track as one work item (~[effort estimate])"},
714
+ {"label": "Create Practice doc instead", "description": "Document as guidelines in docs/02-practices/"},
715
+ {"label": "Skip artifact creation", "description": "Research + ideation report saved, implement later"}
710
716
  ]
711
717
  }]</parameter>
712
718
  </invoke>
713
719
  ```
714
720
 
721
+ **Key**: First option MUST be the actual expert-recommended artifact with a suggested title (e.g., "Epic: OAuth Integration" or "Story: Fix cache invalidation"). Include expert count and brief consensus reason. For alternatives, populate with specifics from expert analysis: estimated story count, detected domains, effort estimate. Remove the recommended artifact from the alternatives list (don't show "Create Epic instead" if Epic is the recommendation).
722
+
715
723
  ---
716
724
 
717
725
  ### Step 11: Create Selected Artifact
@@ -779,6 +779,49 @@ After clicking "Sign in with Google", immediately get unauthorized_client error.
779
779
 
780
780
  ---
781
781
 
782
+ ## Smart Next Steps (AskUserQuestion)
783
+
784
+ After generating the research prompt, suggest contextual next steps:
785
+
786
+ **After prompt generation:**
787
+ ```xml
788
+ <invoke name="AskUserQuestion">
789
+ <parameter name="questions">[{
790
+ "question": "Research prompt for '[TOPIC]' generated ([LINE_COUNT] lines, [CODE_LINES] lines of code). What would you like to do?",
791
+ "header": "Next step",
792
+ "multiSelect": false,
793
+ "options": [
794
+ {"label": "Copy & paste to ChatGPT/Perplexity (Recommended)", "description": "Prompt covers [N] files and [M] specific questions - ready to paste"},
795
+ {"label": "Regenerate with more detail", "description": "Add [missing element: more code from X / error details / attempted solutions]"},
796
+ {"label": "Save prompt to docs/10-research/", "description": "Save as [YYYYMMDD]-prompt-[topic-slug].md for later use"},
797
+ {"label": "Done", "description": "Prompt generated, no further action needed"}
798
+ ]
799
+ }]</parameter>
800
+ </invoke>
801
+ ```
802
+
803
+ **Key**: Always populate `[TOPIC]` with the actual research topic, `[LINE_COUNT]` with the real line count, `[CODE_LINES]` with code snippet line count, `[N]` with number of source files referenced, and `[M]` with number of specific questions. For "Regenerate", identify what's weakest (fewest code lines? no error details? only 1 attempt listed?) and mention it specifically.
804
+
805
+ **After user returns with results:**
806
+ ```xml
807
+ <invoke name="AskUserQuestion">
808
+ <parameter name="questions">[{
809
+ "question": "Got results for '[TOPIC]'. What would you like to do?",
810
+ "header": "Import",
811
+ "multiSelect": false,
812
+ "options": [
813
+ {"label": "Import with /research:import (Recommended)", "description": "Save to docs/10-research/ and optionally run multi-expert ideation"},
814
+ {"label": "Analyze for implementation in [current epic/project]", "description": "Deploy domain experts to map findings to your codebase"},
815
+ {"label": "Ask follow-up about [specific gap]", "description": "Generate deeper prompt on [area needing more detail]"}
816
+ ]
817
+ }]</parameter>
818
+ </invoke>
819
+ ```
820
+
821
+ **Key**: Populate `[TOPIC]` with the research topic. For "Analyze", reference the active epic/story from status.json if one exists, otherwise use "your project". For "Ask follow-up", identify the weakest area of the response (incomplete code example? missing edge case? unclear on versioning?) and reference it specifically.
822
+
823
+ ---
824
+
782
825
  ## Related Commands
783
826
 
784
827
  - `/agileflow:research:analyze` - Analyze existing research for implementation
@@ -625,17 +625,19 @@ Display the formatted research file for review.
625
625
  ```xml
626
626
  <invoke name="AskUserQuestion">
627
627
  <parameter name="questions">[{
628
- "question": "Save this research file?",
628
+ "question": "Save '[TOPIC]' to docs/10-research/[FILENAME]? ([N] key findings, [M] code snippets, [K] action items)",
629
629
  "header": "Confirm",
630
630
  "multiSelect": false,
631
631
  "options": [
632
- {"label": "Yes, save to docs/10-research/", "description": "Write file and update index"},
633
- {"label": "No, cancel", "description": "Cancel without saving"}
632
+ {"label": "Yes, save to docs/10-research/ (Recommended)", "description": "Write [FILENAME] and update research index ([TOTAL] notes total)"},
633
+ {"label": "No, make changes first", "description": "Cancel, I'll revise before saving"}
634
634
  ]
635
635
  }]</parameter>
636
636
  </invoke>
637
637
  ```
638
638
 
639
+ **Key**: Populate `[TOPIC]` with research topic, `[FILENAME]` with the generated filename (YYYYMMDD-slug.md), `[N]`/`[M]`/`[K]` with actual counts of key findings, code snippets, and action items extracted. `[TOTAL]` is the count of existing notes + 1.
640
+
639
641
  ### Step 7: Save Research File
640
642
 
641
643
  If YES:
@@ -662,26 +664,28 @@ After saving, ask if the user wants to understand how this research applies to t
662
664
  ```xml
663
665
  <invoke name="AskUserQuestion">
664
666
  <parameter name="questions">[{
665
- "question": "Would you like me to analyze how this research could be implemented in your project?",
667
+ "question": "Saved '[TOPIC]' ([N] findings, [M] action items). Analyze for implementation?",
666
668
  "header": "Analyze",
667
669
  "multiSelect": false,
668
670
  "options": [
669
- {"label": "Yes - Implementation ideation with multi-expert analysis (Recommended)", "description": "Deploy 3-5 domain experts to analyze from security, performance, testing, and architecture perspectives"},
670
- {"label": "No - Just save the research", "description": "Keep as reference, I can analyze later"},
671
- {"label": "Link to existing Epic/Story", "description": "Reference from current work without full analysis"}
671
+ {"label": "Implementation ideation with multi-expert analysis (Recommended)", "description": "Deploy [3-5] [detected-type] experts to analyze from [relevant perspectives]"},
672
+ {"label": "Save as reference for later", "description": "Saved to docs/10-research/[FILENAME] - analyze anytime with /research:analyze"},
673
+ {"label": "Link to [ACTIVE-STORY-OR-EPIC]", "description": "Add research reference to [story/epic title] without full analysis"}
672
674
  ]
673
675
  }]</parameter>
674
676
  </invoke>
675
677
  ```
676
678
 
677
- **If "Link to existing"**: Add to the target document and finish:
679
+ **Key**: Populate `[TOPIC]` with research topic, `[N]`/`[M]` with actual counts. For the expert option, auto-detect research type (security→"security, api, testing", performance→"performance, database, api", etc.) and list the specific expert perspectives. For "Link to", use the active story/epic ID and title from status.json. If no active work, show "Link to existing Epic/Story" instead. For "Save as reference", include the actual filename that was saved.
680
+
681
+ **If "Link"**: Add to the target document and finish:
678
682
  ```markdown
679
683
  **Research**: See [Topic Research](../10-research/YYYYMMDD-topic-slug.md)
680
684
  ```
681
685
 
682
- **If "No"**: Research is saved, exit gracefully.
686
+ **If "Save as reference"**: Research is saved, exit gracefully.
683
687
 
684
- **If "Yes"**: Continue to Step 10.
688
+ **If "Analyze"**: Continue to Step 10.
685
689
 
686
690
  ---
687
691
 
@@ -906,19 +910,21 @@ Based on expert consensus: **{ADR/Epic/Story/Practice}**
906
910
  ```xml
907
911
  <invoke name="AskUserQuestion">
908
912
  <parameter name="questions">[{
909
- "question": "Based on this multi-expert analysis, would you like to proceed with implementation?",
913
+ "question": "[N] experts analyzed '[TOPIC]' ([CONSENSUS_LEVEL] consensus). Proceed with implementation?",
910
914
  "header": "Proceed?",
911
915
  "multiSelect": false,
912
916
  "options": [
913
- {"label": "Yes - Create implementation artifacts", "description": "I'll create the recommended artifact based on expert consensus"},
914
- {"label": "Modify approach first", "description": "Let's adjust the plan before creating artifacts"},
915
- {"label": "Save analysis only", "description": "Exit plan mode, keep research + analysis for later"},
916
- {"label": "Cancel", "description": "Exit plan mode, research already saved"}
917
+ {"label": "Yes - Create [RECOMMENDED_ARTIFACT] (Recommended)", "description": "[N] high-confidence steps identified across [M] files"},
918
+ {"label": "Modify approach first", "description": "Adjust [specific area of disagreement or concern]"},
919
+ {"label": "Save analysis to research file", "description": "Append ideation report to [FILENAME] for later"},
920
+ {"label": "Cancel", "description": "Exit plan mode, research saved at docs/10-research/[FILENAME]"}
917
921
  ]
918
922
  }]</parameter>
919
923
  </invoke>
920
924
  ```
921
925
 
926
+ **Key**: Populate `[N]` with number of experts consulted, `[TOPIC]` with research topic, `[CONSENSUS_LEVEL]` with High/Medium/Low. For "Create", use the actual recommended artifact type (Epic + Stories / Story / Practice doc). For "Modify", reference the specific area where experts disagreed or had concerns. `[FILENAME]` is the actual saved research file.
927
+
922
928
  **If "Modify approach"**: Discuss changes, update analysis, re-ask.
923
929
  **If "Save analysis only"**: Append Implementation Ideation Report to the research file, exit plan mode.
924
930
  **If "Cancel"**: Exit plan mode, done.
@@ -933,20 +939,22 @@ Based on expert consensus, present the recommendation:
933
939
  ```xml
934
940
  <invoke name="AskUserQuestion">
935
941
  <parameter name="questions">[{
936
- "question": "Based on expert consensus, I recommend creating: [ARTIFACT TYPE]. What would you like to do?",
942
+ "question": "Expert consensus recommends [ARTIFACT_TYPE] for '[TOPIC]'. What would you like to create?",
937
943
  "header": "Create",
938
944
  "multiSelect": false,
939
945
  "options": [
940
- {"label": "[Recommended artifact] (Recommended)", "description": "[Why experts agreed on this choice]"},
941
- {"label": "Create ADR instead", "description": "Document this as an architecture decision"},
942
- {"label": "Create Epic + Stories instead", "description": "Break down into trackable work items"},
943
- {"label": "Create single Story instead", "description": "Track as a single work item"},
944
- {"label": "Skip artifact creation", "description": "Research and analysis are enough for now"}
946
+ {"label": "[Recommended artifact]: [suggested title] (Recommended)", "description": "[N] experts agreed - [brief reason from consensus]"},
947
+ {"label": "Create Epic + Stories instead", "description": "Break into [estimated N] stories across [domains detected]"},
948
+ {"label": "Create single Story instead", "description": "Track as one work item (~[effort estimate])"},
949
+ {"label": "Create Practice doc instead", "description": "Document as guidelines in docs/02-practices/"},
950
+ {"label": "Skip artifact creation", "description": "Research + ideation report saved, implement later"}
945
951
  ]
946
952
  }]</parameter>
947
953
  </invoke>
948
954
  ```
949
955
 
956
+ **Key**: First option MUST be the actual expert-recommended artifact with a suggested title (e.g., "Epic: OAuth Integration" or "Story: Fix cache invalidation"). Include expert count and brief consensus reason. For alternatives, populate with specifics: estimated story count, detected domains (API+UI, Database+API, etc.), and effort estimate from experts. Remove the recommended artifact from the alternatives list (don't show "Create Epic instead" if Epic is the recommendation).
957
+
950
958
  ---
951
959
 
952
960
  ### Step 16: Create Selected Artifact
@@ -125,25 +125,26 @@ Quick actions:
125
125
  - /agileflow:research:import TOPIC="..." - Import external content
126
126
  ```
127
127
 
128
- Or use AskUserQuestion:
128
+ Use AskUserQuestion with contextual options based on what was found:
129
129
 
130
130
  ```xml
131
131
  <invoke name="AskUserQuestion">
132
132
  <parameter name="questions">[{
133
- "question": "What would you like to do?",
133
+ "question": "Found N research notes. What would you like to do?",
134
134
  "header": "Actions",
135
135
  "multiSelect": false,
136
136
  "options": [
137
- {"label": "View a research note", "description": "Read specific research"},
138
- {"label": "Analyze research for implementation", "description": "Enter plan mode"},
139
- {"label": "Create new research prompt", "description": "/agileflow:research:ask"},
140
- {"label": "Import external content", "description": "/agileflow:research:import"},
141
- {"label": "Done", "description": "Exit"}
137
+ {"label": "View '[most-recent-filename]' (Recommended)", "description": "Most recent note from [date] on [topic]"},
138
+ {"label": "Analyze research for implementation", "description": "Deploy multi-expert analysis on a specific note"},
139
+ {"label": "Generate new research prompt", "description": "Create a detailed prompt for ChatGPT/Perplexity"},
140
+ {"label": "Done", "description": "N notes listed, no further action"}
142
141
  ]
143
142
  }]</parameter>
144
143
  </invoke>
145
144
  ```
146
145
 
146
+ **Key**: Always populate the first option with the ACTUAL most recent filename and topic, not a generic "View a note".
147
+
147
148
  ---
148
149
 
149
150
  ### ANTI-PATTERNS (DON'T DO THESE)