Protocol-zero-0/evolution-kernel
Self-improving code for any git repo: give it a measurable goal, a coding agent (Claude Code or Aider) proposes changes, the kernel scores them, keeps winners and rolls back failures. Open-source AlphaEvolve / FunSearch-style evolution loop, sandboxed, with an auditable ledger.
What it solves
Evolution Kernel is a tool that takes any git repository and a measurable goal, then runs a continuous loop: the codebase observes its own behavior, plans improvements using a large language model, executes those changes in an isolated sandbox, evaluates the result, and commits only the changes that genuinely improve the metric. This makes the job of tuning an agent's harness (prompt structure, tool usage, sampling, verification) a reproducible, automated process instead of a manual, hand-crafted effort. It also keeps every decision transparent and rollback-able, so a codebase can evolve without leaving permanent scars.
How it works
The core is a closed loop with five stages:
- Observe - Run a metric command (shell, file, or HTTP endpoint) to capture the current state of the codebase.
- Plan - An LLM reads the metric and the history of prior attempts, and produces a concrete plan of changes.
- Execute - A coding agent (either Aider or Claude Code) applies the plan inside an isolated git worktree, wrapped in a firejail OS-level sandbox for extra security.
- Evaluate - The metric is re-run, and an LLM decides whether the change should be accepted or rejected.
- Commit / rollback - Accepted changes become real git commits on an
evolution/acceptedbranch; rejected changes are discarded, but the experiment is kept in a ledger for audit.
The loop repeats until a hard stop condition fires (e.g., maximum iterations, budget, or consecutive failures). Every attempt writes a complete forensic record to runs/<id>/, including config, observations, plans, diffs, evaluation metrics, and the final decision. Nothing is held in memory; the whole run can be reconstructed from the ledger alone.
Who it’s for
It is aimed at engineers and researchers who want to improve the performance of an AI agent without retraining the underlying model. It is especially useful when:
- You have a measurable eval metric (like accuracy on a benchmark or success rate on a task) and want to automatically improve it.
- You want to evolve the harness around a small, local model to close the capability gap with frontier models.
- You need a production-grade, auditable process for agent improvement, with every change tracked and reversible.
The quickstart example runs the full loop in about one second, at zero cost, and with no API key, using a simple deterministic model; the LLM-driven version requires API keys for Anthropic or OpenAI.
Highlights
- Full closed-loop evolution: observe, plan, execute, evaluate, commit, repeat.
- Every change is a real git commit on
evolution/accepted; you can roll back to any point. - Sandboxed execution: each attempt runs in an isolated git worktree and optionally inside a firejail OS sandbox.
- Complete ledger audit trail, including goal, observations, plans, diffs, evaluation, decision, and reflection.
- Budget guards: max iterations, max consecutive failures, max total USD, and max total tokens.
- Config-driven: swap LLM providers (Anthropic, OpenAI), coding agents (Aider, Claude Code), and even the planner/executor/evaluator role scripts.
- Includes a null-model ablation check to ensure the model actually contributes to gains, not just the harness.
- k-branch parallel exploration (like FunSearch / AlphaEvolve) for broader search.
- Single runtime dependency: PyYAML; ~1,900 lines of core runtime code.
- 99 acceptance/unit tests, CI green on Python 3.10 and 3.12.
Related
- Project
- Project
- Project
- Project