Thanks to visit codestin.com
Credit goes to github.com

Skip to content

An MCP extension that enables Goose agents to autonomously self-improve through evolutionary algorithms, reinforced self-play, and sandboxed testing.

License

Notifications You must be signed in to change notification settings

kwsantiago/goose-evolve

Repository files navigation

Goose Evolve

License: MIT GitHub Stars

What is Goose Evolve?

Goose Evolve is an open-source MCP extension for Goose that enables autonomous self-improvement. Agents evolve by rewriting prompts, MCP configs, and code via evolutionary algorithms and sandboxed testing. Inspired by Darwin Gödel Machine and AlphaEvolve, it focuses on openness, modularity, and user control.

Current Status

Production-Ready Components

  • Evolution Engine - Full genetic algorithm orchestration with state persistence, error recovery, and convergence detection
  • Variant Generator - Deterministic mode, mutation lineage tracking, A/B testing, and 5 mutation strategies
  • Metrics Collector - Data persistence, multi-agent support, anomaly detection, and real-time streaming
  • Fitness Evaluator - Pareto optimization, fitness explanations, parallel evaluation, and statistical analysis

Not Implemented

  • Safety Validator - Pre-test validation and injection detection
  • Sandbox Manager - Docker-based isolated testing
  • MCP Integration - No Goose connection yet
  • Deployment Manager - User approval workflow
  • CLI Interface - Command-line control
  • Logging & Telemetry - Observability infrastructure
  • Documentation - Complete architecture and API docs
  • Hot-Reload - Dynamic prompt updates

Installation

Prerequisites

  • Python 3.9 or higher
  • Docker (for future sandbox functionality)

Install from source

git clone https://github.com/kwsantiago/goose-evolve.git
cd goose-evolve
pip install -e .

Quick Start

Note: This example demonstrates core functionality with mocked components for missing features.

import asyncio
from datetime import datetime

from evolution import EvolutionEngine, FitnessEvaluator, VariantGenerator
from evolution.interfaces import EvolutionTriggerEvent, TestResults, ValidationResult


async def main():
    # These components need production hardening
    variant_generator = VariantGenerator()
    fitness_evaluator = FitnessEvaluator()
    
    # Mocked components (not yet implemented)
    class MockSafetyValidator:
        async def validate(self, variant):
            return ValidationResult(is_valid=True, errors=[])
    
    class MockSandboxManager:
        async def test_variant(self, variant):
            return TestResults(
                variant_id=variant.id,
                success_rate=0.9,
                avg_response_time=1.2,
                error_count=0,
                resource_usage={'memory': 100.0, 'cpu': 50.0}
            )
    
    # Create evolution engine
    engine = EvolutionEngine(
        variant_generator=variant_generator,
        safety_validator=MockSafetyValidator(),
        sandbox_manager=MockSandboxManager(),
        fitness_evaluator=fitness_evaluator
    )
    
    # Create a trigger event
    trigger = EvolutionTriggerEvent(
        trigger_type="threshold",
        metrics_snapshot={'success_rate': 0.75, 'avg_response_time': 1.5},
        timestamp=datetime.now()
    )
    
    # Run evolution cycle (no state persistence yet)
    result = await engine.start_evolution_cycle(trigger)
    print(f"Evolution completed: {result['best_fitness']}")


if __name__ == "__main__":
    asyncio.run(main())

How It Works

The evolution process follows these steps:

  1. Monitor - MetricsCollector tracks performance (needs persistence)
  2. Trigger - Threshold detection generates evolution events
  3. Generate - VariantGenerator creates mutations (needs determinism)
  4. Validate - SafetyValidator not implemented
  5. Test - SandboxManager not implemented
  6. Evaluate - FitnessEvaluator scores variants (needs Pareto optimization)
  7. Deploy - No deployment mechanism or MCP integration yet

Development Roadmap

Phase 0: Production Hardening (Current)

  • Integration testing suite
  • State persistence across components
  • Error recovery mechanisms
  • Performance optimization
  • Resource management

Phase 1: Safety Infrastructure

  • Safety Validator implementation
  • Docker Sandbox Manager
  • Comprehensive test suites

Phase 2: MCP Integration

  • Goose MCP bridge
  • Prompt hot-reload
  • Deployment manager
  • User approval workflows

Phase 3: Developer Experience

  • CLI interface
  • Logging and telemetry
  • Complete documentation
  • Community templates

Phase 4: Advanced Features

  • Multi-modal evolution
  • Background optimization
  • Community sharing platform

Test Coverage

  • 173 tests passing (161 unit tests + 12 integration tests)
  • 12 integration tests covering all critical scenarios
  • Coverage: ~95% for all components
  • Includes: End-to-end, stress tests (5000+ variants), and failure recovery tests

Known Limitations

  1. No Safety Validator - Pre-test validation not implemented
  2. No Sandbox Manager - Docker isolation not implemented
  3. No MCP Integration - Not connected to Goose yet
  4. No Deployment Manager - User approval workflow missing
  5. No CLI Interface - Command-line control not implemented

Contributing

We need help with:

Immediate Needs

  • Integration test suite development
  • State persistence implementation
  • Error recovery mechanisms
  • Production configuration system

Next Phase

  • Safety Validator implementation
  • Docker Sandbox setup
  • MCP Integration for Goose agents
  • CLI Development

Community Contributions

  • Custom fitness functions
  • Evolution strategies
  • Documentation improvements
  • Bug reports and fixes

See CONTRIBUTING.md for detailed guidelines.

Architecture

See architecture.md for detailed system design, component interactions, and extension points.

License

MIT License. See LICENSE for details.

Support

  • GitHub Issues: Report bugs or suggest features
  • Discussions: Architecture and design decisions
  • Discord: Join the Goose community for real-time chat

Citation

If you use Goose Evolve in your research, please cite:

@software{goose-evolve,
  title = {Goose Evolve: Self-Improving AI Agents via Evolutionary Algorithms},
  author = {[Your Name]},
  year = {2025},
  url = {https://github.com/kwsantiago/goose-evolve}
}

About

An MCP extension that enables Goose agents to autonomously self-improve through evolutionary algorithms, reinforced self-play, and sandboxed testing.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages