A construction transition could require more of an element than was available, because the check compared net mass. A step growing a body from 13 to 14 femtograms nets one femtogram but acquires a carbon and a nitrogen while freeing one of other, and released other pays for neither. Matching totals let one element silently fund another. Net mass was never the right question, and the layer asking it could not ask a better one: plan_development has no composition. A single scalar pool could not carry the answer either, since it cannot say that carbon is plentiful while nitrogen is not. The environment now states what is available per ledger channel. plan_development keeps a total-mass bound, which is sound because net never exceeds gross, but it is a proposal rather than an authority. metabolic_budget narrows it to the largest step whose own intake fits channel by channel, and reports the growth that step actually funds. That revises ADR-0031 on this point, recorded in both ADRs. The tests place a single femtogram in each channel in turn and require that no step needing a different element is funded, that nothing is acquired beyond what is present, and that the mass-only plan would have admitted the step; a carbon and a nitrogen together then fund it exactly. Across six target sizes by seven growth fractions by four stock levels, every reported intake fits the availability channel by channel and never exceeds the proposed step. Confirmed to fail with the check removed. The releasing case moved to a target of 20 femtograms, where the step occurs at the full rule step rather than depending on a scarce supply that the corrected plan no longer bounds the same way. Native Release, clang-tidy analysis, ASan and format checks pass 19/19. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
6.5 KiB
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.