Add the immutable genome v1 record and its canonical encoding

Open M3 with the record that development and mutation will read, in a new
evo::biology library that nothing else links yet. A genome is validated
once at construction and exposes no mutator, so an invalid one cannot
exist at runtime and callers never revalidate. A draft carries
unvalidated input; create and decode apply identical semantic checks, so
a decoded record is never less validated than a constructed one.

Schema 1 fixes the seven v0.1 capability kinds. Each has a unit, an
inclusive range, whether every genome must carry it, and the capabilities
it mandates, all held as schema facts rather than record data, so no
record can contradict its own units. A capability adds one parameter and
a bitmask of declared developmental edges; the union of declared and
mandated edges must be acyclic, which seven nodes make exact and bounded.

Identity is a nonzero world-scoped genome ID distinct from every runtime
identity, a nonzero origin event, and zero or one parent. Zero parents
identifies a documented founder. The format reserves room for a second so
recombination needs a schema version rather than a layout change.

The encoding follows ADR-0008: explicit little endian, bounded before any
allocation, an exact length match so trailing bytes are rejected, records
strictly ascending by kind so the bytes are canonical and duplicates fall
out of the same comparison, a stored digest recomputed on decode, and a
trailing checksum. The digest covers identity and ancestry, so identical
capabilities from different origins never share one. Neither value is an
authenticity claim. Unknown schema versions fail closed.

Tests cover ancestry rules, every declared range boundary from both
sides, self, mutual and three-node cycles, a cycle closed by a mandated
edge, truncation at every length, trailing and oversized buffers, every
single-byte corruption, and three resealed edits that reach the digest,
version and ordering checks rather than stopping at the checksum. One
branch is recorded as uncovered rather than given a test that cannot
fail: in schema 1 every mandated capability is also required.

No genome affects any simulation. Native Release, clang-tidy analysis,
ASan and format checks pass 17/17; golden d61ad5bf0c928c76 and ecosystem
fingerprint 2cd4a15f9fbe9949 are 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 20:53:23 -04:00
co-authored by Claude Opus 5
parent 22fb904c3e
commit 8584eb1f6f
12 changed files with 1017 additions and 5 deletions
+18 -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 29 ADRs.
diagrams, biological contracts, engineering constitution and 30 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.1 immutable genome schema and ancestry | Versioned developmental capability data replacing M2.6's duplicated founder strategies |
| 2 | M3.2 development pipeline | Same genome and environment yield the same explicit phenotype parameters |
| 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 |
| 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):
@@ -159,6 +159,21 @@ demonstrates arithmetic and turnover, not ecological plausibility; strategy
constants are chosen inputs and must not become gameplay by having been measured.
Native Release, analysis, ASan and formatting passed; Linux CI has not run yet.
M3.1 opens M3 with the immutable genome record (ADR-0030) in a new `evo::biology`
library that nothing else links yet. A genome is validated once at construction
and exposes no mutator, so an invalid one cannot exist at runtime; `decode`
applies identical checks, so a decoded record is never less validated than a
constructed one. Schema 1 fixes the seven v0.1 capability kinds with units,
inclusive ranges, required flags and mandated developmental edges as schema facts
rather than record data. Identity is a nonzero world-scoped genome ID distinct
from every runtime identity, a nonzero origin event and zero or one parent, with
room reserved for recombination. The encoding is canonical, bounded and exact:
strict ascending order, a stored digest that is recomputed on decode, and a
trailing checksum, with the byte layout in schemas/genome-v1.md. No genome
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.
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