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
@@ -5,16 +5,14 @@ compact_context:
5
5
  priority: critical
6
6
  preserve_rules:
7
7
  - "ACTIVE COMMAND: /agileflow-babysit - Mentor mode with expert delegation"
8
- - "🔔 MANDATORY: Call AskUserQuestion tool at END of EVERY response - especially after completing tasks"
9
- - "NEVER end with text like 'Done!' or 'What's next?' - ALWAYS use AskUserQuestion tool instead"
8
+ - "AskUserQuestion: ALWAYS end with it, but make it SMART - specific recommended option, contextual descriptions, logical next step"
9
+ - "NEVER generic AskUserQuestion like 'Continue?' - always specific: 'Run npm test for auth changes (Recommended)'"
10
+ - "BIAS TOWARD IMPLEMENTATION: Read 3-5 files max then start coding. Don't explore endlessly."
10
11
  - "{{RULES:plan_mode}}"
11
12
  - "{{RULES:delegation}}"
12
- - "STUCK DETECTION: If same error 2+ times, suggest /agileflow:research:ask with 200+ line detailed prompt"
13
- - "Research prompts MUST include: 50+ lines actual code, exact error, what was tried, 3+ specific questions"
13
+ - "STUCK DETECTION: If same error 2+ times, suggest /agileflow:research:ask with detailed prompt"
14
14
  - "PLAN FILE CONTEXT: BEFORE ExitPlanMode, EDIT plan file to add babysit rules header at TOP - rules survive context clear"
15
- - "STORY CLAIMING: Run 'node .agileflow/scripts/lib/story-claiming.js claim <id>' IMMEDIATELY after user selects story"
16
- - "STORY CLAIMING: Run 'node .agileflow/scripts/lib/story-claiming.js others' BEFORE suggesting stories, exclude 🔒 claimed"
17
- - "STORY CLAIMING: Run 'node .agileflow/scripts/lib/story-claiming.js release <id>' when story marked done"
15
+ - "STORY CLAIMING: claim after selection, release after completion, check others before suggesting"
18
16
  - "LOGIC AUDIT: After implementation, offer '🔍 Run logic audit' option via AskUserQuestion (not automatic)"
19
17
  state_fields:
20
18
  - current_story
@@ -41,80 +39,84 @@ This gathers: git status, stories/epics, session state, docs structure, research
41
39
 
42
40
  ---
43
41
 
44
- ## 🧠 SMART DETECTION (Auto-Enable Features)
42
+ ## 🧠 CONTEXTUAL FEATURE ROUTER
45
43
 
46
- **After running context script, automatically detect and enable features.**
44
+ **After running context script, read `docs/09-agents/smart-detect.json` for programmatic recommendations.**
47
45
 
48
- Smart detection eliminates the need for users to specify parameters like `MODE=loop`, `VISUAL=true`, or `COVERAGE=80`. The mentor analyzes project context and enables appropriate features automatically.
46
+ The smart detection system analyzes project signals deterministically (via `smart-detect.js`) and outputs contextual feature recommendations. This replaces manual signal analysis with script-driven detection.
49
47
 
50
- ### Detection Rules
48
+ ### How It Works
51
49
 
52
- | Feature | Auto-Enable When | Override |
53
- |---------|------------------|----------|
54
- | **Loop Mode** | Epic has 3+ ready stories AND test setup exists | User says "just one story" or `MODE=once` |
55
- | **Visual Mode** | Epic/story mentions UI/component/styling OR owner=AG-UI | User says "no screenshots" or `VISUAL=false` |
56
- | **Coverage Mode** | `coverage/` dir exists with baseline >50% | User says "skip coverage" or `COVERAGE=0` |
57
- | **Conditions** | Auto-detect from package.json scripts (lint, tsc, build) | N/A (always apply detected) |
58
- | **Team Mode** | Agent Teams enabled + task spans multiple domains (API+UI) | User says "no teams" or `TEAM=false` |
50
+ 1. `obtain-context.js` gathers project data (status.json, git, metadata, session state)
51
+ 2. `smart-detect.js` runs 42 feature detectors against the data
52
+ 3. Results are written to `docs/09-agents/smart-detect.json`
53
+ 4. Context output includes a "Smart Recommendations" section
54
+ 5. You act on the recommendations below
59
55
 
