Files
aevolution/schemas/cellular-habitat-v1.md
T
dingoandClaude Opus 5.5 be69cae652
Foundation / checks (checks) (push) Successful in 47m40s
Foundation / checks (client) (push) Successful in 17m27s
Foundation / checks (deploy) (push) Successful in 4m17s
Foundation / checks (ecs) (push) Successful in 4m31s
Foundation / checks (network) (push) Successful in 22m1s
Foundation / checks (tsan) (push) Successful in 13m10s
Foundation / checks (postgres) (push) Successful in 20m54s
Foundation / image (push) Successful in 4m15s
Foundation / postgres-tools (push) Successful in 5m32s
Foundation / server-image (push) Successful in 7m15s
Cellular rules 8: pools and bubbles fed by contact (ADR-0136 step A)
Square patches invited camping and left the space between them empty. Rules 8 run on a
format-2 habitat of deposits:
- pools and single-nutrient bubbles at free micrometre centres, each with a stable id
  and a contact radius; the cellular-v7 opening scatters bubbles reproducibly from the
  genesis commit (three in ten in loose clumps) and lists pools with --pool;
- every cell drains what it touches, up to its intake rate per tick, with no target; a
  pool gives at most a quarter of that rate; an emptied deposit disappears;
- a dead cell's detritus breaks into one bubble per non-empty channel;
- wildlife swims to the nearest non-empty deposit and feeds by touch.

Bundle v9 (habitat 2) and schema v43 admit it. Session v11 carries the owner's 512
nearest deposits (id, centre, radius, shape, a drained flag and 16-bit amount codes)
instead of patches; every other cellular message is v10's. The client asks for v11,
draws bubbles (nutrient-coloured, pulsing while drained, popping when gone) and pools as
puddles, slows near food and sends no feed target; the HUD summarises food in range.
Earlier rules, regions and v10 clients are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 00:38:21 -04:00

3.7 KiB

Cellular habitat snapshot v1

This bounded snapshot is implemented by biology::CellularHabitat under ADR-0101. It describes a region-local finite food opening and its current stock; it is not yet an admitted PostgreSQL checkpoint profile. A containing cellular checkpoint must bind its exact world, region and frame identity.

All integers are unsigned little-endian unless stated. Records are packed by the codec, not by native C++ layout.

Envelope

Offset Width Field Contract
0 8 magic ASCII EVOPATK1
8 4 format 1
12 4 habitat rules 1
16 8 world Nonzero identity
24 8 region Nonzero identity
32 8 frame Nonzero identity
40 4 width_um Positive, <=1,000,000, multiple of 1,000
44 4 height_um Positive, <=1,000,000, multiple of 1,000
48 4 patch_pitch_um 1,000
52 4 patch_count 0..4,096
56 8 reserved Zero
64 8 reserved Zero
72 56*n patch records Ordered by ascending (x_um,y_um)
72+56*n 8 checksum FNV-1a64 over all preceding bytes

Exact length is 80 + 56 * patch_count. The checksum detects accidental corruption; it is not an authentication mechanism.

Patch record (56 bytes)

Offset Width Field Contract
0 4 x_um Patch lower-left coordinate; 1,000 μm aligned and in bounds
4 4 y_um Patch lower-left coordinate; 1,000 μm aligned and in bounds
8 8 source Nonzero opening-provenance identity
16 8 energy_pj Finite usable chemical energy
24 8 carbon_fg Finite organic carbon
32 8 nitrogen_fg Finite organic nitrogen
40 8 phosphorus_fg Finite organic phosphorus
48 8 other_fg Finite organic other matter

Unlisted patches contain no stock. Each conserved channel's sum across the opening must fit u64; overflow rejects creation. Records must be strictly ordered and unique. There is no automatic refill or default opening.

Restore validation

Before allocating patch storage, the decoder checks the minimum/maximum byte length, checksum, magic, versions, count cap and exact length. It then validates identity, dimensions, patch pitch, zero reserved fields, patch alignment, source ids, strict ordering and per-channel totals. Restore rebuilds through the same creation validator and accepts only bytes identical to a canonical re-encoding.

Format 2: deposits (ADR-0136 step A)

Format 2 keeps the same 72-byte header with three differences:

  • Format field: it reads 2.
  • Pitch field: it is 0, since deposits are not aligned.
  • First reserved u64: it holds next_deposit, which is above every deposit id.

Records are 64 bytes and keep the format-1 ordering: ascending (x_um, y_um), with addresses unique. Exact length is 80 + 64 * count.

Offset Width Field Contract
0 4 x_um Deposit centre, in bounds; any micrometre
4 4 y_um Deposit centre, in bounds; any micrometre
8 4 id Nonzero, unique, below next_deposit; stable for its life
12 2 radius_um 1 to 5,000: the contact disc
14 1 kind 1 pool, 2 bubble
15 1 reserved Zero
16 8 source Nonzero provenance identity
24 40 stock Energy, then carbon, nitrogen, phosphorus, other

A cell touches a deposit when its square footprint comes within radius_um of the centre. Under rules 8 that contact is feeding:

  • Feeding order: by ascending address, up to the cell's intake rate per tick.
  • Pools: a pool gives at most a quarter of that rate.
  • Corpses: a dead cell's detritus becomes one bubble per non-empty channel, with new ids from next_deposit.
  • Empty deposits: removed.