Files
aevolution/docs/adr/0124-cellular-engulfment-and-detritus.md
T
dingoandClaude Opus 5.5 e17ade8cb7
Foundation / checks (ecs) (push) Successful in 2m28s
Foundation / checks (deploy) (push) Successful in 4m6s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 6m47s
Foundation / checks (checks) (push) Canceled after 6m58s
Foundation / checks (client) (push) Canceled after 6m59s
Foundation / checks (tsan) (push) Canceled after 4m28s
Foundation / checks (network) (push) Canceled after 6m58s
Carry the engulf intent on v10 sessions and the batch trace
ADR-0124: byte 12 of the canonical cellular input, the CellularAction
wire message and the batch trace record becomes a target kind (0 none,
1 patch, 2 engulf with zero coordinates). Kind 2 exists only on v10,
which no server admitted before; cellular servers now admit v10 with v9
behaviour plus engulf, and still refuse a v10 mutation choice until
11.4c. Admission, the session-batch adapter, trace codec, matcher and
action-block validator carry the kind.

The client session library accepts v10 and an engulf flag, and its send
no longer reports a message its version cannot encode as sent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 19:04:46 -04:00

109 lines
5.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ADR-0124: Cellular engulfment and detritus
## Status
Accepted M11.3 engineering contract (2026-10-13), under the maintainer's standing
direction to proceed through M11 with recommendations. It implements the
predation and corpse rules already ratified in
[ADR-0098](0098-m11-first-cellular-loop-decisions.md) §6. Values marked
**tunable** are versioned trial inputs for the 11.9 playtests, not final rules.
## Context
The cellular trial resolves movement, maintenance, patch intake and starvation
(ADR-0101 to ADR-0107). ADR-0098 also requires engulfment of a sufficiently
smaller contacted cell, contested by the prey's membrane, with the prey's whole
inventory moving to the predator once and any excess left as detritus, and it
requires that a corpse can be absorbed by any cell. ADR-0107 kept starvation
corpses as inert records, and nothing can engulf yet.
The 2026-10-13 probe showed that a player's only feedback is patch intake and
reserve, and that founders are identical in size. Engulfment therefore becomes
possible only once mutation or later growth changes relative size; until then it
must still be resolved correctly.
## Decision
### Intent
- A cellular action names one target **kind**, replacing the intake flag in
byte 12 of the 24-byte canonical input: 0 none, 1 patch intake at the given
patch address, 2 engulf. An engulf intent carries zero coordinates; the server
chooses the prey. Clients still send only intentions.
- Kind 2 is accepted only on session protocol v10. v10 was defined for
mutation choice (ADR-0121) but no server admitted it yet, so no existing peer
changes meaning; v7 to v9 keep refusing kind 2 and their bytes are unchanged.
Cellular servers now admit v10 sessions with v9 behaviour plus kind 2; a v10
mutation choice is refused until 11.4c wires its publication.
### Tick order (rules 3)
Each tick keeps the ADR-0104 single-life order and ADR-0106 patch arbitration,
then adds two phases, all in ascending stable life id:
1. **Step:** movement, maintenance and patch intake exactly as under rules 2.
A life that cannot pay maintenance starves (ADR-0107).
2. **Engulf:** each life that survived step 1 and holds an engulf intent takes at
most one prey: the lowest-id surviving life in contact (ADR-0102 footprint
contact) for which
`predator_total_mass × 1000 ≥ required × prey_total_mass`, where
`required = 1500 × prey_membrane_um` (**tunable**; 1.5 for the 1 µm founder
membrane, per ADR-0098). Total mass is the phenotype's structural plus
membrane mass. A life engulfed earlier in the phase can neither act nor be
taken twice. A predator cannot engulf itself.
3. **Death and detritus:** every life that died this tick (starved or engulfed)
becomes a corpse record. Its accumulated heat goes to the world heat owner.
### Transfer
- The prey's body and reserve, every channel, move out exactly once.
- The predator's reserve receives at most its per-tick intake limit in each
channel (the same capacity that bounds absorption). The remainder is detritus.
- Detritus, and the whole inventory of a starved cell, is deposited into the
habitat at the 1 mm patch cell containing the corpse's position:
- If a patch exists there, the inventory is added to its stock. The patch keeps
its provenance; the corpse record and lineage archive keep the dead organism's.
- Otherwise a new patch is created there with the dead life's source as
provenance.
- If the habitat is at its 4,096-patch bound, the nearest existing patch
(lowest address on a tie) receives it.
- Corpse records keep identity, position, growth, extent, death tick and a new
**cause** (starved or engulfed). Their inventory is zero under rules 3.
- Any cell absorbs detritus with ordinary patch intake. Nothing decays or
replenishes; every channel is conserved region-wide.
### Versions and persistence
- Cellular rules 3 and owner envelope 4 (the corpse cause) form a new version
bundle `{rules 3, envelope 4, habitat 1, coordinate 1, genome 1, development 2,
founder 1, archive 2, mutation_state 1}`.
- New regions are provisioned on it. Existing v2 and v3 regions keep rules 2 and
replay byte-for-byte; no in-place migration is provided in this step.
- Schema migration 34 admits the new bundle and canonical input kind 2 with
zero coordinates. Batch traces record the kind with each intent.
- Client presentation of an engulf control and of corpse causes belongs to
11.8 (maintainer-owned client UI).
## Alternatives
- **Explicit prey id in the action:** rejected for this step. It needs a new
message layout and lets a client name an unseen cell; contact already bounds
the choice, and the server picks deterministically.
- **Engulf without a capacity bound:** rejected. ADR-0098 bounds the transfer by
the predator's capacity, and per-tick intake is the only capacity cells have.
- **Keep corpses as separate food objects:** rejected for now. A second food
type needs its own perception, contact and client view; depositing into the
patch grid reuses all three.
- **Migrate existing regions in place:** deferred. Only DEV regions exist, and a
fresh region is cheaper to qualify than a no-tick rules migration.
## Consequences
- Biology gains a pure engulf/detritus resolution; the cellular owner, snapshot,
manifest bundle, SQL admission, v10 session admission, batch trace and
recovery change.
- Founders are equal in size, so live engulfment needs mutation (11.4) or
later growth before it is observable in play.
- Size may dominate predation (ADR-0098 risk); 11.9 watches for it, and the
required ratio stays tunable.