Home / Hyperon AI Algorithms / MOSES / MOSES Full
Responsible: Nil Geisweiller, Yeabsira Derese (iCog Labs), Moshe Looks (original design)
Papers: Looks (2006), Competent Program Evolution (PhD dissertation); Goertzel, Geisweiller et al. (2014), Engineering General Intelligence Vol 2, Ch. 7–9; Goertzel (2025), Hyperon Whitepaper §6.2
Status: MOSES is current across multiple implementations. metta-moses (iCog Labs) provides the most complete MeTTa reimplementation. hyperon-moses (trueagi-io) implements the boolean reduction core. The legacy C++ MOSES remains available. The GEO-EVO geodesic extension is proposed.
This card provides technical depth beyond the concise MOSES index card. MOSES (Meta-Optimizing Semantic Evolutionary Search) is Hyperon's evolutionary program learning methodology — a system that discovers small, human-readable programs by combining estimation-of-distribution algorithms with evolutionary programming. Programs live directly in AtomSpace as graph structures, making them transparent to reasoning (PLN), attention (ECAN), and pattern mining.
Related cards: PLN Full (reasoning-guided evolution), ECAN Full (attention-weighted fitness), MORK Full (content-addressed program storage), TransWeave Full (GEO-EVO integration)
MOSES organizes search at two levels:
The key abstraction enabling MOSES's efficiency. Each program template has knobs — discrete or continuous parameters attached to program nodes that define the local variation space. Turning a knob produces a syntactically valid variant of the template. The representation builder analyzes a program's abstract syntax tree (AST) and identifies which positions admit variation. This converts the combinatorial search over program space into a structured optimization over knob settings within each deme.
Search is partitioned into demes — subpopulations exploring neighborhoods of a particular program template. A metapopulation manager controls deme lifecycle: spawning new demes from promising templates, allocating compute budget, merging results, and retiring exhausted demes.
For classification with skewed class distributions, MOSES provides three mechanisms: --balance=1 (automatic rebalancing), --score-weight (inverse-frequency weighting, mathematically equivalent to scoring by informedness = 0.5×(sensitivity + specificity)), and multi-objective deme strategies where different demes balance two objective functions differently. (mailing-list-backed: MOSES-for-classification-with-imbalanced-categories, 2014)
Boolean programs are reduced toward a canonical form using algebraic simplification rules: distributive law, complement law, idempotent law, absorption-idempotent law, and annulment-identity law. ENF reduction eliminates redundant structure, making programs more readable and enabling MOSES to recognize when syntactically different programs are semantically equivalent.
Before evolutionary search, MOSES can reduce the input dimensionality. Available methods: hill climbing, incremental selection, simple filtering, and stochastic mutual dependency (SMD) with similarity scorers.
The 2025 whitepaper (§6.2.1) proposes deep integration of MOSES with TransWeave, viewing evolution as an optimal transport problem through program space:
\[\text{Selection rule: maximize } \frac{\Delta\log(f \times g)}{\text{cost}}\]This \(f \cdot g\) product structure is the same geodesic control principle used across PRIMUS — in PLN inference, TransWeave transfer, and Schrödinger bridge interpolation.
Per Non-clustered HAA cluster pilot Source 5 close 2026-05-07: [MORK-MOSES-PARTIAL-SCAFFOLD-OPEN-RESEARCH-LINE]. The MORK-MOSES integration described here is aspirational architecture, not current implementation. Concrete current state at HEAD:
setup.sh references mork_ffi as a setup-level hook only. No committed mork_ffi/ subtree exists in metta-moses; git ls-tree HEAD -- 'mork_ffi*' returns no matches.grep -ri 'MOSES' against MORK (closed AtomSpace cluster pilot 2026-04-29) returns no substantive integration code. The integration is one-sided-aspirational (in the metta-moses setup hook), not bidirectional-implemented.Aspirational architecture (treat as roadmap, not current behavior):
On MORK, MOSES is proposed to embed naturally: program templates, factor-graph priors, and deme statistics as content-addressed Atoms. Near-identical candidates would deduplicate via PathMap's structural sharing. MORK would index parameter neighborhoods for fast sampling and stream only the delta of changed subgraphs to the fitness evaluator. This is the Goertzel 2025-07-21 design proposal, not running code.
TransWeave casts evolution as stochastic dynamic programming and supplies typed transfer operators between logic, evolution, and neural value learners. PLN subgoals can bias evolutionary variation; evolutionary regularities feed back as new PLN rules; neural critics provide amortized value estimates. Commutator gaps between these operations are bounded, so steps can be reordered without breaking progress. Whitepaper proposal; not implemented in metta-moses or asmoses HEAD.
Cluster-pilot extraction archive: scripts/archive/non_clustered_haa_pilot/source5_NACE_AIDSL_MOSES_MeTTaNARS/ (close 2026-05-07; V5-10 carry-forward locks the partial-scaffold reframing).
1. Legacy C++ (OpenCog era). The original MOSES, written in C++ with Boost dependencies. Programs output in the combo language. Two variants:
2. MeTTa Boolean Reduction (trueagi-io). hyperon-mosesfocuses on the boolean reduction pipeline — the ENF simplification engine. Design documents explore cognitive synergy and reasoning-as-evolution concepts.
3. Full MeTTa Reimplementation (iCog Labs). metta-mosesis the most complete MeTTa version: demes, metapopulation, knob-based representation, six optimization strategies, complete scoring pipeline, feature selection, and boolean reduction. Runs on PeTTa. Per Non-clustered HAA cluster pilot Source 5 close 2026-05-07: [ACTIVE-METTA-PRIMARY] — this is the canonical Hyperon-era MOSES line at HEAD 9f69e17 (2026-03-26). File-line evidence: deme/create-deme.metta:3-18 (deme construction), deme/expand-deme.metta:47 / :69 / :107-140 (expandDeme + runMoses), deme/merge-demes.metta:222-274 (metapopulation merge), scoring/fitness.metta:123 / :146 / :156-159 (row + aggregate + penalized fitness), scoring/precision-bscore.metta:316-340 (top-level pre-scorer for hill-climbing feature selection).
Per HAA Source 5 close: linas/as-mosesatdde4849c4 HEAD is byte-identical to opencog/asmosesatgitoutput0. the same SHA — verified bidirectional rev-list --left-right --count 0 Verdict [VEPSTAS-MIRROR-SAME-SHA]: Linas Vepstas's mirror is not a separate implementation tradition.
Three stale forks exist; none represent independent traditions. P12 verbatim numerical outputs (orchestrator-verified):
107 opencog/asmoses; verdict [STRICT-FORK-STALE]. 165 the 7 ahead-commits are merge-sync metadata (same pattern as HAA S3 singnet/miner and S4 singnet/relex); verdict [STRICT-FORK-STALE-MERGED-UPSTREAM]. 23 opencog/moses; verdict [STRICT-FORK-DIVERGED-LEGACY-FIXES] pending spot-check on whether the 19-ahead commits are pure merge-sync or substantive legacy fixes.The iCog-Labs-Dev/moses-optimization-algorithmsrepo is [STANDALONE-EXPERIMENT-NOT-FORK] — its commit history (Initial commit / hill climbing implementation / added simulated annealing / Merge PR #1 from Nahom32-implementation) is independent of asmoses/moses, not derived.
AtomSpace-MOSES: Demes as AtomSpaces. A 2018 planning discussion revealed the key architectural motivation: each deme would become its own AtomSpace, enabling PLN and pattern mining to analyze program populations. Nil Geisweiller proposed that candidate growth should be expressible as "proof of its fitness estimation." (Atomspace-MOSES-planning, 2018)
Ensemble Nature and the True Bottleneck. Linas Vepstas (2018) cautioned against focusing on individual top-N programs — MOSES's ensemble of 1000 simple programs is more accurate than 10 highly-evolved experts. He identified fitness evaluation — not Reduct — as the true performance bottleneck, and warned that the probabilistic measure over program populations is fractal, not smooth. (Atomspace-MOSES-planning, hypothetical MOSES refactoring, 2014–2018)
Legacy MOSES Isolation. Legacy C++ MOSES was "rather isolated from the rest of OpenCog" — it could not use Atomese operators or the pattern matcher. This isolation was the core motivation for the MeTTa reimplementations, where programs live natively in AtomSpace from the start. (Questions-on-MOSES, 2017)
Reduct Reorganization by Algebraic Property. Nil Geisweiller organized Reduct rules by algebraic property (commutation, involution, association) rather than by operator — the conceptual ancestor of the ENF pipeline. (Atomspace-MOSES-planning, hypothetical MOSES refactoring, 2014–2018)
Conciseness as Competitive Advantage. MOSES produces classification rules that are "both accurate and concise" — whereas neural nets and SVMs produce "bloated" models. This is a direct consequence of the Occam's razor complexity penalty. (Program-learning-vs-Machine-Learning, 2017)
[MORK-MOSES-PARTIAL-SCAFFOLD-OPEN-RESEARCH-LINE] — metta-moses setup.sh references mork_ffi as a setup-level hook only; no committed mork_ffi subtree exists. The Goertzel 2025-07-21 "MORK-MOSES Implementation Ideas" paper proposes deep integration but remains a proposal, not current behavior. See Mathematical Foundations and MORK.[ACTIVE-METTA-PRIMARY].[ACTIVE-CPP-ATOMSPACE-BASELINE]; HEAD dde4849c4 2025-12-10.[VEPSTAS-MIRROR-SAME-SHA]; not a separate implementation.[SUPERSEDED-BY-METTA-MOSES] for general MOSES, retained as boolean-reduction prototype.[ARCHIVAL-PARADIGM-PREDECESSOR] — last commit 2023-09-19.[STANDALONE-EXPERIMENT-NOT-FORK]; independent commit history (hill climbing + simulated annealing + Nahom32 PR).Cluster-pilot extraction archive: scripts/archive/non_clustered_haa_pilot/source5_NACE_AIDSL_MOSES_MeTTaNARS/ (close 2026-05-07).
[ACTIVE-METTA-PRIMARY] on PeTTa with full MOSES stack (HEAD 9f69e17, 2026-03-26). Canonical Hyperon-era line.[ACTIVE-CPP-ATOMSPACE-BASELINE] (HEAD dde4849c4, 2025-12-10). Recent commits are cogutils extraction; algorithm work earlier in 2025. Linas Vepstas's linas/as-mosesmirror is byte-identical at the same SHA [VEPSTAS-MIRROR-SAME-SHA].[SUPERSEDED-BY-METTA-MOSES] for general MOSES; retained as a boolean-reduction / ENF-pipeline prototype line. P12-verified 27 commits ahead of ngeiswei/hyperon-mosesolder sibling.[ARCHIVAL-PARADIGM-PREDECESSOR] — README explicitly notes "kept to guaranty backward compatibility" and points to AS-MOSES.[STRICT-FORK-STALE], singnet/asmoses [STRICT-FORK-STALE-MERGED-UPSTREAM], singnet/moses [STRICT-FORK-DIVERGED-LEGACY-FIXES]. None contribute new traditions. iCog-Labs-Dev/moses-optimization-algorithmsis [STANDALONE-EXPERIMENT-NOT-FORK] — independent commit history.[MORK-MOSES-PARTIAL-SCAFFOLD-OPEN-RESEARCH-LINE] — metta-moses setup.sh references mork_ffi as a setup-level hook only; no committed mork_ffi subtree. The Goertzel 2025-07-21 Mattermost paper "MORK-MOSES Implementation Ideas" is a proposal, not running code.mork_ffi + PathMap-indexed program-template substrate. Current state is paper-level proposal; no committed integration code in either direction.Cluster-pilot extraction archive: scripts/archive/non_clustered_haa_pilot/source5_NACE_AIDSL_MOSES_MeTTaNARS/ (close 2026-05-07; V5-5..V5-10 + V5-15 carry-forwards locked).