How evomap/evolver works
1. What this repo is
Evolver is a Node.js 18+ CLI engine for agent self-evolution. Its primary job is not to edit code directly, but to read local history/signals, choose a protocol asset, and emit a structured GEP prompt plus audit events.
2. Top-level entry and runtime shape
index.js is the main CLI entrypoint. It supports standalone runs, review mode, and looping/daemon mode. In loop mode it can also emit text directives like sessions_spawn(...) that only become executable when consumed by a host runtime such as OpenClaw.
3. Core orchestration path
src/evolve.js is the central coordinator. It gathers local signals, selects an evolution strategy, invokes the GEP selector, builds the prompt, and records the resulting evolution event into local memory. This is the main dataflow: local logs/signals in, prompt and audit artifact out.
4. GEP is the core domain model
Most of the architecture lives under src/gep/. This subsystem models the protocol objects and operations around Genes, Capsules, and Events. The bundled canonical assets live in assets/gep/ as genes.json, capsules.json, and events.jsonl, which are the local seed store for evolution decisions.
5. Selection, mutation, and prompt assembly
Within src/gep/, modules such as selector.js, mutation.js, strategy.js, prompt.js, candidateEval.js, and curriculum.js shape how the system scores signals and turns them into a GEP-compliant prompt. This is the “decision engine” that picks reusable experience assets instead of generating free-form instructions.
6. State, memory, and evidence trail
Evolver persists local runtime evidence in a memory-oriented layer: assetStore, memoryGraph, narrativeMemory, executionTrace, assetCallLog, learningSignals, and related helpers. The README’s ./memory/ directory is the externalized boundary for logs, signals, and EvolutionEvent history.
7. Security and safety boundary
The repo draws a strong line between read-only evolution and the one place that can execute commands: src/gep/solidify.js and the validator subsystem. Validation commands are restricted by prefix/syntax checks, timeouts, and repository scoping, and unsafe A2A asset promotions are rejected. Supporting modules like sanitize, policyCheck, shield, integrityCheck, and security-related tests reinforce this boundary.
8. Validation subsystem
src/gep/validator/ contains the sandboxed validation pipeline, including the executor and reporter. This is the architecture’s “prove it before trust it” layer: claimed validation steps run in a constrained sandbox, and the result is emitted as a ValidationReport.
9. Optional EvoMap / A2A network integration
When configured with A2A_HUB_URL and a node ID, Evolver connects to the EvoMap Hub for heartbeat, worker-pool participation, skill sharing, and asset publishing. The related code lives across src/gep/a2a.js, a2aProtocol.js, hubSearch, hubVerify, directoryClient, mailboxTransport, taskReceiver, and the ATP modules under src/atp/.
10. Worker and validator network roles
The repo supports two network-side roles: worker participation and decentralized validation. Worker mode advertises capabilities and picks up tasks; validator mode periodically pulls validation jobs and submits reports. This makes the node both a local evolution engine and a network participant.
11. Host runtime and editor integrations
src/adapters/ and src/proxy/ form the integration boundary for external agent runtimes. Adapters exist for Claude Code, Cursor, Kiro, and Codex, while the proxy layer provides HTTP routes, mailbox storage, sync, lifecycle management, and extension hooks for session events, DMs, and skill updates.
12. Operations and lifecycle management
src/ops/ contains the daemon-facing operational commands: lifecycle control, health checks, cleanup, self-repair, skill monitoring, and triggers. These modules are separate from the core evolution engine and are responsible for keeping long-running runs healthy and recoverable.
13. Offline-first, repo-local design
Core functionality works without network access. Git is required because Evolver uses repository state for rollback, blast-radius reasoning, and solidification. Network features, issue reporting, and skill exchange are optional overlays rather than core dependencies.
14. Tooling, scripts, and release pipeline
The scripts/ directory covers import/export, analysis, log extraction, version suggestion, validation, and reporting workflows. Tests span nearly every subsystem, indicating a highly modular architecture with explicit boundaries around protocol logic, adapters, proxy behavior, validator safety, and lifecycle operations.
Main entry points: evolve.js Evolve · selector.js Selector · a2a.js A2A · proxy Proxy
Components 22
Runtime
CLI entry and orchestration
GEP Core
Protocol model, selection, prompt assembly, and safety
- GEP Assets · Canonical genes, capsules, and events used as local evolution seeds
assets/gep - Signals · Collects local history, logs, and environment signals
src/gep/signals.js - Selector · Chooses reusable protocol assets from candidates and signals
src/gep/selector.js - Strategy · Scores evolution paths and guides selection
src/gep/strategy.js - Mutation · Adapts genes, capsules, and candidate assets into a fit prompt form
src/gep/mutation.js - Prompt · Builds the structured GEP-compliant prompt emitted by the engine
src/gep/prompt.js - Candidate Eval · Evaluates candidate assets and evidence quality
src/gep/candidateEval.js - Curriculum · Shapes staged learning and progression across evolution cycles
src/gep/curriculum.js - Memory · Local state and evidence trail for evolution history
src/gep/memoryGraph.js - Trace · Execution traces, call logs, and learning signals
src/gep/executionTrace.js - Solidify · Read-to-write boundary that validates and safely promotes changes
src/gep/solidify.js - Validator · Sandboxed validation pipeline producing validation reports
src/gep/validator/index.js - Report · Structured validation result emitted by the validator
src/gep/validationReport.js
Network
Optional EvoMap and validation network roles
- A2A · Optional EvoMap hub integration for worker and asset exchange
src/gep/a2a.js - Hub Client · Connects to hub services for search, verify, publish, and mailbox flows
src/gep/directoryClient.js - Task Receiver · Consumes network tasks and feeds them into local execution
src/gep/taskReceiver.js - ATP · Optional consumer/merchant workflow around hub participation
src/atp/index.js
Integrations
Host runtimes and proxy boundary
Ops
Daemon and lifecycle management
- Ops · Operational commands for health, cleanup, repair, and triggers
src/ops/index.js
Connections 22
- CLI → Evolve: runs · CLI dispatches core evolution flow
- Evolve → Signals: collects · Reads local history and environment signals
- Evolve → Selector: selects · Chooses a protocol asset path
- Evolve → Strategy: scores · Applies evolution strategy and policy
- Selector → Candidate Eval: ranks · Evaluates candidate assets before selection
- Strategy → Curriculum: guides · Progression policy informs strategy choices
- Selector → Mutation: adapts · Transforms selected assets into a prompt-ready form
- Mutation → Prompt: assembles · Builds the structured prompt payload
- GEP Assets → Selector: seeds · Provides canonical genes, capsules, and events
- Signals → Memory: persists · Records local evidence and history
- Evolve → Trace: records · Writes execution trace and learning signals
- Evolve → Solidify: guards · Passes through safety and promotion boundary
- Solidify → Validator: verifies · Routes claimed validation into sandboxed checks
- Validator → Report: emits · Produces structured validation outcome
- Evolve → Report: attaches · Uses validation result as part of evolution record
- A2A → Hub Client: uses · Network bridge delegates to hub services
- A2A → Task Receiver: feeds · Receives tasks and worker assignments
- A2A → ATP: integrates · Optional worker/merchant participation layer
- Adapters → Proxy: connects · Host runtimes interact through proxy/session boundary
- Proxy → Evolve: triggers · Session events and sync flows can initiate evolution
- Ops → Evolve: operates · Lifecycle and recovery commands act on the engine
- Ops → Proxy: manages · Daemon ops manage long-running proxy state