agent-resource-allocator
Agent skill for resource-allocator - invoke with $agent-resource-allocator
Install
mkdir -p .claude/skills/agent-resource-allocator && curl -L -o skill.zip "https://mcp.directory/api/skills/download/7395" && unzip -o skill.zip -d .claude/skills/agent-resource-allocator && rm skill.zipInstalls to .claude/skills/agent-resource-allocator
About this skill
name: Resource Allocator type: agent category: optimization description: Adaptive resource allocation, predictive scaling and intelligent capacity planning
Resource Allocator Agent
Agent Profile
- Name: Resource Allocator
- Type: Performance Optimization Agent
- Specialization: Adaptive resource allocation and predictive scaling
- Performance Focus: Intelligent resource management and capacity planning
Core Capabilities
1. Adaptive Resource Allocation
// Advanced adaptive resource allocation system
class AdaptiveResourceAllocator {
constructor() {
this.allocators = {
cpu: new CPUAllocator(),
memory: new MemoryAllocator(),
storage: new StorageAllocator(),
network: new NetworkAllocator(),
agents: new AgentAllocator()
};
this.predictor = new ResourcePredictor();
this.optimizer = new AllocationOptimizer();
this.monitor = new ResourceMonitor();
}
// Dynamic resource allocation based on workload patterns
async allocateResources(swarmId, workloadProfile, constraints = {}) {
// Analyze current resource usage
const currentUsage = await this.analyzeCurrentUsage(swarmId);
// Predict future resource needs
const predictions = await this.predictor.predict(workloadProfile, currentUsage);
// Calculate optimal allocation
const allocation = await this.optimizer.optimize(predictions, constraints);
// Apply allocation with gradual rollout
const rolloutPlan = await this.planGradualRollout(allocation, currentUsage);
// Execute allocation
const result = await this.executeAllocation(rolloutPlan);
return {
allocation,
rolloutPlan,
result,
monitoring: await this.setupMonitoring(allocation)
};
}
// Workload pattern analysis
async analyzeWorkloadPatterns(historicalData, timeWindow = '7d') {
const patterns = {
// Temporal patterns
temporal: {
hourly: this.analyzeHourlyPatterns(historicalData),
daily: this.analyzeDailyPatterns(historicalData),
weekly: this.analyzeWeeklyPatterns(historicalData),
seasonal: this.analyzeSeasonalPatterns(historicalData)
},
// Load patterns
load: {
baseline: this.calculateBaselineLoad(historicalData),
peaks: this.identifyPeakPatterns(historicalData),
valleys: this.identifyValleyPatterns(historicalData),
spikes: this.detectAnomalousSpikes(historicalData)
},
// Resource correlation patterns
correlations: {
cpu_memory: this.analyzeCPUMemoryCorrelation(historicalData),
network_load: this.analyzeNetworkLoadCorrelation(historicalData),
agent_resource: this.analyzeAgentResourceCorrelation(historicalData)
},
// Predictive indicators
indicators: {
growth_rate: this.calculateGrowthRate(historicalData),
volatility: this.calculateVolatility(historicalData),
predictability: this.calculatePredictability(historicalData)
}
};
return patterns;
}
// Multi-objective resource optimization
async optimizeResourceAllocation(resources, demands, objectives) {
const optimizationProblem = {
variables: this.defineOptimizationVariables(resources),
constraints: this.defineConstraints(resources, demands),
objectives: this.defineObjectives(objectives)
};
// Use multi-objective genetic algorithm
const solver = new MultiObjectiveGeneticSolver({
populationSize: 100,
generations: 200,
mutationRate: 0.1,
crossoverRate: 0.8
});
const solutions = await solver.solve(optimizationProblem);
// Select solution from Pareto front
const selectedSolution = this.selectFromParetoFront(solutions, objectives);
return {
optimalAllocation: selectedSolution.allocation,
paretoFront: solutions.paretoFront,
tradeoffs: solutions.tradeoffs,
confidence: selectedSolution.confidence
};
}
}
2. Predictive Scaling with Machine Learning
// ML-powered predictive scaling system
class PredictiveScaler {
constructor() {
this.models = {
time_series: new LSTMTimeSeriesModel(),
regression: new RandomForestRegressor(),
anomaly: new IsolationForestModel(),
ensemble: new EnsemblePredictor()
};
this.featureEngineering = new FeatureEngineer();
this.dataPreprocessor = new DataPreprocessor();
}
// Predict scaling requirements
async predictScaling(swarmId, timeHorizon = 3600, confidence = 0.95) {
// Collect training data
const trainingData = await this.collectTrainingData(swarmId);
// Engineer features
const features = await this.featureEngineering.engineer(trainingData);
// Train$update models
await this.updateModels(features);
// Generate predictions
const predictions = await this.generatePredictions(timeHorizon, confidence);
// Calculate scaling recommendations
const scalingPlan = await this.calculateScalingPlan(predictions);
return {
predictions,
scalingPlan,
confidence: predictions.confidence,
timeHorizon,
features: features.summary
};
}
// LSTM-based time series prediction
async trainTimeSeriesModel(data, config = {}) {
const model = await mcp.neural_train({
pattern_type: 'prediction',
training_data: JSON.stringify({
sequences: data.sequences,
targets: data.targets,
features: data.features
}),
epochs: config.epochs || 100
});
// Validate model performance
const validation = await this.validateModel(model, data.validation);
if (validation.accuracy > 0.85) {
await mcp.model_save({
modelId: model.modelId,
path: '$models$scaling_predictor.model'
});
return {
model,
validation,
ready: true
};
}
return {
model: null,
validation,
ready: false,
reason: 'Model accuracy below threshold'
};
}
// Reinforcement learning for scaling decisions
async trainScalingAgent(environment, episodes = 1000) {
const agent = new DeepQNetworkAgent({
stateSize: environment.stateSize,
actionSize: environment.actionSize,
learningRate: 0.001,
epsilon: 1.0,
epsilonDecay: 0.995,
memorySize: 10000
});
const trainingHistory = [];
for (let episode = 0; episode < episodes; episode++) {
let state = environment.reset();
let totalReward = 0;
let done = false;
while (!done) {
// Agent selects action
const action = agent.selectAction(state);
// Environment responds
const { nextState, reward, terminated } = environment.step(action);
// Agent learns from experience
agent.remember(state, action, reward, nextState, terminated);
state = nextState;
totalReward += reward;
done = terminated;
// Train agent periodically
if (agent.memory.length > agent.batchSize) {
await agent.train();
}
}
trainingHistory.push({
episode,
reward: totalReward,
epsilon: agent.epsilon
});
// Log progress
if (episode % 100 === 0) {
console.log(`Episode ${episode}: Reward ${totalReward}, Epsilon ${agent.epsilon}`);
}
}
return {
agent,
trainingHistory,
performance: this.evaluateAgentPerformance(trainingHistory)
};
}
}
3. Circuit Breaker and Fault Tolerance
// Advanced circuit breaker with adaptive thresholds
class AdaptiveCircuitBreaker {
constructor(config = {}) {
this.failureThreshold = config.failureThreshold || 5;
this.recoveryTimeout = config.recoveryTimeout || 60000;
this.successThreshold = config.successThreshold || 3;
this.state = 'CLOSED'; // CLOSED, OPEN, HALF_OPEN
this.failureCount = 0;
this.successCount = 0;
this.lastFailureTime = null;
// Adaptive thresholds
this.adaptiveThresholds = new AdaptiveThresholdManager();
this.performanceHistory = new CircularBuffer(1000);
// Metrics
this.metrics = {
totalRequests: 0,
successfulRequests: 0,
failedRequests: 0,
circuitOpenEvents: 0,
circuitHalfOpenEvents: 0,
circuitClosedEvents: 0
};
}
// Execute operation with circuit breaker protection
async execute(operation, fallback = null) {
this.metrics.totalRequests++;
// Check circuit state
if (this.state === 'OPEN') {
if (this.shouldAttemptReset()) {
this.state = 'HALF_OPEN';
this.successCount = 0;
this.metrics.circuitHalfOpenEvents++;
} else {
return await this.executeFallback(fallback);
}
}
try {
const startTime = performance.now();
const result = await operation();
const endTime = performance.now();
// Record success
this.onSuccess(endTime - startTime);
return result;
} catch (error) {
// Record failure
this.onFailure(error);
// Execute fallback if available
if (fallback) {
return await this.executeFallback(fallback);
}
throw error;
}
}
// Adaptive threshold adjustment
adjustThresholds(performanceData) {
const analysis = this.adaptiveThresholds.analyze(performanceData);
if (analysis.recommendAdjustment) {
this.failureThreshold = Math.max(
1,
Math.round(this.failureThreshold * analysis.thresholdMultiplier)
);
this.recoveryTimeout = Math.max(
1000,
Math.round(this.recoveryTimeout * analysis.timeoutMultiplier)
);
}
}
// Bulk head pattern fo
---
*Content truncated.*
More by ruvnet
View all skills by ruvnet →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversStay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.