60
- ### Detection Flow
56
+ ### Reading Recommendations
61
57
 
62
- 1. Parse context output for signals
63
- 2. Check each detection rule
64
- 3. Enable applicable features silently
65
- 4. Inform user: "🧠 Auto-enabled: Loop Mode, Visual Mode (UI epic detected)"
66
- 5. Proceed with work
58
+ The context output's "Smart Recommendations" section contains:
67
59
 
68
- ### Signal Detection
60
+ - **Phase**: Current lifecycle phase (pre-story, planning, implementation, post-impl, pre-pr)
61
+ - **Immediate**: High-priority features to act on NOW (suggest via AskUserQuestion or auto-run)
62
+ - **Available**: Medium/low-priority features to include as AskUserQuestion options
63
+ - **Auto-enabled**: Existing mode flags (loop_mode, visual_mode, coverage_mode)
69
64
 
70
- **Loop Mode signals:**
71
- - `status.json` has 3+ stories with status "ready" in same epic
72
- - `package.json` has "test" script
73
- - Stories have clear acceptance criteria
65
+ ### Acting on Recommendations
74
66
 
75
- **Visual Mode signals:**
76
- - Epic title contains: UI, component, frontend, styling, design
77
- - Story owner is "AG-UI"
78
- - Files in scope include: `src/components/`, `*.tsx`, `*.css`
79
- - `screenshots/` directory exists
80
- - Context shows "📸 VISUAL E2E TESTING: ENABLED"
67
+ | Category | Action |
68
+ |----------|--------|
69
+ | **immediate** (high priority) | Present via AskUserQuestion with YES as default. If action=auto, run without asking. |
70
+ | **available** (medium/low) | Include as options in your next AskUserQuestion. Group related features. |
71
+ | **auto_enabled** modes | Enable Loop/Visual/Coverage modes silently, inform user. |
72
+ | **skipped features** | Do NOT re-offer features the user already declined this session. |
81
73
 
82
- **Coverage Mode signals:**
83
- - `coverage/coverage-summary.json` exists
84
- - Current line coverage is >50%
85
- - Auto-set threshold to: current_coverage + 5%
74
+ ### Lifecycle-Aware Feature Routing
86
75
 
87
- **Team Mode signals:**
88
- - `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` env var is set
89
- - Epic has stories with different owners (AG-API + AG-UI)
90
- - Task description mentions multiple domains (backend + frontend)
91
- - Template auto-selection: API+UI stories → `fullstack`, security review → `code-review`
92
- - When detected: Start native team via `/agileflow:team:start <template>`
76
+ Features are filtered by lifecycle phase. Only phase-relevant features appear:
93
77
 
94
- **Conditions signals (auto-add all detected):**
95
- - `package.json` has "lint" → add "no linting errors"
96
- - `tsconfig.json` exists add "no type errors"
97
- - `package.json` has "build" add "build succeeds"
78
+ | Phase | Focus | Example Features |
79
+ |-------|-------|-----------------|
80
+ | **pre-story** | Story selection, project planning | blockers, choose, board, sprint, batch |
81
+ | **planning** | Impact analysis, architecture | impact, adr, research, council |
82
+ | **implementation** | Code quality, testing | verify, tests, diagnose, ci, deps |
83
+ | **post-impl** | Review, documentation | review, logic-audit, docs, changelog |
84
+ | **pre-pr** | Final checks, PR creation | pr, compress |
98
85
 
99
- ### Example Auto-Detection Output
86
+ ### User Overrides
100
87
 
