Files
aevolution/docs/biology/GENOME_MODEL.md
T
dingoandClaude Opus 5 3f86dada0e Derive a phenotype from the genome without touching it
M3.2 adds derive_phenotype and plan_development as pure integer
functions of a genome, a growth state and an environment. Nothing is
stored: a phenotype is recomputed from retained inputs rather than
cached, so a cached copy can always be checked against a recomputation.

The risk this increment was scoped against is confusing the genome with
runtime damage. Growth and damage live in a separate state that no
function may write back, and no entry point takes a mutable genome.
Damage changes the phenotype and leaves the encoded bytes and content
digest identical, so heredity cannot carry acquired condition.

The genome's development version selects a rule set, which is what makes
that field worth carrying; an unknown version fails closed rather than
deriving under the wrong rules. Version 1 declares every constant. The
shape model is explicit rather than implied: the body is a cube of
uniform declared density, so extent is an exact integer cube root and
surface is six extents squared. Membrane mass follows surface and the
genome's thickness, maintenance follows total mass plus a membrane
upkeep term, and uptake scales with surface, so size trades uptake
against maintenance. A capability the genome does not carry yields zero.

A plan advances growth by at most the rule step, reduced to the largest
step the available material funds exactly, never a partial one and never
a grant. It reserves nothing and pays for nothing: the matching transfer
does not exist until M3.3, and an apply that moved no inventory would
look like a committed operation while conserving nothing.

The fixture genome is an exact 20 micrometre cube, so every derived value
is asserted as a hand-calculated literal, as are the half-built, damaged,
maximum and cube-root-boundary cases. Determinism is checked over 45
growth and temperature combinations. The declared flooring is pinned
rather than hidden: a body whose mass floors to zero advances its counter
for no material, granting no structure because none exists either way.

Omitted physics is a documented model limitation, not a modifier. Nothing
here is balance, and no organism yet develops. Native Release, clang-tidy
analysis, ASan and format checks pass 18/18; every existing golden and
fingerprint is unchanged. Linux CI has not run yet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 21:48:24 -04:00

8.9 KiB

Genome, development and phenotype

Status: locked separation and evolutionary intent; recommended schema; mutation and morphology are experiments. No biology is implemented in the M0 proof.

flowchart LR
  G[Immutable developmental genome] --> D[Versioned development]
  E[Environment / resources / growth history] --> D
  D --> P[Phenotype revision]
  P --> C[Physical and biological components]
  C --> S[Simulation]
  S --> H[Reproduction / survival / history]

Genomes encode evolvable developmental capabilities, not literal DNA or an Animal/Plant/Fungus inheritance hierarchy. Classification is derived. Capability is distinct from realized structure: permitted armor still requires material and energy. Reconstructible phenotype caches require retained developmental inputs, including growth and damage history. Fitness is an outcome, not a power score.

Proposed genome field Invariant
genome_id Immutable world-scoped identity, distinct from runtime entity ID
schema and development-rule versions Explicit interpretation and migration boundaries
parents Zero only for documented founder; one initially; possible multiple parents later
origin_event_id Explains founder, mutation or reproduction origin
capabilities and parameters Canonical typed records with units, ranges and prerequisites
content_digest Integrity/deduplication aid; never merges distinct historical origins

Founder admission is a world event with inventory debited from a documented environmental or external genesis budget. Genome v0.1 covers energy conversion, membrane, movement, ingestion, reproduction, target size and tolerances only.

Contract Required behavior
ValidateGenome Reject unknown required capability, invalid range/dependency and cyclic development
PlanDevelopment Return bounded construction plan and resource requirements from genome/growth/environment
ApplyDevelopment Reserve resources; commit phenotype revision and matching transfers, or make no change
DerivePhenotype Produce dimensioned mass, geometry, maintenance and enabled component descriptions
GenerateMutationCandidates Genome + bounded recorded context + explicit stream/version → canonical candidates
SelectMutation Revalidate candidate, organism/genome revision and current context before immutable successor

A displayed candidate does not reserve resources. Changed context must reject or revalidate; never silently substitute a different mutation. Thicker membrane first changes thickness/composition; development derives construction mass, permeability/protection, movement and thermal consequences. Omitted physics is a documented model limitation, not an unrelated percentage modifier.

Candidate-generation experiment

Propose a constrained catalog of mutation operators over capability/parameter records. Filter by prerequisites, sort stable operator IDs, then sample bounded integer weights from recorded genome/context. This is an internal rule catalog, not a visible linear progression tree. Environment-conditioned offerings are a game-design proposal, not a claim that biological mutation anticipates needs.

