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>
This commit is contained in:
dingo
2026-09-23 11:31:01 -04:00
co-authored by Claude Opus 5
parent 3f86dada0e
commit be71d4f441
13 changed files with 729 additions and 10 deletions
+42
View File
@@ -0,0 +1,42 @@
#pragma once
#include "evo/accounting/ledger.hpp"
#include "evo/biology/development.hpp"
namespace evo::biology {
// Shares in thousandths over the ledger's C/N/P/other channels, summing to 1000.
// The last channel absorbs the rounding remainder, so a split conserves mass.
using Composition = std::array<std::uint16_t, 4>;
// Chosen constants, selected by the same development version as ADR-0031 and
// reviewable as a unit. Declared model parameters, not balance.
struct MetabolicRules {
Composition structure;
Composition membrane;
// Picojoules per tick per 1000 femtograms at 1000 micrometres per tick.
std::uint64_t movement_per_kilogram;
// Picojoules of intake capacity per 1000 femtograms of it.
std::uint64_t intake_energy_per_kilogram;
};
// Every budget a phenotype implies. Each is derived from a different phenotype
// quantity, so one genome parameter moves some and not others: none of this is a
// multiplier applied to a total.
struct MetabolicBudget {
Phenotype phenotype;
accounting::Inventory body; // matter only; a body is not energy
accounting::Picojoules maintenance; // per tick
accounting::Picojoules movement; // per tick at full speed, a capacity
accounting::Picojoules demand; // maintenance plus movement
accounting::Inventory construction; // what the next growth step would take
accounting::Inventory intake_limit; // per tick
// Zero without the reproduction capability, rather than a default.
accounting::Inventory reproduction_investment;
std::uint16_t assimilation_per_thousand{};
auto operator<=>(const MetabolicBudget&) const = default;
};
[[nodiscard]] std::expected<MetabolicRules, DevelopmentError>
metabolic_rules_for(std::uint32_t development_version);
// The single place the genome's description of capability becomes ledger
// quantities. The genome record itself stays free of accounting types.
[[nodiscard]] std::expected<MetabolicBudget, DevelopmentError>
metabolic_budget(const Genome& genome, GrowthState growth, EnvironmentState environment);
} // namespace evo::biology
+13
View File
@@ -0,0 +1,13 @@
#pragma once
#include "evo/biology/metabolism.hpp"
#include "evo/processes/feeding.hpp"
namespace evo::processes {
// The first place a genome reaches the M2 fixtures. Opening inventory stays the
// caller's: a genome describes what an organism can do, never the resources it
// happens to hold, and inventing an opening balance would create matter.
[[nodiscard]] std::expected<ConsumerConfig, biology::DevelopmentError>
consumer_for(const biology::Genome& genome, biology::GrowthState growth,
biology::EnvironmentState environment, accounting::Inventory opening);
} // namespace evo::processes