101
- ```
102
- 🧠 Smart Detection Results:
103
- ━━━━━━━━━━━━━━━━━━━━━━━━━━
104
- Loop Mode: ENABLED (5 ready stories in EP-0042)
105
- Visual Mode: ENABLED (epic mentions "UI components")
106
- ✓ Coverage Mode: ENABLED @ 75% (current baseline: 70%)
107
- Conditions: lint ✓, types ✓, build ✓
88
+ Respect explicit user parameters (these override smart detection):
89
+ - `/babysit MODE=once` → Force single story mode (overrides loop_mode)
90
+ - `/babysit VISUAL=false` → Disable visual even if detected
91
+ - `/babysit COVERAGE=0` Disable coverage mode
92
+ - User says "skip X" Add to `features_skipped` in session state, don't re-offer
93
+
94
+ ### Session State Tracking
108
95
 
109
- Proceeding with: US-0050 (first ready story)
96
+ Track offered/used/skipped features in session state to prevent re-offering:
97
+ ```json
98
+ {
99
+ "smart_detect": {
100
+ "features_offered": ["impact", "tests"],
101
+ "features_used": ["impact"],
102
+ "features_skipped": ["tests"]
103
+ }
104
+ }
110
105
  ```
111
106
 
112
- ### User Override
107
+ ### Example Router Output
113
108
 
114
- If user explicitly specifies a parameter, respect it:
115
- - `/babysit EPIC=EP-0042 MODE=once` → Force single story mode
116
- - `/babysit VISUAL=false` → Disable visual even if detected
117
- - `/babysit COVERAGE=0` Disable coverage mode
109
+ ```
110
+ 🧠 Contextual Feature Router:
111
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
112
+ Phase: implementation (5 files changed)
113
+ Auto-enabled: loop mode, coverage mode
114
+
115
+ ! verify: Tests are failing (/agileflow:verify)
116
+ ! review: 250 lines changed - code review recommended (/agileflow:review)
117
+ > docs: 2 API files changed - docs sync recommended (/agileflow:docs)
118
+ > logic-audit: 4 source files modified (/agileflow:logic:audit)
119
+ ```
118
120
 
119
121
  ---
120
122
 
@@ -134,6 +136,22 @@ If user explicitly specifies a parameter, respect it:
134
136
 
135
137
  ---
136
138
 
139
+ ## SCALE-ADAPTIVE BEHAVIOR
140
+
141
+ The context output includes a **Project Scale** section. Adjust your approach based on detected scale:
142
+
143
+ | Scale | Planning Depth | Expert Usage | Workflow |
144
+ |-------|---------------|--------------|----------|
145
+ | **Micro** | Skip plan mode for most tasks. Implement directly. | 2 experts max | No epics needed. Quick stories or direct implementation. |
146
+ | **Small** | Light planning. Skip plan mode for familiar tasks. | 3 experts max | Simple stories. Epics optional. |
147
+ | **Medium** | Standard planning. Use plan mode for complex tasks. | 4 experts | Full story workflow with epics. |
148
+ | **Large** | Thorough planning. Always use plan mode. | 5 experts | Full workflow with architecture review. |
149
+ | **Enterprise** | Comprehensive planning with council review. | 5 experts | Full workflow with ADRs and multi-expert analysis. |
150
+
151
+ **Important**: User can always override scale behavior. If they say "plan this carefully" for a micro project, do it.
152
+
153
+ ---
154
+
137
155
  <!-- SECTION: loop-mode -->
138
156
  ## LOOP MODE (Autonomous Execution)
139
157
 
@@ -178,7 +196,7 @@ To force single-story mode, say "just work on one story" or specify `MODE=once`.
178
196
  | `COVERAGE` | No | Auto-detected from coverage baseline; set `0` to disable |
179
197
  | `CONDITIONS` | No | Auto-detected from package.json; or configured in metadata |
180
198
 
181
- **Note:** Most parameters are auto-detected by Smart Detection. Only specify if you need to override the detected values.
199
+ **Note:** Most parameters are auto-detected by the Contextual Feature Router. Only specify if you need to override the detected values.
182
200
 
183
201
  ### To Start Loop Mode
184
202
 
@@ -335,61 +353,61 @@ If you end your response without calling AskUserQuestion, you have violated thes
335
353
 
336
354
  ---
337
355
 
338
- ### 🚨 RULE #0: SMART DETECTION (Before Starting)
339
-
340
- **After running context script, auto-detect and enable features:**
356
+ ### 🚨 RULE #0: CONTEXTUAL FEATURE ROUTER (Before Starting)
341
357
 
342
- | Feature | Auto-Enable When | Override |
343
- |---------|------------------|----------|
344
- | **Loop Mode** | 3+ ready stories + test setup | `MODE=once` or "just one story" |
345
- | **Visual Mode** | UI keywords or AG-UI owner | `VISUAL=false` or "no screenshots" |
346
- | **Coverage Mode** | coverage baseline >50% | `COVERAGE=0` or "skip coverage" |
347
- | **Conditions** | Auto-add from package.json scripts | N/A |
358
+ **After running context script, read the "Smart Recommendations" section and act on it:**
348
359
 
349
- **Detection flow:**
350
- 1. Parse context output
351
- 2. Check detection rules
352
- 3. Enable applicable features
353
- 4. Inform user: "🧠 Auto-enabled: Loop Mode, Visual Mode..."
354
- 5. Proceed with work
360
+ 1. Read `docs/09-agents/smart-detect.json` (or the recommendations in context output)
361
+ 2. Note the lifecycle phase and auto-enabled modes (loop/visual/coverage)
362
+ 3. **Immediate** recommendations → present via AskUserQuestion or auto-run
363
+ 4. **Available** recommendations → include as options in your next AskUserQuestion
364
+ 5. Inform user: "🧠 Phase: X | Auto-enabled: Y | Recommended: Z"
365
+ 6. Track offered/used/skipped features in session state
355
366
 
356
367
  ---
357
368
 
358
- ### 🚨 RULE #1: ALWAYS END WITH AskUserQuestion (NEVER SKIP)
369
+ ### 🚨 RULE #1: ALWAYS END WITH SMART AskUserQuestion (NEVER SKIP)
359
370
 
360
- **EVERY response MUST end with the AskUserQuestion tool.** Not text like "Want me to...?" - the ACTUAL TOOL CALL.
371
+ **EVERY response MUST end with the AskUserQuestion tool** - but make it SMART and contextual.
361
372
 
362
- **This applies (natural pause points):**
363
- - After completing a task (ESPECIALLY important - don't leave user hanging)
364
- - After spawning an agent and receiving results
365
- - When presenting options or decisions
366
- - Even when you think you're "done" - ask what's next
373
+ **Smart suggestion principles:**
374
+ - **Always have a Recommended option** - Mark the best next step with "(Recommended)" based on where you are in the workflow
375
+ - **Be specific, not generic** - "Run tests for auth middleware" not "Run tests". "Implement the API endpoint next" not "Continue"
376
+ - **Suggest the logical next step** - If you just finished planning, recommend "Start implementation". If code is written, recommend "Run tests". If tests pass, recommend "Commit changes"
377
+ - **Include context in descriptions** - "3 files changed, 45 lines added" not just "Review changes"
378
+ - **Offer 3-4 options max** - One recommended, one alternative, one "pause/other"
379
+
380
+ **Contextual recommendations by phase:**
381
+ | Phase | Recommended Option | Why |
382
+ |-------|-------------------|-----|
383
+ | After context gathering | The most impactful ready story | Based on epic progress, blockers, dependencies |
384
+ | After plan approval | "Start implementing now" | Don't ask permission, suggest action |
385
+ | After code is written | "Run tests to verify (Recommended)" | Always verify before committing |
386
+ | After tests pass | "Commit and continue to next story" | Keep momentum |
387
+ | After error | "Try [specific alternative approach]" | Don't just say "fix it" |
388
+ | After expert returns | "Review and apply changes" or "Run tests" | Based on expert output quality |
367
389
 
368
390
  **Don't be annoying - DON'T ask for:**
369
391
  - ❌ Permission to read files, spawn experts, or do routine work
370
392
  - ❌ Confirmation of obvious next steps you should just do
371
393
  - ❌ Every micro-step in a workflow
372
394
 
373
- **Required format:**
374
- ```xml
375
- <function_calls>
376
- <invoke name="AskUserQuestion">
377
- <parameter name="questions">[{
378
- "question": "What would you like to do next?",
379
- "header": "Next step",
380
- "multiSelect": false,
381
- "options": [
382
- {"label": "Option A (Recommended)", "description": "Why this is best"},
383
- {"label": "Option B", "description": "Alternative"},
384
- {"label": "Pause", "description": "Stop here"}
385
- ]
386
- }]</parameter>
387
- </invoke>
388
- </function_calls>
395
+ **BAD (generic, unhelpful):**
396
+ ```json
397
+ [{"label": "Continue", "description": "Keep going"},
398
+ {"label": "Pause", "description": "Stop here"}]
399
+ ```
400
+
401
+ **GOOD (smart, contextual):**
402
+ ```json
403
+ [{"label": "Run npm test to verify auth changes (Recommended)", "description": "3 files changed in packages/cli/scripts/ - verify before committing"},
404
+ {"label": "Review the withAuth middleware diff", "description": "14 files touched - quick review before testing"},
405
+ {"label": "Commit and move to US-0044", "description": "EP-0018 is 80% done - 2 stories left"},
406
+ {"label": "Pause here", "description": "Changes saved, not committed"}]
389
407
  ```
