agileflow 3.0.1 → 3.1.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 (69) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +8 -8
  3. package/lib/api-server.js +3 -2
  4. package/lib/feedback.js +9 -2
  5. package/lib/flag-detection.js +4 -2
  6. package/lib/git-operations.js +4 -2
  7. package/lib/lazy-require.js +59 -0
  8. package/lib/process-executor.js +24 -9
  9. package/lib/skill-loader.js +11 -3
  10. package/package.json +1 -1
  11. package/scripts/agileflow-configure.js +12 -0
  12. package/scripts/agileflow-welcome.js +146 -90
  13. package/scripts/claude-tmux.sh +42 -6
  14. package/scripts/damage-control-multi-agent.js +14 -10
  15. package/scripts/lib/bus-utils.js +3 -1
  16. package/scripts/lib/configure-detect.js +12 -9
  17. package/scripts/lib/configure-features.js +128 -7
  18. package/scripts/lib/configure-repair.js +6 -5
  19. package/scripts/lib/context-formatter.js +13 -3
  20. package/scripts/lib/damage-control-utils.js +5 -1
  21. package/scripts/lib/lifecycle-detector.js +5 -3
  22. package/scripts/lib/process-cleanup.js +8 -4
  23. package/scripts/lib/scale-detector.js +47 -8
  24. package/scripts/lib/signal-detectors.js +117 -59
  25. package/scripts/lib/task-registry.js +5 -1
  26. package/scripts/lib/team-events.js +4 -4
  27. package/scripts/messaging-bridge.js +7 -1
  28. package/scripts/ralph-loop.js +10 -8
  29. package/scripts/smart-detect.js +32 -11
  30. package/scripts/team-manager.js +86 -1
  31. package/scripts/tmux-task-name.sh +105 -0
  32. package/scripts/tmux-task-watcher.sh +344 -0
  33. package/src/core/agents/legal-analyzer-a11y.md +110 -0
  34. package/src/core/agents/legal-analyzer-ai.md +117 -0
  35. package/src/core/agents/legal-analyzer-consumer.md +108 -0
  36. package/src/core/agents/legal-analyzer-content.md +113 -0
  37. package/src/core/agents/legal-analyzer-international.md +115 -0
  38. package/src/core/agents/legal-analyzer-licensing.md +115 -0
  39. package/src/core/agents/legal-analyzer-privacy.md +108 -0
  40. package/src/core/agents/legal-analyzer-security.md +112 -0
  41. package/src/core/agents/legal-analyzer-terms.md +111 -0
  42. package/src/core/agents/legal-consensus.md +242 -0
  43. package/src/core/agents/team-lead.md +50 -13
  44. package/src/core/commands/babysit.md +75 -42
  45. package/src/core/commands/blockers.md +7 -7
  46. package/src/core/commands/configure.md +15 -61
  47. package/src/core/commands/discovery/brief.md +363 -0
  48. package/src/core/commands/discovery/new.md +395 -0
  49. package/src/core/commands/ideate/new.md +5 -5
  50. package/src/core/commands/legal/audit.md +446 -0
  51. package/src/core/commands/logic/audit.md +5 -5
  52. package/src/core/commands/review.md +7 -1
  53. package/src/core/commands/rpi.md +61 -26
  54. package/src/core/commands/sprint.md +7 -6
  55. package/src/core/commands/team/start.md +36 -7
  56. package/src/core/commands/team/stop.md +5 -2
  57. package/src/core/templates/product-brief.md +136 -0
  58. package/tools/cli/installers/ide/claude-code.js +69 -2
  59. package/src/core/agents/configuration/archival.md +0 -350
  60. package/src/core/agents/configuration/attribution.md +0 -343
  61. package/src/core/agents/configuration/ci.md +0 -1103
  62. package/src/core/agents/configuration/damage-control.md +0 -375
  63. package/src/core/agents/configuration/git-config.md +0 -537
  64. package/src/core/agents/configuration/hooks.md +0 -623
  65. package/src/core/agents/configuration/precompact.md +0 -302
  66. package/src/core/agents/configuration/status-line.md +0 -557
  67. package/src/core/agents/configuration/verify.md +0 -618
  68. package/src/core/agents/configuration-damage-control.md +0 -259
  69. package/src/core/agents/configuration-visual-e2e.md +0 -339
