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>
This commit is contained in:
dingo
2026-09-22 21:48:24 -04:00
co-authored by Claude Opus 5
parent 64a12c4dfc
commit 3f86dada0e
11 changed files with 703 additions and 6 deletions
+5 -1
View File
@@ -74,7 +74,11 @@ million ticks conserve exactly, which demonstrates arithmetic, not ecology.
M3.1 now supplies that record (ADR-0030): seven versioned capability kinds with
units, ranges, declared and mandated developmental edges, immutable ancestry and
a canonical bounded encoding. It is validated once at the boundary and coupled to
nothing; development, phenotype derivation and mutation remain M3.2 to M3.4.
nothing. M3.2 now derives a phenotype from it (ADR-0031): mass, a declared cube
geometry, maintenance and enabled components, as pure integer functions of genome,
growth and environment, with a bounded plan reporting what further growth would
require. Growth and damage are runtime state that never reach the genome. Nothing
is spent yet; M3.3 attaches these parameters to the M2 budgets.
## M3 — Genome v0.1
+20 -3
View File
@@ -7,7 +7,7 @@ persistent simulation server. The founding vision remains unchanged.
## Completed implementation
- Vision, architectural pillars, risks, open-question register, architecture
diagrams, biological contracts, engineering constitution and 30 ADRs.
diagrams, biological contracts, engineering constitution and 31 ADRs.
Proposed/deferred choices remain distinct from accepted proof decisions.
- M0–M4 task breakdowns with dependencies, acceptance evidence and risks,
plus M5–M14 gates in [ROADMAP.md](ROADMAP.md).
@@ -61,8 +61,8 @@ for the bounded proof; the general production ECS remains a later measured choic
| Priority | Work | Completion evidence |
|---|---|---|
| 1 | M3.2 development pipeline | Same genome and environment yield the same explicit phenotype parameters, with material and capability prerequisites |
| 2 | M3.3 derive energetic components | Size, membrane and movement tradeoffs affect several budgets; connects the genome to the M2 fixtures |
| 1 | M3.3 derive energetic components | Size, membrane and movement tradeoffs affect several budgets; the first increment where a genome reaches the M2 ledger |
| 2 | M3.4 seeded mutation candidates | Bounded reproducible candidates conditioned by recorded context, with prerequisite and cost tests |
| Delivery gate | Add/update the dev workload when a deployable increment needs it; Argo is ready | Observe Job/pod completion separately from image publication; no World0 changes |
M1.6 now implements [the sequential scheduler contract](architecture/SCHEDULER_CONTRACT.md):
@@ -174,6 +174,23 @@ affects any simulation; the M2 fixtures still duplicate founder strategies.
Development, phenotype, mutation and heredity remain M3.2 to M3.5. Native
Release, analysis, ASan and formatting passed; Linux CI has not run yet.
M3.2 derives a phenotype from that record (ADR-0031). `derive_phenotype` and
`plan_development` are pure integer functions of genome, growth and environment,
so a phenotype is recomputed from retained inputs rather than cached. Growth and
damage are runtime state that never reach the genome: damage changes the
phenotype and leaves the content digest identical, which is the risk this
increment was scoped against. The genome's development version selects a rule
set and an unknown version fails closed. Version 1 declares every constant:
the body is a cube of uniform declared density, membrane mass follows surface and
thickness, maintenance follows 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, and reserves
nothing: no inventory moves until M3.3. Omitted physics is a documented model
limitation, not a modifier, and the constants must not become tuning by having
been written down. Native Release, analysis, ASan and formatting passed 18/18;
Linux CI has not run yet.
Before biology, resolve the relevant heredity and energetic contracts rather
than treating proof particles as organisms. Exact game tick rate, NPC mutation,
logout treatment, species/extinction rules and multicellular transition remain
+115
View File
@@ -0,0 +1,115 @@
# ADR-0031: Deterministic development and derived phenotype
## Status
Adopted for M3.2. 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.
+1
View File
@@ -23,6 +23,7 @@ Each record has the eight required sections.
0028 adopts funded reproduction, bounded slot capacity and retained lineage IDs.
0029 scopes the deterministic ecosystem driver and bounded measured episodes.
0030 adopts the immutable genome v1 record, validation and canonical encoding.
0031 adopts deterministic development, derived phenotype and bounded plans.
Every dependency adoption records exact version/commit and integrity hash,
transitive license obligations, maintenance/security review, owner and removal
+39
View File
@@ -115,3 +115,42 @@ 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](../adr/0031-development-and-phenotype.md) 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.
+48
View File
@@ -434,3 +434,51 @@ network protocol or durable storage, and neither the digest nor the checksum is
an authenticity claim. Golden `d61ad5bf0c928c76` and the ecosystem fingerprint
`2cd4a15f9fbe9949` are unchanged. No deployment manifest or image pin changed.
Linux validation is pending its first pushed run; no Gitea result is claimed yet.
## M3.2 development and phenotype (2026-09-22)
Native Release, analysis and MSVC ASan each passed 18/18 CTests; formatting
passed. Commands: `tools/windows-check.ps1 -Preset <release|analysis|asan>
-Action check` and debug `-Action format`. `development-contracts` is the one new
CTest case, in the existing `evo::biology` library, which still nothing else
links. No existing suite changed.
The fixture genome uses a target size of 8,000,000 fg, which is an exact 20
micrometre cube at the declared density, so every derived value is hand-calculable
and is asserted as a literal: structural mass 8,000,000, extent 20, surface 2,400,
membrane mass 28,800,000, total 36,800,000 and maintenance 160,000 picojoules per
tick. Half-built, damaged and maximum-size cases are hand-calculated the same way,
including the 1e9 fg body that is an exact 100 micrometre cube with an uptake rate
of exactly the reference surface, and the 999,999,999 fg body one cubic micrometre
short of it, whose extent is 99.
Determinism is checked over 45 growth and temperature combinations, each derived
twice and compared, with more growth never yielding less structure. Damage is
checked to change the phenotype while leaving the genome's encoded bytes and
content digest identical, which is the M3.2 risk stated in the roadmap. Capability
prerequisites are checked both ways: without the capability a component is zero at
any size, and with it uptake scales with surface while movement speed does not.
Thermal shortfall is checked inside tolerance, symmetrically outside it, and
without the capability, and is confirmed to change no other derived value.
Unsupported rule versions and out-of-range growth fail closed through both entry
points.
Plans are checked for the full funded step, for the exact largest affordable step
one femtogram short of it, for no growth with no material, for a finished organism,
for clamping the last step to the target rather than overshooting, and for never
repairing damage. The declared flooring is pinned rather than hidden: a body whose
mass floors to zero advances its growth counter for no material, which grants no
structure because none exists at that size either way.
Coverage limitation: the overflow guards are unreachable through the public API at
schema 1 ranges, because the largest admissible genome produces a total mass of
about 7.2e11 femtograms, eleven orders of magnitude below the u64 limit. They are
kept as guards for later schema ranges and are recorded here rather than covered
by a test that could not fail.
No organism develops, nothing links the library except its own tests, and no
inventory moves: a plan reserves nothing and pays for nothing. The transfer half
of ApplyDevelopment, energetic budgets, repair, ageing, starvation, mutation and
morphology are not implemented. Golden `d61ad5bf0c928c76`, ecosystem fingerprint
`2cd4a15f9fbe9949` and the frozen genome fixture are unchanged. No deployment
manifest or image pin changed. Linux validation is pending its first pushed run.