390
408
 
391
409
  **❌ WRONG:** "Want me to continue?" / "Should I proceed?" / "Done! Let me know what's next"
392
- **✅ RIGHT:** Call the AskUserQuestion tool with actual options - NEVER end without it
410
+ **✅ RIGHT:** Call the AskUserQuestion tool with specific, contextual options - NEVER end without it
393
411
 
394
412
  ---
395
413
 
@@ -407,6 +425,17 @@ If you end your response without calling AskUserQuestion, you have violated thes
407
425
 
408
426
  ---
409
427
 
428
+ ### 🚨 RULE #2b: BIAS TOWARD IMPLEMENTATION
429
+
430
+ **Don't explore endlessly. Start writing code early.**
431
+
432
+ - Read at most 3-5 key files before starting implementation
433
+ - If plan mode is active, keep exploration under 2 minutes
434
+ - After plan approval, start implementing IMMEDIATELY - don't ask "ready?"
435
+ - If a session is 10+ minutes in with zero code changes, something is wrong
436
+
437
+ ---
438
+
410
439
  ### 🚨 RULE #3: DELEGATION FRAMEWORK
411
440
 
412
441
  ```
@@ -561,9 +590,11 @@ After implementation completes, you MUST call AskUserQuestion with options like:
561
590
  11. Call `ExitPlanMode` for user approval
562
591
 
563
592
  **Phase 3: Execution**
564
- 12. Delegate to experts based on scope
565
- 13. Collect results if async (TaskOutput)
566
- 14. Verify tests pass
593
+ 12. **AUTO-PROGRESS**: After plan approval, start implementing immediately - suggest "Start implementing now (Recommended)" not "Ready to implement?"
594
+ 13. Delegate to experts based on scope
595
+ 14. Collect results if async (TaskOutput)
596
+ 15. Verify tests pass
597
+ 16. AskUserQuestion with specific test results: "All tests pass - commit changes? (Recommended)"
567
598
 
568
599
  **Phase 4: Completion**
569
600
  15. Update status.json (mark story done)
@@ -669,10 +700,28 @@ After completing an implementation, offer logic audit as an **optional quality c
669
700
 
670
701
  ---
671
702
 
703
+ ### SMART ASKUSERQUESTION EXAMPLES
704
+
705
+ After implementation:
706
+ - "Run `npm test` in packages/cli/ (Recommended)" + "3 files changed, verify before commit"
707
+ - "🔍 Run logic audit on modified files" + "5 analyzers check for edge cases"
708
+
709
+ After tests pass:
710
+ - "Commit: 'fix: resolve tmux socket path' (Recommended)" + "All tests pass"
711
+ - "Review diff before committing" + "14 files touched"
712
+
713
+ After error:
714
+ - "Try alternative: use execFileSync instead (Recommended)" + "Current approach has shell injection risk"
715
+ - "Run /agileflow:research:ask" + "Same error occurred twice"
716
+
717
+ ---
718
+
672
719
  ### REMEMBER AFTER COMPACTION
673
720
 
674
721
  - `/agileflow:babysit` IS ACTIVE - follow these rules
675
- - **SMART DETECTION**: Auto-enable Loop/Visual/Coverage modes based on context
722
+ - **CONTEXTUAL ROUTER**: Read smart-detect.json for recommendations, act on immediate items
723
+ - **SMART AskUserQuestion**: Always specific, always contextual, always with (Recommended) option
724
+ - **BIAS TOWARD IMPLEMENTATION**: Read 3-5 files max then start coding
676
725
  - Plan mode FIRST for non-trivial tasks
677
726
  - Delegate complex work to experts
678
727
  - If stuck 2+ times → research prompt
@@ -1412,16 +1461,14 @@ After running context script:
1412
1461
  ```
