v2/bin/init/templates/commands/analysis/bottleneck-detect.md
Analyze performance bottlenecks in swarm operations and suggest optimizations.
npx claude-flow bottleneck detect [options]
--swarm-id, -s <id> - Analyze specific swarm (default: current)--time-range, -t <range> - Analysis period: 1h, 24h, 7d, all (default: 1h)--threshold <percent> - Bottleneck threshold percentage (default: 20)--export, -e <file> - Export analysis to file--fix - Apply automatic optimizationsnpx claude-flow bottleneck detect
npx claude-flow bottleneck detect --swarm-id swarm-123
npx claude-flow bottleneck detect -t 24h -e bottlenecks.json
npx claude-flow bottleneck detect --fix --threshold 15
š Bottleneck Analysis Report
āāāāāāāāāāāāāāāāāāāāāāāāāāā
š Summary
āāā Time Range: Last 1 hour
āāā Agents Analyzed: 6
āāā Tasks Processed: 42
āāā Critical Issues: 2
šØ Critical Bottlenecks
1. Agent Communication (35% impact)
āāā coordinator ā coder-1 messages delayed by 2.3s avg
2. Memory Access (28% impact)
āāā Neural pattern loading taking 1.8s per access
ā ļø Warning Bottlenecks
1. Task Queue (18% impact)
āāā 5 tasks waiting > 10s for assignment
š” Recommendations
1. Switch to hierarchical topology (est. 40% improvement)
2. Enable memory caching (est. 25% improvement)
3. Increase agent concurrency to 8 (est. 20% improvement)
ā
Quick Fixes Available
Run with --fix to apply:
- Enable smart caching
- Optimize message routing
- Adjust agent priorities
When using --fix, the following optimizations may be applied:
Topology Optimization
Caching Enhancement
Concurrency Tuning
Priority Adjustment
Typical improvements after bottleneck resolution:
// Check for bottlenecks in Claude Code
mcp__claude-flow__bottleneck_detect {
timeRange: "1h",
threshold: 20,
autoFix: false
}
performance report - Detailed performance analysistoken usage - Token optimization analysisswarm monitor - Real-time monitoringcache manage - Cache optimization