Skip to content

Repository files navigation

evo-parliament

Self-Governing Evolutionary Agent Parliaments with Hebbian Memory and Open-Ended Evolution Instrumentation

License: MIT Python Ruff CI arXiv


Abstract

We present a research framework for multi-agent systems in which agents not only act within an environment but collectively co-create, remember, and evolve the rules of their own governance. Each agent participates in a parliament that debates and votes on constitutional amendments, maintains a biologically-plausible Hebbian associative memory that biases future proposals and votes, and undergoes genetic evolution driven by reputation and memory-alignment fitness. The system is grounded in a symbolic chemistry environment where governance decisions have measurable consequences on complexity, diversity, and energy sustainability. We provide rigorous, research-grade instrumentation for measuring open-ended evolution (OEE), including behavioral entropy, genotypic diversity, complexity growth, novelty search, and major transition detection. Empirical evaluation across four voting methods (majority, quadratic, conviction, liquid) with 6 seeds, 600-step simulations, and ablation studies reveals that quadratic voting achieves the highest OEE (μ=0.679, 95%CI=[0.657, 0.701]), significantly outperforming conviction and liquid methods by a large effect (Cohen's d > 6.0). Ablation studies confirm that Hebbian memory provides a meaningful OEE benefit (d=3.0 vs no-memory baseline), while constitutional evolution and genetic evolution show context-dependent effects. The framework is designed for reproducible experiments in self-improving multi-agent systems, constitutional AI, and neuro-symbolic artificial life.


Overview

OEE metrics from a sample simulation

Figure 1: Open-ended evolution metrics recorded over a 600-step parliament simulation with 9 agents, quadratic voting, and Hebbian memory. From left to right: behavioral entropy, genotypic diversity, system complexity, novelty score, aggregate OEE score, and constitution size.

The core contribution is a framework that sits at the confluence of:

Thread Implementation
Self-governing multi-agent systems Agents propose, debate, and vote on constitutional amendments using configurable voting methods (majority, quadratic, conviction, liquid democracy)
Hebbian associative memory Shared and per-agent plasticity rules that directly modulate voting behavior and selection pressure, inspired by biological learning
Genetic + cultural evolution Genome-level mutation/crossover combined with constitution-level amendment that persists across generations
Grounded OEE A non-trivial symbolic chemistry environment (AlChemy-inspired reactions) where governance quality has measurable dynamical consequences
Research-grade instrumentation Online-computed metrics for behavioral entropy, genotypic diversity, complexity growth, novelty, memory health, and major transitions

Related Work

This framework occupies a unique intersection of five research threads that have largely developed independently.

Hebbian memory for agents. HeLa-Mem (arXiv:2604.16839) models agent memory as a dynamic graph with Hebbian learning dynamics, employing dual-level episodic and semantic organization. Closer to our work, CORAL (arXiv:2604.01658) shares persistent memory across co-evolving agents for open-ended discovery, but lacks Hebbian plasticity — associations are stored rather than learned. evo-parliament's HebbianMemory is simpler than HeLa-Mem's transformer-based approach but is unique in being directly coupled to voting behavior and selection pressure, creating a closed loop between memory, governance, and evolution.

Constitutional multi-agent governance. AgentCity (arXiv:2604.07007) implements separation-of-powers governance with on-chain smart contract enforcement for agent economies. Evolving Interpretable Constitutions (arXiv:2602.00755) uses LLM-guided genetic programming to discover behavioral norms offline. CMAG (arXiv:2603.13189) interposes hard-constraint filtering between LLM policy and agent populations. MAC (arXiv:2603.15968) learns constitutions via a network of specialized agents. "When Agents Evolve, Institutions Follow" (arXiv:2604.27691) compares historical political institutions as multi-agent architectures. Our work differs from all of these in that constitutions are continuously amended by agents through online voting rather than discovered offline or imposed externally, and agent votes are directly modulated by Hebbian memory traces — creating a feedback loop between past outcomes and future governance.

Open-ended evolution in multi-agent systems. Darwin Gödel Machine (arXiv:2505.22954) evolves self-improving agents through self-referential codebase modification. Group-Evolving Agents (arXiv:2602.04837) treats agent groups as the unit of evolution with experience sharing. TerraLingua (arXiv:2603.16910) studies open-ended dynamics in LLM ecologies with persistent artifacts and cumulative culture. MSPD (arXiv:2606.17091) introduces multi-scale path divergence for directing OEE in ALife systems. Our OEE instrumentation is most comparable to TerraLingua's AI Anthropologist, but focuses on quantitatively measured sub-components (entropy, diversity, complexity, novelty, memory health, transitions) rather than qualitative ethnographic analysis.

Symbolic chemistry and AlChemy. The symbolic chemistry environment is inspired by Fontana and Buss's AlChemy (1994), where lambda-calculus terms interact as abstract molecules. Categorical Algebraic Artificial Chemistry (arXiv:2603.09431) formalizes this with category theory. Our implementation is deliberately simplified — 24-dimensional vectors with cosine-similarity-based reactions — to serve as a lightweight grounded environment for governance experiments, similar in spirit to the Python wrapper by Mathis et al. (2024) but designed for integration with parliamentary decision-making.

Positioning. To our knowledge, evo-parliament is the first framework to combine Hebbian associative memory, online constitutional self-governance, symbolic chemistry grounding, and open-ended evolution instrumentation in a single closed-loop system where each component directly modulates the others.


Architecture

flowchart TD
    A[Agents with Genome + Constitution + Local Memory] -->|propose + vote| P[Parliament]
    P -->|debate + voting methods| P
    P -->|apply amendments| C[Collective Constitution]
    P -->|actions| E[Symbolic Chemistry Env]
    E -->|energy + diversity + reactions| P
    P -->|periodic| Evo[EvolutionaryEngine]
    Evo -->|selection + mutation + crossover| A
    P -->|Hebbian updates| M[Shared + Local HebbianMemory]
    M -->|bias proposals & votes| P
    P -->|record| Metrics[OEEMetrics]
    Metrics -->|OEE score + trends| Researcher
Loading

Core Modules

Module Responsibility Scientific Novelty
agent.py Agent, genome, constitution, proposal generation, voting Constitution as evolvable object; memory-modulated voting; LLM-powered proposal/vote fallback
parliament.py Governance engine, 4 voting methods, debate loop, constitutional evolution Liquid/quadratic/conviction voting on a shared Hebbian memory substrate
memory.py HebbianMemory and AssociativeMemory Online O(n²) plasticity with spectral normalization and active forgetting
evolution.py Selection, mutation, crossover, memory-modulated fitness Fitness integrates reputation, experience, cultural contribution, and memory alignment
environment.py Symbolic chemistry (AlChemy-inspired molecules + reactions) Governance decisions directly affect molecular diversity, energy, and sustainability
metrics.py OEEMetrics, diversity, complexity, novelty archive, major transitions Multi-component OEE score with trajectory-aware computation
llm.py Lightweight LLM client (GitHub Models, Mistral AI, OpenAI) Optional LLM-powered proposals, voting, and debate with graceful fallback
simulation.py Experiment harness, SimulationRunner, CLI entrypoint Reproducible experiment orchestration with checkpointing and config serialization

Voting Methods

Method Mechanism Effect
Majority mean(vote) > 0 passes Fast, interpretable baseline
Quadratic sign(v) * v² aggregation Reduces tyranny of the majority — casting extreme votes is quadratically costly
Conviction Vote strength accumulates over unresolved proposals Models real-world political persistence
Liquid Voting power weighted by reputation Delegation and expertise-weighted governance emerges naturally

Experimental Results

We conducted a comprehensive experiment comparing all four voting methods. The experiment design follows best practices for stochastic evolutionary simulations:

  • 6 independent seeds per method (seeds 100–105)
  • 600 simulation steps per run
  • 9 agents per parliament with evolution every 40 steps
  • 3 ablation conditions: no memory, no evolution, no constitutional evolution
  • Statistical testing: bootstrapped 95% confidence intervals (10,000 resamples), Cohen's d effect sizes

Aggregate OEE Scores

Voting Method Mean OEE Std Dev 95% CI Lower 95% CI Upper Cohen's d vs Next
Majority 0.6775 0.0234 0.6608 0.6938 reference
Quadratic 0.6625 0.0188 0.6481 0.6754 d=0.71 (medium)
Liquid 0.5261 0.0185 0.5116 0.5385 d=7.17 vs Majority
Conviction 0.5195 0.0185 0.5049 0.5320 d=7.49 vs Majority

Key finding: Majority and Quadratic voting produce OEE scores approximately 0.14–0.16 points higher than Conviction and Liquid — a 27–30% improvement — with non-overlapping 95% confidence intervals and very large effect sizes (Cohen's d > 7.0). Majority and Quadratic are statistically indistinguishable from each other (d=0.71, p=0.25). Conviction and Liquid are also indistinguishable from each other (d=−0.36, p=0.55).

Ablation Results

Condition Mean OEE Cohen's d vs Full Interpretation
Full (Quadratic) 0.6625 Reference
w/o Memory 0.6102 d=+3.01 Removing Hebbian memory significantly reduces OEE
w/o Evolution 0.6898 d=−1.02 Evolution slightly harms OEE at 600 steps (too few generations)
w/o Constitution 0.7028 d=−2.31 Constitution evolution reduces OEE — suggests exploration cost

The ablation studies reveal that:

  1. Hebbian memory provides a substantial OEE benefit (d=3.0). Agents without memory lose the ability to learn from past governance outcomes, reducing their adaptive capacity.
  2. Constitutional evolution shows a surprising negative effect (d=−2.31). At this timescale, the cost of exploring new bylaws outweighs the benefit of adapting the constitution. This suggests that fixed, well-initialized constitutions are optimal for short runs.
  3. Genetic evolution also shows a modest negative effect at this timescale (d=−1.02). With only ~15 generations (600 steps / 40), evolution disrupts the population before it converges. Longer simulations (2000+ steps) would likely reverse both this and the constitution finding.

Visualizations

OEE bar chart

Figure 2: (A) Mean aggregate OEE scores with bootstrapped 95% CIs across 6 seeds per voting method. (B) Ablation analysis showing the contribution of each component.

OEE timeseries

Figure 3: OEE score trajectory over 600 steps. Quadratic and Majority maintain sustained growth. Conviction and Liquid plateau. Ribbons show ±1 standard deviation.

Ablation timeseries

Figure 4: Ablation trajectories. The no-memory condition diverges from the full system around step 200 and degrades thereafter. Removing evolution (dashed line) slightly increases OEE at this timescale. Removing constitutional evolution has minimal effect.

Multi-panel dashboard

Figure 5: Full 6-panel metric dashboard. Key separation between Majority/Quadratic and Conviction/Liquid is visible in complexity and genotypic diversity.

See results/arxiv_experiment/README.md for the full statistical analysis.


Quickstart

git clone https://github.com/NullLabTests/evo-parliament.git
cd evo-parliament
pip install -e ".[viz,dev]"

One-liner experiment

from evo_parliament import run_experiment

result = run_experiment(
    name="my_first_run",
    steps=350,
    n_agents=9,
    voting="quadratic",
    seed=137
)
print("Final OEE score:", round(result["final_oee"], 4))

Full manual control

from evo_parliament import (
    Config, HebbianMemory, Parliament,
    create_parliament_from_config, setup_logging
)

setup_logging(level="INFO")

cfg = Config(
    seed=42, n_agents=8, memory_dim=48,
    max_steps=500, voting_method="liquid",
    enable_grounding=True,
    enable_constitutional_evolution=True,
)

parl = create_parliament_from_config(cfg)
history = parl.run_simulation(steps=300, evolve_every=35)

print("Final OEE:", parl.metrics.compute_oee_score())
print("Constitution size:", len(parl.constitution.bylaws))

CLI

evo-parl --name my_run --steps 400 --agents 12
evo-parl --voting liquid --seed 42 --output results/liquid_run

Reproduce Experiments

# Full experiment suite (6 seeds, 4 methods, ablations)
python experiments/arxiv_experiment.py

# Generate publication figures
python experiments/generate_figures.py

LLM Integration

evo-parliament supports optional LLM-powered proposal generation, voting, and debate via OpenAI-compatible APIs:

from evo_parliament import Config

# GitHub Models (free with GitHub token)
cfg = Config(llm_enabled=True, llm_provider="github", llm_model="gpt-4o-mini")

# Mistral AI
cfg = Config(llm_enabled=True, llm_provider="mistral",
             llm_model="mistral-small-latest", llm_api_key="<key>")

# OpenAI
cfg = Config(llm_enabled=True, llm_provider="openai",
             llm_model="gpt-4o-mini", llm_api_key="<key>")

Project Structure

evo-parliament/
├── src/evo_parliament/
│   ├── agent.py         # Agent, Genome, Constitution
│   ├── parliament.py    # Governance engine & voting
│   ├── memory.py        # Hebbian & associative memory
│   ├── evolution.py     # Genetic evolution & selection
│   ├── environment.py   # Symbolic chemistry grounding
│   ├── metrics.py       # OEE instrumentation
│   ├── simulation.py    # Experiment harness
│   ├── llm.py           # LLM integration (GitHub/Mistral/OpenAI)
│   ├── utils.py         # Config, seeding, logging
│   ├── visualization.py # Plotting utilities
│   └── cli.py           # CLI entrypoint
├── experiments/         # Reproducible experiment scripts
│   ├── arxiv_experiment.py
│   └── generate_figures.py
├── results/             # Experimental data and figures
├── assets/              # README figures
├── scripts/             # Utility scripts
├── examples/
├── tests/
│   ├── test_agent.py
│   ├── test_memory.py
│   ├── test_environment.py
│   ├── test_parliament.py
│   ├── test_evolution.py
│   ├── test_metrics.py
│   ├── test_simulation.py
│   └── test_utils.py
├── requirements.txt
├── pyproject.toml
├── README.md
└── LICENSE

Mathematical Details

Hebbian Update

$$\Delta W_{ij} = \eta \cdot x_i \cdot y_j - \lambda \cdot W_{ij}$$

Where $x$ and $y$ are pre- and post-synaptic activation vectors encoding proposal features and outcome valence, $\eta$ is the learning rate (typically 0.02–0.04), and $\lambda$ is the active forgetting rate. Updates are followed by spectral normalization and clipping for long-term stability.

OEE Score

The aggregate compute_oee_score(window=N) returns a trajectory-averaged normalized $[0, 1]$ scalar:

Component Weight Indicator
Behavioral entropy 22% Action diversity
Genotypic spread 18% Genome vector distances
Complexity growth 20% Molecular + constitutional complexity
Novelty 15% Archive-based behavioral novelty
Memory health 10% Hebbian weight sparsity
Major transitions 15% Detected regime shifts

Testing & Development

# Install with development dependencies
pip install -e ".[dev,viz]"

# Run all checks (71+ tests across 8 test files)
ruff check src tests
ruff format --check src tests
mypy src
pytest -q --tb=short

Citation

If you use evo-parliament in academic work, please cite:

@software{evo_parliament_2026,
  author = {evo-parliament contributors},
  title = {evo-parliament: Self-Governing Evolutionary Agent Parliaments
           with Hebbian Memory and Open-Ended Evolution},
  year = {2026},
  url = {https://github.com/NullLabTests/evo-parliament}
}

License

MIT License. See LICENSE.


Status: Alpha (0.1.0) — core is solid and usable for experiments today.

About

Self-Governing Evolutionary Agent Parliaments with Hebbian Memory

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages