waldzell-agentic-enhancement.yml•24.9 kB
name: 🧬 Self-Improvement Orchestration
on:
schedule:
# Run comprehensive self-improvement cycle daily at 2 AM UTC
- cron: '0 2 * * *'
workflow_dispatch:
inputs:
improvement_mode:
description: 'Self-improvement mode'
required: false
default: 'comprehensive'
type: choice
options:
- 'comprehensive'
- 'focused'
- 'meta_evolution_only'
- 'performance_only'
- 'emergency_optimization'
systems_to_run:
description: 'Systems to execute (comma-separated)'
required: false
default: 'meta_evolution,cross_learning,emergent_discovery,performance_tuning,reflection'
type: string
evolution_intensity:
description: 'Evolution intensity level'
required: false
default: 'normal'
type: choice
options:
- 'light'
- 'normal'
- 'intensive'
- 'experimental'
env:
IMPROVEMENT_MODE: ${{ github.event.inputs.improvement_mode || 'comprehensive' }}
SYSTEMS_TO_RUN: ${{ github.event.inputs.systems_to_run || 'meta_evolution,cross_learning,emergent_discovery,performance_tuning,reflection' }}
EVOLUTION_INTENSITY: ${{ github.event.inputs.evolution_intensity || 'normal' }}
jobs:
# 🔍 System Health Check
health-check:
runs-on: ubuntu-latest
outputs:
system_health: ${{ steps.health.outputs.health_status }}
ready_for_evolution: ${{ steps.health.outputs.ready }}
steps:
- name: 🔄 Checkout Code
uses: actions/checkout@v4
- name: 🧠 Setup Claude Environment
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
curl -fsSL https://claude.ai/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
sudo apt-get update && sudo apt-get install -y jq bc
- name: 🔍 System Health Assessment
id: health
run: |
echo "🔍 Assessing system health before self-improvement..."
# Check script executability
script_count=0
executable_count=0
for category in evolution dev-tools optimization memory; do
for script in $category/*.sh; do
if [ -f "$script" ]; then
((script_count++))
if [ -x "$script" ]; then
((executable_count++))
fi
fi
done
done
# Calculate health metrics
executable_ratio=$(echo "scale=2; $executable_count / $script_count" | bc)
# Check for critical systems
critical_systems=("evolution/adas-meta-agent.sh" "evolution/fitness-evaluator.sh" "dev-tools/code-review-advanced.sh")
critical_healthy=true
for system in "${critical_systems[@]}"; do
if [ ! -x "$system" ]; then
critical_healthy=false
echo "❌ Critical system not executable: $system"
fi
done
# Determine overall health
if [ "$critical_healthy" = true ] && (( $(echo "$executable_ratio > 0.9" | bc -l) )); then
health_status="healthy"
ready="true"
echo "✅ System health: HEALTHY ($executable_count/$script_count scripts executable)"
elif [ "$critical_healthy" = true ]; then
health_status="degraded"
ready="true"
echo "⚠️ System health: DEGRADED (some non-critical issues)"
else
health_status="unhealthy"
ready="false"
echo "❌ System health: UNHEALTHY (critical systems offline)"
fi
echo "health_status=$health_status" >> $GITHUB_OUTPUT
echo "ready=$ready" >> $GITHUB_OUTPUT
# 🧬 Meta-Meta Evolution
meta-evolution:
runs-on: ubuntu-latest
needs: health-check
if: needs.health-check.outputs.ready_for_evolution == 'true' && contains(github.event.inputs.systems_to_run || 'meta_evolution', 'meta_evolution')
outputs:
evolution_results: ${{ steps.meta-evolve.outputs.results }}
strategies_evolved: ${{ steps.meta-evolve.outputs.strategies }}
steps:
- name: 🔄 Checkout Code
uses: actions/checkout@v4
- name: 🧠 Setup Claude Environment
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
curl -fsSL https://claude.ai/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
sudo apt-get update && sudo apt-get install -y jq bc
- name: 🧬 Meta-Meta Evolution
id: meta-evolve
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
echo "🧬 Running Meta-Meta Evolution Engine..."
# Set evolution parameters based on intensity
case "$EVOLUTION_INTENSITY" in
"light")
generations=2
mutation_rate=0.2
;;
"normal")
generations=3
mutation_rate=0.3
;;
"intensive")
generations=5
mutation_rate=0.4
;;
"experimental")
generations=7
mutation_rate=0.5
;;
esac
# Run meta-evolution
chmod +x evolution/meta-meta-evolution-engine.sh
./evolution/meta-meta-evolution-engine.sh \
--generations $generations \
--mutation-rate $mutation_rate \
--selection-pressure 0.7
# Capture results
if [ -f "meta-evolution-archive/best_strategies.json" ]; then
strategies=$(jq -c '.best_strategies' meta-evolution-archive/best_strategies.json)
echo "strategies=$strategies" >> $GITHUB_OUTPUT
echo "✅ Meta-evolution completed with $(echo "$strategies" | jq length) strategies"
else
echo "strategies=[]" >> $GITHUB_OUTPUT
echo "⚠️ Meta-evolution completed but no strategies file found"
fi
echo "results=completed" >> $GITHUB_OUTPUT
# 🕸️ Cross-Script Learning
cross-learning:
runs-on: ubuntu-latest
needs: health-check
if: needs.health-check.outputs.ready_for_evolution == 'true' && contains(github.event.inputs.systems_to_run || 'cross_learning', 'cross_learning')
outputs:
patterns_extracted: ${{ steps.learning.outputs.patterns }}
recommendations: ${{ steps.learning.outputs.recommendations }}
steps:
- name: 🔄 Checkout Code
uses: actions/checkout@v4
- name: 🧠 Setup Claude Environment
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
curl -fsSL https://claude.ai/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
sudo apt-get update && sudo apt-get install -y jq bc
- name: 🕸️ Cross-Script Learning Network
id: learning
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
echo "🕸️ Running Cross-Script Learning Network..."
chmod +x evolution/cross-script-learning-network.sh
./evolution/cross-script-learning-network.sh \
--min-frequency 2 \
--threshold 0.7 \
--apply-learnings
# Extract results
if [ -f "cross-script-learning/knowledge-base/consolidated_patterns.json" ]; then
pattern_count=$(jq '.pattern_frequencies | length' cross-script-learning/knowledge-base/consolidated_patterns.json)
echo "patterns=$pattern_count" >> $GITHUB_OUTPUT
echo "✅ Cross-learning extracted $pattern_count pattern types"
else
echo "patterns=0" >> $GITHUB_OUTPUT
fi
if [ -f "cross-script-learning/knowledge-base/learning_recommendations.json" ]; then
rec_count=$(jq '.recommendations | length' cross-script-learning/knowledge-base/learning_recommendations.json)
echo "recommendations=$rec_count" >> $GITHUB_OUTPUT
echo "✅ Generated $rec_count learning recommendations"
else
echo "recommendations=0" >> $GITHUB_OUTPUT
fi
# 🌟 Emergent Capability Discovery
emergent-discovery:
runs-on: ubuntu-latest
needs: health-check
if: needs.health-check.outputs.ready_for_evolution == 'true' && contains(github.event.inputs.systems_to_run || 'emergent_discovery', 'emergent_discovery')
outputs:
emergent_capabilities: ${{ steps.discovery.outputs.capabilities }}
prototypes_created: ${{ steps.discovery.outputs.prototypes }}
steps:
- name: 🔄 Checkout Code
uses: actions/checkout@v4
- name: 🧠 Setup Claude Environment
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
curl -fsSL https://claude.ai/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
sudo apt-get update && sudo apt-get install -y jq bc
- name: 🌟 Emergent Capability Discovery
id: discovery
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
echo "🌟 Running Emergent Capability Discovery..."
# Set discovery parameters based on mode
if [ "$IMPROVEMENT_MODE" = "comprehensive" ]; then
discovery_mode="systematic"
max_combinations=50
elif [ "$IMPROVEMENT_MODE" = "focused" ]; then
discovery_mode="targeted"
max_combinations=20
else
discovery_mode="random"
max_combinations=30
fi
chmod +x evolution/emergent-capability-discovery.sh
./evolution/emergent-capability-discovery.sh \
--discovery-mode $discovery_mode \
--combination-depth 2 \
--max-combinations $max_combinations \
--threshold 0.75
# Extract results
if [ -f "emergent-discovery/emergent-archive/emergent_capabilities.json" ]; then
capabilities=$(jq '.emergent_capabilities | length' emergent-discovery/emergent-archive/emergent_capabilities.json)
echo "capabilities=$capabilities" >> $GITHUB_OUTPUT
else
echo "capabilities=0" >> $GITHUB_OUTPUT
fi
prototypes=$(ls emergent-discovery/emergent-archive/emergent_*.sh 2>/dev/null | wc -l)
echo "prototypes=$prototypes" >> $GITHUB_OUTPUT
echo "✅ Emergent discovery: $capabilities capabilities, $prototypes prototypes"
# ⚡ Performance-Driven Auto-Tuning
performance-tuning:
runs-on: ubuntu-latest
needs: health-check
if: needs.health-check.outputs.ready_for_evolution == 'true' && contains(github.event.inputs.systems_to_run || 'performance_tuning', 'performance_tuning')
outputs:
optimizations_applied: ${{ steps.tuning.outputs.optimizations }}
performance_improvement: ${{ steps.tuning.outputs.improvement }}
steps:
- name: 🔄 Checkout Code
uses: actions/checkout@v4
- name: 🧠 Setup Claude Environment
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
curl -fsSL https://claude.ai/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
sudo apt-get update && sudo apt-get install -y jq bc
- name: ⚡ Performance-Driven Auto-Tuning
id: tuning
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
echo "⚡ Running Performance-Driven Auto-Tuning..."
chmod +x optimization/performance-driven-auto-tuning.sh
timeout 600 ./optimization/performance-driven-auto-tuning.sh \
--interval 0 \
--threshold 0.8 || echo "⚠️ Performance tuning completed with timeout"
# Extract results
if [ -f "performance-monitoring/tuning/optimization_recommendations.json" ]; then
optimizations=$(jq '.recommendations | length' performance-monitoring/tuning/optimization_recommendations.json)
echo "optimizations=$optimizations" >> $GITHUB_OUTPUT
# Calculate average expected improvement
if [ "$optimizations" -gt 0 ]; then
# Extract improvement percentages and calculate average
avg_improvement=$(jq -r '.recommendations[].expected_improvement' performance-monitoring/tuning/optimization_recommendations.json | grep -o '[0-9]*' | awk '{sum+=$1; count++} END {if(count>0) print sum/count; else print 0}')
echo "improvement=${avg_improvement:-0}" >> $GITHUB_OUTPUT
else
echo "improvement=0" >> $GITHUB_OUTPUT
fi
else
echo "optimizations=0" >> $GITHUB_OUTPUT
echo "improvement=0" >> $GITHUB_OUTPUT
fi
echo "✅ Performance tuning: $optimizations optimizations identified"
# 🤔 Continuous Reflection
reflection:
runs-on: ubuntu-latest
needs: [health-check, meta-evolution, cross-learning, emergent-discovery, performance-tuning]
if: always() && needs.health-check.outputs.ready_for_evolution == 'true' && contains(github.event.inputs.systems_to_run || 'reflection', 'reflection')
outputs:
insights_generated: ${{ steps.reflect.outputs.insights }}
strategic_actions: ${{ steps.reflect.outputs.actions }}
steps:
- name: 🔄 Checkout Code
uses: actions/checkout@v4
- name: 🧠 Setup Claude Environment
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
curl -fsSL https://claude.ai/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
sudo apt-get update && sudo apt-get install -y jq bc
- name: 🤔 Continuous Reflection
id: reflect
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
echo "🤔 Running Continuous Reflection Engine..."
# Set reflection parameters
if [ "$IMPROVEMENT_MODE" = "comprehensive" ]; then
reflection_mode="comprehensive"
depth="deep"
elif [ "$IMPROVEMENT_MODE" = "focused" ]; then
reflection_mode="focused"
depth="medium"
else
reflection_mode="strategic"
depth="deep"
fi
chmod +x evolution/continuous-reflection-engine.sh
./evolution/continuous-reflection-engine.sh \
--reflection-mode $reflection_mode \
--depth $depth \
--interval 0 \
--auto-implement
# Extract results
if [ -f "continuous-reflection/insights/deep_reflection.json" ]; then
insights=$(jq '.key_insights | length' continuous-reflection/insights/deep_reflection.json)
actions=$(jq '.action_recommendations | length' continuous-reflection/insights/deep_reflection.json)
echo "insights=$insights" >> $GITHUB_OUTPUT
echo "actions=$actions" >> $GITHUB_OUTPUT
echo "✅ Reflection: $insights insights, $actions strategic actions"
else
echo "insights=0" >> $GITHUB_OUTPUT
echo "actions=0" >> $GITHUB_OUTPUT
fi
# 🌐 Supabase Integration & Data Collection
supabase-integration:
runs-on: ubuntu-latest
needs: [meta-evolution, cross-learning, emergent-discovery, performance-tuning, reflection]
if: always()
steps:
- name: 🔄 Checkout Code
uses: actions/checkout@v4
- name: 🌐 Supabase Data Collection
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}
run: |
echo "🌐 Integrating with Supabase for data collection..."
chmod +x evolution/supabase-edge-integration.sh
./evolution/supabase-edge-integration.sh --create-functions
# Collect and send orchestration results
orchestration_data=$(cat <<EOF
{
"orchestration_timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
"improvement_mode": "$IMPROVEMENT_MODE",
"evolution_intensity": "$EVOLUTION_INTENSITY",
"systems_executed": "$SYSTEMS_TO_RUN",
"results": {
"meta_evolution": "${{ needs.meta-evolution.outputs.evolution_results || 'skipped' }}",
"cross_learning_patterns": "${{ needs.cross-learning.outputs.patterns_extracted || '0' }}",
"emergent_capabilities": "${{ needs.emergent-discovery.outputs.emergent_capabilities || '0' }}",
"performance_optimizations": "${{ needs.performance-tuning.outputs.optimizations_applied || '0' }}",
"reflection_insights": "${{ needs.reflection.outputs.insights_generated || '0' }}"
}
}
EOF
)
echo "📊 Orchestration results collected"
echo "$orchestration_data" > orchestration_results.json
# 📊 Comprehensive Reporting
reporting:
runs-on: ubuntu-latest
needs: [health-check, meta-evolution, cross-learning, emergent-discovery, performance-tuning, reflection, supabase-integration]
if: always()
steps:
- name: 🔄 Checkout Code
uses: actions/checkout@v4
- name: 📊 Generate Comprehensive Report
run: |
echo "📊 Generating comprehensive self-improvement report..."
# Create comprehensive orchestration report
cat > SELF_IMPROVEMENT_REPORT.md << EOF
# 🧬 Self-Improvement Orchestration Report
**Orchestration Date:** $(date -u +"%Y-%m-%d %H:%M:%S UTC")
**Improvement Mode:** $IMPROVEMENT_MODE
**Evolution Intensity:** $EVOLUTION_INTENSITY
**Systems Executed:** $SYSTEMS_TO_RUN
## 🔍 System Health
- **Overall Health:** ${{ needs.health-check.outputs.system_health }}
- **Ready for Evolution:** ${{ needs.health-check.outputs.ready_for_evolution }}
## 🧬 Self-Improvement Results
### Meta-Meta Evolution
$(if [ "${{ needs.meta-evolution.result }}" = "success" ]; then
echo "✅ **Status:** Completed successfully"
echo "📈 **Strategies Evolved:** ${{ needs.meta-evolution.outputs.strategies_evolved || 'Data not available' }}"
else
echo "⏭️ **Status:** Skipped or failed"
fi)
### Cross-Script Learning Network
$(if [ "${{ needs.cross-learning.result }}" = "success" ]; then
echo "✅ **Status:** Completed successfully"
echo "🧩 **Patterns Extracted:** ${{ needs.cross-learning.outputs.patterns_extracted || '0' }}"
echo "🎓 **Recommendations Generated:** ${{ needs.cross-learning.outputs.recommendations || '0' }}"
else
echo "⏭️ **Status:** Skipped or failed"
fi)
### Emergent Capability Discovery
$(if [ "${{ needs.emergent-discovery.result }}" = "success" ]; then
echo "✅ **Status:** Completed successfully"
echo "🌟 **Emergent Capabilities:** ${{ needs.emergent-discovery.outputs.emergent_capabilities || '0' }}"
echo "🤖 **Prototypes Created:** ${{ needs.emergent-discovery.outputs.prototypes_created || '0' }}"
else
echo "⏭️ **Status:** Skipped or failed"
fi)
### Performance-Driven Auto-Tuning
$(if [ "${{ needs.performance-tuning.result }}" = "success" ]; then
echo "✅ **Status:** Completed successfully"
echo "⚡ **Optimizations Applied:** ${{ needs.performance-tuning.outputs.optimizations_applied || '0' }}"
echo "📈 **Performance Improvement:** ${{ needs.performance-tuning.outputs.performance_improvement || '0' }}%"
else
echo "⏭️ **Status:** Skipped or failed"
fi)
### Continuous Reflection
$(if [ "${{ needs.reflection.result }}" = "success" ]; then
echo "✅ **Status:** Completed successfully"
echo "🤔 **Insights Generated:** ${{ needs.reflection.outputs.insights_generated || '0' }}"
echo "🎯 **Strategic Actions:** ${{ needs.reflection.outputs.strategic_actions || '0' }}"
else
echo "⏭️ **Status:** Skipped or failed"
fi)
## 🌐 Data Integration
- **Supabase Integration:** ${{ needs.supabase-integration.result }}
- **Performance Data:** Collected and stored
- **Evolution Insights:** Archived for future iterations
## 🚀 Next Steps
1. **Review Results:** Analyze generated insights and recommendations
2. **Implement Changes:** Apply high-priority optimizations
3. **Monitor Performance:** Track improvements from this orchestration cycle
4. **Schedule Next Cycle:** Prepare for next self-improvement iteration
## 📈 System Evolution Metrics
- **Total Systems Orchestrated:** $(echo "$SYSTEMS_TO_RUN" | tr ',' '\n' | wc -l)
- **Successful Executions:** $(echo "${{ needs.meta-evolution.result }} ${{ needs.cross-learning.result }} ${{ needs.emergent-discovery.result }} ${{ needs.performance-tuning.result }} ${{ needs.reflection.result }}" | grep -c success)
- **Evolution Cycle:** Complete
- **System Status:** Self-improving and autonomous
---
*Generated by Self-Improvement Orchestration System*
*The AI is evolving itself - recursively and autonomously*
EOF
- name: 📤 Upload Orchestration Artifacts
uses: actions/upload-artifact@v4
with:
name: self-improvement-results-${{ github.run_number }}
path: |
SELF_IMPROVEMENT_REPORT.md
meta-evolution-archive/
cross-script-learning/
emergent-discovery/
performance-monitoring/
continuous-reflection/
orchestration_results.json
retention-days: 30
- name: 📊 Update Job Summary
run: |
echo "## 🧬 Self-Improvement Orchestration Summary" >> $GITHUB_STEP_SUMMARY
echo "================================" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Orchestration Date:** $(date -u +"%Y-%m-%d %H:%M:%S UTC")" >> $GITHUB_STEP_SUMMARY
echo "**Mode:** $IMPROVEMENT_MODE" >> $GITHUB_STEP_SUMMARY
echo "**Intensity:** $EVOLUTION_INTENSITY" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 🎯 Results" >> $GITHUB_STEP_SUMMARY
echo "- **Meta-Evolution:** ${{ needs.meta-evolution.result || 'Not run' }}" >> $GITHUB_STEP_SUMMARY
echo "- **Cross-Learning:** ${{ needs.cross-learning.result || 'Not run' }}" >> $GITHUB_STEP_SUMMARY
echo "- **Emergent Discovery:** ${{ needs.emergent-discovery.result || 'Not run' }}" >> $GITHUB_STEP_SUMMARY
echo "- **Performance Tuning:** ${{ needs.performance-tuning.result || 'Not run' }}" >> $GITHUB_STEP_SUMMARY
echo "- **Reflection:** ${{ needs.reflection.result || 'Not run' }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 📈 Metrics" >> $GITHUB_STEP_SUMMARY
echo "- **System Health:** ${{ needs.health-check.outputs.system_health }}" >> $GITHUB_STEP_SUMMARY
echo "- **Evolution Patterns:** ${{ needs.cross-learning.outputs.patterns_extracted || '0' }}" >> $GITHUB_STEP_SUMMARY
echo "- **Emergent Capabilities:** ${{ needs.emergent-discovery.outputs.emergent_capabilities || '0' }}" >> $GITHUB_STEP_SUMMARY
echo "- **Performance Optimizations:** ${{ needs.performance-tuning.outputs.optimizations_applied || '0' }}" >> $GITHUB_STEP_SUMMARY
echo "- **Strategic Insights:** ${{ needs.reflection.outputs.insights_generated || '0' }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "🤖 **Status:** The system is autonomously evolving and improving itself!" >> $GITHUB_STEP_SUMMARY