Record seed, organism, eligible event index, context digest, rules and stream ID. Unrelated entity additions cannot change candidates. No wall clock, std::hash or implementation-defined distribution enters sampling. Store bounded context statistics; retries cannot obtain free rerolls. Candidate count, context window, costs, inherited/acquired expression, NPC mutation and recombination remain open before M3 mutation acceptance. No implementation silently settles these rules.

Later morphology and history

Evaluate typed body graphs with tissue/segment/organ nodes and distinct attachment, joint, vascular, neural and developmental edges. Independent consumers derive meshes, collisions, mass, maintenance and locomotion. Validate work/graph bounds, structural connectivity and resource feasibility. Development dependencies are acyclic or explicitly bounded; vascular cycles can be valid. Mesh validity alone does not prove biological viability. Intelligence remains one costly strategy.

Keep extinct genomes and ancestry indefinitely. Rule migrations preserve original records/provenance and are tested on cloned worlds. Unknown required capabilities fail closed. Tests cover canonical round trips, prerequisites, resource-limited development, deterministic candidates, stream independence, retry stability, bounded graph expansion, ancestry-preserving migration and material tradeoffs.

Implemented M3.1 genome record

ADR-0030 implements the record this document proposes, and nothing that reads it. evo::biology::Genome is validated once at construction and exposes no mutator, so an invalid genome cannot exist at runtime and callers never revalidate. GenomeDraft carries unvalidated input; create and decode apply identical semantic checks, so a decoded record is never less validated than a constructed one.

Schema 1 fixes the seven v0.1 capability kinds. Each has a unit, an inclusive parameter range, whether every genome must carry it, and the capabilities it mandates, all held as schema facts rather than record data, so no genome can contradict its own units. Energy conversion, membrane and target size are required. A capability record adds one u32 parameter and a bitmask of declared developmental edges; the union of declared and mandated edges must be acyclic.

Identity is a nonzero world-scoped genome ID distinct from every runtime identity, a nonzero origin event, and zero or one parent. Zero parents identifies a documented founder. The format reserves room for a second parent so recombination needs a schema version rather than a layout change. The byte layout, validation rules and digest semantics are in genome-v1.md.

Contract Status after M3.1
ValidateGenome Implemented for schema 1, at construction and at decode
PlanDevelopment Not started; M3.2
ApplyDevelopment Not started; M3.2
DerivePhenotype Not started; M3.2
GenerateMutationCandidates Not started; M3.4
SelectMutation Not started; M3.4

No genome affects any simulation. The M2 process fixtures still duplicate founder strategies verbatim and do not read this record; M3.3 connects capability to energetic cost. Nothing here decides mutation operators, inherited versus acquired expression, NPC divergence or recombination. A parameter within range is not a viable organism: validation proves neither developmental feasibility nor biological plausibility, and the schema ranges are expressible bounds rather than balance. Fitness remains an outcome, not a score held in the record.

Implemented M3.2 development and phenotype

ADR-0031 adds derive_phenotype and plan_development as pure functions over the M3.1 record. Nothing is stored: a phenotype is recomputed from retained inputs rather than cached, so a cached copy can always be checked against a recomputation.

GrowthState holds what an organism has built and what it has lost, in thousandths. EnvironmentState holds ambient temperature and the material a plan may draw on. Neither is written to the genome, and no function takes a mutable genome: damage changes the phenotype and leaves the content digest untouched, so heredity cannot carry acquired condition.

The genome's development version selects the rule set, and an unknown version fails closed. Version 1 declares every constant the derivation uses. The shape model is explicit: the body is a cube of uniform declared density, so extent is the exact integer cube root of volume and surface is six extents squared. Membrane mass is surface times the genome's thickness times membrane density. Maintenance is proportional to total mass plus a membrane upkeep term, so a thicker membrane costs more to hold. Uptake scales with surface against a declared reference, so size trades uptake against maintenance. A capability the genome does not carry yields zero for its component.

Contract Status after M3.2
ValidateGenome Implemented for schema 1, at construction and at decode
PlanDevelopment Implemented: bounded step, exact largest affordable, reserves nothing
ApplyDevelopment Half: a plan carries the growth state it would produce, but no transfer exists until M3.3
DerivePhenotype Implemented for rule version 1
GenerateMutationCandidates Not started; M3.4
SelectMutation Not started; M3.4

Omitted physics is a documented model limitation. Extent, maintenance and uptake are derived quantities, not balance, stats or a power score, and the constants must not become tuning by having been written down. Thermal shortfall is reported as a quantity; it is not a mortality, penalty or damage rule. A derived phenotype is not a viability claim. Repair is not modelled: a plan advances growth and never reduces damage. Nothing is spent or reserved, and no organism yet develops.