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
@@ -10,12 +10,19 @@ compact_context:
10
10
  - "Find CONSENSUS (2+ files agree = HIGH), UNIQUE (1 file = verify), CONFLICTS (disagreement = flag)"
11
11
  - "Show synthesis BEFORE recommending artifacts (diff-first)"
12
12
  - "Use confidence scoring: HIGH (2+ agree), UNIQUE (1 file), CONFLICT (disagree)"
13
+ - "After synthesis, offer Implementation Ideation with multi-expert analysis (like /research:import)"
14
+ - "If ideation requested: EnterPlanMode → deploy 3-5 experts IN PARALLEL → synthesize → Implementation Ideation Report"
15
+ - "Intelligent artifact recommendation based on research type (not always ADR/Epic)"
13
16
  - "Always end with AskUserQuestion for next steps"
14
17
  state_fields:
15
18
  - selected_files
16
19
  - metadata_extracted
17
20
  - consensus_findings
18
21
  - conflicts_found
22
+ - analysis_requested
23
+ - experts_deployed
24
+ - expert_results
25
+ - consensus_level
19
26
  ---
20
27
 
21
28
  # /agileflow:research:synthesize
@@ -48,9 +55,9 @@ node .agileflow/scripts/obtain-context.js research:synthesize
48
55
 
49
56
  ## ⚠️ COMPACT SUMMARY - /agileflow:research:synthesize IS ACTIVE
50
57
 
51
- **CRITICAL**: You are running `/agileflow:research:synthesize`. This command queries across multiple research files.
58
+ **CRITICAL**: You are running `/agileflow:research:synthesize`. This command queries across multiple research files and optionally analyzes for implementation.
52
59
 
53
- **ROLE**: Find patterns, consensus, and conflicts across research. Apply confidence scoring.
60
+ **ROLE**: Find patterns, consensus, and conflicts across research. Apply confidence scoring. Optionally deploy multi-expert analysis for implementation ideation.
54
61
 
55
62
  ---
56
63
 
@@ -175,28 +182,118 @@ Different approaches recommended:
175
182
 
176
183
  ---
177
184
 
178
- ### 🚨 RULE #6: END WITH AskUserQuestion
185
+ ### 🚨 RULE #6: END WITH AskUserQuestion (OFFER IDEATION)
179
186
 
180
- **After showing synthesis, ask what to do next:**
187
+ **After showing synthesis, offer implementation ideation (like /research:import):**
181
188
 
182
189
  ```xml
183
190
  <invoke name="AskUserQuestion">
184
191
  <parameter name="questions">[{
185
- "question": "What would you like to do with this synthesis?",
192
+ "question": "Synthesis of '[TOPIC]': [N] consensus findings, [M] conflicts across [K] files. What next?",
186
193
  "header": "Next step",
187
194
  "multiSelect": false,
188
195
  "options": [
189
- {"label": "Save synthesis report", "description": "Save to docs/10-research/ as synthesis note"},
190
- {"label": "Create ADR from consensus", "description": "Document architectural decision"},
191
- {"label": "Create Epic + Stories", "description": "Break down into trackable work"},
192
- {"label": "Flag conflicts for review", "description": "Mark outdated research for update"},
193
- {"label": "Narrow scope - different topic", "description": "Try different search keywords"},
194
- {"label": "Done", "description": "Exit synthesis"}
196
+ {"label": "Implementation ideation with [detected-type] experts (Recommended)", "description": "Deploy [3-5] experts ([expert list]) to analyze [N] consensus findings for your codebase"},
197
+ {"label": "Save synthesis report", "description": "Save to docs/10-research/[YYYYMMDD]-synthesis-[slug].md"},
198
+ {"label": "Flag [M] conflicts for review", "description": "Mark conflicting research on [conflict topics] for update"},
199
+ {"label": "Narrow scope - different topic", "description": "Current: '[TOPIC]' matched [K] files - try different keywords"},
200
+ {"label": "Done", "description": "Synthesis complete, [N] consensus + [M] conflicts documented"}
195
201
  ]
196
202
  }]</parameter>
197
203
  </invoke>
198
204
  ```
