diff --git a/docs/architecture/ghostlight-dungeon-mvp.md b/docs/architecture/ghostlight-dungeon-mvp.md index 504263f..e9ab986 100644 --- a/docs/architecture/ghostlight-dungeon-mvp.md +++ b/docs/architecture/ghostlight-dungeon-mvp.md @@ -181,6 +181,149 @@ Classify each part: - **Delete:** duplicate local orchestration or adapters that preserve two projection authorities. +### Source-grounded Epiphany extraction map + +The current implementation lives across these Epiphany source owners: + +| Current source | Current responsibility | Decision | +| --- | --- | --- | +| `epiphany-core/src/persona_turn.rs` | Epiphany-specific input documents, prompt rendering, effect schema, effect validation, stage/terminal receipt documents, and atomic terminal-decision insertion | Split | +| `epiphany-openai-runtime/src/persona_executor.rs` | Three-stage ordering, model-runner port, stage replay, brake checks, causal reasoning contexts, output hashing, and terminal receipt creation | Move/generalize | +| `epiphany-openai-runtime/src/bin/epiphany-persona-service.rs` | Reserves Epiphany heartbeat work, reads Epiphany memory and transcript, observes repo activity, assembles the execution plan, admits failure/terminal state, and routes accepted speech toward Epiphany's signed Discord crossing | Stay/adapt | +| `epiphany-core/src/persona_conversation.rs` | Epiphany conversation lifecycle, retention, terminal reconciliation, and downstream state/mouth routing | Stay | +| `epiphany-core/src/persona_discord_crossing.rs` and `persona_discord_permit.rs` | Signed Epiphany public-consequence crossing and receipt verification | Stay | +| Epiphany runtime spine, Mind, heartbeat, memory, and CultMesh brake documents | Canonical Epiphany state, admission, scheduling, memory, and inference permission | Stay | + +#### Move to Ghostlight + +The shared Ghostlight organ owns: + +- `PersonaProjectionPlan` with actor id, snapshot/version binding, stage model + choices, permitted typed input slice, and consumer receipt context; +- `ProjectorInput` as a consumer-supplied typed slice whose generic categories + are identity experience, memories, perceived events, relationships, goals, + knowledge, capabilities, pressures, and affordances; +- Projector rendering and the rule that its output is one private lived + narrative stream without JSON, action syntax, raw state, or substrate + instructions; +- Persona invocation whose domain input is only that lived narrative stream; +- Interpreter invocation over the lived stream plus Persona output; +- generic `PersonaStageReceipt`, causal predecessor binding, snapshot binding, + request/output hashes, exact replay, empty-output refusal, schema validation, + and terminal receipt; +- generic typed outputs: private delta proposals, explicit speech, reaction + priority, and world/action proposals; +- concurrency primitives for parallel participant appraisal waves. + +The current `PersonaModelRunner` trait and `execute_persona_model_turn_with_runner` +shape in `persona_executor.rs` are the strongest extraction seed. They already +separate inference transport from orchestration and prove exact replay. The +Epiphany reasoning-basis and decision-context types are consumer-specific; +Ghostlight instead exposes receipt-context hooks so Epiphany can keep generating +those documents without placing her Mind inside the shared crate. + +#### Stay in Epiphany + +Epiphany keeps: + +- `PersonaIdentity` meaning and the canonical `gamecult.persona_state.v0` + projection of her Mind; +- `EpiphanyAgentMemoryEntry`, semantic-memory retrieval, pending Discord + mentions, repo activity observation, social affordances, organ dependencies, + and raw transcript ownership; +- heartbeat reservation, swarm brake state, runtime sessions/jobs, reasoning + basis, decision contexts, and Epiphany terminal conversation lifecycle; +- the `state_note`, `say`, and `drop` mapping used by her current public Persona; +- Mind admission of memory effects and all signed Bifrost/Discord request, + permit, delivery, and receipt paths; +- policy about allowed channels, speech acts, safety notes, retention, and + whether a candidate becomes a public consequence. + +`put_persona_terminal_decision` currently atomically stores Epiphany's effect +document and terminal receipt. That storage remains Epiphany-owned. The shared +organ returns a terminal bundle; Epiphany translates it to her documents and +performs her own exact CAS. + +#### Split at narrow ports + +- **Typed state slicer:** Ghostlight defines generic categories and redaction + invariants. Epiphany reads her state and constructs the permitted slice. +- **Narrative rendering:** Ghostlight owns the generic membrane and stage + contract. Epiphany supplies Persona-specific doctrine and authored voice + material as typed inputs, not an alternate orchestration path. +- **Model transport:** Ghostlight defines an async stage-runner port. Epiphany + implements it with `EpiphanyModelRequest`, Codex/OpenAI-compatible auth, + runtime jobs, and private model-event recovery. GhostlightDungeon implements + it with DeepSeek. +- **Receipts:** Ghostlight owns portable stage and terminal fields. Epiphany's + adapter augments them with `EpiphanyReasoningBasis`, sealed decision contexts, + brake evidence, and runtime-spine identities. +- **Interpreter vocabulary:** Ghostlight owns the portable proposal envelope. + Each consumer registers or supplies its typed effect payload schema. The + consumer validates domain policy again before admission. +- **Execution permission:** the shared executor asks a consumer-owned permit + port before each inference stage and before terminalization. Epiphany binds + it to the CultMesh swarm brake; GhostlightDungeon binds it to live-priority + and campaign snapshot gates. + +#### Delete or demote in Epiphany after parity + +- Delete local ownership of three-stage ordering, stage id generation, hashing, + exact replay, and terminal bundle construction from + `persona_executor.rs`; its replacement is an Epiphany adapter around the + Ghostlight crate. +- Delete the second injection of semantic memory, repo activity, pending + mentions, social affordances, and raw transcript into the Persona turn. + Those inputs belong to the Projector and must reach Persona only through the + lived narrative stream. +- Demote Epiphany's prompt builders to Persona-specific policy/templates fed to + Ghostlight, or delete them when the generic renderer fully owns the membrane. +- Keep the old effect document reader only as a migration reader for already + persisted receipts. It cannot execute new turns or admit new effects. +- Do not retain an environment flag, fallback runner, or compatibility mode + capable of choosing the old local executor for a new turn. + +#### Strict narrative-stream correction + +The current Epiphany `PersonaTurnInput` contains `projected_state` **and** +identity, semantic recall, pending mentions, repo activity, social affordances, +and transcript. Its prompt renders those channels again. That means the Persona +does not currently receive only the Projector's narrative stream. + +The shared v1 contract removes those parallel inputs: + +```text +consumer-owned typed slice + -> Ghostlight Projector + -> LivedNarrativeStream { text, snapshot_binding, receipt_ref } + -> Persona model receives text only as domain context + -> natural Persona narrative + -> Ghostlight Interpreter receives stream + output + consumer effect schema + -> typed proposal bundle + -> consumer-owned validation and commit +``` + +Model transport may carry provider metadata and a fixed system instruction that +identifies the model as the Persona, but it may not smuggle state, transcript, +tools, routing instructions, or effect syntax around the lived stream. + +#### Extraction verification + +Before deleting the Epiphany executor, capture replay fixtures from its existing +tests and representative real terminal receipts. Run old and shared organs over +the same typed projector inputs with frozen model outputs. Verify: + +- identical stage order, causal chain, hashes, replay refusal, and terminal + idempotency; +- channel escape, malformed effects, empty output, wrong-model replay, brake + engagement, and stale snapshot all fail without a terminal admission; +- Epiphany's adapter produces the same admissible `state_note`, `say`, and + `drop` documents from the shared proposal bundle; +- the Persona request contains no second state or transcript channel; +- no new Epiphany turn can invoke the old executor after cutover; +- signed mouth delivery remains entirely downstream of Epiphany Mind admission + and is never inferred from Ghostlight completion. + ### Handing the organ back to Epiphany Epiphany consumes the Ghostlight projection crate/service through a pinned @@ -386,4 +529,3 @@ invariant needs a negative proof at its visible layer: - background launch pressure yields before a live player inference wave; - unauthenticated, reused-invite, public-network, and cross-session campaign access are rejected. - diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 717d968..fc0f4c8 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -66,4 +66,5 @@ {"note": "Ghostlight began migrating machine-managed persistent state behind cultcache-py: branch and evidence records now route through a registered CultCache seam with readable JSON exports kept for diffability and compatibility.", "status": "accepted", "ts": "2026-05-06T03:46:41+00:00", "type": "architecture"} {"note": "CultCache wire contract clarified: DatabaseEntry payloads must be MessagePack arrays indexed by explicit field keys with nil gaps for reserved/deleted slots; cultcache-py now exposes define_database_entry_type for that contract and CultLib generator was patched to preserve sparse key slots.", "status": "accepted", "ts": "2026-05-06T03:57:10+00:00", "type": "architecture"} {"note": "Ghostlight agent-state schema is now the first shared cross-runtime payload contract. CultNet clients should carry ghostlight.agent_state.v0 unchanged inside typed document envelopes, with CultLib-style auth/session semantics handled by the transport layer rather than bespoke per-repo glue.", "status": "accepted", "ts": "2026-05-06T04:49:20+00:00", "type": "architecture"} -{"ts": "2026-08-16T14:26:32+00:00", "type": "architecture", "status": "accepted", "note": "GhostlightDungeon ownership map accepted: Ghostlight owns generalized Projector-Persona-Interpreter machinery; consuming Personas such as Epiphany retain canonical mind and commit authority through narrow adapters. WorldKernel is the sole campaign writer."} +{"note": "GhostlightDungeon ownership map accepted: Ghostlight owns generalized Projector-Persona-Interpreter machinery; consuming Personas such as Epiphany retain canonical mind and commit authority through narrow adapters. WorldKernel is the sole campaign writer.", "status": "accepted", "ts": "2026-08-16T14:26:32+00:00", "type": "architecture"} +{"ts": "2026-08-16T14:28:19+00:00", "type": "architecture", "status": "accepted", "note": "Epiphany extraction map grounded in persona_turn.rs, persona_executor.rs, persona-service, conversation, and Discord crossing: shared orchestration moves to Ghostlight; Epiphany Mind/state/mouth stay; narrow slicer, transport, receipt, schema, and permit ports split; strict v1 removes second-channel state from Persona turn."} diff --git a/state/ghostlight-state.cultcache.jsonl b/state/ghostlight-state.cultcache.jsonl index fa49e22..a74ffba 100644 --- a/state/ghostlight-state.cultcache.jsonl +++ b/state/ghostlight-state.cultcache.jsonl @@ -68,3 +68,4 @@ {"key": "2026-05-06T035710Z0000-0066-272010506962", "payload": "eyJub3RlIjogIkN1bHRDYWNoZSB3aXJlIGNvbnRyYWN0IGNsYXJpZmllZDogRGF0YWJhc2VFbnRyeSBwYXlsb2FkcyBtdXN0IGJlIE1lc3NhZ2VQYWNrIGFycmF5cyBpbmRleGVkIGJ5IGV4cGxpY2l0IGZpZWxkIGtleXMgd2l0aCBuaWwgZ2FwcyBmb3IgcmVzZXJ2ZWQvZGVsZXRlZCBzbG90czsgY3VsdGNhY2hlLXB5IG5vdyBleHBvc2VzIGRlZmluZV9kYXRhYmFzZV9lbnRyeV90eXBlIGZvciB0aGF0IGNvbnRyYWN0IGFuZCBDdWx0TGliIGdlbmVyYXRvciB3YXMgcGF0Y2hlZCB0byBwcmVzZXJ2ZSBzcGFyc2Uga2V5IHNsb3RzLiIsICJzdGF0dXMiOiAiYWNjZXB0ZWQiLCAidHMiOiAiMjAyNi0wNS0wNlQwMzo1NzoxMCswMDowMCIsICJ0eXBlIjogImFyY2hpdGVjdHVyZSJ9", "stored_at": "2026-05-06T03:57:10.429056+00:00", "type": "ghostlight.evidence_record.v0"} {"key": "2026-05-06T044920Z0000-0067-d18749ed9b85", "payload": "eyJub3RlIjogIkdob3N0bGlnaHQgYWdlbnQtc3RhdGUgc2NoZW1hIGlzIG5vdyB0aGUgZmlyc3Qgc2hhcmVkIGNyb3NzLXJ1bnRpbWUgcGF5bG9hZCBjb250cmFjdC4gQ3VsdE5ldCBjbGllbnRzIHNob3VsZCBjYXJyeSBnaG9zdGxpZ2h0LmFnZW50X3N0YXRlLnYwIHVuY2hhbmdlZCBpbnNpZGUgdHlwZWQgZG9jdW1lbnQgZW52ZWxvcGVzLCB3aXRoIEN1bHRMaWItc3R5bGUgYXV0aC9zZXNzaW9uIHNlbWFudGljcyBoYW5kbGVkIGJ5IHRoZSB0cmFuc3BvcnQgbGF5ZXIgcmF0aGVyIHRoYW4gYmVzcG9rZSBwZXItcmVwbyBnbHVlLiIsICJzdGF0dXMiOiAiYWNjZXB0ZWQiLCAidHMiOiAiMjAyNi0wNS0wNlQwNDo0OToyMCswMDowMCIsICJ0eXBlIjogImFyY2hpdGVjdHVyZSJ9", "stored_at": "2026-05-06T04:49:20.304695+00:00", "type": "ghostlight.evidence_record.v0"} {"key": "2026-08-16T142632Z0000-0068-b7da3122b5e8", "payload": "eyJub3RlIjogIkdob3N0bGlnaHREdW5nZW9uIG93bmVyc2hpcCBtYXAgYWNjZXB0ZWQ6IEdob3N0bGlnaHQgb3ducyBnZW5lcmFsaXplZCBQcm9qZWN0b3ItUGVyc29uYS1JbnRlcnByZXRlciBtYWNoaW5lcnk7IGNvbnN1bWluZyBQZXJzb25hcyBzdWNoIGFzIEVwaXBoYW55IHJldGFpbiBjYW5vbmljYWwgbWluZCBhbmQgY29tbWl0IGF1dGhvcml0eSB0aHJvdWdoIG5hcnJvdyBhZGFwdGVycy4gV29ybGRLZXJuZWwgaXMgdGhlIHNvbGUgY2FtcGFpZ24gd3JpdGVyLiIsICJzdGF0dXMiOiAiYWNjZXB0ZWQiLCAidHMiOiAiMjAyNi0wOC0xNlQxNDoyNjozMiswMDowMCIsICJ0eXBlIjogImFyY2hpdGVjdHVyZSJ9", "stored_at": "2026-08-16T14:26:32.332252+00:00", "type": "ghostlight.evidence_record.v0"} +{"key": "2026-08-16T142819Z0000-0069-97f4de27c74a", "payload": "eyJub3RlIjogIkVwaXBoYW55IGV4dHJhY3Rpb24gbWFwIGdyb3VuZGVkIGluIHBlcnNvbmFfdHVybi5ycywgcGVyc29uYV9leGVjdXRvci5ycywgcGVyc29uYS1zZXJ2aWNlLCBjb252ZXJzYXRpb24sIGFuZCBEaXNjb3JkIGNyb3NzaW5nOiBzaGFyZWQgb3JjaGVzdHJhdGlvbiBtb3ZlcyB0byBHaG9zdGxpZ2h0OyBFcGlwaGFueSBNaW5kL3N0YXRlL21vdXRoIHN0YXk7IG5hcnJvdyBzbGljZXIsIHRyYW5zcG9ydCwgcmVjZWlwdCwgc2NoZW1hLCBhbmQgcGVybWl0IHBvcnRzIHNwbGl0OyBzdHJpY3QgdjEgcmVtb3ZlcyBzZWNvbmQtY2hhbm5lbCBzdGF0ZSBmcm9tIFBlcnNvbmEgdHVybi4iLCAic3RhdHVzIjogImFjY2VwdGVkIiwgInRzIjogIjIwMjYtMDgtMTZUMTQ6Mjg6MTkrMDA6MDAiLCAidHlwZSI6ICJhcmNoaXRlY3R1cmUifQ==", "stored_at": "2026-08-16T14:28:19.728049+00:00", "type": "ghostlight.evidence_record.v0"}