Files
aevolution/docs/adr/0032-metabolic-budgets-from-genome.md
T
dingoandClaude Opus 5 be71d4f441 Give capability a cost without giving it a multiplier
M3.3 turns a phenotype into the budgets a ledger can hold: body
composition, maintenance, movement, the next construction step, the
per-tick intake limit and the reproduction investment. metabolism is the
single place the genome's description of capability becomes accounting
quantities, so the record itself stays free of those types and M3.1's
boundary is crossed once, explicitly.

The named risk is reintroducing RPG modifiers, where a capability
parameter becomes a flat percentage over every budget. Each budget is
therefore derived from a different phenotype quantity: maintenance from
mass plus membrane upkeep, movement from mass and speed, intake from
surface, construction from the mass a growth step adds, investment from
the body a parent already has. One parameter moves some budgets and not
others, by different amounts. Doubling membrane thickness costs more
matter to build, more energy to hold and more to haul, while leaving
uptake, speed, assimilation and structural mass identical, and the mass
and maintenance ratios differ, so no single multiplier could produce it.
The test asserts that non-uniformity rather than describing it.

Composition is declared per compartment, and membrane is the carbon-rich
one, so a thicker membrane changes what a body is made of and not only
how much. A split assigns the first three channels by share and gives the
remainder to the last, so parts always sum back to the whole and a
derived body can be spent through the ledger without a rounding leak.
That is checked at four awkward masses where every share floors.

processes::consumer_for is the first path from a genome into the M2
fixtures. Opening inventory stays the caller's: a genome says what an
organism can do, never what it holds, and a derived config that invented
an opening balance would create matter. A derived consumer is shown
driving a real feeding tick with the ledger conserving exactly, and a
bite one femtogram past the derived cap refused by the M2.3 contract.

Every budget is asserted as a hand-calculated literal. The constants are
chosen so budgets are of comparable magnitude, which is legibility for
tests and not tuning. No existing fixture reads genomes, and no organism
spends any budget: there is still no starvation, death or repair rule.

Native Release, clang-tidy analysis, ASan and format checks pass 19/19;
every existing golden and fingerprint is unchanged. Linux CI has not run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-23 11:31:01 -04:00

5.7 KiB

ADR-0032: Metabolic budgets derived from a phenotype

Status

Adopted for M3.3. Running seeded ensembles on genome-derived strategies is M3.6. Mutation is M3.4. No gameplay balance, mortality rule or fitness score is selected, and no existing M2 fixture behaviour changes.

Context

M3.2 derives dimensioned physical parameters but nothing spends them. The M2 fixtures still run on hand-written constants, so capability and cost are still unrelated. This is the increment where a genome first reaches the ledger, and the roadmap names its risk precisely: reintroducing RPG modifiers, where a capability parameter becomes a flat percentage applied uniformly to every budget.

M3.1 deliberately kept the genome free of accounting types so its units could not imply ledger semantics. That boundary now has to be crossed somewhere explicit rather than everywhere implicitly.

Decision

Add evo::biology::metabolic_budget, one entry point returning every budget a phenotype implies, in accounting types. The genome record itself stays free of those types: metabolism is the single translation layer, and the genome remains a description of capability rather than of resources.

The budgets are body composition, maintenance per tick, movement per tick at full speed, total demand, the next construction step, the per-tick intake limit and the reproduction investment. They are derived from different phenotype quantities on purpose: maintenance from total mass plus a membrane upkeep term, movement from total mass and speed, intake from surface, construction from the mass difference a growth step implies, and investment from the body a parent would divide. A change to one genome parameter therefore moves some budgets and not others, by different amounts. That is the whole point: a thicker membrane costs more matter to build and more energy to hold, while changing neither uptake nor speed. Nothing here is a multiplier applied to a total.

Composition is declared per compartment in thousandths. Structure and membrane have different compositions, so a thicker membrane changes what the body is made of and not only how much. A split assigns the first three channels by share and gives the remainder to the last, so mass is conserved exactly and a body can be spent through the ledger without a rounding leak.

Reproduction investment is the body scaled by the genome's reproduction fraction, with its energy priced at the same construction rate as the organism's own tissue: building offspring tissue costs what building your own does. A genome without the reproduction capability invests nothing, rather than investing a default.

The rule constants are selected by the same development version as M3.2 and fail closed on an unknown one. They are chosen so the budgets are of comparable magnitude, because budgets that differ by orders of magnitude make every tradeoff invisible. That is a legibility choice for tests, not tuning, and it must be re-derived before any of it is balanced.

processes::consumer_for converts a budget into the existing ConsumerConfig. Opening inventory stays the caller's: a genome describes what an organism can do, never the resources it happens to hold, and a derived config that also invented an opening balance would be creating matter. Nothing else in the M2 fixtures changes, and no existing fixture starts reading genomes.

Alternatives Considered

A single efficiency multiplier over one budget would be exactly the modifier this increment exists to avoid. Putting accounting types into the genome record would undo the M3.1 boundary and let a stored parameter imply a ledger channel. Deriving composition from the phenotype rather than declaring it per compartment would hide the one place the membrane's different chemistry is stated. Giving the rounding remainder to the largest channel instead of a fixed one would make a split depend on the mass being split. Having consumer_for supply an opening inventory would create matter from a description.

Benefits

Capability now has cost, and the cost is not uniform. Size, membrane thickness and movement each move a different subset of budgets, so the tradeoffs are visible and testable rather than asserted. Mass splits conserve exactly, so a derived body can be spent through the ledger. The M2 fixtures gain a genome-driven path without any of them changing behaviour.

Costs

Every constant is chosen, including two compositions, a movement coefficient and an intake energy density. Intake is distributed by the structure composition, which assumes an organism takes up what it builds from. Movement is priced at full speed whether or not an organism moves, so it is a capacity rather than an expenditure. The small integer helpers are duplicated rather than shared through an internal header.

Risks

Do not read any budget as balance or a power score, and do not let the constants become tuning by having been measured. Comparable magnitudes were chosen for legibility and say nothing about what an organism should be able to afford. A budget is a derived quantity, not a rule: nothing here decides starvation, death, repair or whether demand is ever met. No organism spends any of this yet.

Consequences

Test that each budget is hand-calculable, that mass splits conserve exactly on both compartments and at the remainder boundary, that a thicker membrane raises matter cost and maintenance while leaving uptake and speed untouched, that a larger body raises maintenance and uptake together, that an absent capability yields a zero budget rather than a default, that unknown rule versions fail closed, and that a derived consumer drives a real feeding tick with the ledger conserving. No genome, snapshot, ledger, existing fixture, renderer or deployment changes.