From 59fd80070270032b6e51e3338006fef96dff74af Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 13 Jul 2026 17:51:17 +0100 Subject: [PATCH] Align Persona artifacts with typed contracts --- .../src/bin/epiphany-character-loop.rs | 23 ++++++++- .../src/bin/epiphany-persona-discord.rs | 36 +++++++++++--- ...onceptual-substitution-audit-2026-07-12.md | 46 ++++++++++++++++++ notes/fresh-workspace-handoff.md | 25 ++++++++++ schemas/cultnet/README.md | 2 +- ...epiphany.character-turn-packet.schema.json | 2 +- ...phany.character_turn_intent.v0.schema.json | 5 +- .../epiphany.persona-bubble.schema.json | 20 ++++++-- schemas/cultnet/index.json | 2 +- state/ledgers.msgpack | Bin 483862 -> 485050 bytes state/map.yaml | 3 +- state/scratch.md | 4 +- 12 files changed, 147 insertions(+), 21 deletions(-) diff --git a/epiphany-core/src/bin/epiphany-character-loop.rs b/epiphany-core/src/bin/epiphany-character-loop.rs index 7e9f8d22..5adae9d6 100644 --- a/epiphany-core/src/bin/epiphany-character-loop.rs +++ b/epiphany-core/src/bin/epiphany-character-loop.rs @@ -744,7 +744,28 @@ fn run_smoke() -> Result { &fs::read_to_string(&path) .with_context(|| format!("failed to read smoke artifact {}", path.display()))?, )?; - let ok = packet["schemaVersion"] == CHARACTER_TURN_SCHEMA_VERSION + const EXPECTED_PACKET_FIELDS: [&str; 14] = [ + "allowedOutputs", + "appraisalSeed", + "cognitionLanes", + "createdAt", + "guardrails", + "projectedLocalContext", + "projectionSeed", + "protocol", + "reactionSeed", + "resultShape", + "schemaVersion", + "source", + "stimulus", + "utteranceState", + ]; + let ok = packet.as_object().is_some_and(|payload| { + payload.len() == EXPECTED_PACKET_FIELDS.len() + && EXPECTED_PACKET_FIELDS + .iter() + .all(|key| payload.contains_key(*key)) + }) && packet["schemaVersion"] == CHARACTER_TURN_SCHEMA_VERSION && packet["protocol"]["bundle"] == "epiphany.character_loop" && packet["protocol"]["roleId"] == "Persona" && packet["protocol"]["organStateProfile"]["profileKind"] == "persona" diff --git a/epiphany-core/src/bin/epiphany-persona-discord.rs b/epiphany-core/src/bin/epiphany-persona-discord.rs index a67fb60c..e42ccd93 100644 --- a/epiphany-core/src/bin/epiphany-persona-discord.rs +++ b/epiphany-core/src/bin/epiphany-persona-discord.rs @@ -974,7 +974,23 @@ console.log(JSON.stringify({ .context("Persona speech audit smoke expected latest CultMesh audit")?; let ok = draft["ok"] == true && bubble["ok"] == true - && bubble["bubble"]["schema_version"] == BUBBLE_SCHEMA_VERSION + && bubble["bubble"]["schemaVersion"] == BUBBLE_SCHEMA_VERSION + && bubble["bubble"].as_object().is_some_and(|payload| { + const EXPECTED: [&str; 11] = [ + "agentId", + "bubble", + "content", + "createdAt", + "displayName", + "mood", + "roleId", + "schemaVersion", + "source", + "status", + "target", + ]; + payload.len() == EXPECTED.len() && EXPECTED.iter().all(|key| payload.contains_key(*key)) + }) && bubble["bubble"]["bubble"]["requiresDiscord"] == false && blocked["ok"] == false && blocked["blocked"] == "missing-channel-id" @@ -1072,14 +1088,14 @@ fn has_bound_discord_publication(payload: &Value) -> bool { fn bubble_payload(content: &str, source: &str, mood: &str) -> Value { serde_json::json!({ - "schema_version": BUBBLE_SCHEMA_VERSION, - "created_at": now_iso(), + "schemaVersion": BUBBLE_SCHEMA_VERSION, + "createdAt": now_iso(), "status": "projected", "source": source, "target": "aquarium", - "role_id": "Persona", - "agent_id": "Persona", - "display_name": "Persona", + "roleId": "Persona", + "agentId": "Persona", + "displayName": "Persona", "mood": mood, "content": content.trim(), "bubble": { @@ -1117,7 +1133,9 @@ fn latest_persona_artifacts(artifact_dir: &Path, limit: usize) -> Vec { "path": path, "name": path.file_name().and_then(|name| name.to_str()), "modifiedAt": modified_at.to_rfc3339_opts(SecondsFormat::Secs, true), - "schemaVersion": payload.get("schema_version"), + "schemaVersion": payload + .get("schemaVersion") + .or_else(|| payload.get("schema_version")), "status": payload.get("status"), "reason": payload.get("reason"), "content": payload.get("content"), @@ -1155,7 +1173,9 @@ fn recent_persona_speech(artifact_dir: &Path, limit: usize) -> Vec one crossing attempt -> one +canonical `crossing_${commandId}` receipt. Its current actuator gate only checks +that a command-id string is nonempty, however, and reusing that ambient id can +overwrite the canonical receipt. Discord has a singular typed command shape but +only smoke-grade intake; Reddit has no typed command contract. Epiphany must not +invent a local UUID and call it Bifrost command authority. The coherent repair +belongs at Bifrost intake: create one typed command per crossing, bind exact +action/payload/target, atomically claim it once, and reject nonexistent, +concurrent, mismatched, or terminal reuse. Until that exists, crossing identity +remains an upstream authority wound rather than a local validation omission. + +## Producer spelling is contract identity + +Persona bubble artifacts emitted snake_case root fields while their registered +CultNet schema required camelCase. Character-loop had removed caller-authored +`--status`, but the registered character intent still admitted `status` and +arbitrary extra fields. Bubble now writes the registered field names; legacy +snake_case remains read-only compatibility input. Bubble and character packet +schemas reject extra root fields, character intent rejects undeclared cargo, +and native smokes assert the exact emitted top-level sets. A registered schema +that the producer does not actually speak is catalog theater, not a contract. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 7eb109f9..e5d6fe62 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -2,6 +2,31 @@ ## Current orientation — 2026-07-12 +### Aetheria organ-structure evidence — 2026-07-13 + +Task `019f3fe1-9f69-74e3-97fb-a18490d72119` supplied strong positive evidence +for the Epiphany hypothesis without requiring raw worker-thought inspection. +Modeling maintained concrete migration bodies across Aetheria, EveUnity, and +CultLib; Eyes found CultCache crash consistency and SoA ownership skew; Hands +landed bounded disjoint changes; Soul rejected a registry repair that still +allowed readers to observe partial refresh; Imagination corrected a roadmap +that called unfinished migration complete; Self preserved dependency order and +kept unrelated compile skew out of coherent commits. + +Prompt forms worth preserving: + +- require the exact compile boundary and deletion line when research expands; +- give Hands hostile negative acceptance criteria, not only a desired output; +- explicitly allow a worker to stop and name a missing substrate primitive; +- review diffs against authority and concurrency invariants after tests pass. + +The product gap exposed by this success is persistence, not better roleplay. +Modeling's repo anatomy, confirmed/changed/invalidated claims, freshness, +frontier, and semantic-index consequences must live in typed searchable state +and be projected into later Hands prompts. Otherwise an excellent coordinator +can perform the structure transiently, but the next awakened Self inherits only +the applause. + Epiphany is in an authority-provenance purification pass. The live question is not whether a command can produce a plausible document; it is whether the subsystem writing that document owns the fact it asserts. The confirmed conceptual substitutions have been cut: diff --git a/schemas/cultnet/README.md b/schemas/cultnet/README.md index 371766aa..30d0cf9a 100644 --- a/schemas/cultnet/README.md +++ b/schemas/cultnet/README.md @@ -37,7 +37,7 @@ server object deserves to be duplicated into a second baroque schema maze. - `*.intent.v0`: control documents Aquarium, a Discord bridge, a voice surface, or another trusted coordinator can submit through CultNet. - receipt/artifact schemas such as `epiphany.swarm-control-receipt`, - `epiphany.Persona-bubble`, `epiphany.character-turn-packet`, and + `epiphany.persona-bubble`, `epiphany.character-turn-packet`, and `epiphany.repo-birth-runner`. ## Publication Path diff --git a/schemas/cultnet/epiphany.character-turn-packet.schema.json b/schemas/cultnet/epiphany.character-turn-packet.schema.json index 5ee1be3c..fa80e1eb 100644 --- a/schemas/cultnet/epiphany.character-turn-packet.schema.json +++ b/schemas/cultnet/epiphany.character-turn-packet.schema.json @@ -4,7 +4,7 @@ "title": "Epiphany Character Turn Packet", "description": "Epiphany-native character-loop projection packet.", "type": "object", - "additionalProperties": true, + "additionalProperties": false, "properties": { "schemaVersion": { "type": "string" diff --git a/schemas/cultnet/epiphany.character_turn_intent.v0.schema.json b/schemas/cultnet/epiphany.character_turn_intent.v0.schema.json index a97fe97c..22f2282b 100644 --- a/schemas/cultnet/epiphany.character_turn_intent.v0.schema.json +++ b/schemas/cultnet/epiphany.character_turn_intent.v0.schema.json @@ -4,7 +4,7 @@ "title": "epiphany character_turn_intent v0", "description": "Character-loop turn intent for Persona or other embodied actors.", "type": "object", - "additionalProperties": true, + "additionalProperties": false, "properties": { "threadId": { "type": "string" @@ -21,9 +21,6 @@ "mode": { "type": "string" }, - "status": { - "type": "string" - }, "mood": { "type": "string" } diff --git a/schemas/cultnet/epiphany.persona-bubble.schema.json b/schemas/cultnet/epiphany.persona-bubble.schema.json index 95282eb5..ddac6e31 100644 --- a/schemas/cultnet/epiphany.persona-bubble.schema.json +++ b/schemas/cultnet/epiphany.persona-bubble.schema.json @@ -1,10 +1,10 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://gamecult.dev/epiphany/cultnet/epiphany.Persona-bubble.schema.json", + "$id": "https://gamecult.dev/epiphany/cultnet/epiphany.persona-bubble.schema.json", "title": "Epiphany Persona Bubble", "description": "Aquarium-visible Persona bubble artifact.", "type": "object", - "additionalProperties": true, + "additionalProperties": false, "properties": { "schemaVersion": { "type": "string" @@ -41,7 +41,21 @@ }, "bubble": { "type": "object", - "additionalProperties": true + "additionalProperties": false, + "properties": { + "kind": { "type": "string" }, + "anchorRoleId": { "type": "string" }, + "opensIn": { "type": "string" }, + "requiresDiscord": { "type": "boolean" }, + "ttlSeconds": { "type": "integer", "minimum": 0 } + }, + "required": [ + "kind", + "anchorRoleId", + "opensIn", + "requiresDiscord", + "ttlSeconds" + ] } }, "required": [ diff --git a/schemas/cultnet/index.json b/schemas/cultnet/index.json index 1da5d8dd..fdee40ea 100644 --- a/schemas/cultnet/index.json +++ b/schemas/cultnet/index.json @@ -827,7 +827,7 @@ "path": "epiphany.swarm-control-receipt.schema.json" }, { - "schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.Persona-bubble.schema.json", + "schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.persona-bubble.schema.json", "kind": "document_payload", "wireContracts": [ "cultnet.schema.v0" diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 399e5a66793fb83b28c4c76bc84a735466d6c8a6..f3711343ad839c9ffafa9c1985b91cfefe20cdb2 100644 GIT binary patch delta 1171 zcmZvby^b736or|!*_B1e1_;UMN`#)?o!OsRW*n_nmh1q_(jp;|Sk+y(d&*N?w_Q~| zLq{V-;K*{~WnKe`z%mg5A|v1ph+@Ev5d-{i8@BaMz-5)<0eRMuq zoX)=a?Sli}{q*_h`Dpa&`s%ByI^Q7&6; zINYZP9S16c(=fu9MSBF7mdx46G_L&uFD6Ox=d!UVp z%Xe#JkKAOC$DDAwm@>fkU71Y}ikxhS0VBW*HQOr{c*x(PItrAAt%hAJFk^ecsTDsh zQWSjcS?Nri?fP{A$UmO>KdGQutRN-8uC+?Z2?f>-VQ`bg_r3b*wrM;9CWd95kQG