Summary
Phase 1 of the outer loop evolutionary swarm search system. Implements the foundational layer: Pydantic models, graph mutation operators, population/archive management, novelty filtering, and workflow serialization.
Components
factory/outer_loop/models.py — Strict Pydantic v2 models: MutationType, MutationRecord, Individual, HyperparameterRecord, SwarmConfig, OuterLoopState, GenerationSummary
factory/outer_loop/mutations.py — 6 structured graph mutation operators (insert_node, remove_node, redirect_edge, parallelize, serialize, mutate_params) with MutationStrategy protocol and WeightedRandomStrategy default implementation. Includes validate_and_repair for post-mutation graph integrity.
factory/outer_loop/population.py — Population (collection management, tournament selection) and MAPElitesArchive (4D quality-diversity grid with Pareto front computation)
factory/outer_loop/similarity.py — structural_hash (SHA-256 canonical form), graph_edit_distance, compute_features (depth/fork_degree/agent_count/gate_count), NoveltyFilter
factory/workflow/primitives.py — Added Workflow.to_dict() and Workflow.from_dict() for round-trip serialization with _type discriminators
Tests
85 tests across 5 test files covering all components with round-trip serialization, edge cases, and integration with all builtin workflows.
Target Branch
feat/outer-loop-evolution
Summary
Phase 1 of the outer loop evolutionary swarm search system. Implements the foundational layer: Pydantic models, graph mutation operators, population/archive management, novelty filtering, and workflow serialization.
Components
factory/outer_loop/models.py— Strict Pydantic v2 models:MutationType,MutationRecord,Individual,HyperparameterRecord,SwarmConfig,OuterLoopState,GenerationSummaryfactory/outer_loop/mutations.py— 6 structured graph mutation operators (insert_node,remove_node,redirect_edge,parallelize,serialize,mutate_params) withMutationStrategyprotocol andWeightedRandomStrategydefault implementation. Includesvalidate_and_repairfor post-mutation graph integrity.factory/outer_loop/population.py—Population(collection management, tournament selection) andMAPElitesArchive(4D quality-diversity grid with Pareto front computation)factory/outer_loop/similarity.py—structural_hash(SHA-256 canonical form),graph_edit_distance,compute_features(depth/fork_degree/agent_count/gate_count),NoveltyFilterfactory/workflow/primitives.py— AddedWorkflow.to_dict()andWorkflow.from_dict()for round-trip serialization with_typediscriminatorsTests
85 tests across 5 test files covering all components with round-trip serialization, edge cases, and integration with all builtin workflows.
Target Branch
feat/outer-loop-evolution