feat(lifecycle): rules 13 multicellular organisms and Emerge
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m32s
Foundation / postgres-tools (push) Successful in 21s
Foundation / server-image (push) Successful in 4m12s
Foundation / image (push) Successful in 4m52s

Adhesion turns a cell into a two-member organism: one life with a member
count, one genome and one reserve, developed as its genome with the target
size times its members. The single cell ends as an empty merged corpse.
An organism expresses accepted mutations as a whole, paid from its reserve;
its buds add internal members (wildlife stops one short of the threshold);
the extra members' mass loads its thrust. At the emergence threshold the
Emerge intent exports the body and reserve through the boundary ledger and
ends the life as emerged.

Records the maintainer's 2026-10-23 decisions in ADR-0179 and the project
vision (whole-organism mutations; the playtest form of Emerge).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-23 06:50:19 -04:00
co-authored by Claude Opus 5.5
parent 9f117c9545
commit f454e038a1
21 changed files with 664 additions and 50 deletions
+7 -5
View File
@@ -58,7 +58,8 @@ bool valid_intent(const CellularLifeIntent& life) {
!(step.bud && (step.intake_target || step.engulf)) &&
!(step.frozen && (step.movement != biology::CellularIntent{} || step.intake_target ||
step.engulf || step.bud || step.brake || step.exclude != 0)) &&
step.exclude <= 0x0F && !(step.become && !step.bud);
step.exclude <= 0x0F && !(step.become && !step.bud) &&
!(step.emerge && (step.frozen || step.bud || step.engulf || step.intake_target));
}
bool valid_ticks(std::span<const CellularTickIntents> ticks) {
std::set<std::uint64_t> identities;
@@ -167,9 +168,9 @@ void put_intent(std::vector<std::uint8_t>& out, const CellularLifeIntent& life)
// Flags: bit 0 frozen (ADR-0128), bit 1 brake (rules 12). SQL never parses this byte, and
// player action records keep it zero: the trace alone carries a brake.
// Bit 2 (rules 13): continue as the bud.
out.push_back(static_cast<std::uint8_t>((life.intent.frozen ? 1U : 0U) |
(life.intent.brake ? 2U : 0U) |
(life.intent.become ? 4U : 0U)));
out.push_back(
static_cast<std::uint8_t>((life.intent.frozen ? 1U : 0U) | (life.intent.brake ? 2U : 0U) |
(life.intent.become ? 4U : 0U) | (life.intent.emerge ? 8U : 0U)));
// Byte 14 (rules 13): kept matter channels, bits 0-3; byte 15 stays zero.
out.push_back(life.intent.exclude);
out.push_back(0);
@@ -311,7 +312,7 @@ decode_cellular_batch(std::span<const std::uint8_t> bytes) {
step.lives.reserve(static_cast<std::size_t>(count));
for (std::uint64_t i = 0; i < count; ++i) {
const auto record = bytes.subspan(offset, cellular_batch_intent_bytes);
if (record[12] > 3 || record[13] > 7 || record[14] > 0x0F || record[15] != 0)
if (record[12] > 3 || record[13] > 15 || record[14] > 0x0F || record[15] != 0)
return std::unexpected{CellularBatchError::format};
CellularLifeIntent life;
life.life_id = get(record, 0, 8);
@@ -332,6 +333,7 @@ decode_cellular_batch(std::span<const std::uint8_t> bytes) {
life.intent.brake = (record[13] & 2U) != 0; // Rules 12; owners below refuse it.
life.intent.exclude = record[14]; // Rules 13; owners below refuse it.
life.intent.become = (record[13] & 4U) != 0; // Rules 13; owners below refuse it.
life.intent.emerge = (record[13] & 8U) != 0; // Rules 13; owners below refuse it.
if (!valid_intent(life) ||
(!step.lives.empty() && step.lives.back().life_id >= life.life_id))
return std::unexpected{CellularBatchError::format};