@@ -0,0 +1,395 @@
1
+ ---
2
+ description: Run structured discovery workflow - brainstorm, research, and generate a Product Brief
3
+ argument-hint: "TOPIC=<text> [DEPTH=quick|guided|deep]"
4
+ compact_context:
5
+ priority: critical
6
+ preserve_rules:
7
+ - "ACTIVE COMMAND: /agileflow:discovery:new - Discovery workflow orchestrator"
8
+ - "DEPTH modes: quick (skip research, auto-generate), guided (interactive, optional research), deep (comprehensive research + curation)"
9
+ - "Phase 1: Brainstorm via /agileflow:ideate:new SCOPE=all"
10
+ - "Phase 2: Research via /agileflow:research:ask (optional in quick mode)"
11
+ - "Phase 3: Generate Product Brief via /agileflow:discovery:brief"
12
+ - "Output: docs/08-project/briefs/{date}-{topic-slug}-brief.md"
13
+ - "MUST parse TOPIC (required) and DEPTH (default: guided)"
14
+ - "After brief generation, offer: create epic, refine brief, or done"
15
+ state_fields:
16
+ - topic
17
+ - depth
18
+ - brainstorm_complete
19
+ - research_complete
20
+ - brief_generated
21
+ - ideation_file
22
+ - research_files
23
+ ---
24
+
25
+ # /agileflow:discovery:new
26
+
27
+ Run a structured discovery workflow that produces a professional Product Brief. Chains brainstorming, optional research, and synthesis into a single orchestrated flow.
28
+
29
+ ---
30
+
31
+ ## Purpose
32
+
33
+ Bridge the gap between "vague idea" and "epic planning". This command validates product viability BEFORE decomposing into stories/epics.
34
+
35
+ ```
36
+ Vague Idea --> /discovery:new --> Product Brief --> /epic --> Stories --> Implementation
37
+ ```
38
+
39
+ ---
40
+
41
+ ## STEP 0: Gather Context
42
+
43
+ ```bash
44
+ node .agileflow/scripts/obtain-context.js discovery
45
+ ```
46
+
47
+ ---
48
+
49
+ <!-- COMPACT_SUMMARY_START -->
50
+
51
+ ## Compact Summary
52
+
53
+ **Command**: `/agileflow:discovery:new` - Orchestrate brainstorm + research + Product Brief generation
54
+
55
+ **Quick Usage**:
56
+ ```
57
+ /agileflow:discovery:new TOPIC="Mobile time tracking app"
58
+ /agileflow:discovery:new TOPIC="AI code review tool" DEPTH=deep
59
+ /agileflow:discovery:new TOPIC="Internal dashboard" DEPTH=quick
60
+ ```
61
+
62
+ **Phases**:
63
+ 1. Brainstorm (delegates to `/agileflow:ideate:new`)
64
+ 2. Research (delegates to `/agileflow:research:ask` - optional in quick mode)
65
+ 3. Brief Generation (delegates to `/agileflow:discovery:brief`)
66
+
67
+ **Depth Modes**:
68
+ - `quick`: Auto-run brainstorm, skip research, generate brief immediately (~5-10 min)
69
+ - `guided` (default): Interactive brainstorm, optional research, curate before brief (~30-45 min)
70
+ - `deep`: Comprehensive brainstorm + multi-stage research + detailed brief (~2+ hours)
71
+
72
+ **Output**: `docs/08-project/briefs/{YYYYMMDD}-{topic-slug}-brief.md`
73
+
74
+ ### Tool Usage Examples
75
+
76
+ **AskUserQuestion** (depth selection):
77
+ ```xml
78
+ <invoke name="AskUserQuestion">
79
+ <parameter name="questions">[{"question": "What depth of discovery do you want for this topic?", "header": "Depth", "multiSelect": false, "options": [{"label": "Guided (Recommended)", "description": "Interactive brainstorm + optional research + curated brief (30-45 min)"}, {"label": "Quick", "description": "Auto brainstorm, skip research, fast brief (5-10 min)"}, {"label": "Deep", "description": "Comprehensive brainstorm + multi-stage research + detailed brief (2+ hours)"}]}]</parameter>
80
+ </invoke>
81
+ ```
82
+
83
+ <!-- COMPACT_SUMMARY_END -->
84
+
85
+ ---
86
+
87
+ ## How It Works
88
+
89
+ ```
90
+ USER: /agileflow:discovery:new TOPIC="..." DEPTH=guided
91
+ |
92
+ v
93
+ +-------------------------------+
94
+ | STEP 1: PARSE ARGUMENTS |
95
+ | - TOPIC (required) |
96
+ | - DEPTH (quick/guided/deep) |
97
+ +-------------------------------+
98
+ |
99
+ v
100
+ +-------------------------------+
101
+ | STEP 2: BRAINSTORM |
102
+ | Delegate to ideate:new |
103
+ | Output: ideation report |
104
+ +-------------------------------+
105
+ |
106
+ v
107
+ +-------------------------------+
108
+ | STEP 3: RESEARCH (optional) |
109
+ | Delegate to research:ask |
110
+ | User runs externally |
111
+ | Import with research:import |
112
+ +-------------------------------+
113
+ |
114
+ v
115
+ +-------------------------------+
116
+ | STEP 4: GENERATE BRIEF |
117
+ | Delegate to discovery:brief |
118
+ | Synthesize all inputs |
119
+ | Output: Product Brief |
120
+ +-------------------------------+
121
+ |
122
+ v
123
+ +-------------------------------+
124
+ | STEP 5: NEXT STEPS |
125
+ | Create epic? Refine? Done? |
126
+ +-------------------------------+
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Prompt
132
+
133
+ ROLE: Discovery Workflow Orchestrator
134
+
135
+ You run a structured discovery workflow that takes a topic from idea to Product Brief. You chain existing AgileFlow commands together and guide the user through each phase.
136
+
137
+ ### STEP 1: PARSE ARGUMENTS
138
+
139
+ Parse the user's input:
140
+
141
+ | Argument | Required | Default | Description |
142
+ |----------|----------|---------|-------------|
143
+ | TOPIC | Yes | - | The product/feature idea to explore |
144
+ | DEPTH | No | guided | Discovery depth: quick, guided, or deep |
145
+
146
+ **If TOPIC is missing**, ask the user:
147
+
148
+ ```xml
149
+ <invoke name="AskUserQuestion">
150
+ <parameter name="questions">[{"question": "What product or feature idea do you want to explore?", "header": "Topic", "multiSelect": false, "options": [{"label": "I'll type it", "description": "Describe the idea you want to validate"}]}]</parameter>
151
+ </invoke>
152
+ ```
153
+
154
+ **If DEPTH is not provided**, use `guided` as the default.
155
+
156
+ **Normalize the topic** into a slug for filenames: lowercase, replace spaces with hyphens, remove special characters. Example: "AI Code Review Tool" becomes `ai-code-review-tool`.
157
+
158
+ ---
159
+
160
+ ### STEP 2: BRAINSTORM PHASE
161
+
162
+ **Purpose**: Generate creative ideas and approaches around the topic using multi-expert analysis.
163
+
164
+ **Tell the user what's happening:**
165
+ ```
166
+ Phase 1/3: Brainstorming
167
+ Deploying domain experts to explore "{TOPIC}" from multiple angles...
168
+ ```
169
+
170
+ **Execute brainstorming differently per depth:**
171
+
172
+ #### Quick Mode
173
+ Run brainstorming with minimal interaction. Deploy 3 experts in parallel using the Task tool:
174
+
175
+ 1. **Product expert** - analyze market fit, user needs, competitive landscape
176
+ 2. **API/Architecture expert** - evaluate technical feasibility, architecture options
177
+ 3. **UX/Design expert** - consider user experience, interaction patterns
178
+
179
+ Use this prompt template for each expert:
180
+
181
+ ```
182
+ TASK: Brainstorm ideas for a product/feature: "{TOPIC}"
183
+
184
+ From your {DOMAIN} perspective, generate 3-5 ideas covering:
185
+ 1. **Core Value Proposition**: What's the main value this delivers?
186
+ 2. **Key Features**: What are the essential features?
187
+ 3. **Target Users**: Who benefits most?
188
+ 4. **Risks**: What could go wrong?
189
+ 5. **Differentiation**: How is this different from alternatives?
190
+
191
+ Be specific and actionable. Reference real-world examples where helpful.
192
+ ```
193
+
194
+ Deploy all experts with `run_in_background: true`, then collect results with TaskOutput.
195
+
196
+ #### Guided Mode
197
+ Same as Quick, but after collecting results:
198
+
199
+ 1. **Present a summary** of the brainstorm findings to the user
200
+ 2. **Ask the user to curate**: Which ideas resonate? Which to drop?
201
+
202
+ ```xml
203
+ <invoke name="AskUserQuestion">
204
+ <parameter name="questions">[{"question": "Review the brainstorm results above. Which direction do you want to pursue?", "header": "Curate", "multiSelect": false, "options": [{"label": "Proceed with all ideas", "description": "Include everything in the brief"}, {"label": "Let me highlight the best ones", "description": "I'll tell you which ideas to focus on"}, {"label": "Re-brainstorm with different focus", "description": "Try again with adjusted scope"}]}]</parameter>
205
+ </invoke>
206
+ ```
207
+
208
+ #### Deep Mode
209
+ Deploy 5+ experts (add Security and Testing to the base 3). Use `DEPTH=deep` prompts asking for 5 ideas each. After collection, present findings and allow the user to curate, add their own ideas, and refine before proceeding.
210
+
211
+ **Save brainstorm output** to `docs/08-project/ideation/ideation-{YYYYMMDD}-{topic-slug}.md`
212
+
213
+ Record the ideation file path for Phase 3.
214
+
215
+ ---
216
+
217
+ ### STEP 3: RESEARCH PHASE
218
+
219
+ **Purpose**: Gather external context - competitive analysis, market data, best practices.
220
+
221
+ **Behavior varies by depth:**
222
+
223
+ #### Quick Mode
224
+ **Skip research entirely.** Tell the user:
225
+ ```
226
+ Phase 2/3: Research
227
+ Skipping external research (quick mode). Using brainstorm findings + internal knowledge only.
228
+ ```
229
+ Proceed directly to Step 4.
230
+
231
+ #### Guided Mode
232
+ **Offer optional research.** Ask the user:
233
+
234
+ ```xml
235
+ <invoke name="AskUserQuestion">
236
+ <parameter name="questions">[{"question": "Would you like to research this topic before generating the brief?", "header": "Research", "multiSelect": false, "options": [{"label": "Yes, generate research prompt (Recommended)", "description": "Creates a detailed prompt for ChatGPT/Perplexity to gather competitive + market data"}, {"label": "Skip research", "description": "Generate brief using brainstorm findings + internal knowledge only"}, {"label": "I already have research", "description": "I'll paste findings or point to existing docs/10-research/ files"}]}]</parameter>
237
+ </invoke>
238
+ ```
239
+
240
+ **If yes**: Generate a research prompt tailored to the topic. Focus on:
241
+ - Competitive analysis (top 3-5 alternatives)
242
+ - Target market validation
243
+ - Best practices and patterns
244
+
245
+ Use this approach - generate the prompt inline (don't delegate to `/research:ask` to avoid double-orchestration complexity):
246
+
247
+ ```markdown
248
+ # Research Request: {TOPIC} - Competitive & Market Analysis
249
+
250
+ ## Context
251
+ We're exploring building: {TOPIC}
252
+ Key ideas from brainstorming: {top 3-5 ideas from Phase 1}
253
+
254
+ ## Questions
255
+ 1. What are the top 3-5 existing solutions for {TOPIC}? Compare on: features, pricing, target audience, strengths/weaknesses.
256
+ 2. What is the target market size? Who are the primary user segments?
257
+ 3. What are current best practices and emerging trends in this space?
258
+ 4. What common pitfalls should we avoid?
259
+ 5. What technical approaches are most common (architecture, tech stack)?
260
+
261
+ ## Format
262
+ Provide structured analysis with tables for comparison. Include specific data points and sources where possible.
263
+ ```
264
+
265
+ Instruct the user to copy the prompt, run it externally, and paste results back. When results are returned, save them to `docs/10-research/{YYYYMMDD}-{topic-slug}-market-research.md`.
266
+
267
+ **If user has existing research**: Ask them to specify the file path(s). Read those files to incorporate into the brief.
268
+
269
+ #### Deep Mode
270
+ Run **multiple research stages**, each with a focused prompt:
271
+
272
+ 1. **Stage 1: Competitive Analysis** - Top 5 competitors, feature comparison, pricing
273
+ 2. **Stage 2: Market Sizing** - TAM/SAM/SOM, user segments, growth trends
274
+ 3. **Stage 3: Technical Landscape** - Common architectures, tech stacks, best practices
275
+
276
+ Each stage is optional (user can skip). For each completed stage, save research output to `docs/10-research/`.
277
+
278
+ Record all research file paths for Phase 3.
279
+
280
+ ---
281
+
282
+ ### STEP 4: GENERATE PRODUCT BRIEF
283
+
284
+ **Purpose**: Synthesize brainstorm findings + research into a structured Product Brief.
285
+
286
+ **Tell the user:**
287
+ ```
288
+ Phase 3/3: Generating Product Brief
289
+ Synthesizing brainstorm findings and research into a structured brief...
290
+ ```
291
+
292
+ **Read the inputs:**
293
+ 1. Read the ideation report from Step 2
294
+ 2. Read any research files from Step 3
295
+
296
+ **Generate the brief** by filling in the product-brief template. Apply these rules:
297
+
298
+ **MoSCoW Mapping from brainstorm confidence:**
299
+ - Ideas agreed by 2+ experts OR marked as core value = **MUST HAVE**
300
+ - Ideas from 1 expert with strong rationale = **SHOULD HAVE**
301
+ - Nice-to-have ideas or differentiators = **COULD HAVE**
302
+ - Explicitly rejected or out-of-scope ideas = **WON'T HAVE**
303
+
304
+ **Persona extraction:**
305
+ - From research: extract user segments and pain points
306
+ - From brainstorm: infer personas from "target users" sections
307
+ - If insufficient data: create 2 reasonable personas based on the topic
308
+
309
+ **Success metrics:**
310
+ - Derive from the problem statement and value proposition
311
+ - Include both quantitative (adoption rate, time saved) and qualitative (user satisfaction) metrics
312
+
313
+ **ROI estimation:**
314
+ - Effort: Based on feature count and complexity from MoSCoW
315
+ - Benefit: Based on target user pain points and market size
316
+ - Keep it simple - order-of-magnitude estimates, not financial modeling
317
+
318
+ **Competitive context:**
319
+ - From research findings if available
320
+ - From expert knowledge if research was skipped
321
+
322
+ **Save the brief** to: `docs/08-project/briefs/{YYYYMMDD}-{topic-slug}-brief.md`
323
+
324
+ Create the `docs/08-project/briefs/` directory if it doesn't exist.
325
+
326
+ ---
327
+
328
+ ### STEP 5: OFFER NEXT STEPS
329
+
330
+ Present the completed brief and ask what to do next:
331
+
332
+ ```xml
333
+ <invoke name="AskUserQuestion">
334
+ <parameter name="questions">[{"question": "Product Brief for '{TOPIC}' has been generated. What would you like to do next?", "header": "Next Steps", "multiSelect": false, "options": [{"label": "Create epic from this brief (Recommended)", "description": "Run /agileflow:epic to decompose into stories"}, {"label": "Refine the brief", "description": "Edit specific sections or add more detail"}, {"label": "Run deeper research", "description": "Generate research prompts for areas that need more data"}, {"label": "Done for now", "description": "Brief saved, come back to it later"}]}]</parameter>
335
+ </invoke>
336
+ ```
337
+
338
+ ---
339
+
340
+ ## Arguments
341
+
342
+ | Argument | Values | Default | Description |
343
+ |----------|--------|---------|-------------|
344
+ | TOPIC | Free text | (required) | The product/feature idea to explore |
345
+ | DEPTH | quick, guided, deep | guided | Discovery depth level |
346
+
347
+ {{argument}}
348
+
349
+ ---
350
+
351
+ ## Expected Output
352
+
353
+ ### Success
354
+
355
+ ```
356
+ Discovery Workflow: "AI Code Review Tool"
357
+ Depth: guided
358
+ ============================================
359
+
360
+ Phase 1/3: Brainstorming
361
+ Deploying 3 domain experts...
362
+ Product Expert... done
363
+ Architecture Expert... done
364
+ UX Expert... done
365
+ Synthesized 12 ideas (4 high-confidence, 6 medium, 2 low)
366
+
367
+ Phase 2/3: Research
368
+ [User runs external research prompt]
369
+ Imported competitive analysis (3 competitors found)
370
+
371
+ Phase 3/3: Generating Product Brief
372
+ Executive Summary... done
373
+ User Personas... done
374
+ Features (MoSCoW)... done
375
+ Success Metrics... done
376
+ Business Case... done
377
+ Competitive Context... done
378
+ Risks... done
379
+
380
+ Brief saved to: docs/08-project/briefs/20260213-ai-code-review-tool-brief.md
381
+
382
+ What would you like to do next?
383
+ ```
384
+
385
+ ---
386
+
387
+ ## Related Commands
388
+
389
+ - `/agileflow:discovery:brief` - Generate a Product Brief from existing ideation + research
390
+ - `/agileflow:ideate:new` - Run multi-expert brainstorming
391
+ - `/agileflow:research:ask` - Generate external research prompts
392
+ - `/agileflow:research:import` - Import research results
393
+ - `/agileflow:epic` - Create epic from a brief
394
+ - `/agileflow:auto` - Auto-generate stories from an epic
395
+ - `/agileflow:council` - Get architectural advice on an idea
@@ -705,14 +705,14 @@ After generating output, present options:
705
705
  ```xml
