agileflow 3.1.0 → 3.2.1

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 (106) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +57 -85
  3. package/lib/dashboard-automations.js +130 -0
  4. package/lib/dashboard-git.js +254 -0
  5. package/lib/dashboard-inbox.js +64 -0
  6. package/lib/dashboard-protocol.js +1 -0
  7. package/lib/dashboard-server.js +114 -924
  8. package/lib/dashboard-session.js +136 -0
  9. package/lib/dashboard-status.js +72 -0
  10. package/lib/dashboard-terminal.js +354 -0
  11. package/lib/dashboard-websocket.js +88 -0
  12. package/lib/drivers/codex-driver.ts +4 -4
  13. package/lib/logger.js +106 -0
  14. package/package.json +4 -2
  15. package/scripts/agileflow-configure.js +2 -2
  16. package/scripts/agileflow-welcome.js +409 -434
  17. package/scripts/claude-tmux.sh +80 -2
  18. package/scripts/context-loader.js +4 -9
  19. package/scripts/lib/browser-qa-evidence.js +409 -0
  20. package/scripts/lib/browser-qa-status.js +192 -0
  21. package/scripts/lib/command-prereqs.js +280 -0
  22. package/scripts/lib/configure-detect.js +92 -2
  23. package/scripts/lib/configure-features.js +295 -1
  24. package/scripts/lib/context-formatter.js +468 -233
  25. package/scripts/lib/context-loader.js +27 -15
  26. package/scripts/lib/damage-control-utils.js +8 -1
  27. package/scripts/lib/feature-catalog.js +321 -0
  28. package/scripts/lib/portable-tasks-cli.js +274 -0
  29. package/scripts/lib/portable-tasks.js +479 -0
  30. package/scripts/lib/signal-detectors.js +1 -1
  31. package/scripts/lib/team-events.js +86 -1
  32. package/scripts/obtain-context.js +28 -4
  33. package/scripts/smart-detect.js +17 -0
  34. package/scripts/strip-ai-attribution.js +63 -0
  35. package/scripts/team-manager.js +7 -2
  36. package/scripts/welcome-deferred.js +437 -0
  37. package/src/core/agents/browser-qa.md +328 -0
  38. package/src/core/agents/perf-analyzer-assets.md +174 -0
  39. package/src/core/agents/perf-analyzer-bundle.md +165 -0
  40. package/src/core/agents/perf-analyzer-caching.md +160 -0
  41. package/src/core/agents/perf-analyzer-compute.md +165 -0
  42. package/src/core/agents/perf-analyzer-memory.md +182 -0
  43. package/src/core/agents/perf-analyzer-network.md +157 -0
  44. package/src/core/agents/perf-analyzer-queries.md +155 -0
  45. package/src/core/agents/perf-analyzer-rendering.md +156 -0
  46. package/src/core/agents/perf-consensus.md +280 -0
  47. package/src/core/agents/security-analyzer-api.md +199 -0
  48. package/src/core/agents/security-analyzer-auth.md +160 -0
  49. package/src/core/agents/security-analyzer-authz.md +168 -0
  50. package/src/core/agents/security-analyzer-deps.md +147 -0
  51. package/src/core/agents/security-analyzer-infra.md +176 -0
  52. package/src/core/agents/security-analyzer-injection.md +148 -0
  53. package/src/core/agents/security-analyzer-input.md +191 -0
  54. package/src/core/agents/security-analyzer-secrets.md +175 -0
  55. package/src/core/agents/security-consensus.md +276 -0
  56. package/src/core/agents/test-analyzer-assertions.md +181 -0
  57. package/src/core/agents/test-analyzer-coverage.md +183 -0
  58. package/src/core/agents/test-analyzer-fragility.md +185 -0
  59. package/src/core/agents/test-analyzer-integration.md +155 -0
  60. package/src/core/agents/test-analyzer-maintenance.md +173 -0
  61. package/src/core/agents/test-analyzer-mocking.md +178 -0
  62. package/src/core/agents/test-analyzer-patterns.md +189 -0
  63. package/src/core/agents/test-analyzer-structure.md +177 -0
  64. package/src/core/agents/test-consensus.md +294 -0
  65. package/src/core/commands/{legal/audit.md → audit/legal.md} +13 -13
  66. package/src/core/commands/{logic/audit.md → audit/logic.md} +12 -12
  67. package/src/core/commands/audit/performance.md +443 -0
  68. package/src/core/commands/audit/security.md +443 -0
  69. package/src/core/commands/audit/test.md +442 -0
  70. package/src/core/commands/babysit.md +505 -463
  71. package/src/core/commands/browser-qa.md +240 -0
  72. package/src/core/commands/configure.md +8 -8
  73. package/src/core/commands/research/ask.md +42 -9
  74. package/src/core/commands/research/import.md +14 -8
  75. package/src/core/commands/research/list.md +17 -16
  76. package/src/core/commands/research/synthesize.md +8 -8
  77. package/src/core/commands/research/view.md +28 -4
  78. package/src/core/commands/whats-new.md +2 -2
  79. package/src/core/experts/devops/expertise.yaml +13 -2
  80. package/src/core/experts/documentation/expertise.yaml +26 -4
  81. package/src/core/profiles/COMPARISON.md +170 -0
  82. package/src/core/profiles/README.md +178 -0
  83. package/src/core/profiles/claude-code.yaml +111 -0
  84. package/src/core/profiles/codex.yaml +103 -0
  85. package/src/core/profiles/cursor.yaml +134 -0
  86. package/src/core/profiles/examples.js +250 -0
  87. package/src/core/profiles/loader.js +235 -0
  88. package/src/core/profiles/windsurf.yaml +159 -0
  89. package/src/core/teams/logic-audit.json +6 -0
  90. package/src/core/teams/perf-audit.json +71 -0
  91. package/src/core/teams/security-audit.json +71 -0
  92. package/src/core/teams/test-audit.json +71 -0
  93. package/src/core/templates/browser-qa-spec.yaml +94 -0
  94. package/src/core/templates/command-prerequisites.yaml +169 -0
  95. package/src/core/templates/damage-control-patterns.yaml +9 -0
  96. package/tools/cli/installers/ide/_base-ide.js +33 -3
  97. package/tools/cli/installers/ide/claude-code.js +2 -69
  98. package/tools/cli/installers/ide/codex.js +9 -9
  99. package/tools/cli/installers/ide/cursor.js +165 -4
  100. package/tools/cli/installers/ide/windsurf.js +237 -6
  101. package/tools/cli/lib/content-transformer.js +234 -9
  102. package/tools/cli/lib/docs-setup.js +1 -1
  103. package/tools/cli/lib/ide-generator.js +357 -0
  104. package/tools/cli/lib/ide-registry.js +2 -2
  105. package/scripts/tmux-task-name.sh +0 -105
  106. package/scripts/tmux-task-watcher.sh +0 -344
@@ -4,7 +4,7 @@ argument-hint: "[file|directory] [DEPTH=quick|deep] [FOCUS=privacy|terms|a11y|li
4
4
  compact_context:
5
5
  priority: high
6
6
  preserve_rules:
7
- - "ACTIVE COMMAND: /agileflow:legal:audit - Multi-agent legal risk analysis"
7
+ - "ACTIVE COMMAND: /agileflow:audit:legal - Multi-agent legal risk analysis"
8
8
  - "CRITICAL: Deploy analyzers IN PARALLEL in ONE message with multiple Task calls"
9
9
  - "CRITICAL: Wait for all results before running consensus (use TaskOutput with block=true)"
10
10
  - "CRITICAL: Confidence scoring: CONFIRMED (2+ agree), LIKELY (1 with evidence), INVESTIGATE (1 weak)"
@@ -18,7 +18,7 @@ compact_context:
18
18
  - findings_collected
19
19
  ---
20
20
 
21
- # /agileflow:legal:audit
21
+ # /agileflow:audit:legal
22
22
 
23
23
  Deploy multiple specialized legal risk analyzers in parallel to find compliance gaps, then synthesize results through consensus voting into a prioritized Legal Risk Report.
24
24
 
@@ -27,11 +27,11 @@ Deploy multiple specialized legal risk analyzers in parallel to find compliance
27
27
  ## Quick Reference
28
28
 
29
29
  ```
30
- /agileflow:legal:audit app/ # Analyze app directory (quick, core 5 analyzers)
31
- /agileflow:legal:audit . DEPTH=deep # Deep analysis - all 9 analyzers
32
- /agileflow:legal:audit src/ FOCUS=privacy,a11y # Focus on specific areas
33
- /agileflow:legal:audit . DEPTH=deep FOCUS=all # Comprehensive full audit
34
- /agileflow:legal:audit app/page.tsx FOCUS=ai # Check single file for AI compliance
30
+ /agileflow:audit:legal app/ # Analyze app directory (quick, core 5 analyzers)
31
+ /agileflow:audit:legal . DEPTH=deep # Deep analysis - all 9 analyzers
32
+ /agileflow:audit:legal src/ FOCUS=privacy,a11y # Focus on specific areas
33
+ /agileflow:audit:legal . DEPTH=deep FOCUS=all # Comprehensive full audit
34
+ /agileflow:audit:legal app/page.tsx FOCUS=ai # Check single file for AI compliance
35
35
  ```
