agileflow 2.90.7 → 2.92.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 (144) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +6 -6
  3. package/lib/README.md +178 -0
  4. package/lib/codebase-indexer.js +818 -0
  5. package/lib/colors.js +190 -12
  6. package/lib/consent.js +232 -0
  7. package/lib/correlation.js +277 -0
  8. package/lib/error-codes.js +46 -0
  9. package/lib/errors.js +48 -6
  10. package/lib/file-cache.js +182 -0
  11. package/lib/format-error.js +156 -0
  12. package/lib/path-resolver.js +155 -7
  13. package/lib/paths.js +212 -20
  14. package/lib/placeholder-registry.js +205 -0
  15. package/lib/registry-di.js +358 -0
  16. package/lib/result-schema.js +363 -0
  17. package/lib/result.js +210 -0
  18. package/lib/session-registry.js +13 -0
  19. package/lib/session-state-machine.js +465 -0
  20. package/lib/validate-commands.js +308 -0
  21. package/lib/validate-names.js +3 -3
  22. package/lib/validate.js +116 -52
  23. package/package.json +4 -1
  24. package/scripts/af +34 -0
  25. package/scripts/agent-loop.js +63 -9
  26. package/scripts/agileflow-configure.js +2 -2
  27. package/scripts/agileflow-welcome.js +435 -23
  28. package/scripts/archive-completed-stories.sh +57 -11
  29. package/scripts/claude-tmux.sh +102 -0
  30. package/scripts/damage-control-bash.js +3 -70
  31. package/scripts/damage-control-edit.js +3 -20
  32. package/scripts/damage-control-write.js +3 -20
  33. package/scripts/dependency-check.js +310 -0
  34. package/scripts/get-env.js +11 -4
  35. package/scripts/lib/configure-detect.js +23 -1
  36. package/scripts/lib/configure-features.js +43 -2
  37. package/scripts/lib/context-formatter.js +771 -0
  38. package/scripts/lib/context-loader.js +699 -0
  39. package/scripts/lib/damage-control-utils.js +107 -0
  40. package/scripts/lib/json-utils.sh +162 -0
  41. package/scripts/lib/state-migrator.js +353 -0
  42. package/scripts/lib/story-state-machine.js +437 -0
  43. package/scripts/obtain-context.js +118 -1048
  44. package/scripts/pre-push-check.sh +46 -0
  45. package/scripts/precompact-context.sh +36 -11
  46. package/scripts/query-codebase.js +538 -0
  47. package/scripts/ralph-loop.js +5 -5
  48. package/scripts/session-manager.js +220 -42
  49. package/scripts/spawn-parallel.js +651 -0
  50. package/scripts/tui/blessed/data/watcher.js +180 -0
  51. package/scripts/tui/blessed/index.js +244 -0
  52. package/scripts/tui/blessed/panels/output.js +101 -0
  53. package/scripts/tui/blessed/panels/sessions.js +150 -0
  54. package/scripts/tui/blessed/panels/trace.js +97 -0
  55. package/scripts/tui/blessed/ui/help.js +77 -0
  56. package/scripts/tui/blessed/ui/screen.js +52 -0
  57. package/scripts/tui/blessed/ui/statusbar.js +47 -0
  58. package/scripts/tui/blessed/ui/tabbar.js +99 -0
  59. package/scripts/tui/index.js +38 -30
  60. package/scripts/validators/README.md +143 -0
  61. package/scripts/validators/component-validator.js +239 -0
  62. package/scripts/validators/json-schema-validator.js +186 -0
  63. package/scripts/validators/markdown-validator.js +152 -0
  64. package/scripts/validators/migration-validator.js +129 -0
  65. package/scripts/validators/security-validator.js +380 -0
  66. package/scripts/validators/story-format-validator.js +197 -0
  67. package/scripts/validators/test-result-validator.js +114 -0
  68. package/scripts/validators/workflow-validator.js +247 -0
  69. package/src/core/agents/accessibility.md +6 -0
  70. package/src/core/agents/adr-writer.md +6 -0
  71. package/src/core/agents/analytics.md +6 -0
  72. package/src/core/agents/api.md +6 -0
  73. package/src/core/agents/ci.md +6 -0
  74. package/src/core/agents/codebase-query.md +261 -0
  75. package/src/core/agents/compliance.md +6 -0
  76. package/src/core/agents/configuration-damage-control.md +6 -0
  77. package/src/core/agents/configuration-visual-e2e.md +6 -0
  78. package/src/core/agents/database.md +10 -0
  79. package/src/core/agents/datamigration.md +6 -0
  80. package/src/core/agents/design.md +6 -0
  81. package/src/core/agents/devops.md +6 -0
  82. package/src/core/agents/documentation.md +6 -0
  83. package/src/core/agents/epic-planner.md +6 -0
  84. package/src/core/agents/integrations.md +6 -0
  85. package/src/core/agents/mentor.md +6 -0
  86. package/src/core/agents/mobile.md +6 -0
  87. package/src/core/agents/monitoring.md +6 -0
  88. package/src/core/agents/multi-expert.md +6 -0
  89. package/src/core/agents/performance.md +6 -0
  90. package/src/core/agents/product.md +6 -0
  91. package/src/core/agents/qa.md +6 -0
  92. package/src/core/agents/readme-updater.md +6 -0
  93. package/src/core/agents/refactor.md +6 -0
  94. package/src/core/agents/research.md +6 -0
  95. package/src/core/agents/security.md +6 -0
  96. package/src/core/agents/testing.md +10 -0
  97. package/src/core/agents/ui.md +6 -0
  98. package/src/core/commands/adr.md +114 -0
  99. package/src/core/commands/agent.md +120 -0
  100. package/src/core/commands/assign.md +145 -0
  101. package/src/core/commands/audit.md +401 -0
  102. package/src/core/commands/babysit.md +32 -5
  103. package/src/core/commands/board.md +1 -0
  104. package/src/core/commands/changelog.md +118 -0
  105. package/src/core/commands/configure.md +42 -6
  106. package/src/core/commands/diagnose.md +114 -0
  107. package/src/core/commands/epic.md +205 -1
  108. package/src/core/commands/handoff.md +128 -0
  109. package/src/core/commands/help.md +76 -0
  110. package/src/core/commands/metrics.md +1 -0
  111. package/src/core/commands/pr.md +96 -0
  112. package/src/core/commands/research/analyze.md +1 -0
  113. package/src/core/commands/research/ask.md +2 -0
  114. package/src/core/commands/research/import.md +1 -0
  115. package/src/core/commands/research/list.md +2 -0
  116. package/src/core/commands/research/synthesize.md +584 -0
  117. package/src/core/commands/research/view.md +2 -0
  118. package/src/core/commands/roadmap/analyze.md +400 -0
  119. package/src/core/commands/session/new.md +113 -6
  120. package/src/core/commands/session/spawn.md +197 -0
  121. package/src/core/commands/sprint.md +22 -0
  122. package/src/core/commands/status.md +200 -1
  123. package/src/core/commands/story/list.md +9 -9
  124. package/src/core/commands/story/view.md +1 -0
  125. package/src/core/commands/story.md +143 -4
  126. package/src/core/experts/codebase-query/expertise.yaml +190 -0
  127. package/src/core/experts/codebase-query/question.md +73 -0
  128. package/src/core/experts/codebase-query/self-improve.md +105 -0
  129. package/src/core/templates/agileflow-metadata.json +55 -2
  130. package/src/core/templates/plan-template.md +125 -0
  131. package/src/core/templates/story-lifecycle.md +213 -0
  132. package/src/core/templates/story-template.md +4 -0
  133. package/src/core/templates/tdd-test-template.js +241 -0
  134. package/tools/cli/commands/setup.js +86 -0
  135. package/tools/cli/installers/core/installer.js +94 -0
  136. package/tools/cli/installers/ide/_base-ide.js +20 -11
  137. package/tools/cli/installers/ide/codex.js +29 -47
  138. package/tools/cli/lib/config-manager.js +17 -2
  139. package/tools/cli/lib/content-transformer.js +271 -0
  140. package/tools/cli/lib/error-handler.js +14 -22
  141. package/tools/cli/lib/ide-error-factory.js +421 -0
  142. package/tools/cli/lib/ide-health-monitor.js +364 -0
  143. package/tools/cli/lib/ide-registry.js +114 -1
  144. package/tools/cli/lib/ui.js +14 -25
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  description: Generate detailed research prompt for web AI tools (ChatGPT, Perplexity, etc.)
3
3
  argument-hint: TOPIC=<text> [DETAILS=<constraints>] [ERROR=<error message>]
4
+ type: output-only # This command generates output for user to copy - not an ongoing task
4
5
  compact_context:
5
6
  priority: critical
6
7
  preserve_rules:
@@ -775,4 +776,5 @@ After clicking "Sign in with Google", immediately get unauthorized_client error.
775
776
  - `/agileflow:research:analyze` - Analyze existing research for implementation
776
777
  - `/agileflow:research:import` - Import research results back
777
778
  - `/agileflow:research:list` - Show research notes index
779
+ - `/agileflow:research:synthesize` - Synthesize insights across multiple research files
778
780
  - `/agileflow:research:view` - Read specific research note
@@ -827,4 +827,5 @@ The implementation plan is now tracked and ready to execute.
827
827
  - `/agileflow:research:analyze` - Revisit existing research for implementation analysis
828
828
  - `/agileflow:research:ask` - Generate research prompt for web AI
829
829
  - `/agileflow:research:list` - Show research notes index
830
+ - `/agileflow:research:synthesize` - Synthesize insights across multiple research files
830
831
  - `/agileflow:research:view` - Read specific research note
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  description: Show research notes index
3
3
  argument-hint: (no arguments)
4
+ type: output-only # This command displays output - not an ongoing task
4
5
  compact_context:
5
6
  priority: medium
6
7
  preserve_rules:
@@ -258,4 +259,5 @@ Quick actions:
258
259
  - `/agileflow:research:analyze` - Analyze research for implementation in your project
259
260
  - `/agileflow:research:ask` - Generate research prompt for web AI
260
261
  - `/agileflow:research:import` - Import research results
262
+ - `/agileflow:research:synthesize` - Synthesize insights across multiple research files
261
263
  - `/agileflow:research:view` - Read specific research note
@@ -0,0 +1,584 @@
1
+ ---
2
+ description: Synthesize insights across multiple research files
3
+ argument-hint: [TOPIC=<text> | FILES=<comma-separated>]
4
+ compact_context:
5
+ priority: high
6
+ preserve_rules:
7
+ - "ACTIVE COMMAND: /agileflow:research:synthesize - Cross-research synthesis"
8
+ - "Search docs/10-research/ for matching files by keyword or use provided FILES list"
9
+ - "Extract metadata: date, findings, approach, sources, related items"
10
+ - "Find CONSENSUS (2+ files agree = HIGH), UNIQUE (1 file = verify), CONFLICTS (disagreement = flag)"
11
+ - "Show synthesis BEFORE recommending artifacts (diff-first)"
12
+ - "Use confidence scoring: HIGH (2+ agree), UNIQUE (1 file), CONFLICT (disagree)"
13
+ - "Always end with AskUserQuestion for next steps"
14
+ state_fields:
15
+ - selected_files
16
+ - metadata_extracted
17
+ - consensus_findings
18
+ - conflicts_found
19
+ ---
20
+
21
+ # /agileflow:research:synthesize
22
+
23
+ Synthesize insights across multiple research files to find patterns, detect conflicts, and aggregate knowledge.
24
+
25
+ ---
26
+
27
+ ## Purpose
28
+
29
+ Query across your research notes to discover:
30
+ - **Consensus findings** - What do multiple research files agree on? (HIGH confidence)
31
+ - **Unique insights** - What appears in only one file? (Specialized or outdated?)
32
+ - **Conflicts** - Where do research files disagree? (Needs human review)
33
+ - **Patterns** - Common technologies, timelines, categories across research
34
+
35
+ **RLM Concept Applied**: This implements the "dependency graph over documents" pattern - treating research files as nodes in a graph and finding cross-document relationships.
36
+
37
+ ---
38
+
39
+ <!-- COMPACT_SUMMARY_START -->
40
+
41
+ ## ⚠️ COMPACT SUMMARY - /agileflow:research:synthesize IS ACTIVE
42
+
43
+ **CRITICAL**: You are running `/agileflow:research:synthesize`. This command queries across multiple research files.
44
+
45
+ **ROLE**: Find patterns, consensus, and conflicts across research. Apply confidence scoring.
46
+
47
+ ---
48
+
49
+ ### 🚨 RULE #1: VALIDATE INPUTS FIRST
50
+
51
+ **Require TOPIC or FILES:**
52
+ - `TOPIC=<text>` - Search research files by keyword
53
+ - `FILES=<comma-separated>` - Specific files to analyze
54
+
55
+ If neither provided, ask user:
56
+ ```xml
57
+ <invoke name="AskUserQuestion">
58
+ <parameter name="questions">[{
59
+ "question": "What topic would you like to synthesize research about?",
60
+ "header": "Topic",
61
+ "multiSelect": false,
62
+ "options": [
63
+ {"label": "Enter topic keyword", "description": "Search research files by keyword (use 'Other' to type)"},
64
+ {"label": "List all research first", "description": "Show research index to pick files"},
65
+ {"label": "Analyze ALL research", "description": "Synthesize entire research library (may be slow)"}
66
+ ]
67
+ }]</parameter>
68
+ </invoke>
69
+ ```
70
+
71
+ ---
72
+
73
+ ### 🚨 RULE #2: SEARCH OR SELECT RESEARCH FILES
74
+
75
+ **If TOPIC provided:**
76
+ 1. Search `docs/10-research/*.md` for files containing keyword
77
+ 2. Check filename, title (# header), key findings, summary
78
+ 3. Present matching files to user for confirmation
79
+
80
+ **If FILES provided:**
81
+ 1. Validate each file exists in `docs/10-research/`
82
+ 2. Warn if any file not found
83
+ 3. Proceed with valid files
84
+
85
+ **Auto-select if <5 matches. Ask user to confirm if 5+ matches.**
86
+
87
+ ---
88
+
89
+ ### 🚨 RULE #3: EXTRACT METADATA FROM EACH FILE
90
+
91
+ For each selected research file, extract:
92
+
93
+ | Field | Source |
94
+ |-------|--------|
95
+ | Date | Filename (YYYYMMDD) or **Date**: header |
96
+ | Topic | First `# ` header |
97
+ | Status | **Status**: field (Active/Superseded/Archived) |
98
+ | Summary | ## Summary section (first paragraph) |
99
+ | Key Findings | Bullet list under ## Key Findings |
100
+ | Recommended Approach | ## Recommended Approach section |
101
+ | Technologies | Keywords in findings (React, Next.js, etc.) |
102
+ | Related ADRs | ## Related section ADR links |
103
+ | Related Stories | ## Related section story links |
104
+ | Sources | ## Sources section URLs |
105
+ | Age Days | Today - file date |
106
+
107
+ ---
108
+
109
+ ### 🚨 RULE #4: APPLY CONFIDENCE SCORING
110
+
111
+ | Category | Definition | Threshold | Action |
112
+ |----------|------------|-----------|--------|
113
+ | **HIGH** | Finding appears in 2+ files | 2+ matches | Strong recommendation |
114
+ | **MEDIUM** | Related findings, not exact | Similar topics | Consider context |
115
+ | **UNIQUE** | Only in 1 file | 1 match | Verify: newer insight or outdated? |
116
+ | **CONFLICT** | Files disagree on approach | Contradictory | Flag for human review |
117
+
118
+ **How to detect:**
119
+ - **Consensus**: Same finding/approach mentioned in multiple files
120
+ - **Unique**: Grep for finding - only 1 file contains it
121
+ - **Conflict**: Different recommendations for same topic (e.g., "use Redis" vs "use in-memory cache")
122
+
123
+ ---
124
+
125
+ ### 🚨 RULE #5: SHOW SYNTHESIS BEFORE ARTIFACTS (DIFF-FIRST)
126
+
127
+ **Present synthesis report BEFORE offering to create anything:**
128
+
129
+ ```markdown
130
+ ## Research Synthesis: [TOPIC]
131
+
132
+ ### Files Analyzed (N total)
133
+ | Date | Title | Status |
134
+ |------|-------|--------|
135
+ | YYYY-MM-DD | [Topic] | Active |
136
+
137
+ ### Consensus Findings (HIGH CONFIDENCE)
138
+ Findings that appear in 2+ research notes:
139
+ - **[Finding]** - Sources: [file1.md, file2.md]
140
+ - [Supporting detail from files]
141
+
142
+ ### Unique Insights (VERIFY)
143
+ Findings only in one research note:
144
+ - **[Finding]** - Source: [file.md]
145
+ - Age: N days | Reason: [Specialized topic / Newer research / Consider updating]
146
+
147
+ ### Conflicts Detected (NEEDS REVIEW)
148
+ Different approaches recommended:
149
+ - **[Topic]**:
150
+ - [file1.md]: Recommends X because [reason]
151
+ - [file2.md]: Recommends Y because [reason]
152
+ - **Resolution needed**: [suggestion]
153
+
154
+ ### Technology Patterns
155
+ | Technology | Files | First Mentioned | Most Recent |
156
+ |------------|-------|-----------------|-------------|
157
+ | Next.js | 5 | 2025-12-01 | 2026-01-17 |
158
+
159
+ ### Related Artifacts
160
+ - **ADRs**: [list of ADRs mentioned across files]
161
+ - **Stories**: [list of stories mentioned]
162
+ - **Epics**: [list of epics mentioned]
163
+
164
+ ### Timeline
165
+ [Oldest research date] → [Newest research date]
166
+ ```
167
+
168
+ ---
169
+
170
+ ### 🚨 RULE #6: END WITH AskUserQuestion
171
+
172
+ **After showing synthesis, ask what to do next:**
173
+
174
+ ```xml
175
+ <invoke name="AskUserQuestion">
176
+ <parameter name="questions">[{
177
+ "question": "What would you like to do with this synthesis?",
178
+ "header": "Next step",
179
+ "multiSelect": false,
180
+ "options": [
181
+ {"label": "Save synthesis report", "description": "Save to docs/10-research/ as synthesis note"},
182
+ {"label": "Create ADR from consensus", "description": "Document architectural decision"},
183
+ {"label": "Create Epic + Stories", "description": "Break down into trackable work"},
184
+ {"label": "Flag conflicts for review", "description": "Mark outdated research for update"},
185
+ {"label": "Narrow scope - different topic", "description": "Try different search keywords"},
186
+ {"label": "Done", "description": "Exit synthesis"}
187
+ ]
188
+ }]</parameter>
189
+ </invoke>
190
+ ```
191
+
192
+ ---
193
+
194
+ ### ANTI-PATTERNS (DON'T DO THESE)
195
+
196
+ ❌ Skip validation of TOPIC/FILES
197
+ ❌ Include files that don't match the topic
198
+ ❌ Show generic synthesis without reading actual file contents
199
+ ❌ Jump to artifact creation without showing synthesis first
200
+ ❌ Ignore conflicts - they must be flagged
201
+ ❌ Treat all findings as equal - use confidence scoring
202
+ ❌ End without AskUserQuestion
203
+
204
+ ### DO THESE INSTEAD
205
+
206
+ ✅ Validate TOPIC or FILES first
207
+ ✅ Search and confirm file selection
208
+ ✅ Read and extract metadata from each file
209
+ ✅ Apply confidence scoring (HIGH/UNIQUE/CONFLICT)
210
+ ✅ Show full synthesis before offering artifacts
211
+ ✅ Flag conflicts for human review
212
+ ✅ Always end with AskUserQuestion
213
+
214
+ ---
215
+
216
+ ### WORKFLOW
217
+
218
+ **Phase 1: Input Validation**
219
+ 1. Check if TOPIC or FILES provided
220
+ 2. If neither, ask user via AskUserQuestion
221
+ 3. Store selected topic/files in state
222
+
223
+ **Phase 2: File Selection**
224
+ 4. If TOPIC: Search docs/10-research/*.md for keyword matches
225
+ 5. If FILES: Validate each file exists
226
+ 6. Present matches, confirm selection if 5+ files
227
+
228
+ **Phase 3: Metadata Extraction**
229
+ 7. For each file, read and extract:
230
+ - Date, topic, status, summary
231
+ - Key findings, recommended approach
232
+ - Technologies, related items, sources
233
+
234
+ **Phase 4: Synthesis Analysis**
235
+ 8. Compare findings across files
236
+ 9. Identify consensus (2+ files agree)
237
+ 10. Identify unique insights (1 file only)
238
+ 11. Detect conflicts (disagreements)
239
+ 12. Extract technology patterns
240
+
241
+ **Phase 5: Report Generation**
242
+ 13. Format synthesis report with sections:
243
+ - Files Analyzed
244
+ - Consensus Findings (HIGH)
245
+ - Unique Insights (VERIFY)
246
+ - Conflicts (NEEDS REVIEW)
247
+ - Technology Patterns
248
+ - Related Artifacts
249
+ - Timeline
250
+
251
+ **Phase 6: Present & Next Steps**
252
+ 14. Show synthesis report to user
253
+ 15. Ask what to do next via AskUserQuestion
254
+
255
+ ---
256
+
257
+ ### KEY FILES
258
+
259
+ | File | Purpose |
260
+ |------|---------|
261
+ | `docs/10-research/` | Directory containing all research notes |
262
+ | `docs/10-research/README.md` | Index of research with metadata |
263
+ | `docs/10-research/*.md` | Individual research files to analyze |
264
+
265
+ ---
266
+
267
+ ### REMEMBER AFTER COMPACTION
268
+
269
+ - `/agileflow:research:synthesize` IS ACTIVE - cross-research analysis
270
+ - Validate TOPIC or FILES first
271
+ - Search and select relevant research files
272
+ - Extract metadata from each file
273
+ - Apply confidence scoring: HIGH (2+ agree), UNIQUE (1 file), CONFLICT (disagree)
274
+ - Show synthesis BEFORE offering artifacts
275
+ - Flag conflicts for human review
276
+ - End with AskUserQuestion for next steps
277
+
278
+ <!-- COMPACT_SUMMARY_END -->
279
+
280
+ ---
281
+
282
+ ## Arguments
283
+
284
+ | Argument | Required | Description |
285
+ |----------|----------|-------------|
286
+ | TOPIC | No* | Keyword to search research files (*one of TOPIC or FILES required) |
287
+ | FILES | No* | Comma-separated list of specific files to analyze |
288
+
289
+ **Examples:**
290
+ ```
291
+ /agileflow:research:synthesize TOPIC="authentication"
292
+ /agileflow:research:synthesize TOPIC="performance"
293
+ /agileflow:research:synthesize FILES="20260117-rlm.md,20260109-rag.md"
294
+ ```
295
+
296
+ ---
297
+
298
+ ## IMMEDIATE ACTIONS
299
+
300
+ Upon invocation, execute these steps:
301
+
302
+ ### Step 1: Create Todo List
303
+
304
+ ```xml
305
+ <invoke name="TodoWrite">
306
+ <parameter name="todos">[
307
+ {"content": "Validate TOPIC or FILES input", "status": "in_progress", "activeForm": "Validating inputs"},
308
+ {"content": "Search/select research files", "status": "pending", "activeForm": "Selecting files"},
309
+ {"content": "Extract metadata from each file", "status": "pending", "activeForm": "Extracting metadata"},
310
+ {"content": "Analyze for consensus/conflicts", "status": "pending", "activeForm": "Analyzing patterns"},
311
+ {"content": "Generate synthesis report", "status": "pending", "activeForm": "Generating report"},
312
+ {"content": "Present synthesis and offer next steps", "status": "pending", "activeForm": "Presenting synthesis"}
313
+ ]</parameter>
314
+ </invoke>
315
+ ```
316
+
317
+ ### Step 2: Validate Inputs
318
+
319
+ **If TOPIC provided:**
320
+ - Store topic keyword
321
+ - Proceed to search
322
+
323
+ **If FILES provided:**
324
+ - Parse comma-separated list
325
+ - Validate each file exists in `docs/10-research/`
326
+ - Proceed with valid files
327
+
328
+ **If NEITHER provided:**
329
+ ```xml
330
+ <invoke name="AskUserQuestion">
331
+ <parameter name="questions">[{
332
+ "question": "What topic would you like to synthesize research about?",
333
+ "header": "Topic",
334
+ "multiSelect": false,
335
+ "options": [
336
+ {"label": "Enter topic keyword", "description": "Search research files by keyword (use 'Other' to type)"},
337
+ {"label": "List all research first", "description": "Show research index to pick files"},
338
+ {"label": "Analyze ALL research", "description": "Synthesize entire research library"}
339
+ ]
340
+ }]</parameter>
341
+ </invoke>
342
+ ```
343
+
344
+ ### Step 3: Search/Select Research Files
345
+
346
+ **If TOPIC search:**
347
+ 1. List all files in `docs/10-research/`
348
+ 2. For each file, check if topic keyword appears in:
349
+ - Filename
350
+ - First `# ` header (title)
351
+ - `## Summary` section
352
+ - `## Key Findings` section
353
+ 3. Collect matching files
354
+
355
+ **Present matches:**
356
+ ```
357
+ Found N research files matching "[TOPIC]":
358
+
359
+ | # | Date | Title | Summary |
360
+ |---|------|-------|---------|
361
+ | 1 | 2026-01-17 | RLM - Recursive Language Models | Breakthrough approach... |
362
+ | 2 | 2026-01-09 | Training vs RAG | Three approaches... |
363
+ ```
364
+
365
+ **If 5+ matches, ask for confirmation:**
366
+ ```xml
367
+ <invoke name="AskUserQuestion">
368
+ <parameter name="questions">[{
369
+ "question": "Found N matching files. Analyze all or select specific ones?",
370
+ "header": "Selection",
371
+ "multiSelect": false,
372
+ "options": [
373
+ {"label": "Analyze all N files (Recommended)", "description": "Comprehensive synthesis"},
374
+ {"label": "Let me pick specific files", "description": "I'll tell you which ones"},
375
+ {"label": "Narrow search - different keyword", "description": "Try more specific topic"}
376
+ ]
377
+ }]</parameter>
378
+ </invoke>
379
+ ```
380
+
381
+ ### Step 4: Extract Metadata
382
+
383
+ For each selected file, read and extract:
384
+
385
+ ```javascript
386
+ // Pseudocode for metadata extraction
387
+ {
388
+ path: "20260117-rlm.md",
389
+ date: "2026-01-17", // From filename YYYYMMDD
390
+ title: "RLM - Recursive Language Models", // From # header
391
+ status: "Active", // From **Status**: field
392
+ summary: "Breakthrough approach for AI agents...", // First paragraph of ## Summary
393
+ key_findings: [
394
+ "Context rot is function of context AND task complexity",
395
+ "REPL + recursion enables intelligent search",
396
+ "Model documents as dependency graphs"
397
+ ],
398
+ recommended_approach: "Use REPL with recursion for complex documents",
399
+ technologies: ["AI", "LLM", "Python", "REPL"],
400
+ related_adrs: ["ADR-0008"],
401
+ related_stories: [],
402
+ sources: ["Video transcript"],
403
+ age_days: 0
404
+ }
405
+ ```
406
+
407
+ ### Step 5: Synthesis Analysis
408
+
409
+ **5a. Find Consensus (HIGH confidence)**
410
+ - Group findings by similarity
411
+ - Mark as HIGH if finding appears in 2+ files
412
+ - Example: "Use caching" in file1 + "Add cache layer" in file2 = consensus
413
+
414
+ **5b. Identify Unique Insights**
415
+ - Findings only appearing in 1 file
416
+ - Check age: older = potentially outdated, newer = potentially valuable new insight
417
+ - Flag for verification
418
+
419
+ **5c. Detect Conflicts**
420
+ - Different recommendations for same topic
421
+ - Example: "Use Redis" vs "Use in-memory cache" for caching
422
+ - Flag with both positions and reasons
423
+
424
+ **5d. Extract Patterns**
425
+ - Common technologies across files
426
+ - Timeline of research (oldest → newest)
427
+ - Related artifacts mentioned
428
+
429
+ ### Step 6: Generate Synthesis Report
430
+
431
+ Format the synthesis:
432
+
433
+ ```markdown
434
+ ## Research Synthesis: [TOPIC]
435
+
436
+ **Generated**: YYYY-MM-DD
437
+ **Files Analyzed**: N research notes
438
+ **Date Range**: [oldest] → [newest]
439
+
440
+ ---
441
+
442
+ ### Files Analyzed
443
+
444
+ | Date | Title | Status | Age |
445
+ |------|-------|--------|-----|
446
+ | 2026-01-17 | RLM - Recursive Language Models | Active | 0 days |
447
+ | 2026-01-09 | Training vs RAG | Active | 8 days |
448
+
449
+ ---
450
+
451
+ ### Consensus Findings (HIGH CONFIDENCE)
452
+
453
+ These findings appear in 2+ research notes:
454
+
455
+ 1. **[Finding Statement]**
456
+ - Sources: file1.md (line X), file2.md (line Y)
457
+ - Context: [Brief explanation of agreement]
458
+
459
+ 2. **[Finding Statement]**
460
+ - Sources: file1.md, file3.md
461
+ - Context: [Brief explanation]
462
+
463
+ ---
464
+
465
+ ### Unique Insights (VERIFY)
466
+
467
+ Findings that appear in only one research note:
468
+
469
+ 1. **[Finding Statement]** - Source: file.md
470
+ - Age: N days
471
+ - Assessment: [Specialized topic / Newer research / Consider reviewing]
472
+
473
+ ---
474
+
475
+ ### Conflicts Detected (NEEDS REVIEW)
476
+
477
+ Different approaches recommended for the same topic:
478
+
479
+ 1. **[Topic: Caching Strategy]**
480
+ | File | Recommendation | Reason |
481
+ |------|----------------|--------|
482
+ | file1.md | Use Redis | Scalability for distributed systems |
483
+ | file2.md | Use in-memory | Simplicity for single-node |
484
+
485
+ **Resolution suggestion**: Consider your deployment architecture
486
+
487
+ ---
488
+
489
+ ### Technology Patterns
490
+
491
+ | Technology | Mentions | First Seen | Most Recent |
492
+ |------------|----------|------------|-------------|
493
+ | Next.js | 5 files | 2025-12-01 | 2026-01-17 |
494
+ | React | 4 files | 2025-12-01 | 2026-01-15 |
495
+
496
+ ---
497
+
498
+ ### Related Artifacts
499
+
500
+ **ADRs mentioned**: ADR-0001, ADR-0003, ADR-0008
501
+ **Stories mentioned**: US-0042, US-0055
502
+ **Epics mentioned**: EP-0004, EP-0007
503
+
504
+ ---
505
+
506
+ ### Timeline
507
+
508
+ ```
509
+ 2025-12-01 ──────────────────────────── 2026-01-17
510
+ │ │
511
+ ├─ First research: [topic] │
512
+ │ │
513
+ └──────────────────────────────────────────┴─ Latest: [topic]
514
+ ```
515
+ ```
516
+
517
+ ### Step 7: Present and Offer Next Steps
518
+
519
+ Show the full synthesis report, then:
520
+
521
+ ```xml
522
+ <invoke name="AskUserQuestion">
523
+ <parameter name="questions">[{
524
+ "question": "What would you like to do with this synthesis?",
525
+ "header": "Next step",
526
+ "multiSelect": false,
527
+ "options": [
528
+ {"label": "Save synthesis report (Recommended)", "description": "Save to docs/10-research/ as synthesis note"},
529
+ {"label": "Create ADR from consensus", "description": "Document architectural decision based on agreed findings"},
530
+ {"label": "Create Epic + Stories", "description": "Break down implementation based on synthesis"},
531
+ {"label": "Flag conflicts for review", "description": "Mark conflicting research for update"},
532
+ {"label": "Try different topic", "description": "Synthesize different research area"},
533
+ {"label": "Done", "description": "Exit synthesis"}
534
+ ]
535
+ }]</parameter>
536
+ </invoke>
537
+ ```
538
+
539
+ ---
540
+
541
+ ## Saving Synthesis Report
542
+
543
+ If user chooses to save:
544
+
545
+ **Filename format**: `YYYYMMDD-synthesis-[topic-slug].md`
546
+
547
+ **Add to docs/10-research/README.md index:**
548
+ ```markdown
549
+ | Date | Topic | File | Summary |
550
+ |------|-------|------|---------|
551
+ | 2026-01-17 | Synthesis: Authentication | 20260117-synthesis-authentication.md | Cross-research synthesis of N files... |
552
+ ```
553
+
554
+ **Mark as synthesis type** in file header:
555
+ ```markdown
556
+ # Synthesis: [Topic]
557
+
558
+ **Type**: Synthesis (cross-research analysis)
559
+ **Date**: YYYY-MM-DD
560
+ **Files Analyzed**: N
561
+ **Consensus Items**: N
562
+ **Conflicts Found**: N
563
+ ```
564
+
565
+ ---
566
+
567
+ ## Rules
568
+
569
+ - **Read actual file contents** - Don't guess based on titles
570
+ - **Apply confidence scoring** - HIGH/UNIQUE/CONFLICT
571
+ - **Flag conflicts explicitly** - They need human review
572
+ - **Show synthesis before artifacts** - Diff-first principle
573
+ - **Link to source files** - Always reference original research
574
+ - **Age-aware analysis** - Older research may be outdated
575
+
576
+ ---
577
+
578
+ ## Related Commands
579
+
580
+ - `/agileflow:research:list` - Show all research notes
581
+ - `/agileflow:research:view` - Read specific research note
582
+ - `/agileflow:research:analyze` - Analyze single research for implementation
583
+ - `/agileflow:research:import` - Import new research
584
+ - `/agileflow:research:ask` - Generate research prompt for web AI
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  description: Read a specific research note
3
3
  argument-hint: FILE=<filename>
4
+ type: output-only # This command displays output - not an ongoing task
4
5
  compact_context:
5
6
  priority: medium
6
7
  preserve_rules:
@@ -284,3 +285,4 @@ If "Analyze for implementation" selected, invoke:
284
285
  - `/agileflow:research:ask` - Generate research prompt for web AI
285
286
  - `/agileflow:research:import` - Import research results
286
287
  - `/agileflow:research:list` - Show research notes index
288
+ - `/agileflow:research:synthesize` - Synthesize insights across multiple research files