706
706
  <invoke name="AskUserQuestion">
707
707
  <parameter name="questions">[{
708
- "question": "What would you like to do with these ideas?",
708
+ "question": "[total] ideas from [expert_count] experts ([high] HIGH confidence, [medium] MEDIUM). [new] new, [recurring] recurring.",
709
709
  "header": "Next Steps",
710
710
  "multiSelect": false,
711
711
  "options": [
712
- {"label": "Create stories for high-confidence items", "description": "Generate stories in docs/06-stories/"},
713
- {"label": "Create epic grouping all improvements", "description": "Bundle into EP-XXXX: Ideation Improvements"},
714
- {"label": "Run deeper analysis on specific category", "description": "Re-run with SCOPE={category} DEPTH=deep"},
715
- {"label": "Save report and done", "description": "Keep the report, no further action"}
712
+ {"label": "Create [high] stories for HIGH-confidence items (Recommended)", "description": "Top idea: [top_idea_title] ([impact] impact, agreed by [N] experts)"},
713
+ {"label": "Create epic: '[epic_title]'", "description": "Bundle all [high] HIGH + [medium] MEDIUM items into EP-XXXX"},
714
+ {"label": "Deep dive on [top_category] ([count] ideas)", "description": "Re-run SCOPE=[category] DEPTH=deep for more detail"},
715
+ {"label": "Save report and done", "description": "Report saved to docs/08-project/ideation/ideation-[date].md"}
716
716
  ]
717
717
  }]</parameter>
718
718
  </invoke>