36
36
 
37
37
  ---
@@ -40,7 +40,7 @@ Deploy multiple specialized legal risk analyzers in parallel to find compliance
40
40
 
41
41
  ```
42
42
  ┌─────────────────────────────────────────────────────────────┐
43
- │ /agileflow:legal:audit
43
+ │ /agileflow:audit:legal │
44
44
  │ │
45
45
  │ 1. Parse arguments (target, depth, focus) │
46
46
  │ 2. Deploy analyzers IN PARALLEL │
@@ -379,13 +379,13 @@ Total: 10 findings (3 false positives excluded)
379
379
  <!-- COMPACT_SUMMARY_START -->
380
380
  ## Compact Summary
381
381
 
382
- **Command**: `/agileflow:legal:audit` - Multi-agent legal risk analysis with consensus
382
+ **Command**: `/agileflow:audit:legal` - Multi-agent legal risk analysis with consensus
383
383
 
384
384
  **Quick Usage**:
385
385
  ```
386
- /agileflow:legal:audit app/ # Quick scan (core 5 analyzers)
387
- /agileflow:legal:audit . DEPTH=deep # All 9 analyzers
388
- /agileflow:legal:audit src/ FOCUS=privacy,a11y # Specific areas
386
+ /agileflow:audit:legal app/ # Quick scan (core 5 analyzers)
387
+ /agileflow:audit:legal . DEPTH=deep # All 9 analyzers
388
+ /agileflow:audit:legal src/ FOCUS=privacy,a11y # Specific areas
389
389
  ```
390
390
 
391
391
  **What It Does**: Deploy legal analyzers in parallel → Each finds different compliance gaps → Consensus coordinator validates, filters by project type, prioritizes → Actionable Legal Risk Report
@@ -440,7 +440,7 @@ Fix before launch? [Y/n]
440
440
 
441
441
  ## Related Commands
442
442
 
443
- - `/agileflow:logic:audit` - Logic bug analysis (similar architecture)
443
+ - `/agileflow:audit:logic` - Logic bug analysis (similar architecture)
444
444
  - `/agileflow:review` - Code review (includes some compliance checks)
445
445
  - `/agileflow:multi-expert` - General multi-expert analysis
446
446
  - `/agileflow:verify` - Run tests
@@ -4,7 +4,7 @@ argument-hint: "[file|directory] [DEPTH=quick|deep] [FOCUS=edge|invariant|flow|t
4
4
  compact_context:
5
5
  priority: high
6
6
  preserve_rules:
7
- - "ACTIVE COMMAND: /agileflow:logic:audit - Multi-agent logic analysis"
7
+ - "ACTIVE COMMAND: /agileflow:audit:logic - Multi-agent logic analysis"
8
8
  - "CRITICAL: Deploy analyzers IN PARALLEL in ONE message with multiple Task calls"
9
9
  - "CRITICAL: Wait for all results before running consensus (use TaskOutput with block=true)"
10
10
  - "CRITICAL: Confidence scoring: CONFIRMED (2+ agree), LIKELY (1 with evidence), INVESTIGATE (1 weak)"
@@ -18,7 +18,7 @@ compact_context:
18
18
  - findings_collected
19
19
  ---
20
20
 
21
- # /agileflow:logic:audit
21
+ # /agileflow:audit:logic
22
22
 
23
23
  Deploy multiple specialized logic analyzers in parallel to find bugs, then synthesize results through consensus voting.
24
24
 
@@ -27,10 +27,10 @@ Deploy multiple specialized logic analyzers in parallel to find bugs, then synth
27
27
  ## Quick Reference
28
28
 
29
29
  ```
30
- /agileflow:logic:audit src/utils.js # Analyze single file
31
- /agileflow:logic:audit src/ DEPTH=deep # Deep analysis of directory
32
- /agileflow:logic:audit . FOCUS=race,type # Focus on race conditions and type issues
33
- /agileflow:logic:audit src/cart.js DEPTH=quick # Quick scan of specific file
30
+ /agileflow:audit:logic src/utils.js # Analyze single file
31
+ /agileflow:audit:logic src/ DEPTH=deep # Deep analysis of directory
32
+ /agileflow:audit:logic . FOCUS=race,type # Focus on race conditions and type issues
33
+ /agileflow:audit:logic src/cart.js DEPTH=quick # Quick scan of specific file
34
34
  ```
35
35
 
36
36
  ---
@@ -39,7 +39,7 @@ Deploy multiple specialized logic analyzers in parallel to find bugs, then synth
39
39
 
40
40
  ```