199
205
 
206
+ **Key**: Populate `[TOPIC]` with search topic, `[N]` with consensus finding count, `[M]` with conflict count, `[K]` with files analyzed count. For ideation, auto-detect expert type from synthesis content and list specific experts (e.g., "security, api, testing"). For "Flag conflicts", reference the actual conflict topics found. If no conflicts found (M=0), replace that option with "Synthesize with additional files" or remove it.
207
+
208
+ ---
209
+
210
+ ### 🚨 RULE #7: IMPLEMENTATION IDEATION = PLAN MODE + MULTI-EXPERT ANALYSIS
211
+
212
+ **When user requests ideation, you MUST:**
213
+
214
+ 1. **Enter plan mode**:
215
+ ```xml
216
+ <invoke name="EnterPlanMode"/>
217
+ ```
218
+
219
+ 2. **Gather project context**:
220
+ ```bash
221
+ node .agileflow/scripts/obtain-context.js babysit
222
+ ```
223
+
224
+ 3. **Deploy 3-5 domain experts IN PARALLEL** (see RULE #9 for expert selection)
225
+
226
+ 4. **Synthesize results** with confidence scoring
227
+
228
+ **Why**: Single-perspective analysis misses domain-specific considerations. Multi-expert analysis provides security, performance, testing, and architecture perspectives for comprehensive implementation guidance.
229
+
230
+ ---
231
+
232
+ ### 🚨 RULE #8: SHOW BENEFITS FIRST IN ANALYSIS
233
+
234
+ **Order matters: Benefits → Implementation → Complexity → Risks.**
235
+
236
+ ```
237
+ ❌ WRONG: "We'd modify 5 files, add 2 dependencies, refactor the system..."
238
+ ✅ RIGHT: "You'd gain: 40% faster auth, better security, cleaner codebase.
239
+ To implement, we'd modify 5 files, add 2 dependencies..."
240
+ ```
241
+
242
+ ---
243
+
244
+ ### 🚨 RULE #9: IMPLEMENTATION IDEATION (Multi-Expert Analysis)
245
+
246
+ When user requests "Implementation ideation with multi-expert analysis":
247
+
248
+ 1. **Enter Plan Mode** and auto-detect research type to select experts
249
+ 2. **Deploy 3-5 experts IN PARALLEL** (like /ideate pattern)
250
+ 3. **Each expert analyzes from their domain perspective**:
251
+ - Implementation fit for codebase
252
+ - Domain-specific considerations
253
+ - Recommended approach with specific files
254
+ - Risks and gotchas
255
+ 4. **Synthesize with confidence scoring**:
256
+ - HIGH CONFIDENCE: 2+ experts agree on approach/files
257
+ - MEDIUM CONFIDENCE: 1 expert with specific evidence
258
+ 5. **Present unified Implementation Ideation Report** with expert consensus
259
+
260
+ **Expert Selection by Research Type:**
261
+
262
+ | Research Type | Experts (Deploy ALL in parallel) |
263
+ |--------------|--------------------------------|
264
+ | Architecture/Framework | api, database, performance, security (4) |
265
+ | Feature Implementation | api, ui, testing, database (4) |
266
+ | Security/Compliance | security, api, testing, compliance (4) |
267
+ | Performance | performance, database, api, monitoring (4) |
268
+ | Best Practices | refactor, testing, documentation (3) |
269
+ | Full-Stack (default) | api, ui, database, testing, security (5) |
270
+
271
+ **Detection Keywords:**
272
+ - **Security**: auth, oauth, jwt, encryption, vulnerability, compliance
273
+ - **Performance**: cache, optimize, latency, throughput, benchmark
274
+ - **Architecture**: migrate, upgrade, framework, refactor, redesign
275
+ - **UI**: component, styling, accessibility, ux, design system
276
+ - **Database**: schema, migration, query, index, model
277
+
278
+ ---
279
+
280
+ ### 🚨 RULE #10: INTELLIGENT ARTIFACT SELECTION
281
+
282
+ **Recommend artifact type based on expert consensus. DON'T default to ADR or Epic.**
283
+
284
+ | Research Type | Artifact | Indicators |
285
+ |---|---|---|
286
+ | Architecture/tech decision | **ADR** | Trade-offs, "use X or Y?", one-time decision |
287
+ | Large feature (5+ steps) | **Epic + Stories** | Multiple files, multiple domains, 3+ days |
288
+ | Single focused task | **Story** | 1-3 files, 1-4 hours, single domain |
289
+ | Best practices/guidelines | **Practice doc** | "How to do X", guidelines, no feature work |
290
+ | Code quality/refactoring | **Tech debt item** | No user-facing change, improvement |
291
+
292
+ **Example recommendations:**
293
+ - "Upgrade to Next.js 15" → ADR
294
+ - "Add OAuth" → Epic + Stories (multiple domains)
295
+ - "Fix cache bug" → Story (single issue)
296
+
200
297
  ---
201
298
 
202
299
  ### ANTI-PATTERNS (DON'T DO THESE)
@@ -207,6 +304,9 @@ Different approaches recommended:
207
304
  ❌ Jump to artifact creation without showing synthesis first
208
305
  ❌ Ignore conflicts - they must be flagged
209
306
  ❌ Treat all findings as equal - use confidence scoring
307
+ ❌ Single-perspective analysis (shallow, misses domain considerations)
308
+ ❌ Deploy experts one at a time (MUST be parallel)
309
+ ❌ Assume ADR is the right artifact for all synthesis
210
310
  ❌ End without AskUserQuestion
211
311
 
212
312
  ### DO THESE INSTEAD
@@ -217,6 +317,10 @@ Different approaches recommended:
217
317
  ✅ Apply confidence scoring (HIGH/UNIQUE/CONFLICT)
218
318
  ✅ Show full synthesis before offering artifacts
219
319
  ✅ Flag conflicts for human review
320
+ ✅ Offer implementation ideation with multi-expert analysis
321
+ ✅ Deploy 3-5 domain experts IN PARALLEL for multi-perspective analysis
322
+ ✅ Synthesize expert results with confidence scoring
323
+ ✅ Recommend artifact type based on expert consensus (not always ADR)
220
324
  ✅ Always end with AskUserQuestion
221
325
 
222
326
  ---
@@ -256,9 +360,18 @@ Different approaches recommended:
256
360
  - Related Artifacts
257
361
  - Timeline
258
362
 
259
- **Phase 6: Present & Next Steps**
363
+ **Phase 6: Present & Offer Ideation**
260
364
  14. Show synthesis report to user
261
- 15. Ask what to do next via AskUserQuestion
365
+ 15. Ask what to do next via AskUserQuestion (offer ideation)
366
+
367
+ **Phase 7: Implementation Ideation (If Requested)**
368
+ 16. Enter plan mode + select 3-5 domain experts
369
+ 17. Deploy experts IN PARALLEL (Task tool with run_in_background)
370
+ 18. Collect results (TaskOutput) + synthesize with confidence scoring
371
+ 19. Present Implementation Ideation Report
372
+ 20. Confirm interest in proceeding
373
+ 21. Recommend artifact type based on expert consensus
374
+ 22. Create artifact if user confirms
262
375
 
263
376
  ---
264
377
 
@@ -281,6 +394,11 @@ Different approaches recommended:
281
394
  - Apply confidence scoring: HIGH (2+ agree), UNIQUE (1 file), CONFLICT (disagree)
282
395
  - Show synthesis BEFORE offering artifacts
283
396
  - Flag conflicts for human review
397
+ - Offer Implementation Ideation with multi-expert analysis (like /research:import)
398
+ - If ideation requested: enter plan mode + deploy 3-5 domain experts IN PARALLEL
399
+ - Synthesize expert results with confidence scoring (HIGH = 2+ agree)
400
+ - Present Implementation Ideation Report with expert consensus
401
+ - Recommend artifact type based on expert consensus (not always ADR)
284
402
  - End with AskUserQuestion for next steps
285
403
 
286
404
  <!-- COMPACT_SUMMARY_END -->
@@ -529,21 +647,239 @@ Show the full synthesis report, then:
529
647
  ```xml
530
648
  <invoke name="AskUserQuestion">
531
649
  <parameter name="questions">[{
532
- "question": "What would you like to do with this synthesis?",
650
+ "question": "Synthesis of '[TOPIC]': [N] consensus findings, [M] conflicts across [K] files. What next?",
533
651
  "header": "Next step",
534
652
  "multiSelect": false,
535
653
  "options": [
536
- {"label": "Save synthesis report (Recommended)", "description": "Save to docs/10-research/ as synthesis note"},
537
- {"label": "Create ADR from consensus", "description": "Document architectural decision based on agreed findings"},
538
- {"label": "Create Epic + Stories", "description": "Break down implementation based on synthesis"},
539
- {"label": "Flag conflicts for review", "description": "Mark conflicting research for update"},
540
- {"label": "Try different topic", "description": "Synthesize different research area"},
541
- {"label": "Done", "description": "Exit synthesis"}
654
+ {"label": "Implementation ideation with [detected-type] experts (Recommended)", "description": "Deploy [3-5] experts ([expert list]) to analyze [N] consensus findings for your codebase"},
655
+ {"label": "Save synthesis report", "description": "Save to docs/10-research/[YYYYMMDD]-synthesis-[slug].md"},
656
+ {"label": "Flag [M] conflicts for review", "description": "Mark conflicting research on [conflict topics] for update"},
657
+ {"label": "Try different topic", "description": "Current: '[TOPIC]' matched [K] files - try different keywords"},
658
+ {"label": "Done", "description": "Synthesis complete, [N] consensus + [M] conflicts documented"}
659
+ ]
660
+ }]</parameter>
661
+ </invoke>
662
+ ```
663
+
664
+ **Key**: Same smart population rules as RULE #6 above. Populate all `[bracketed]` values with actual data from the synthesis. If no conflicts (M=0), replace "Flag conflicts" with "Synthesize with additional files". Auto-detect expert type from synthesis findings.
665
+
666
+ **If "Implementation ideation"**: Continue to Step 8.
667
+ **If "Save synthesis report"**: Save and update index (see Saving section below).
668
+ **If other**: Handle accordingly.
669
+
670
+ ---
671
+
672
+ ### Step 8: Enter Plan Mode and Select Experts
673
+
674
+ ```xml
675
+ <invoke name="EnterPlanMode"/>
676
+ ```
677
+
678
+ Then immediately gather project context:
679
+
680
+ ```bash
681
+ node .agileflow/scripts/obtain-context.js babysit
682
+ ```
683
+
684
+ **Auto-detect research type and select experts:**
685
+
686
+ Analyze the TOPIC and synthesis findings to determine research type, then select 3-5 experts:
687
+
688
+ | Research Type | Detection Keywords | Experts |
689
+ |--------------|-------------------|---------|
690
+ | **Security/Compliance** | auth, oauth, jwt, encryption, vulnerability, compliance, csrf, xss | security, api, testing, compliance |
691
+ | **Performance** | cache, optimize, latency, throughput, benchmark, profiling | performance, database, api, monitoring |
692
+ | **Architecture/Framework** | migrate, upgrade, framework, refactor, redesign, architecture | api, database, performance, security |
693
+ | **UI/Frontend** | component, styling, accessibility, ux, design system, responsive | ui, api, testing, accessibility |
694
+ | **Database** | schema, migration, query, index, model, postgres, mongo | database, api, performance, datamigration |
695
+ | **Full-Stack (default)** | multiple domains or unclear | api, ui, database, testing, security |
696
+
697
+ ---
698
+
699
+ ### Step 9: Deploy Experts in Parallel
700
+
701
+ **CRITICAL**: Deploy ALL selected experts in a SINGLE message using the Task tool.
702
+
703
+ Each expert receives this prompt template:
704
+
705
+ ```
706
+ EXPERTISE FIRST: Read your expertise.yaml file if it exists at .agileflow/expertise/{domain}.yaml
707
+
708
+ RESEARCH SYNTHESIS: {synthesis report summary}
709
+ CONSENSUS FINDINGS: {list of HIGH confidence findings}
710
+ CONFLICTS: {list of conflicts found}
711
+ PROJECT CONTEXT: {from obtain-context.js output}
712
+
713
+ TASK: Analyze this research synthesis from your {DOMAIN} perspective:
714
+
715
+ 1. **Implementation Fit**: How well do the consensus findings fit the current codebase?
716
+ - What patterns/files would need to change?
717
+ - Any conflicts with existing architecture?
718
+
719
+ 2. **Domain-Specific Considerations**: From your expertise:
720
+ - For SECURITY: What security implications? Risks? Compliance needs?
721
+ - For PERFORMANCE: What performance impacts? Bottlenecks? Optimization opportunities?
722
+ - For TESTING: What test coverage needed? Edge cases? Regression risks?
723
+ - For API: What API changes? Breaking changes? Versioning needs?
724
+ - For UI: What UX considerations? Accessibility? Design patterns?
725
+ - For DATABASE: What schema changes? Migration strategy? Query impact?
726
+
727
+ 3. **Implementation Approach**: Your recommended approach:
728
+ - Key files to modify (specific paths from codebase)
729
+ - Effort estimate (hours/days/weeks)
730
+ - Dependencies or prerequisites
731
+
732
+ 4. **Risks & Gotchas**: What could go wrong?
733
+ - Technical risks
734
+ - Migration complexity
735
+ - Team adoption concerns
736
+
737
+ FORMAT as structured markdown with specific file paths and evidence from codebase.
738
+ ```
739
+
740
+ ---
741
+
742
+ ### Step 10: Collect Results and Synthesize
743
+
744
+ Collect all expert outputs using TaskOutput, then synthesize:
745
+
746
+ 1. **Find Consensus**: Group similar recommendations across experts
747
+ - **HIGH CONFIDENCE**: 2+ experts recommend same approach/files
748
+ - **MEDIUM CONFIDENCE**: 1 expert with specific evidence
749
+
750
+ 2. **Aggregate Effort Estimates**: Average across experts, note range
751
+
752
+ 3. **Collect All Risks**: Union of risks from all experts, prioritize by frequency
753
+
754
+ 4. **Validate Artifact Recommendation** via expert consensus:
755
+ - If experts mention "decision", "tradeoffs", "alternatives" → **ADR**
756
+ - If experts identify 5+ files across multiple domains → **Epic + Stories**
757
+ - If experts agree on single focus area, 1-3 files → **Story**
758
+ - If experts focus on guidelines, patterns → **Practice doc**
759
+
760
+ ---
761
+
762
+ ### Step 11: Present Implementation Ideation Report
763
+
764
+ ```markdown
765
+ ## Implementation Ideation Report
766
+
767
+ **Research Synthesis**: {TOPIC}
768
+ **Experts Consulted**: {list of 3-5 experts with badges}
769
+ **Consensus Level**: {High/Medium/Low based on agreement}
770
+
771
+ ---
772
+
773
+ ### High-Confidence Implementation Steps
774
+ *Agreed by 2+ experts*
775
+
776
+ 1. **{Step title}**
777
+ - Experts: {badges}
778
+ - Files: `path/to/file1.ts`, `path/to/file2.ts`
779
+ - Effort: {averaged estimate}
780
+ - Approach: {consensus approach}
781
+
782
+ ---
783
+
784
+ ### Domain-Specific Considerations
785
+
786
+ **Security** (security expert):
787
+ - {key consideration}
788
+ - Mitigation: {recommended approach}
789
+
790
+ **Performance** (performance expert):
791
+ - {optimization opportunity}
792
+
793
+ **Testing** (testing expert):
794
+ - {coverage requirements}
795
+ - {edge cases}
796
+
797
+ ---
798
+
799
+ ### Risks & Gotchas
800
+
801
+ | Risk | Expert(s) | Severity | Mitigation |
802
+ |------|-----------|----------|------------|
803
+ | {risk 1} | security | High | {mitigation} |
804
+
805
+ ---
806
+
807
+ ### Effort Estimate Summary
808
+
809
+ | Expert | Estimate | Notes |
810
+ |--------|----------|-------|
811
+ | {expert} | {estimate} | {notes} |
812
+ | **Consensus** | **{averaged}** | {range} |
813
+
814
+ ---
815
+
816
+ ### Recommended Artifact
817
+
818
+ Based on expert consensus: **{ADR/Epic/Story/Practice}**
819
+ **Reason**: {why this artifact type}
820
+ ```
821
+
822
+ ---
823
+
824
+ ### Step 12: Confirm and Create Artifact
825
+
826
+ ```xml
827
+ <invoke name="AskUserQuestion">
828
+ <parameter name="questions">[{
829
+ "question": "[N] experts analyzed '[TOPIC]' ([CONSENSUS_LEVEL] consensus). Proceed with implementation?",
830
+ "header": "Proceed?",
831
+ "multiSelect": false,
832
+ "options": [
833
+ {"label": "Yes - Create [RECOMMENDED_ARTIFACT] (Recommended)", "description": "[N] high-confidence steps identified across [M] files"},
834
+ {"label": "Modify approach first", "description": "Adjust [specific area of disagreement or concern]"},
835
+ {"label": "Save analysis to synthesis file", "description": "Append ideation report to [FILENAME] for later"},
836
+ {"label": "Cancel", "description": "Exit plan mode, synthesis already shown"}
542
837
  ]
543
838
  }]</parameter>
544
839
  </invoke>
545
840
  ```
546
841
 
842
+ **Key**: Populate `[N]` with expert count, `[TOPIC]` with research topic, `[CONSENSUS_LEVEL]` with High/Medium/Low. For "Create", use the actual recommended artifact type. For "Modify", reference specific disagreement areas from expert results.
843
+
844
+ **If "Yes"**: Present intelligent artifact selection:
845
+
846
+ ```xml
847
+ <invoke name="AskUserQuestion">
848
+ <parameter name="questions">[{
849
+ "question": "Expert consensus recommends [ARTIFACT_TYPE] for '[TOPIC]'. What would you like to create?",
850
+ "header": "Create",
851
+ "multiSelect": false,
852
+ "options": [
853
+ {"label": "[Recommended artifact]: [suggested title] (Recommended)", "description": "[N] experts agreed - [brief reason from consensus]"},
854
+ {"label": "Create Epic + Stories instead", "description": "Break into [estimated N] stories across [domains detected]"},
855
+ {"label": "Create single Story instead", "description": "Track as one work item (~[effort estimate])"},
856
+ {"label": "Create Practice doc instead", "description": "Document as guidelines in docs/02-practices/"},
857
+ {"label": "Skip artifact creation", "description": "Synthesis + ideation report saved, implement later"}
858
+ ]
859
+ }]</parameter>
860
+ </invoke>
861
+ ```
862
+
863
+ **Key**: First option MUST be the actual expert-recommended artifact with a suggested title. Include expert count and brief consensus reason. For alternatives, populate with specifics from expert analysis. Remove the recommended artifact from the alternatives list.
864
+
865
+ **If "Save analysis only"**: Append Implementation Ideation Report to the synthesis file, exit plan mode.
866
+ **If "Cancel"**: Exit plan mode.
867
+
868
+ After artifact creation, exit plan mode and confirm:
869
+
870
+ ```
871
+ Created [ARTIFACT] from synthesis "[TOPIC]"
872
+
873
+ **Multi-Expert Analysis Summary:**
874
+ - Experts consulted: {list}
875
+ - Consensus level: {High/Medium/Low}
876
+ - Key insights preserved: {count}
877
+
878
+ **Artifacts:**
879
+ - Synthesis: docs/10-research/YYYYMMDD-synthesis-topic.md
880
+ - [Artifact]: [path or ID]
881
+ ```
882
+
547
883
  ---
548
884
 
549
885
  ## Saving Synthesis Report
@@ -246,23 +246,26 @@ Output the full content of the research note.
246
246
 
247
247
  ### Step 4: Suggest Actions
248
248
 
249
- After displaying:
249
+ After displaying, offer contextual actions based on the research content:
250
250
 
251
251
  ```xml
252
252
  <invoke name="AskUserQuestion">
253
253
  <parameter name="questions">[{
254
- "question": "What would you like to do with this research?",
254
+ "question": "Viewed '[TOPIC]' research ([N] action items found). What next?",
255
255
  "header": "Actions",
256
256
  "multiSelect": false,
257
257
  "options": [
258
- {"label": "Analyze for implementation", "description": "Enter plan mode and see how to implement this in your project"},
259
- {"label": "View another research note", "description": "Switch to a different note"},
260
- {"label": "Done", "description": "Exit"}
258
+ {"label": "Analyze for implementation in [current epic/project] (Recommended)", "description": "Deploy multi-expert analysis to map research to your codebase"},
259
+ {"label": "Synthesize with related notes on [detected topic]", "description": "Cross-reference with [count] other notes on similar topics"},
260
+ {"label": "Create story from [N] action items", "description": "Turn research action items into trackable stories"},
261
+ {"label": "View another note", "description": "Browse other research notes"}
261
262
  ]
262
263
  }]</parameter>
263
264
  </invoke>
264
265
  ```
265
266
 
267
+ **Key**: Always include specific counts (action items found), detected topics, and reference the current epic if one is active. If no action items exist, replace that option with "Import additional research on [topic]".
268
+
266
269
  If "Analyze for implementation" selected, invoke:
267
270
  ```
268
271
  /agileflow:research:analyze FILE=[current file]
@@ -196,17 +196,35 @@ Include:
196
196
  </invoke>
197
197
  ```
198
198
 
199
- **AskUserQuestion** (for auto-fix approval):
199
+ **AskUserQuestion** (for auto-fix approval - use actual counts from review):
200
200
  ```xml
201
201
  <invoke name="AskUserQuestion">
202
202
  <parameter name="questions">[{
203
- "question": "Auto-fix these issues?",
204
- "header": "Code Review",
203
+ "question": "Review found [N] issues ([critical] critical, [high] high). How to proceed?",
204
+ "header": "Fixes",
205
205
  "multiSelect": false,
206
206
  "options": [
207
- {"label": "Auto-fix all (Recommended)", "description": "Fix 8 style issues automatically"},
208
- {"label": "Review each one", "description": "Show diffs for approval"},
209
- {"label": "Skip auto-fixes", "description": "Just report, no changes"}
207
+ {"label": "Auto-fix [N] style issues (Recommended)", "description": "Safe auto-fixes for formatting, imports, and lint errors"},
208
+ {"label": "Fix [N] security issue(s) manually", "description": "Review each security fix with diff before applying"},
209
+ {"label": "View diff of all suggested changes", "description": "Preview all [N] fixes before deciding"},
210
+ {"label": "Skip auto-fixes", "description": "Keep report only, no code changes"}
211
+ ]
212
+ }]</parameter>
213
+ </invoke>
214
+ ```
215
+
216
+ **Post-review AskUserQuestion** (after fixes are applied):
217
+ ```xml
218
+ <invoke name="AskUserQuestion">
219
+ <parameter name="questions">[{
220
+ "question": "Applied [N] fixes. Score improved [old]→[new]/100. What next?",
221
+ "header": "Next step",
222
+ "multiSelect": false,
223
+ "options": [
224
+ {"label": "Run tests to verify fixes (Recommended)", "description": "Execute test suite to confirm fixes don't break anything"},
225
+ {"label": "Commit fixes", "description": "Stage and commit the [N] auto-fixed files"},
226
+ {"label": "Create stories for [N] follow-up items", "description": "Track medium/low issues as future work"},
227
+ {"label": "Done", "description": "Review complete, report saved to docs/08-project/code-reviews/"}
210
228
  ]
211
229
  }]</parameter>
212
230
  </invoke>
@@ -122,6 +122,34 @@ Extract from user's description:
122
122
  - Primary use cases
123
123
  - Target workflow
124
124
 
125
+ **STEP 2b**: Ask for skill metadata (model and category)
126
+
127
+ ```xml
128
+ <invoke name="AskUserQuestion">
129
+ <parameter name="questions">[{
130
+ "question": "Which AI model should this skill prefer?",
131
+ "header": "Model",
132
+ "multiSelect": false,
133
+ "options": [
134
+ {"label": "Haiku (Recommended)", "description": "Fast and cheap - good for most skills"},
135
+ {"label": "Sonnet", "description": "Balanced - good for complex analysis"},
136
+ {"label": "Opus", "description": "Most capable - for critical decisions"},
137
+ {"label": "No preference", "description": "Let the caller decide"}
138
+ ]
139
+ }, {
140
+ "question": "What category best describes this skill?",
141
+ "header": "Category",
142
+ "multiSelect": false,
143
+ "options": [
144
+ {"label": "Database", "description": "Database operations, queries, migrations"},
145
+ {"label": "API", "description": "REST APIs, GraphQL, webhooks"},
146
+ {"label": "UI", "description": "Components, styling, design system"},
147
+ {"label": "DevOps", "description": "CI/CD, deployment, infrastructure"}
148
+ ]
149
+ }]</parameter>
150
+ </invoke>
151
+ ```
152
+
125
153
  ---
126
154
 
127
155
  ### Phase 2: Plan Mode Research (CRITICAL)
@@ -265,10 +293,16 @@ User reviews the plan and approves or requests changes.
265
293
 
266
294
  **STEP 8**: Generate SKILL.md
267
295
 
296
+ Include enhanced metadata frontmatter for skill discovery and delegation:
297
+
268
298
  ```markdown
269
299
  ---
270
300
  name: <skill-name-with-hyphens>
301
+ type: skill
271
302
  description: Use when <triggering conditions and symptoms>
303
+ model: <haiku|sonnet|opus>
304
+ category: <database|api|ui|testing|devops|security|custom>
305
+ version: 1.0.0
272
306
  ---
273
307
 
274
308
  # <Skill Title>
@@ -48,6 +48,8 @@ function getDirectoryStructure(docsFolder = 'docs') {
48
48
  `${docsFolder}/07-testing/acceptance`,
49
49
  `${docsFolder}/07-testing/test-cases`,
50
50
  `${docsFolder}/08-project`,
51
+ `${docsFolder}/08-project/ideation`,
52
+ `${docsFolder}/08-project/logic-audits`,
51
53
  `${docsFolder}/09-agents/bus`,
52
54
  `${docsFolder}/10-research`,
53
55
  ];
@@ -187,6 +189,8 @@ Project-level planning and tracking.
187
189
  - **backlog.md**: Prioritized backlog
188
190
  - **milestones.md**: Release milestones
189
191
  - **risks.md**: Project risks and mitigation strategies
192
+ - **ideation/**: Ideation reports from \`/agileflow:ideate:new\`
193
+ - **logic-audits/**: Logic audit reports from \`/agileflow:logic:audit\`
190
194
  `,
191
195
 
192
196
  [`${docsFolder}/09-agents/README.md`]: `# Agent Status Tracking