1413
1462
  **AgileFlow Mentor** ready. I'll coordinate domain experts for your implementation.
1414
1463
 
1415
- 🧠 Smart Detection Results:
1416
- ━━━━━━━━━━━━━━━━━━━━━━━━━━
1417
- [Show detected features based on context analysis]
1418
- Loop Mode: ENABLED/DISABLED (reason)
1419
- Visual Mode: ENABLED/DISABLED (reason)
1420
- ✓ Coverage Mode: ENABLED/DISABLED @ N% (reason)
1421
- ✓ Conditions: [detected from package.json]
1464
+ 🧠 Contextual Router:
1465
+ ━━━━━━━━━━━━━━━━━━━━
1466
+ Phase: [lifecycle phase] | [phase reason]
1467
+ [Show auto-enabled modes: loop/visual/coverage]
1468
+ [Show immediate recommendations if any]
1422
1469
 
1423
1470
  Based on your project state:
1424
- [Present 3-5 ranked suggestions via AskUserQuestion]
1471
+ [Present 3-5 ranked suggestions via AskUserQuestion, incorporating smart-detect recommendations]
1425
1472
 
1426
1473
  **My approach:**
1427
1474
  1. You select a task
@@ -95,19 +95,36 @@ Automatically generate changelog from PR titles, commits, and tags.
95
95
  - Memory leak in WebSocket handler (#139)
96
96
  ```
97
97
 
98
- **Tool Usage Example**:
98
+ **Tool Usage Examples**:
99
+
100
+ Post-generation (use actual commit counts):
101
+ ```xml
102
+ <invoke name="AskUserQuestion">
103
+ <parameter name="questions">[{
104
+ "question": "Changelog preview: [N] entries ([added] added, [fixed] fixed, [changed] changed). Suggested version: [version]. What next?",
105
+ "header": "Changelog",
106
+ "multiSelect": false,
107
+ "options": [
108
+ {"label": "Add [N] entries to CHANGELOG.md (Recommended)", "description": "Update changelog with [version] section and commit"},
109
+ {"label": "Preview entries first", "description": "Show full formatted changelog section before writing"},
110
+ {"label": "Edit entries manually", "description": "Adjust wording, recategorize, or remove entries"},
111
+ {"label": "Skip", "description": "Preview generated, no changes to CHANGELOG.md"}
112
+ ]
113
+ }]</parameter>
114
+ </invoke>
115
+ ```
116
+
99
117
  When commits need manual categorization:
100
118
  ```xml
101
119
  <invoke name="AskUserQuestion">
102
120
  <parameter name="questions">[{
103
- "question": "How should this commit be categorized?",
104
- "header": "Categorize Commit",
121
+ "question": "How should '[commit message]' be categorized?",
122
+ "header": "Categorize",
105
123
  "multiSelect": false,
106
124
  "options": [
107
125
  {"label": "Added", "description": "New feature or capability (feat:)"},
108
126
  {"label": "Changed", "description": "Modification or enhancement (refactor:, perf:)"},
109
127
  {"label": "Fixed", "description": "Bug fix (fix:)"},
110
- {"label": "Security", "description": "Security fix (security:)"},
111
128
  {"label": "Skip", "description": "Don't include in changelog"}
112
129
  ]
113
130
  }]</parameter>
@@ -39,8 +39,9 @@ Main Menu → "What would you like to configure?"
39
39
  │ └─ Custom: Save, Export, Import, Delete
40
40
  ├─ Features → Enable | Disable | View status
41
41
  │ └─ Hooks (4) + Other Features (4)
42
- ├─ Sessions → Default startup mode for new sessions
43
- └─ Normal | Skip permissions | Accept edits | No Claude
42
+ ├─ Sessions → Startup mode and Agent Teams configuration
43
+ ├─ Startup Mode: Normal | Skip permissions | Accept edits | No Claude
44
+ │ └─ Agent Teams: Enable/disable native multi-agent orchestration
44
45
  ├─ Infrastructure → Visual E2E | Damage Control | CI/CD | Quality Gates
45
46
  └─ Maintenance → Fix format | Upgrade | Repair | Check status
46
47
  ```
@@ -390,6 +391,24 @@ node .agileflow/scripts/agileflow-configure.js --disable=feature1,feature2
390
391
 
391
392
  ### If "Sessions" selected
392
393
 
394
+ Present the Sessions sub-menu:
395
+
396
+ ```xml
397
+ <invoke name="AskUserQuestion">
398
+ <parameter name="questions">[{
399
+ "question": "What session setting would you like to configure?",
400
+ "header": "Sessions",
401
+ "multiSelect": false,
402
+ "options": [
403
+ {"label": "Default startup mode", "description": "How Claude launches in new sessions (permissions, worktree-only)"},
404
+ {"label": "Agent Teams", "description": "Enable/disable native multi-agent orchestration (experimental)"}
405
+ ]
406
+ }]</parameter>
407
+ </invoke>
408
+ ```
409
+
410
+ #### If "Default startup mode" selected
411
+
393
412
  Configure default startup mode for new sessions created with `/agileflow:session:new`.
394
413
 
395
414
  First, read current setting:
@@ -498,6 +517,88 @@ The 'af' command already reads the configured startup mode automatically.
498
517
  No additional changes needed.
499
518
  ```
500
519
 
520
+ #### If "Agent Teams" selected
521
+
522
+ Configure Claude Code's native multi-agent orchestration (experimental feature).
523
+
524
+ First, read current setting:
525
+ ```bash
526
+ node -e "try{const m=JSON.parse(require('fs').readFileSync('docs/00-meta/agileflow-metadata.json','utf8'));console.log(JSON.stringify({enabled:m.features?.agentTeams?.enabled||false}))}catch(e){console.log(JSON.stringify({enabled:false}))}"
527
+ ```
528
+
529
+ Then present options:
530
+ ```xml
531
+ <invoke name="AskUserQuestion">
532
+ <parameter name="questions">[{
533
+ "question": "Enable native Agent Teams? This uses Claude Code's experimental multi-agent orchestration (TeamCreate, SendMessage) for parallel agent coordination.",
534
+ "header": "Agent Teams",
535
+ "multiSelect": false,
536
+ "options": [
537
+ {"label": "Enable (Recommended)", "description": "Use native Agent Teams when available, subagent fallback when not"},
538
+ {"label": "Disable", "description": "Always use subagent mode (Task/TaskOutput) for multi-agent work"},
539
+ {"label": "What is this?", "description": "Learn more about Agent Teams before deciding"}
540
+ ]
541
+ }]</parameter>
542
+ </invoke>
543
+ ```
544
+
545
+ **If "Enable" selected:**
546
+ ```bash
547
+ node .agileflow/scripts/agileflow-configure.js --enable=agentteams
548
+ ```
549
+
550
+ Display:
551
+ ```
552
+ ✅ Native Agent Teams enabled
553
+
554
+ When Claude Code sets CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1, AgileFlow will:
555
+ • Use native TeamCreate for parallel agent spawning
556
+ • Send messages via both native SendMessage AND JSONL bus
557
+ • Track team lifecycle events in session-state.json
558
+
559
+ When the flag is not set, AgileFlow falls back to subagent mode automatically.
560
+ ```
561
+
562
+ **If "Disable" selected:**
563
+ ```bash
564
+ node .agileflow/scripts/agileflow-configure.js --disable=agentteams
565
+ ```
566
+
567
+ Display:
568
+ ```
569
+ ✅ Native Agent Teams disabled
570
+
571
+ AgileFlow will use subagent mode (Task/TaskOutput) for all multi-agent
572
+ orchestration. This is the stable, well-tested mode.
573
+ ```
574
+
575
+ **If "What is this?" selected:**
576
+
577
+ Display this explanation:
578
+ ```
579
+ ## Agent Teams (Experimental)
580
+
581
+ Claude Code's native Agent Teams feature enables parallel multi-agent
582
+ orchestration with explicit coordination tools:
583
+
584
+ • TeamCreate/TeamDelete - Spawn and manage agent teams
585
+ • SendMessage - Direct agent-to-agent communication (3ms vs 150ms JSONL)
586
+ • Enhanced TaskCreate/Update - Native task coordination
587
+
588
+ How AgileFlow integrates:
589
+ 1. When enabled, team-manager.js builds native TeamCreate payloads
590
+ 2. messaging-bridge.js sends to BOTH native channel AND JSONL bus
591
+ 3. damage-control-multi-agent.js validates Team/Task operations
592
+ 4. Subagent mode remains available as automatic fallback
593
+
594
+ Requirements:
595
+ • Claude Code must set CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
596
+ • Feature is opt-in per project via this configuration
597
+ • CI/CD always uses subagent mode (safety gate)
598
+ ```
599
+
600
+ Then re-ask the enable/disable question.
601
+
501
602
  ---
502
603
 
503
604
  ### If "Infrastructure" selected
@@ -637,6 +738,8 @@ node .agileflow/scripts/agileflow-configure.js --disable=statusline
637
738
  node .agileflow/scripts/agileflow-configure.js --enable=archival --archival-days=14
638
739
  node .agileflow/scripts/agileflow-configure.js --enable=shellaliases
639
740
  node .agileflow/scripts/agileflow-configure.js --enable=claudemdreinforcement
741
+ node .agileflow/scripts/agileflow-configure.js --enable=agentteams
742
+ node .agileflow/scripts/agileflow-configure.js --disable=agentteams
640
743
 
641
744
  # Maintenance
642
745
  node .agileflow/scripts/agileflow-configure.js --detect
@@ -119,10 +119,20 @@ Clear separation: AuthService, AuthRepository, AuthController...</parameter>
119
119
  </invoke>
120
120
  ```
121
121
 
122
- **AskUserQuestion** (for approval):
122
+ **AskUserQuestion** (use actual counts from scan):
123
123
  ```xml
124
124
  <invoke name="AskUserQuestion">
125
- <parameter name="questions">[{"question": "Generate stories for critical debt?", "header": "Action", "multiSelect": false, "options": [{"label": "Yes, create stories", "description": "Generate stories for top 5 critical items"}, {"label": "No, report only", "description": "Save report without creating stories"}]}]</parameter>
125
+ <parameter name="questions">[{
126
+ "question": "Found [N] debt items ([critical] critical, [high] high). Total effort: ~[days] days. What next?",
127
+ "header": "Action",
128
+ "multiSelect": false,
129
+ "options": [
130
+ {"label": "Generate [N] stories for critical items (Recommended)", "description": "Create trackable stories for the [critical] critical-severity debt items"},
131
+ {"label": "Review debt items in detail first", "description": "Show full analysis for each item before deciding"},
132
+ {"label": "Export debt report to docs/08-project/", "description": "Save report as tech-debt-[date].md for team review"},
133
+ {"label": "Skip for now", "description": "Scan complete, [N] items identified"}
134
+ ]
135
+ }]</parameter>
126
136
  </invoke>
127
137
  ```
128
138
 
@@ -194,17 +194,18 @@ Suggested Story: "US-XXXX: Improve story template with AC examples"
194
194
  </invoke>
195
195
  ```
196
196
 
197
- **AskUserQuestion** (for feedback permission):
197
+ **AskUserQuestion** (use actual story/sprint context):
198
198
  ```xml
199
199
  <invoke name="AskUserQuestion">
200
200
  <parameter name="questions">[{
201
- "question": "Provide feedback on US-0042 completion?",
202
- "header": "Optional Feedback",
201
+ "question": "[STORY] completed in [duration]. Quick feedback? (optional, ~2 min)",
202
+ "header": "Feedback",
203
203
  "multiSelect": false,
204
204
  "options": [
205
- {"label": "Yes, provide feedback", "description": "Take 2-3 min to share insights"},
206
- {"label": "Not now", "description": "Skip feedback"},
207
- {"label": "Remind me later", "description": "Ask again next time"}
205
+ {"label": "Rate this story's workflow (Recommended)", "description": "Quick 1-5 ratings on AC clarity, estimate accuracy, and smoothness"},
206
+ {"label": "Report a workflow issue", "description": "Flag a specific problem encountered during [STORY]"},
207
+ {"label": "Suggest process improvement", "description": "Share an idea based on what you learned"},
208
+ {"label": "Skip for now", "description": "No feedback needed for [STORY]"}
208
209
  ]
209
210
  }]</parameter>
210
211
  </invoke>
@@ -173,7 +173,7 @@ Consolidate into unified error handling with typed exceptions.
173
173
  💡 Actions:
174
174
  • Create story: /agileflow:story "Error Handling Consolidation"
175
175
  • Mark in progress: Update ideation index manually
176
- • View original report: Read docs/08-project/ideation-20260106.md
176
+ • View original report: Read docs/08-project/ideation/ideation-20260106.md
177
177
  ```
178
178
 
179
179
  **Status Filter Output** (when STATUS=pending):