41
41
  ┌─────────────────────────────────────────────────────────────┐
42
- │ /agileflow:logic:audit
42
+ │ /agileflow:audit:logic │
43
43
  │ │
44
44
  │ 1. Parse arguments (target, depth, focus) │
45
45
  │ 2. Deploy 5 analyzers IN PARALLEL │
@@ -307,13 +307,13 @@ Total: 7 findings (2 false positives excluded)
307
307
  <!-- COMPACT_SUMMARY_START -->
308
308
  ## Compact Summary
309
309
 
310
- **Command**: `/agileflow:logic:audit` - Multi-agent logic analysis with consensus
310
+ **Command**: `/agileflow:audit:logic` - Multi-agent logic analysis with consensus
311
311
 
312
312
  **Quick Usage**:
313
313
  ```
314
- /agileflow:logic:audit src/utils.js # Single file
315
- /agileflow:logic:audit src/ DEPTH=deep # Deep analysis
316
- /agileflow:logic:audit . FOCUS=race,type # Specific analyzers
314
+ /agileflow:audit:logic src/utils.js # Single file
315
+ /agileflow:audit:logic src/ DEPTH=deep # Deep analysis
316
+ /agileflow:audit:logic . FOCUS=race,type # Specific analyzers
317
317
  ```
318
318
 
319
319
  **What It Does**: Deploy 5 logic analyzers in parallel → Each finds different bug classes → Consensus coordinator validates and prioritizes → Actionable report
@@ -354,7 +354,7 @@ Proceed with tests? [Y/n]
354
354
 
355
355
  To integrate with babysit, add to implementation workflow:
356
356
  1. Complete implementation
357
- 2. Run `/agileflow:logic:audit {changed_files} DEPTH=quick`
357
+ 2. Run `/agileflow:audit:logic {changed_files} DEPTH=quick`
358
358
  3. If critical issues → block, show findings
359
359
  4. If no critical → proceed to tests
360
360
 
