用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/ruvnet/ruflo --skill agent-performance-monitor命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Ruflo is a multi-agent orchestration platform for AI coding agents (Claude Code, Cursor, Codex, Copilot, Gemini, Amp, +12 more). Use this skill when the user wants to (1) install/init ruflo in a project, (2) run multi-agent swarms with hierarchical coordination, (3) use ruflo's 314+ MCP tools for memory, routing, hooks, sub-agents, or workflows, (4) check ruflo status/version/doctor health, or (5) discover which of ruflo's 30+ plugins fits their task.
One-shot chat completion against DeepSeek's `deepseek-chat` model via the OpenAI-compatible /v1/chat/completions endpoint. Reads DEEPSEEK_API_KEY from the environment; degrades gracefully (exit 0 with a JSON status:degraded envelope) when the key is missing or the API is unreachable. Use for non-reasoning tasks — summarization, extraction, quick classification — where deepseek-reasoner would be overkill.
Reasoning-mode completion against DeepSeek's `deepseek-reasoner` model (R1) via /v1/chat/completions. Surfaces the model's chain-of-thought (`reasoning_content`) separately from the final answer (`content`), so callers can display or discard the CoT without re-parsing. Reads DEEPSEEK_API_KEY; degrades gracefully (exit 0 with status:degraded envelope) when unset or the API is unreachable. Ignores temperature/top_p per DeepSeek's spec for reasoner models.
正在显示 SKILL.md
基于 SOC 职业分类
| name | agent-performance-monitor |
| description | Agent skill for performance-monitor - invoke with $agent-performance-monitor |
// Advanced metrics collection system
class MetricsCollector {
constructor() {
this.collectors = new Map();
this.aggregators = new Map();
this.streams = new Map();
this.alertThresholds = new Map();
}
// Multi-dimensional metrics collection
async collectMetrics() {
const metrics = {
// System metrics
system: await this.collectSystemMetrics(),
// Agent-specific metrics
agents: await this.collectAgentMetrics(),
// Swarm coordination metrics
coordination: await this.collectCoordinationMetrics(),
// Task execution metrics
tasks: await this.collectTaskMetrics(),
// Resource utilization metrics
resources: await this.collectResourceMetrics(),
// Network and communication metrics
network: await this.collectNetworkMetrics()
};
// Real-time processing and analysis
await this.processMetrics(metrics);
return metrics;
}
// System-level metrics
async collectSystemMetrics() {
return {
cpu: {
usage: await this.getCPUUsage(),
loadAverage: await this.getLoadAverage(),
coreUtilization: await this.getCoreUtilization()
},
memory: {
usage: await this.getMemoryUsage(),
available: await this.getAvailableMemory(),
pressure: await this.getMemoryPressure()
},
io: {
diskUsage: await this.getDiskUsage(),
diskIO: await this.getDiskIOStats(),
networkIO: await this.getNetworkIOStats()
},
processes: {
count: await this.getProcessCount(),
threads: await this.getThreadCount(),
handles: await this.getHandleCount()
}
};
}
// Agent performance metrics
async collectAgentMetrics() {
const agents = await mcp.agent_list({});
const agentMetrics = new Map();
for (const agent of agents) {
const metrics = await mcp.agent_metrics({ agentId: agent.id });
agentMetrics.set(agent.id, {
...metrics,
efficiency: this.calculateEfficiency(metrics),
responsiveness: this.calculateResponsiveness(metrics),
reliability: this.calculateReliability(metrics)
});
}
return agentMetrics;
}
}
// Intelligent bottleneck detection
class BottleneckAnalyzer {
constructor() {
this.detectors = [
new CPUBottleneckDetector(),
new MemoryBottleneckDetector(),
new IOBottleneckDetector(),
new NetworkBottleneckDetector(),
new CoordinationBottleneckDetector(),
new TaskQueueBottleneckDetector()
];
this.patterns = new Map();
this.history = new CircularBuffer(1000);
}
// Multi-layer bottleneck analysis
async analyzeBottlenecks(metrics) {
const bottlenecks = [];
// Parallel detection across all layers
const detectionPromises = this.detectors.map(detector =>
detector.detect(metrics)
);
const results = await Promise.all(detectionPromises);
// Correlate and prioritize bottlenecks
for ( result results) {
(result.) {
bottlenecks.({
: result.,
: result.,
: result.,
: result.,
: result.,
: result.,
: .()
});
}
}
.(bottlenecks);
.(bottlenecks);
}
() {
( bottleneck bottlenecks) {
signature = .(bottleneck);
(..(signature)) {
pattern = ..(signature);
pattern.++;
pattern. = .();
pattern. = .(pattern);
} {
..(signature, {
signature,
: ,
: .(),
: .(),
: ,
:
});
}
}
}
}
// Service Level Agreement monitoring
class SLAMonitor {
constructor() {
this.slaDefinitions = new Map();
this.violations = new Map();
this.alertChannels = new Set();
this.escalationRules = new Map();
}
// Define SLA metrics and thresholds
defineSLA(service, slaConfig) {
this.slaDefinitions.set(service, {
availability: slaConfig.availability || 99.9, // percentage
responseTime: slaConfig.responseTime || 1000, // milliseconds
throughput: slaConfig.throughput || 100, // requests per second
errorRate: slaConfig.errorRate || 0.1, // percentage
recoveryTime: slaConfig.recoveryTime || 300, // seconds
// Time windows for measurements
measurementWindow: slaConfig. || ,
: slaConfig. || ,
: slaConfig. || {
: ,
: ,
:
}
});
}
() {
violations = [];
( [service, sla] .) {
metrics = .(service);
evaluation = .(service, sla, metrics);
(evaluation.) {
violations.(evaluation);
.(service, evaluation);
}
}
violations;
}
() {
evaluation = {
service,
: .(),
: ,
: []
};
(metrics. < sla.) {
evaluation..({
: ,
: sla.,
: metrics.,
: .(metrics., sla., sla.)
});
evaluation. = ;
}
(metrics. > sla.) {
evaluation..({
: ,
: sla.,
: metrics.,
: .(metrics., sla., sla.)
});
evaluation. = ;
}
evaluation;
}
}
// Comprehensive resource tracking
class ResourceTracker {
constructor() {
this.trackers = {
cpu: new CPUTracker(),
memory: new MemoryTracker(),
disk: new DiskTracker(),
network: new NetworkTracker(),
gpu: new GPUTracker(),
agents: new AgentResourceTracker()
};
this.forecaster = new ResourceForecaster();
this.optimizer = new ResourceOptimizer();
}
// Real-time resource tracking
async trackResources() {
const resources = {};
// Parallel resource collection
const trackingPromises = Object.entries(this.trackers).map(
async ([type, tracker]) => [type, await tracker.collect()]
);
const results = .(trackingPromises);
( [type, data] results) {
resources[type] = {
...data,
: .(data),
: .(data),
: .(type, data),
: ..(type, data)
};
}
resources;
}
() {
{
: resourceData. / resourceData.,
: resourceData. / resourceData.,
: resourceData. / resourceData.,
: {
: resourceData. / resourceData.,
: resourceData. / resourceData.,
: resourceData. / resourceData.,
: resourceData. / resourceData.
}
};
}
() {
currentResources = .();
forecasts = {};
( [type, data] .(currentResources)) {
forecasts[type] = ..(type, data, timeHorizon);
}
{
timeHorizon,
forecasts,
: ..(forecasts),
: .(forecasts)
};
}
}
// Comprehensive MCP integration
const performanceIntegration = {
// Real-time performance monitoring
async startMonitoring(config = {}) {
const monitoringTasks = [
this.monitorSwarmHealth(),
this.monitorAgentPerformance(),
this.monitorResourceUtilization(),
this.monitorBottlenecks(),
this.monitorSLACompliance()
];
// Start all monitoring tasks concurrently
const monitors = await Promise.all(monitoringTasks);
return {
swarmHealthMonitor: monitors[0],
agentPerformanceMonitor: monitors[1],
resourceMonitor: monitors[2],
bottleneckMonitor: monitors[3],
slaMonitor: monitors[4]
};
},
// Swarm health monitoring
async monitorSwarmHealth() {
const healthMetrics = await mcp.health_check({
components: ['swarm', 'coordination', 'communication']
});
return {
: healthMetrics.,
: healthMetrics.,
: healthMetrics.,
: healthMetrics.
};
},
() {
agents = mcp.({});
performanceData = ();
( agent agents) {
metrics = mcp.({ : agent. });
performance = mcp.({
: ,
:
});
performanceData.(agent., {
...metrics,
performance,
: .(metrics, performance),
: mcp.({ : agent. })
});
}
performanceData;
},
() {
bottlenecks = mcp.({});
analysis = {
: bottlenecks. > ,
: bottlenecks.,
: .(bottlenecks),
: .(bottlenecks),
: .(bottlenecks),
: .(bottlenecks)
};
analysis;
}
};
// Advanced anomaly detection system
class AnomalyDetector {
constructor() {
this.models = {
statistical: new StatisticalAnomalyDetector(),
machine_learning: new MLAnomalyDetector(),
time_series: new TimeSeriesAnomalyDetector(),
behavioral: new BehavioralAnomalyDetector()
};
this.ensemble = new EnsembleDetector(this.models);
}
// Multi-model anomaly detection
async detectAnomalies(metrics) {
const anomalies = [];
// Parallel detection across all models
const detectionPromises = Object.entries(this.models).map(
async ([modelType, model]) => {
const detected = await model.detect(metrics);
return { modelType, detected };
}
);
const results = await Promise.all(detectionPromises);
// Ensemble voting for final decision
ensembleResult = ..(results);
{
: ensembleResult.,
: ensembleResult.,
: ensembleResult.,
: results
};
}
() {
mean = .(data);
stdDev = .(data, mean);
threshold = * stdDev;
data.( .(point - mean) > threshold)
.( ({
: point,
: ,
: .(point - mean) / stdDev,
: .(point, mean, stdDev)
}));
}
() {
model = .();
predictions = model.(timeSeries);
anomalies = [];
( i = ; i < timeSeries.; i++) {
error = .(timeSeries[i] - predictions[i]);
threshold = .(timeSeries, i);
(error > threshold) {
anomalies.({
: i,
: timeSeries[i],
: predictions[i],
: error,
:
});
}
}
anomalies;
}
}
// Dashboard data provider
class DashboardProvider {
constructor() {
this.updateInterval = 1000; // 1 second updates
this.subscribers = new Set();
this.dataBuffer = new CircularBuffer(1000);
}
// Real-time dashboard data
async provideDashboardData() {
const dashboardData = {
// High-level metrics
overview: {
swarmHealth: await this.getSwarmHealthScore(),
activeAgents: await this.getActiveAgentCount(),
totalTasks: await this.getTotalTaskCount(),
averageResponseTime: await this.getAverageResponseTime()
},
// Performance metrics
performance: {
throughput: await this.getCurrentThroughput(),
latency: await .(),
: .(),
: .()
},
: {
: .(),
: .(),
: .(),
: .()
},
: .(),
: .(),
: .(),
: .()
};
.(dashboardData);
dashboardData;
}
() {
..(callback);
..(callback);
}
() {
..( {
{
(data);
} (error) {
.(, error);
}
});
}
}
# Start comprehensive monitoring
npx claude-flow performance-report --format detailed --timeframe 24h
# Real-time bottleneck analysis
npx claude-flow bottleneck-analyze --component swarm-coordination
# Health check all components
npx claude-flow health-check --components ["swarm", "agents", "coordination"]
# Collect specific metrics
npx claude-flow metrics-collect --components ["cpu", "memory", "network"]
# Monitor SLA compliance
npx claude-flow sla-monitor --service swarm-coordination --threshold 99.9
# Configure performance alerts
npx claude-flow alert-config --metric cpu_usage --threshold 80 --severity warning
# Set up anomaly detection
npx claude-flow anomaly-setup --models ["statistical", "ml", "time_series"]
# Configure notification channels
npx claude-flow notification-config --channels ["slack", "email", "webhook"]
// Performance analytics engine
const analytics = {
// Key Performance Indicators
calculateKPIs(metrics) {
return {
// Availability metrics
uptime: this.calculateUptime(metrics),
availability: this.calculateAvailability(metrics),
// Performance metrics
responseTime: {
average: this.calculateAverage(metrics.responseTimes),
p50: this.calculatePercentile(metrics.responseTimes, 50),
p90: this.calculatePercentile(metrics.responseTimes, 90),
p95: this.calculatePercentile(metrics.responseTimes, 95),
p99: this.calculatePercentile(metrics.responseTimes, 99)
},
// Throughput metrics
throughput: this.calculateThroughput(metrics),
// Error metrics
errorRate: this.calculateErrorRate(metrics),
: .(metrics),
: .(metrics)
};
},
() {
{
: .(historicalData, timeWindow),
: .(historicalData, timeWindow),
: .(historicalData, timeWindow),
: .(historicalData, timeWindow)
};
}
};
This Performance Monitor agent provides comprehensive real-time monitoring, bottleneck detection, SLA compliance tracking, and advanced analytics for optimal swarm performance management.