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:
322
Framework-Hooks/config/hook_coordination.yaml
Normal file
322
Framework-Hooks/config/hook_coordination.yaml
Normal file
@@ -0,0 +1,322 @@
|
||||
# Hook Coordination Configuration
|
||||
# Intelligent hook execution patterns, dependency resolution, and optimization
|
||||
# Enables smart coordination of all Framework-Hooks lifecycle events
|
||||
|
||||
# Metadata
|
||||
version: "1.0.0"
|
||||
last_updated: "2025-01-06"
|
||||
description: "Hook coordination and execution intelligence patterns"
|
||||
|
||||
# Hook Execution Patterns
|
||||
execution_patterns:
|
||||
parallel_execution:
|
||||
# Independent hooks that can run simultaneously
|
||||
groups:
|
||||
- name: "independent_analysis"
|
||||
hooks: ["compression_engine", "pattern_detection"]
|
||||
description: "Compression and pattern analysis can run independently"
|
||||
max_parallel: 2
|
||||
timeout: 5000 # ms
|
||||
|
||||
- name: "intelligence_gathering"
|
||||
hooks: ["mcp_intelligence", "learning_engine"]
|
||||
description: "MCP and learning intelligence can run in parallel"
|
||||
max_parallel: 2
|
||||
timeout: 3000 # ms
|
||||
|
||||
- name: "background_optimization"
|
||||
hooks: ["performance_monitor", "cache_management"]
|
||||
description: "Performance monitoring and cache operations"
|
||||
max_parallel: 2
|
||||
timeout: 2000 # ms
|
||||
|
||||
sequential_execution:
|
||||
# Hooks that must run in specific order
|
||||
chains:
|
||||
- name: "session_lifecycle"
|
||||
sequence: ["session_start", "pre_tool_use", "post_tool_use", "stop"]
|
||||
description: "Core session lifecycle must be sequential"
|
||||
mandatory: true
|
||||
break_on_error: true
|
||||
|
||||
- name: "context_preparation"
|
||||
sequence: ["session_start", "context_loading", "pattern_detection"]
|
||||
description: "Context must be prepared before pattern analysis"
|
||||
conditional: {session_type: "complex"}
|
||||
|
||||
- name: "optimization_chain"
|
||||
sequence: ["compression_engine", "performance_monitor", "learning_engine"]
|
||||
description: "Optimization workflow sequence"
|
||||
trigger: {optimization_mode: true}
|
||||
|
||||
conditional_execution:
|
||||
# Hooks that execute based on context conditions
|
||||
rules:
|
||||
- hook: "compression_engine"
|
||||
conditions:
|
||||
- resource_usage: ">0.75"
|
||||
- conversation_length: ">50"
|
||||
- enable_compression: true
|
||||
priority: "high"
|
||||
|
||||
- hook: "pattern_detection"
|
||||
conditions:
|
||||
- complexity_score: ">0.5"
|
||||
- enable_pattern_analysis: true
|
||||
OR:
|
||||
- operation_type: ["analyze", "review", "debug"]
|
||||
priority: "medium"
|
||||
|
||||
- hook: "mcp_intelligence"
|
||||
conditions:
|
||||
- mcp_servers_available: true
|
||||
- operation_requires_mcp: true
|
||||
priority: "high"
|
||||
|
||||
- hook: "learning_engine"
|
||||
conditions:
|
||||
- learning_enabled: true
|
||||
- session_type: ["interactive", "complex"]
|
||||
priority: "medium"
|
||||
|
||||
- hook: "performance_monitor"
|
||||
conditions:
|
||||
- performance_monitoring: true
|
||||
OR:
|
||||
- complexity_score: ">0.7"
|
||||
- resource_usage: ">0.8"
|
||||
priority: "low"
|
||||
|
||||
# Dependency Resolution
|
||||
dependency_resolution:
|
||||
hook_dependencies:
|
||||
# Define dependencies between hooks
|
||||
session_start:
|
||||
requires: []
|
||||
provides: ["session_context", "initial_state"]
|
||||
|
||||
pre_tool_use:
|
||||
requires: ["session_context"]
|
||||
provides: ["tool_context", "pre_analysis"]
|
||||
depends_on: ["session_start"]
|
||||
|
||||
compression_engine:
|
||||
requires: ["session_context"]
|
||||
provides: ["compression_config", "optimized_context"]
|
||||
optional_depends: ["session_start"]
|
||||
|
||||
pattern_detection:
|
||||
requires: ["session_context"]
|
||||
provides: ["detected_patterns", "pattern_insights"]
|
||||
optional_depends: ["session_start", "compression_engine"]
|
||||
|
||||
mcp_intelligence:
|
||||
requires: ["tool_context", "detected_patterns"]
|
||||
provides: ["mcp_recommendations", "server_selection"]
|
||||
depends_on: ["pre_tool_use"]
|
||||
optional_depends: ["pattern_detection"]
|
||||
|
||||
post_tool_use:
|
||||
requires: ["tool_context", "tool_results"]
|
||||
provides: ["post_analysis", "performance_metrics"]
|
||||
depends_on: ["pre_tool_use"]
|
||||
|
||||
learning_engine:
|
||||
requires: ["post_analysis", "performance_metrics"]
|
||||
provides: ["learning_insights", "adaptations"]
|
||||
depends_on: ["post_tool_use"]
|
||||
optional_depends: ["mcp_intelligence", "pattern_detection"]
|
||||
|
||||
stop:
|
||||
requires: ["session_context"]
|
||||
provides: ["session_summary", "cleanup_status"]
|
||||
depends_on: ["session_start"]
|
||||
optional_depends: ["learning_engine", "post_tool_use"]
|
||||
|
||||
resolution_strategies:
|
||||
# How to resolve dependency conflicts
|
||||
missing_dependency:
|
||||
strategy: "graceful_degradation"
|
||||
fallback: "skip_optional"
|
||||
|
||||
circular_dependency:
|
||||
strategy: "break_weakest_link"
|
||||
priority_order: ["session_start", "pre_tool_use", "post_tool_use", "stop"]
|
||||
|
||||
timeout_handling:
|
||||
strategy: "continue_without_dependency"
|
||||
timeout_threshold: 10000 # ms
|
||||
|
||||
# Performance Optimization
|
||||
performance_optimization:
|
||||
execution_optimization:
|
||||
# Optimize hook execution based on context
|
||||
fast_path:
|
||||
conditions:
|
||||
- complexity_score: "<0.3"
|
||||
- operation_type: ["simple", "basic"]
|
||||
- resource_usage: "<0.5"
|
||||
optimizations:
|
||||
- skip_non_essential_hooks: true
|
||||
- reduce_analysis_depth: true
|
||||
- enable_aggressive_caching: true
|
||||
- parallel_where_possible: true
|
||||
|
||||
comprehensive_path:
|
||||
conditions:
|
||||
- complexity_score: ">0.7"
|
||||
- operation_type: ["complex", "analysis"]
|
||||
- accuracy_priority: "high"
|
||||
optimizations:
|
||||
- enable_all_hooks: true
|
||||
- deep_analysis_mode: true
|
||||
- cross_hook_coordination: true
|
||||
- detailed_logging: true
|
||||
|
||||
resource_management:
|
||||
# Manage resource usage across hooks
|
||||
resource_budgets:
|
||||
cpu_budget: 80 # percent
|
||||
memory_budget: 70 # percent
|
||||
time_budget: 15000 # ms total
|
||||
|
||||
resource_allocation:
|
||||
session_lifecycle: 30 # percent of budget
|
||||
intelligence_hooks: 40 # percent
|
||||
optimization_hooks: 30 # percent
|
||||
|
||||
caching_strategies:
|
||||
# Hook result caching
|
||||
cacheable_hooks:
|
||||
- hook: "pattern_detection"
|
||||
cache_key: ["session_context", "operation_type"]
|
||||
cache_duration: 300 # seconds
|
||||
|
||||
- hook: "mcp_intelligence"
|
||||
cache_key: ["operation_context", "available_servers"]
|
||||
cache_duration: 600 # seconds
|
||||
|
||||
- hook: "compression_engine"
|
||||
cache_key: ["context_size", "compression_level"]
|
||||
cache_duration: 1800 # seconds
|
||||
|
||||
# Context-Aware Execution
|
||||
context_awareness:
|
||||
operation_context:
|
||||
# Adapt execution based on operation context
|
||||
context_patterns:
|
||||
- context_type: "ui_development"
|
||||
hook_priorities: ["mcp_intelligence", "pattern_detection", "compression_engine"]
|
||||
preferred_execution: "fast_parallel"
|
||||
|
||||
- context_type: "code_analysis"
|
||||
hook_priorities: ["pattern_detection", "mcp_intelligence", "learning_engine"]
|
||||
preferred_execution: "comprehensive_sequential"
|
||||
|
||||
- context_type: "performance_optimization"
|
||||
hook_priorities: ["performance_monitor", "compression_engine", "pattern_detection"]
|
||||
preferred_execution: "resource_optimized"
|
||||
|
||||
user_preferences:
|
||||
# Adapt to user preferences and patterns
|
||||
preference_patterns:
|
||||
- user_type: "performance_focused"
|
||||
optimizations: ["aggressive_caching", "parallel_execution", "skip_optional"]
|
||||
|
||||
- user_type: "quality_focused"
|
||||
optimizations: ["comprehensive_analysis", "detailed_validation", "full_coordination"]
|
||||
|
||||
- user_type: "speed_focused"
|
||||
optimizations: ["fast_path", "minimal_hooks", "cached_results"]
|
||||
|
||||
# Error Handling and Recovery
|
||||
error_handling:
|
||||
error_recovery:
|
||||
# Hook failure recovery strategies
|
||||
recovery_strategies:
|
||||
- error_type: "timeout"
|
||||
recovery: "continue_without_hook"
|
||||
log_level: "warning"
|
||||
|
||||
- error_type: "dependency_missing"
|
||||
recovery: "graceful_degradation"
|
||||
log_level: "info"
|
||||
|
||||
- error_type: "critical_failure"
|
||||
recovery: "abort_and_cleanup"
|
||||
log_level: "error"
|
||||
|
||||
resilience_patterns:
|
||||
# Make hook execution resilient
|
||||
resilience_features:
|
||||
retry_failed_hooks: true
|
||||
max_retries: 2
|
||||
retry_backoff: "exponential" # linear, exponential
|
||||
|
||||
graceful_degradation: true
|
||||
fallback_to_basic: true
|
||||
preserve_essential_hooks: ["session_start", "stop"]
|
||||
|
||||
error_isolation: true
|
||||
prevent_error_cascade: true
|
||||
maintain_session_integrity: true
|
||||
|
||||
# Hook Lifecycle Management
|
||||
lifecycle_management:
|
||||
hook_states:
|
||||
# Track hook execution states
|
||||
state_tracking:
|
||||
- pending
|
||||
- initializing
|
||||
- running
|
||||
- completed
|
||||
- failed
|
||||
- skipped
|
||||
- timeout
|
||||
|
||||
lifecycle_events:
|
||||
# Events during hook execution
|
||||
event_handlers:
|
||||
before_hook_execution:
|
||||
actions: ["validate_dependencies", "check_resources", "prepare_context"]
|
||||
|
||||
after_hook_execution:
|
||||
actions: ["update_metrics", "cache_results", "trigger_dependent_hooks"]
|
||||
|
||||
hook_failure:
|
||||
actions: ["log_error", "attempt_recovery", "notify_dependent_hooks"]
|
||||
|
||||
monitoring:
|
||||
# Monitor hook execution
|
||||
performance_tracking:
|
||||
track_execution_time: true
|
||||
track_resource_usage: true
|
||||
track_success_rate: true
|
||||
track_dependency_resolution: true
|
||||
|
||||
health_monitoring:
|
||||
hook_health_checks: true
|
||||
dependency_health_checks: true
|
||||
performance_degradation_detection: true
|
||||
|
||||
# Dynamic Configuration
|
||||
dynamic_configuration:
|
||||
adaptive_execution:
|
||||
# Adapt execution patterns based on performance
|
||||
adaptation_triggers:
|
||||
- performance_degradation: ">20%"
|
||||
action: "switch_to_fast_path"
|
||||
|
||||
- error_rate: ">10%"
|
||||
action: "enable_resilience_mode"
|
||||
|
||||
- resource_pressure: ">90%"
|
||||
action: "reduce_hook_scope"
|
||||
|
||||
learning_integration:
|
||||
# Learn from hook execution patterns
|
||||
learning_features:
|
||||
learn_optimal_execution_order: true
|
||||
learn_user_preferences: true
|
||||
learn_performance_patterns: true
|
||||
adapt_to_project_context: true
|
||||
Reference in New Issue
Block a user