mirror of
https://github.com/SuperClaude-Org/SuperClaude_Framework.git
synced 2025-12-29 16:16:08 +00:00
feat: Implement YAML-first declarative intelligence architecture
Revolutionary transformation from hardcoded Python intelligence to hot-reloadable YAML patterns, enabling dynamic configuration without code changes. ## Phase 1: Foundation Intelligence Complete ### YAML Intelligence Patterns (6 files) - intelligence_patterns.yaml: Multi-dimensional pattern recognition with adaptive learning - mcp_orchestration.yaml: Server selection decision trees with load balancing - hook_coordination.yaml: Parallel execution patterns with dependency resolution - performance_intelligence.yaml: Resource zones and auto-optimization triggers - validation_intelligence.yaml: Health scoring and proactive diagnostic patterns - user_experience.yaml: Project detection and smart UX adaptations ### Python Infrastructure Enhanced (4 components) - intelligence_engine.py: Generic YAML pattern interpreter with hot-reload - learning_engine.py: Enhanced with YAML intelligence integration - yaml_loader.py: Added intelligence configuration helper methods - validate_system.py: New YAML-driven validation with health scoring ### Key Features Implemented - Hot-reload intelligence: Update patterns without code changes or restarts - Declarative configuration: All intelligence logic expressed in YAML - Graceful fallbacks: System works correctly even with missing YAML files - Multi-pattern coordination: Intelligent recommendations from multiple sources - Health scoring: Component-weighted validation with predictive diagnostics - Generic architecture: Single engine consumes all intelligence pattern types ### Testing Results ✅ All components integrate correctly ✅ Hot-reload mechanism functional ✅ Graceful error handling verified ✅ YAML-driven validation operational ✅ Health scoring system working (detected real system issues) This enables users to modify intelligence behavior by editing YAML files, add new pattern types without coding, and hot-reload improvements in real-time. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
299
Framework-Hooks/config/performance_intelligence.yaml
Normal file
299
Framework-Hooks/config/performance_intelligence.yaml
Normal file
@@ -0,0 +1,299 @@
|
||||
# Performance Intelligence Configuration
|
||||
# Adaptive performance patterns, auto-optimization, and resource management
|
||||
# Enables intelligent performance monitoring and self-optimization
|
||||
|
||||
# Metadata
|
||||
version: "1.0.0"
|
||||
last_updated: "2025-01-06"
|
||||
description: "Performance intelligence and auto-optimization patterns"
|
||||
|
||||
# Adaptive Performance Targets
|
||||
adaptive_targets:
|
||||
baseline_management:
|
||||
# Dynamic baseline adjustment based on system performance
|
||||
adjustment_strategy: "rolling_average"
|
||||
adjustment_window: 50 # operations
|
||||
adjustment_sensitivity: 0.15 # 15% threshold for adjustment
|
||||
min_samples: 10 # minimum samples before adjustment
|
||||
|
||||
baseline_metrics:
|
||||
response_time:
|
||||
initial_target: 500 # ms
|
||||
acceptable_variance: 0.3
|
||||
improvement_threshold: 0.1
|
||||
|
||||
resource_usage:
|
||||
initial_target: 0.7 # 70%
|
||||
acceptable_variance: 0.2
|
||||
critical_threshold: 0.9
|
||||
|
||||
error_rate:
|
||||
initial_target: 0.02 # 2%
|
||||
acceptable_variance: 0.01
|
||||
critical_threshold: 0.1
|
||||
|
||||
target_adaptation:
|
||||
# How targets adapt to system capabilities
|
||||
adaptation_triggers:
|
||||
- condition: {performance_improvement: ">20%", duration: ">7_days"}
|
||||
action: "tighten_targets"
|
||||
adjustment: 0.15
|
||||
|
||||
- condition: {performance_degradation: ">15%", duration: ">3_days"}
|
||||
action: "relax_targets"
|
||||
adjustment: 0.2
|
||||
|
||||
- condition: {system_upgrade_detected: true}
|
||||
action: "recalibrate_baselines"
|
||||
reset_period: "24_hours"
|
||||
|
||||
adaptation_limits:
|
||||
max_target_tightening: 0.5 # Don't make targets too aggressive
|
||||
max_target_relaxation: 2.0 # Don't make targets too loose
|
||||
adaptation_cooldown: 3600 # seconds between major adjustments
|
||||
|
||||
# Auto-Optimization Engine
|
||||
auto_optimization:
|
||||
optimization_triggers:
|
||||
# Automatic optimization triggers
|
||||
performance_triggers:
|
||||
- name: "response_time_degradation"
|
||||
condition: {avg_response_time: ">target*1.3", samples: ">10"}
|
||||
urgency: "high"
|
||||
actions: ["enable_aggressive_caching", "reduce_analysis_depth", "parallel_processing"]
|
||||
|
||||
- name: "memory_pressure"
|
||||
condition: {memory_usage: ">0.85", duration: ">300_seconds"}
|
||||
urgency: "critical"
|
||||
actions: ["garbage_collection", "cache_cleanup", "reduce_context_size"]
|
||||
|
||||
- name: "cpu_saturation"
|
||||
condition: {cpu_usage: ">0.9", duration: ">60_seconds"}
|
||||
urgency: "high"
|
||||
actions: ["reduce_concurrent_operations", "defer_non_critical", "enable_throttling"]
|
||||
|
||||
- name: "error_rate_spike"
|
||||
condition: {error_rate: ">0.1", recent_window: "5_minutes"}
|
||||
urgency: "critical"
|
||||
actions: ["enable_fallback_mode", "increase_timeouts", "reduce_complexity"]
|
||||
|
||||
optimization_strategies:
|
||||
# Available optimization strategies
|
||||
aggressive_caching:
|
||||
description: "Enable aggressive caching of results and computations"
|
||||
performance_impact: 0.3 # Expected improvement
|
||||
resource_cost: 0.1 # Memory cost
|
||||
duration: 1800 # seconds
|
||||
|
||||
parallel_processing:
|
||||
description: "Increase parallelization where possible"
|
||||
performance_impact: 0.25
|
||||
resource_cost: 0.2
|
||||
duration: 3600
|
||||
|
||||
reduce_analysis_depth:
|
||||
description: "Reduce depth of analysis to improve speed"
|
||||
performance_impact: 0.4
|
||||
quality_impact: -0.1 # Slight quality reduction
|
||||
duration: 1800
|
||||
|
||||
intelligent_batching:
|
||||
description: "Batch similar operations for efficiency"
|
||||
performance_impact: 0.2
|
||||
resource_cost: -0.05 # Reduces resource usage
|
||||
duration: 3600
|
||||
|
||||
# Resource Management Intelligence
|
||||
resource_management:
|
||||
resource_zones:
|
||||
# Performance zones with different strategies
|
||||
green_zone:
|
||||
threshold: 0.60 # Below 60% resource usage
|
||||
strategy: "optimal_performance"
|
||||
features_enabled: ["full_analysis", "comprehensive_caching", "background_optimization"]
|
||||
|
||||
yellow_zone:
|
||||
threshold: 0.75 # 60-75% resource usage
|
||||
strategy: "balanced_optimization"
|
||||
features_enabled: ["standard_analysis", "selective_caching", "reduced_background"]
|
||||
optimizations: ["defer_non_critical", "reduce_verbosity"]
|
||||
|
||||
orange_zone:
|
||||
threshold: 0.85 # 75-85% resource usage
|
||||
strategy: "performance_preservation"
|
||||
features_enabled: ["essential_analysis", "minimal_caching"]
|
||||
optimizations: ["aggressive_caching", "parallel_where_safe", "reduce_context"]
|
||||
|
||||
red_zone:
|
||||
threshold: 0.95 # 85-95% resource usage
|
||||
strategy: "resource_conservation"
|
||||
features_enabled: ["critical_only"]
|
||||
optimizations: ["emergency_cleanup", "minimal_processing", "fail_fast"]
|
||||
|
||||
critical_zone:
|
||||
threshold: 1.0 # Above 95% resource usage
|
||||
strategy: "emergency_mode"
|
||||
features_enabled: []
|
||||
optimizations: ["immediate_cleanup", "operation_rejection", "system_protection"]
|
||||
|
||||
dynamic_allocation:
|
||||
# Intelligent resource allocation
|
||||
allocation_strategies:
|
||||
workload_based:
|
||||
description: "Allocate based on current workload patterns"
|
||||
factors: ["operation_complexity", "expected_duration", "priority"]
|
||||
|
||||
predictive:
|
||||
description: "Allocate based on predicted resource needs"
|
||||
factors: ["historical_patterns", "operation_type", "context_size"]
|
||||
|
||||
adaptive:
|
||||
description: "Adapt allocation based on real-time performance"
|
||||
factors: ["current_performance", "resource_availability", "optimization_goals"]
|
||||
|
||||
# Performance Regression Detection
|
||||
regression_detection:
|
||||
detection_algorithms:
|
||||
# Algorithms for detecting performance regression
|
||||
statistical_analysis:
|
||||
algorithm: "t_test"
|
||||
confidence_level: 0.95
|
||||
minimum_samples: 20
|
||||
window_size: 100 # operations
|
||||
|
||||
trend_analysis:
|
||||
algorithm: "linear_regression"
|
||||
trend_threshold: 0.1 # 10% degradation trend
|
||||
analysis_window: 168 # hours (1 week)
|
||||
|
||||
anomaly_detection:
|
||||
algorithm: "isolation_forest"
|
||||
contamination: 0.1 # Expected anomaly rate
|
||||
sensitivity: 0.8
|
||||
|
||||
regression_patterns:
|
||||
# Common regression patterns to detect
|
||||
gradual_degradation:
|
||||
pattern: {performance_trend: "decreasing", duration: ">5_days"}
|
||||
severity: "medium"
|
||||
investigation: "check_for_memory_leaks"
|
||||
|
||||
sudden_degradation:
|
||||
pattern: {performance_drop: ">30%", timeframe: "<1_hour"}
|
||||
severity: "high"
|
||||
investigation: "check_recent_changes"
|
||||
|
||||
periodic_degradation:
|
||||
pattern: {performance_cycles: "detected", frequency: "regular"}
|
||||
severity: "low"
|
||||
investigation: "analyze_periodic_patterns"
|
||||
|
||||
# Intelligent Resource Optimization
|
||||
intelligent_optimization:
|
||||
predictive_optimization:
|
||||
# Predict and prevent performance issues
|
||||
prediction_models:
|
||||
resource_exhaustion:
|
||||
model_type: "time_series"
|
||||
prediction_horizon: 3600 # seconds
|
||||
accuracy_threshold: 0.8
|
||||
|
||||
performance_degradation:
|
||||
model_type: "pattern_matching"
|
||||
pattern_library: "historical_degradations"
|
||||
confidence_threshold: 0.7
|
||||
|
||||
proactive_actions:
|
||||
- prediction: "memory_exhaustion"
|
||||
lead_time: 1800 # seconds
|
||||
actions: ["preemptive_cleanup", "cache_optimization", "context_reduction"]
|
||||
|
||||
- prediction: "cpu_saturation"
|
||||
lead_time: 600 # seconds
|
||||
actions: ["reduce_parallelism", "defer_background_tasks", "enable_throttling"]
|
||||
|
||||
optimization_recommendations:
|
||||
# Generate optimization recommendations
|
||||
recommendation_engine:
|
||||
analysis_depth: "comprehensive"
|
||||
recommendation_confidence: 0.8
|
||||
implementation_difficulty: "user_friendly"
|
||||
|
||||
recommendation_types:
|
||||
configuration_tuning:
|
||||
description: "Suggest configuration changes for better performance"
|
||||
impact_assessment: "quantified"
|
||||
|
||||
resource_allocation:
|
||||
description: "Recommend better resource allocation strategies"
|
||||
cost_benefit_analysis: true
|
||||
|
||||
workflow_optimization:
|
||||
description: "Suggest workflow improvements"
|
||||
user_experience_impact: "minimal"
|
||||
|
||||
# Performance Monitoring Intelligence
|
||||
monitoring_intelligence:
|
||||
intelligent_metrics:
|
||||
# Smart metric collection and analysis
|
||||
adaptive_sampling:
|
||||
base_sampling_rate: 1.0 # Sample every operation
|
||||
high_load_rate: 0.5 # Reduce sampling under load
|
||||
critical_load_rate: 0.1 # Minimal sampling in critical situations
|
||||
|
||||
contextual_metrics:
|
||||
# Collect different metrics based on context
|
||||
ui_operations:
|
||||
focus_metrics: ["response_time", "render_time", "user_interaction_delay"]
|
||||
|
||||
analysis_operations:
|
||||
focus_metrics: ["processing_time", "memory_usage", "accuracy_score"]
|
||||
|
||||
batch_operations:
|
||||
focus_metrics: ["throughput", "resource_efficiency", "completion_rate"]
|
||||
|
||||
performance_insights:
|
||||
# Generate performance insights
|
||||
insight_generation:
|
||||
pattern_recognition: true
|
||||
correlation_analysis: true
|
||||
root_cause_analysis: true
|
||||
improvement_suggestions: true
|
||||
|
||||
insight_types:
|
||||
bottleneck_identification:
|
||||
description: "Identify performance bottlenecks"
|
||||
priority: "high"
|
||||
|
||||
optimization_opportunities:
|
||||
description: "Find optimization opportunities"
|
||||
priority: "medium"
|
||||
|
||||
capacity_planning:
|
||||
description: "Predict capacity requirements"
|
||||
priority: "low"
|
||||
|
||||
# Performance Validation
|
||||
performance_validation:
|
||||
validation_framework:
|
||||
# Validate performance improvements
|
||||
a_b_testing:
|
||||
enable_automatic_testing: true
|
||||
test_duration: 3600 # seconds
|
||||
statistical_significance: 0.95
|
||||
|
||||
performance_benchmarking:
|
||||
benchmark_frequency: "weekly"
|
||||
regression_threshold: 0.05 # 5% regression tolerance
|
||||
|
||||
continuous_improvement:
|
||||
# Continuous performance improvement
|
||||
improvement_tracking:
|
||||
track_optimization_effectiveness: true
|
||||
measure_user_satisfaction: true
|
||||
monitor_system_health: true
|
||||
|
||||
feedback_loops:
|
||||
performance_feedback: "real_time"
|
||||
user_feedback_integration: true
|
||||
system_learning_integration: true
|
||||
Reference in New Issue
Block a user