Files
aevolution/docs/adr/0031-development-and-phenotype.md
2026-10-08 12:08:53 -04:00

6.5 KiB

[Reviewed]

ADR-0031: Deterministic development and derived phenotype

Status

Adopted for M3.2, and revised by ADR-0032 on one point: affordability cannot be settled without composition, so the plan's material check is a total-mass proposal rather than an authority, and the environment states what is available per ledger channel instead of as one pool. The transfer half of ApplyDevelopment, energetic budgets and any coupling to the M2 process fixtures are M3.3. Mutation is M3.4. No gameplay balance, mortality rule or fitness score is selected.

Context

M3.1 produced a validated genome that nothing reads. GENOME_MODEL requires two things before capability can reach a budget: DerivePhenotype, producing dimensioned mass, geometry, maintenance and enabled component descriptions, and PlanDevelopment, returning a bounded construction plan and its resource requirements from genome, growth and environment.

The named risk is confusing the genome with runtime damage. A genome is immutable and shared by a lineage; what an organism has actually built, and what it has lost, are per-organism runtime state. If development wrote either back into the genome, heredity would silently carry acquired condition.

Decision

Add evo::biology free functions over the existing record. Nothing is stored: derive_phenotype and plan_development are pure functions of a genome, a GrowthState and an EnvironmentState, so a phenotype is recomputed from retained inputs rather than cached, and a cached copy can always be checked against a recomputation.

GrowthState holds what the organism has built and lost, both in thousandths: realized fraction of target size, and damage. EnvironmentState holds the ambient temperature and the material available for building. Neither is ever written to the genome, and no function takes a mutable genome. Damage reduces realized structure and therefore the phenotype; it changes no genome field and leaves the content digest untouched.

The genome's development version selects a rule set. Version 1 declares every constant the derivation uses: densities, a maintenance rate, a membrane upkeep factor, a construction energy cost, a reference surface for uptake scaling, a reference temperature, and a maximum growth step per plan. An unknown version fails closed rather than silently deriving under the wrong rules, which is what makes that field worth carrying.

Derivation is exact integer arithmetic with declared flooring, no floating point, no clock and no randomness, so the same inputs always produce the same phenotype. Every step is checked for overflow and reports an error rather than wrapping.

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 is a real tradeoff rather than a free gain. A capability the genome does not carry yields zero for its component: permitted capability still requires the record to carry it, and later the material to build it. Thermal shortfall is the amount by which the ambient temperature exceeds the genome's tolerance around the reference, reported as a physical quantity and not as a mortality, penalty or damage rule.

plan_development advances realized growth toward the target by at most the rule step, computes the mass difference between the current and proposed phenotype, and reports the material and construction energy that difference requires. When the available material cannot fund the whole step it returns the largest step the material does fund, exactly, rather than a partially funded one or a grant. The plan carries the growth state it would produce, so committing is storing that state; no function applies a plan on its own, because the matching transfer does not exist until M3.3 and an apply that moved nothing would invite exactly the unpaid commit this project keeps rejecting.

Alternatives Considered

Caching a phenotype on the organism would need invalidation on every input change and would let a stale cache outlive the record it came from. Writing realized growth back into the genome would make heredity carry acquired condition, the explicit risk here. Floating point would end determinism across platforms for no gain at these magnitudes. A geometry solver or a real surface-to-volume physics model is unjustified before any of it reaches a budget. An apply that returned a new growth state without moving inventory would look like a committed operation while conserving nothing.

Benefits

Capability becomes dimensioned physical parameters without touching the genome or any ledger. Development is reproducible from retained inputs, so a phenotype can be recomputed and compared rather than trusted. Material shortfall reduces what is built instead of granting it. M3.3 can attach budgets to a phenotype that is already deterministic and already tested.

Costs

The rule constants are chosen, not derived, and the cube shape model is a deliberate simplification. Flooring at each step biases small organisms slightly downward. Recomputing instead of caching costs a cube root and a few multiplications per query. Repair is not modelled: a plan advances growth and never reduces damage, which leaves damaged structure permanent for now.

Risks

Omitted physics is a documented model limitation, not an unrelated modifier: do not read extent, maintenance or uptake as balance, stats or a power score, and do not let the constants become tuning by having been written down. A derived phenotype is not a viability claim, and thermal shortfall is a reported quantity, not a death rule. Nothing here decides repair, ageing, starvation, morphology or how any of this is spent; a plan reserves nothing and pays for nothing.

Consequences

Test that identical inputs give identical phenotypes and that the genome and its digest are unchanged by every call, that damage changes the phenotype while leaving the genome identical, that absent capabilities yield zero components, that every rule constant is exercised, that the cube root is exact at boundaries, that unknown rule versions and out-of-range growth fail closed, that overflow is reported rather than wrapped, and that an underfunded plan returns the exact largest affordable step. No genome, snapshot, ledger, process fixture, renderer or deployment changes, and no organism yet develops.