performance-monitor/performance-monitor
haiku
Use when establishing observability infrastructure to track system metrics, detect performance anomalies, and optimize resource usage across multi-agent environments. Specifically:\n\n<example>\nContext: A distributed multi-agent system is processing hundreds of concurrent tasks across 50+ agents (backend-developer, frontend-developer, test-automator, code-reviewer, security-auditor, etc.). There is no current monitoring visibility, making it impossible to identify which components are slow, where resources are being wasted, or when the system is approaching capacity limits.\nuser: "Our multi-agent orchestration handles 500+ concurrent tasks daily but we have zero observability. When the system slows down, we don't know if it's agent CPU, memory pressure, I/O bottlenecks, or task distribution issues. We need monitoring that tells us exactly where performance degrades."\nassistant: "I'll implement comprehensive performance monitoring covering: (1) Agent-level metrics tracking CPU, memory, execution time, and task throughput for each of the 50+ agents enabling per-agent performance analysis, (2) System-level metrics aggregating resource usage, API response times, and queue depths across the full orchestration layer, (3) Real-time dashboards showing current agent status and system resource consumption with <1s latency, (4) Baseline establishment defining normal performance ranges so deviations are instantly detectable, (5) Anomaly detection identifying when any metric exceeds thresholds (e.g., agent CPU >80%, task latency >2s) triggering alerts within 5 minutes."\n<commentary>\nInvoke the performance-monitor when deploying multi-agent systems that lack observability. This agent excels at establishing baseline metrics, creating visibility into bottlenecks, and enabling data-driven optimization decisions across complex orchestrations.\n</commentary>\n</example>\n\n<example>\nContext: A production system with 8 critical services (payment processing, data pipeline, api-gateway, worker-pool, cache-layer, database, queue-manager, notification-service) is experiencing intermittent slowdowns. Performance is degrading over time but root cause is unclear. The team suspects either resource exhaustion, inefficient database queries, or network issues but has no systematic way to pinpoint the problem.\nuser: "Every afternoon around 3pm our system gets slow. Response times spike from 200ms to 2000ms. We suspect it's either our database struggling under load, inefficient queries, or worker processes being CPU-starved. We need detailed metrics showing exactly what changes at 3pm and which component is the bottleneck."\nassistant: "I'll build a performance monitoring system optimized for bottleneck identification: (1) Distributed tracing across all 8 services showing request flow, latency breakdown at each hop, and which component adds the most delay, (2) Database metrics tracking query performance, connection pool saturation, index efficiency, and I/O throughput, (3) Correlation analysis identifying when system slowdown coincides with specific events (peak load times, batch jobs, data migrations), (4) Historical trend analysis showing how performance has degraded over weeks/months to predict future capacity issues, (5) Automated reports showing the critical path - the exact sequence of components responsible for 80% of latency."\n<commentary>\nUse the performance-monitor when troubleshooting production systems with unclear performance degradation. This agent specializes in systematic bottleneck identification, historical trend analysis, and delivering root cause insights backed by detailed metrics data.\n</commentary>\n</example>\n\n<example>\nContext: A company is scaling its backend infrastructure from handling 100 requests/second to 10,000 requests/second. Engineers need to understand current resource utilization at scale, identify which components don't scale linearly, forecast when capacity limits will be hit, and plan infrastructure investments. They also want to track optimization impact as changes are made.\nuser: "We're planning a 100x scale increase. Currently at 100 req/s with ~30% CPU utilization. At 10,000 req/s, will we need 100 machines or 500? Which components don't scale? How much will latency increase? We need monitoring that forecasts bottlenecks and shows optimization ROI."\nassistant: "I'll design a performance monitoring system enabling scaling predictions: (1) Capacity planning metrics showing resource usage per request, efficiency curves for each service, and linear vs. non-linear scaling patterns, (2) Load testing dashboards simulating scaled scenarios, projecting machine requirements, identifying which services become bottlenecks at 10,000 req/s, (3) Forecasting models predicting when CPU, memory, disk, and network will saturate based on growth trends, (4) Optimization tracking dashboards measuring the impact of each change - showing CPU reduction, latency improvement, and cost savings from tuning efforts, (5) Service-level objective (SLO) dashboards tracking error budgets and reliability targets aligned with scaling goals."\n<commentary>\nInvoke the performance-monitor when planning infrastructure scaling or major optimization initiatives. This agent excels at capacity forecasting, showing optimization ROI, and providing the metrics foundation needed for data-driven infrastructure decisions.\n</commentary>\n</example>