@@ -0,0 +1,443 @@
1
+ ---
2
+ description: Multi-agent performance bottleneck analysis with consensus voting for finding optimization opportunities
3
+ argument-hint: "[file|directory] [DEPTH=quick|deep] [FOCUS=queries|rendering|memory|bundle|compute|network|caching|assets|all]"
4
+ compact_context:
5
+ priority: high
6
+ preserve_rules:
7
+ - "ACTIVE COMMAND: /agileflow:audit:performance - Multi-agent performance bottleneck analysis"
8
+ - "CRITICAL: Deploy analyzers IN PARALLEL in ONE message with multiple Task calls"
9
+ - "CRITICAL: Wait for all results before running consensus (use TaskOutput with block=true)"
10
+ - "CRITICAL: Confidence scoring: CONFIRMED (2+ agree), LIKELY (1 with evidence), INVESTIGATE (1 weak)"
11
+ - "MUST parse arguments: TARGET (file/dir), DEPTH (quick/deep), FOCUS (queries|rendering|memory|bundle|compute|network|caching|assets|all)"
12
+ - "Pass consensus all analyzer outputs, let it synthesize the final report"
13
+ state_fields:
14
+ - target_path
15
+ - depth
16
+ - focus_areas
17
+ - analyzers_deployed
18
+ - findings_collected
19
+ ---
20
+
21
+ # /agileflow:audit:performance
22
+
23
+ Deploy multiple specialized performance analyzers in parallel to find bottlenecks and optimization opportunities, then synthesize results through consensus voting into a prioritized Performance Audit Report.
24
+
25
+ ---
26
+
27
+ ## Quick Reference
28
+
29
+ ```
30
+ /agileflow:audit:performance app/ # Analyze app directory (quick, core 5 analyzers)
31
+ /agileflow:audit:performance . DEPTH=deep # Deep analysis - all 8 analyzers
32
+ /agileflow:audit:performance src/ FOCUS=queries,memory # Focus on specific areas
33
+ /agileflow:audit:performance . DEPTH=deep FOCUS=all # Comprehensive full audit
34
+ /agileflow:audit:performance app/api/ FOCUS=queries # Check API queries specifically
35
+ ```
36
+
37
+ ---
38
+
39
+ ## How It Works
40
+
41
+ ```
42
+ +-------------------------------------------------------------+
43
+ | /agileflow:audit:performance |
44
+ | |
45
+ | 1. Parse arguments (target, depth, focus) |
46
+ | 2. Deploy analyzers IN PARALLEL |
47
+ | 3. Collect all findings |
48
+ | 4. Run consensus coordinator to validate & prioritize |
49
+ | 5. Generate actionable Performance Audit Report |
50
+ +-------------------------------------------------------------+
51
+
52
+ +---------+ +----------+ +--------+ +--------+ +---------+
53
+ | Queries | | Rendering| | Memory | | Bundle | | Compute |
54
+ +----+----+ +----+-----+ +---+----+ +---+----+ +----+----+
55
+ | | | | |
56
+ +----+---+ +----+---+ +----+---+ (deep only)
57
+ | Network| | Caching| | Assets |
58
+ +---+----+ +---+----+ +---+----+
59
+ | | |
60
+ +-----------+----------+
61
+ v
62
+ +----------------------+
63
+ | Consensus Coordinator|
64
+ | (validates, votes, |
65
+ | generates report) |
66
+ +----------------------+
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Arguments
72
+
73
+ | Argument | Values | Default | Description |
74
+ |----------|--------|---------|-------------|
75
+ | TARGET | file/directory | `.` | What to analyze |
76
+ | DEPTH | quick, deep | quick | quick = core 5 analyzers, deep = all 8 |
77
+ | FOCUS | queries,rendering,memory,bundle,compute,network,caching,assets,all | all | Which analyzers to deploy |
78
+
79
+ ---
80
+
81
+ ## Step-by-Step Process
82
+
83
+ ### STEP 1: Parse Arguments
84
+
85
+ ```
86
+ TARGET = first argument or current directory
87
+ DEPTH = quick (default) or deep
88
+ FOCUS = all (default) or comma-separated list
89
+ ```
90
+
91
+ **Analyzer Selection**:
92
+
93
+ | Condition | Analyzers Deployed |
94
+ |-----------|-------------------|
95
+ | `DEPTH=quick` + `FOCUS=all` | queries, rendering, memory, bundle, compute (core 5) |
96
+ | `DEPTH=deep` + `FOCUS=all` | All 8 analyzers |
97
+ | `FOCUS=queries` | perf-analyzer-queries only |
98
+ | `FOCUS=rendering` | perf-analyzer-rendering only |
99
+ | `FOCUS=memory` | perf-analyzer-memory only |
100
+ | `FOCUS=bundle` | perf-analyzer-bundle only |
101
+ | `FOCUS=compute` | perf-analyzer-compute only |
102
+ | `FOCUS=network` | perf-analyzer-network only |
103
+ | `FOCUS=caching` | perf-analyzer-caching only |
104
+ | `FOCUS=assets` | perf-analyzer-assets only |
105
+ | `FOCUS=queries,memory` | Comma-separated: deploy specified analyzers |
106
+
107
+ **DEPTH behavior**:
108
+ - `quick` (default): Deploy core 5 analyzers. Focus on CRITICAL/HIGH issues only.
109
+ - `deep`: Deploy all 8 analyzers. Include MEDIUM/LOW findings.
110
+
111
+ ### STEP 2: Deploy Analyzers in Parallel
112
+
113
+ **CRITICAL**: Deploy ALL selected analyzers in a SINGLE message with multiple Task calls.
114
+
115
+ **Prompt template for each analyzer**:
116
+
117
+ ```
118
+ TASK: Analyze the following code for {PERFORMANCE_DOMAIN} bottlenecks.
119
+
120
+ TARGET: {file_path or directory}
121
+ DEPTH: {quick|deep}
122
+
123
+ {For quick depth}: Focus on CRITICAL and HIGH severity issues only. Skip micro-optimizations.
124
+ {For deep depth}: Be comprehensive. Include MEDIUM and LOW severity findings.
125
+
126
+ Read the target files and apply your analysis methodology.
127
+
128
+ OUTPUT your findings in your standard format (FINDING-N with location, severity, confidence, code, explanation, remediation).
129
+
130
+ If no issues found, output: "No {PERFORMANCE_DOMAIN} bottlenecks found in {TARGET}"
131
+ ```
132
+
133
+ **Example deployment (DEPTH=quick, FOCUS=all - deploys core 5)**:
134
+
135
+ ```xml
136
+ <invoke name="Task">
137
+ <parameter name="description">Query performance analysis</parameter>
138
+ <parameter name="prompt">TASK: Analyze the following code for QUERY PERFORMANCE bottlenecks.
139
+ TARGET: src/
140
+ DEPTH: quick
141
+ Focus on CRITICAL and HIGH severity issues only...
142
+ ...</parameter>
143
+ <parameter name="subagent_type">perf-analyzer-queries</parameter>
144
+ <parameter name="run_in_background">true</parameter>
145
+ </invoke>
146
+
147
+ <invoke name="Task">
148
+ <parameter name="description">Rendering performance analysis</parameter>
149
+ <parameter name="prompt">TASK: Analyze the following code for RENDERING PERFORMANCE bottlenecks.
150
+ TARGET: src/
151
+ DEPTH: quick
152
+ ...</parameter>
153
+ <parameter name="subagent_type">perf-analyzer-rendering</parameter>
154
+ <parameter name="run_in_background">true</parameter>
155
+ </invoke>
156
+
157
+ <invoke name="Task">
158
+ <parameter name="description">Memory leak analysis</parameter>
159
+ <parameter name="prompt">TASK: Analyze the following code for MEMORY LEAK and RETENTION bottlenecks.
160
+ TARGET: src/
161
+ DEPTH: quick
162
+ ...</parameter>
163
+ <parameter name="subagent_type">perf-analyzer-memory</parameter>
164
+ <parameter name="run_in_background">true</parameter>
165
+ </invoke>
166
+
167
+ <invoke name="Task">
168
+ <parameter name="description">Bundle size analysis</parameter>
169
+ <parameter name="prompt">TASK: Analyze the following code for BUNDLE SIZE bottlenecks.
170
+ TARGET: src/
171
+ DEPTH: quick
172
+ ...</parameter>
173
+ <parameter name="subagent_type">perf-analyzer-bundle</parameter>
174
+ <parameter name="run_in_background">true</parameter>
175
+ </invoke>
176
+
177
+ <invoke name="Task">
178
+ <parameter name="description">Compute performance analysis</parameter>
179
+ <parameter name="prompt">TASK: Analyze the following code for COMPUTE PERFORMANCE bottlenecks.
180
+ TARGET: src/
181
+ DEPTH: quick
182
+ ...</parameter>
183
+ <parameter name="subagent_type">perf-analyzer-compute</parameter>
184
+ <parameter name="run_in_background">true</parameter>
185
+ </invoke>
186
+ ```
187
+
188
+ **For DEPTH=deep, also deploy**:
189
+
190
+ ```xml
191
+ <invoke name="Task">
192
+ <parameter name="description">Network performance analysis</parameter>
193
+ <parameter name="prompt">TASK: Analyze the following code for NETWORK PERFORMANCE bottlenecks...
194
+ ...</parameter>
195
+ <parameter name="subagent_type">perf-analyzer-network</parameter>
196
+ <parameter name="run_in_background">true</parameter>
197
+ </invoke>
198
+
199
+ <invoke name="Task">
200
+ <parameter name="description">Caching analysis</parameter>
201
+ <parameter name="prompt">TASK: Analyze the following code for CACHING OPPORTUNITIES...
202
+ ...</parameter>
203
+ <parameter name="subagent_type">perf-analyzer-caching</parameter>
204
+ <parameter name="run_in_background">true</parameter>
205
+ </invoke>
206
+
207
+ <invoke name="Task">
208
+ <parameter name="description">Asset optimization analysis</parameter>
209
+ <parameter name="prompt">TASK: Analyze the following code for ASSET OPTIMIZATION opportunities...
210
+ ...</parameter>
211
+ <parameter name="subagent_type">perf-analyzer-assets</parameter>
212
+ <parameter name="run_in_background">true</parameter>
213
+ </invoke>
214
+ ```
215
+
216
+ ### STEP 3: Collect Results
217
+
218
+ Wait for all analyzers to complete:
219
+
220
+ ```xml
221
+ <invoke name="TaskOutput">
222
+ <parameter name="task_id">{queries_id}</parameter>
223
+ <parameter name="block">true</parameter>
224
+ </invoke>
225
+
226
+ <invoke name="TaskOutput">
227
+ <parameter name="task_id">{rendering_id}</parameter>
228
+ <parameter name="block">true</parameter>
229
+ </invoke>
230
+
231
+ <!-- ... collect all results ... -->
232
+ ```
233
+
234
+ ### STEP 4: Run Consensus Coordinator
235
+
236
+ Pass all analyzer outputs to the consensus coordinator:
237
+
238
+ ```xml
239
+ <invoke name="Task">
240
+ <parameter name="description">Performance audit consensus</parameter>
241
+ <parameter name="prompt">You are the Performance Consensus Coordinator.
242
+
243
+ TARGET: {target_path}
244
+ DEPTH: {depth}
245
+
246
+ ## Analyzer Outputs
247
+
248
+ ### Query Performance Analyzer Results:
249
+ {queries_output}
250
+
251
+ ### Rendering Performance Analyzer Results:
252
+ {rendering_output}
253
+
254
+ ### Memory Analyzer Results:
255
+ {memory_output}
256
+
257
+ ### Bundle Size Analyzer Results:
258
+ {bundle_output}
259
+
260
+ ### Compute Performance Analyzer Results:
261
+ {compute_output}
262
+
263
+ {If deep depth, also include:}
264
+ ### Network Performance Analyzer Results:
265
+ {network_output}
266
+
267
+ ### Caching Analyzer Results:
268
+ {caching_output}
269
+
270
+ ### Asset Optimization Analyzer Results:
271
+ {assets_output}
272
+
273
+ ---
274
+
275
+ Follow your consensus process:
276
+ 1. Detect project type from the codebase
277
+ 2. Parse all findings into normalized structure
278
+ 3. Group related findings by location
279
+ 4. Vote on confidence (CONFIRMED if 2+ agree, LIKELY if 1 with evidence)
280
+ 5. Filter by project type relevance
281
+ 6. Estimate performance impact for each finding
282
+ 7. Generate the final Performance Audit Report
283
+ 8. Save report to docs/08-project/perf-audits/perf-audit-{YYYYMMDD}.md
284
+ </parameter>
285
+ <parameter name="subagent_type">perf-consensus</parameter>
286
+ </invoke>
287
+ ```
288
+
289
+ ### STEP 5: Present Results
290
+
291
+ After consensus completes, show the report summary and offer next steps:
292
+
293
+ ```xml
294
+ <invoke name="AskUserQuestion">
295
+ <parameter name="questions">[{
296
+ "question": "Performance audit complete: [N] findings ([critical] Critical, [high] High). [files_count] files analyzed. Project type: [type].",
297
+ "header": "Next steps",
298
+ "multiSelect": false,
299
+ "options": [
300
+ {"label": "Fix [critical] Critical issues now (Recommended)", "description": "[top_issue_summary]"},
301
+ {"label": "Create stories for all findings", "description": "Track [critical] critical + [high] high priority items in backlog"},
302
+ {"label": "Re-run with DEPTH=deep on [target]", "description": "Current was quick (5 analyzers) - deep adds Network, Caching, Assets"},
303
+ {"label": "Save report and done", "description": "Report saved to docs/08-project/perf-audits/"}
304
+ ]
305
+ }]</parameter>
306
+ </invoke>
307
+ ```
308
+
309
+ ---
310
+
311
+ ## Example Output
312
+
313
+ ```
314
+ Performance Audit: app/
315
+ ====================================================================
316
+
317
+ Deploying 5 performance analyzers (quick mode)...
318
+ * Query Performance Analyzer
319
+ * Rendering Performance Analyzer
320
+ * Memory Analyzer
321
+ * Bundle Size Analyzer
322
+ * Compute Performance Analyzer
323
+
324
+ Running consensus...
325
+ * Consensus complete
326
+ * Project type detected: Full-stack Web Application
327
+
328
+ --------------------------------------------
329
+ BOTTLENECK SUMMARY
330
+ --------------------------------------------
331
+
332
+ | Severity | Count | Category |
333
+ |----------|-------|----------|
334
+ | Critical | 1 | N+1 Queries |
335
+ | High | 2 | Bundle Size, Memory Leak |
336
+ | Medium | 3 | Rendering, Compute |
337
+ | Low | 1 | Minor Optimization |
338
+
339
+ Total: 7 findings (1 false positive excluded)
340
+
341
+ --------------------------------------------
342
+ FIX IMMEDIATELY
343
+ --------------------------------------------
344
+
345
+ 1. N+1 query in user list endpoint [CONFIRMED by Queries, Compute]
346
+ Location: api/users.ts:45
347
+ Impact: ~500ms added per request with 100 users
348
+ Fix: Use eager loading / JOIN instead of loop query
349
+
350
+ 2. Memory leak from uncleared setInterval [CONFIRMED by Memory, Compute]
351
+ Location: services/poller.ts:28
352
+ Impact: Memory grows ~10MB/hour, eventual OOM
353
+ Fix: Clear interval in cleanup/destroy handler
354
+
355
+ --------------------------------------------
356
+ FIX THIS SPRINT
357
+ --------------------------------------------
358
+
359
+ 3. Importing entire lodash (527KB) for one function [LIKELY - Bundle]
360
+ 4. Missing React.memo on frequently re-rendered list [LIKELY - Rendering]
361
+ 5. Synchronous file read in API handler [LIKELY - Compute]
362
+
363
+ [Full report saved to docs/08-project/perf-audits/perf-audit-20260220.md]
364
+ ```
365
+
366
+ ---
367
+
368
+ <!-- COMPACT_SUMMARY_START -->
369
+ ## Compact Summary
370
+
371
+ **Command**: `/agileflow:audit:performance` - Multi-agent performance bottleneck analysis with consensus
372
+
373
+ **Quick Usage**:
374
+ ```
375
+ /agileflow:audit:performance app/ # Quick scan (core 5 analyzers)
376
+ /agileflow:audit:performance . DEPTH=deep # All 8 analyzers
377
+ /agileflow:audit:performance src/ FOCUS=queries,memory # Specific areas
378
+ ```
379
+
380
+ **What It Does**: Deploy performance analyzers in parallel -> Each finds different bottleneck classes -> Consensus coordinator validates, filters by project type, estimates impact -> Actionable Performance Audit Report
381
+
382
+ **Analyzers (Core 5 - quick mode)**:
383
+ - `perf-analyzer-queries` - N+1 queries, unindexed lookups, missing pagination, ORM anti-patterns
384
+ - `perf-analyzer-rendering` - Unnecessary re-renders, expensive computations in render, missing memoization
385
+ - `perf-analyzer-memory` - Memory leaks, event listener cleanup, closure captures, large object retention
386
+ - `perf-analyzer-bundle` - Large imports, no tree-shaking, missing dynamic imports, duplicate deps
387
+ - `perf-analyzer-compute` - Sync I/O, CPU-intensive loops, blocking operations, missing worker threads
388
+
389
+ **Analyzers (Deep mode adds 3 more)**:
390
+ - `perf-analyzer-network` - HTTP waterfall, missing batching, no compression, large payloads
391
+ - `perf-analyzer-caching` - Missing memoization, redundant computations, no HTTP cache headers
392
+ - `perf-analyzer-assets` - Unoptimized images, render-blocking resources, missing lazy loading
393
+
394
+ **Severity Levels** (impact-oriented):
395
+ - CRITICAL: P95 latency > 2x or causes timeout/OOM
396
+ - HIGH: Measurable user-facing impact
397
+ - MEDIUM: Optimization opportunity
398
+ - LOW: Micro-optimization
399
+
400
+ **Confidence Levels**:
401
+ - CONFIRMED: 2+ analyzers agree -> High priority
402
+ - LIKELY: 1 analyzer with evidence -> Medium priority
403
+ - INVESTIGATE: 1 analyzer, weak evidence -> Low priority
404
+
405
+ **Output**: `docs/08-project/perf-audits/perf-audit-{YYYYMMDD}.md`
406
+ <!-- COMPACT_SUMMARY_END -->
407
+
408
+ ---
409
+
410
+ ## Boundary Rules (No Overlap)
411
+
412
+ - **vs audit:logic**: No correctness bugs — only performance implications
413
+ - **vs audit:security**: No vulnerability analysis — only efficiency
414
+ - **vs performance agent**: The `performance.md` agent is a team member for story work. This is an on-demand analysis tool
415
+
416
+ ---
417
+
418
+ ## Integration with Babysit
419
+
420
+ When `/agileflow:babysit` completes implementation, it can run a quick performance audit:
421
+
422
+ ```
423
+ Implementation complete. Running quick performance audit...
424
+
425
+ Performance Audit Results:
426
+ =========================
427
+ No critical bottlenecks found
428
+ 1 HIGH issue detected:
429
+ - api/users.ts:45 - N+1 query in loop (100+ DB calls per request)
430
+ Confidence: CONFIRMED (Queries + Compute analyzers)
431
+
432
+ Fix before merging? [Y/n]
433
+ ```
434
+
435
+ ---
436
+
437
+ ## Related Commands
438
+
439
+ - `/agileflow:audit:logic` - Logic bug analysis (similar architecture)
440
+ - `/agileflow:audit:security` - Security vulnerability analysis (similar architecture)
441
+ - `/agileflow:audit:legal` - Legal compliance analysis (similar architecture)
442
+ - `/agileflow:multi-expert` - General multi-expert analysis
443
+ - `/agileflow:verify` - Run tests