From 78de1ed4cd31fe1ab261718c313a6ae0726bf128 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 2 Jun 2026 14:19:43 +0100 Subject: [PATCH] Prove dynamic context persists in worker launch --- epiphany-codex-bridge/src/launch_context.rs | 46 +++++++++++++++++++- notes/epiphany-fork-implementation-plan.md | 2 +- notes/epiphany-verse-architecture.md | 8 ++-- notes/fresh-workspace-handoff.md | 2 +- state/ledgers.msgpack | Bin 173724 -> 173984 bytes state/map.yaml | 4 +- 6 files changed, 54 insertions(+), 8 deletions(-) diff --git a/epiphany-codex-bridge/src/launch_context.rs b/epiphany-codex-bridge/src/launch_context.rs index ad083020..3d1d5c4f 100644 --- a/epiphany-codex-bridge/src/launch_context.rs +++ b/epiphany-codex-bridge/src/launch_context.rs @@ -149,11 +149,16 @@ fn launch_memory_context( #[cfg(test)] mod tests { use super::*; + use epiphany_core::EpiphanyRoleResultRoleId; + use epiphany_core::RuntimeSpineHeartbeatJobOptions; + use epiphany_core::build_epiphany_role_launch_request_with_dynamic_context; + use epiphany_core::open_runtime_spine_heartbeat_job; + use epiphany_core::runtime_worker_launch_request; use std::fs; use uuid::Uuid; #[test] - fn launch_context_renders_local_verse_packet() -> anyhow::Result<()> { + fn launch_context_persists_on_runtime_worker_request() -> anyhow::Result<()> { let temp = std::env::temp_dir().join(format!("epiphany-bridge-launch-context-{}", Uuid::new_v4())); fs::create_dir_all(&temp)?; @@ -178,6 +183,45 @@ mod tests { assert!(rendered.contains("Memory graph")); assert!(local_verse_store_path(&runtime_store).exists()); assert!(memory_graph_store_path(&runtime_store).exists()); + + let launch_request = build_epiphany_role_launch_request_with_dynamic_context( + "thread-1", + EpiphanyRoleResultRoleId::Modeling, + Some(state.revision), + Some(60), + &state, + Some(rendered.clone()), + ) + .map_err(anyhow::Error::msg)?; + open_runtime_spine_heartbeat_job( + &runtime_store, + RuntimeSpineHeartbeatJobOptions { + runtime_id: EPIPHANY_LOCAL_VERSE_RUNTIME_ID.to_string(), + display_name: "Epiphany Local".to_string(), + session_id: "epiphany-main".to_string(), + objective: "Test persisted launch context.".to_string(), + coordinator_note: "Bridge launch-context smoke.".to_string(), + job_id: "job-launch-context".to_string(), + role: launch_request.owner_role.clone(), + binding_id: launch_request.binding_id.clone(), + authority_scope: launch_request.authority_scope.clone(), + instruction: launch_request.instruction.clone(), + launch_document: launch_request.launch_document.clone(), + output_contract_id: launch_request.output_contract_id.clone(), + organ_launch_contract: launch_request.organ_launch_contract.clone(), + created_at: "2026-06-02T00:00:00Z".to_string(), + }, + )?; + let stored = runtime_worker_launch_request(&runtime_store, "job-launch-context")? + .expect("runtime worker launch request should be persisted"); + let stored_document = stored.launch_document()?; + let stored_context = stored_document + .dynamic_prompt_context() + .expect("stored launch document should carry dynamic context"); + assert!(stored_context.contains("Odin")); + assert!(stored_context.contains("Memory graph")); + assert!(stored_context.contains("Test launch context.")); + fs::remove_dir_all(&temp)?; Ok(()) } diff --git a/notes/epiphany-fork-implementation-plan.md b/notes/epiphany-fork-implementation-plan.md index 852adb48..7a04740a 100644 --- a/notes/epiphany-fork-implementation-plan.md +++ b/notes/epiphany-fork-implementation-plan.md @@ -87,7 +87,7 @@ The landed machine now has: - first Codex-independent native runtime vertebra through `epiphany-runtime-spine`, storing runtime identity, sessions, jobs, job results, and events as typed CultCache MessagePack documents, opening/completing native jobs, projecting job-result counts, and emitting a framed CultNet hello message for the native contract - first Rust CultMesh local-node integration: `vendor/cultmesh-rs` now provides the repo-contained CultMesh surface over vendored CultCache/CultNet, and `epiphany-core` depends on that surface for local `EpiphanyCultMeshStatusEntry`, `EpiphanyCultMeshVersePolicyEntry`, and `EpiphanyCultMeshGlobalRoomPolicyEntry` round-trip smokes instead of treating raw CultNet as the ergonomic app-facing database layer - first local Verse query surface: `notes/epiphany-verse-architecture.md` names Verse/Odin/Yggdrasil ownership, and `epiphany-verse-query` can seed/query a compact CultMesh-backed local Verse context bundle for operator inspection and future dynamic prompt assembly without granting semantic memory, public sharing, or state-admission authority -- first dynamic prompt launch handoff: role/reorient worker launch documents carry optional `dynamicPromptContext`, runtime prompt assembly consumes that field into worker instructions, `epiphany-prompt-context-smoke` proves rendered Verse/memory context can ride a role launch document without admitting unrelated private-looking text, and live bridge role/reorient launch paths now feed local Verse plus memory graph context from sibling `local-verse.ccmp` and `memory-graph.msgpack` stores beside runtime-spine +- first dynamic prompt launch handoff: role/reorient worker launch documents carry optional `dynamicPromptContext`, runtime prompt assembly consumes that field into worker instructions, `epiphany-prompt-context-smoke` proves rendered Verse/memory context can ride a role launch document without admitting unrelated private-looking text, live bridge role/reorient launch paths now feed local Verse plus memory graph context from sibling `local-verse.ccmp` and `memory-graph.msgpack` stores beside runtime-spine, and the bridge launch-context test proves the dynamic packet survives in a persisted runtime-spine worker launch request - first Hands/Soul/Continuity contract catalogs: action, verification, and continuity now have native `epiphany-core` contract families, runtime-spine advertisement, CultMesh policy documents, and local CultMesh smoke coverage beside Mind/Substrate Gate/Eyes - live-specialist runner must be rebuilt around heartbeat/runtime-spine result receipts - first Phase 6 Aquarium operator shell extracted to sibling repo `E:\Projects\EpiphanyAquarium`, a Tauri v2 + React/WebGL client over the existing status bridge, dogfood artifacts, and GUI action artifacts, with its own distilled interface state/memory/doctrine plus durable checkpoint preparation, bounded status/coordinator artifact buttons, fixed modeling/verification/reorient launch and read-back buttons, and explicit review-gated reorient acceptance diff --git a/notes/epiphany-verse-architecture.md b/notes/epiphany-verse-architecture.md index 99186995..4a94b238 100644 --- a/notes/epiphany-verse-architecture.md +++ b/notes/epiphany-verse-architecture.md @@ -187,11 +187,13 @@ For swarm migration, the next useful chain is: 1. Keep `epiphany-verse-query` as the local Verse context smoke. 2. Add semantic memory graph query packets beside the Verse policy/status packet. -3. Add a launch/runtime smoke that proves a persisted worker request includes - relevant Verse/memory context and omits unrelated private sludge. -4. Move one Aquarium/local-run read path to the native Verse query before +3. Move one Aquarium/local-run read path to the native Verse query before increasing swarm cadence. +The bridge launch-context test is now the first launch/runtime smoke for this +chain. It renders dynamic context, opens a runtime-spine worker request, reloads +the persisted launch document, and asserts the Verse/memory packet survived. + No live swarm runner is cleared until pause/brake, stale active-turn recovery, Face eligibility, and memory lifecycle receipts remain inspectable through the same Verse model. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index e6ced5e9..deb49bde 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -48,7 +48,7 @@ remembers doctrine; the branch remembers the blade. - Native status now exposes that quarantined bridge spine without granting it authority. `runtime_spine_status` counts tool invocation intents, receipts, and pending calls; `runtime_tool_invocation_statuses` derives read-only intent/receipt status rows; `epiphany-runtime-spine status` reports the counts; and `epiphany-mvp-status --runtime-store ` renders the latest tool calls under `tools`. This is operator visibility only. The model-runtime feedback seam is also now typed: MCP-shaped model tool calls preserve the original provider `call_id` plus source model request id; `epiphany-model-runtime tool-followup` builds a provider-neutral follow-up `EpiphanyModelRequest` from completed typed tool receipts using the previous provider response id; and `epiphany-model-runtime tool-followup-turn` derives and runs that continuation through the selected provider in one runtime-owned operation. `epiphany-model-runtime run-worker --auto-tools --tool-adapter-bin ` now lets a launched worker automatically execute typed MCP intents through the quarantined Codex MCP adapter, feed receipts back through follow-up model turns, and only then parse/complete the worker result. Codex still executes the quarantined MCP edge; Epiphany owns the continuation request shape and invocation boundary. - The active foundation directive is now `notes/codex-starvation-and-cultnet-liberation-plan.md`. The previous Codex app-server control-plane rebuild made Epiphany less rotten inside Codex, but that is not the destination. Epiphany must become a native CultCache/CultMesh/CultNet runtime while remaining an honest modified Codex-derived backend for subscription auth/model use. Codex should remain relatively vanilla and keep doing Codex things, including useful app-server and streaming bridge affordances, but it must not own Epiphany state, processes, prompts, scheduler decisions, or policy. The bridge handles interop; Codex and Epiphany do not get to rummage around in each other's organs. - `notes/epiphany-cultmesh-dreaming-roadmap.md` is the new concrete design for distributed Epiphany dreaming. The invariant is hard: private state stays local; public dreams are separately authored typed documents distributed through CultMesh/CultNet; foreign dreams are thought weather until a reviewed local adoption receipt digests them. The first code slice should be dream schemas plus a local CultMesh-backed store, not public fanout. -- CultMesh is now the preferred Rust abstraction for that local store work. The compile-time Rust substrate is repo-contained: `vendor/cultcache-rs`, `vendor/cultnet-rs`, and `vendor/cultmesh-rs`. The old `E:\Projects\CultLib\crates\*` dependency body is dead in this checkout and must not be revived by accident. Vendored CultCache reads/writes `cultcache.store.v1`, so `state/ledgers.msgpack` and `epiphany-state status` are aligned again. The first integrations are deliberately small: status, Verse policy, global room policy, organ contract policy, native operator status, native operator snapshots, and local operator run intent/receipt round-trip through CultMesh. `notes/epiphany-verse-architecture.md` now names the local Verse/Odin/Yggdrasil architecture: Odin sees advertised Verse metadata without bypassing boundaries, Yggdrasil hosts important trusted GameCult Verses such as Bifrost, and prompt assembly should query compact local Verse plus semantic memory packets instead of carrying the whole archive. Role/reorient launch documents now have optional `dynamicPromptContext`; runtime prompt assembly consumes that field into worker instructions, `epiphany-prompt-context-smoke` proves a rendered Verse/memory packet is preserved on a role launch document, and live bridge role/reorient launches now feed local Verse plus memory graph context from sibling `local-verse.ccmp` and `memory-graph.msgpack` stores beside runtime-spine. The memory graph refreshes from current typed thread-state repo graphs when absent, so thin state remains visibly thin. Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-cultmesh-smoke`, `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-cultmesh-status -- smoke --store .\.epiphany-smoke\cultmesh\operator-status.ccmp --runtime-id epiphany-cultmesh-status-smoke`, `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-operator-snapshot -- smoke --store .\.epiphany-smoke\cultmesh\operator-snapshots.ccmp --runtime-id epiphany-operator-snapshot-smoke --snapshot-id smoke-status`, `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-operator-run -- smoke --store .\.epiphany-smoke\cultmesh\operator-runs.ccmp --runtime-id epiphany-operator-run-smoke --run-id smoke-run`, `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-verse-query -- smoke`, and `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-prompt-context-smoke` for the focused proofs. Future local dream/status/Verse work should start from CultMesh, not raw CultNet, unless the task is polishing the CultMesh internals themselves. Preserve the three Verse tiers: `epiphany-internal` for private sub-agent typed state, `gamecult-local` for trusted LAN/Yggdrasil-tunnel GameCult sharing, and `epiphany-global` for untrusted public dreams plus topic-specific threaded public rooms for Face posts. +- CultMesh is now the preferred Rust abstraction for that local store work. The compile-time Rust substrate is repo-contained: `vendor/cultcache-rs`, `vendor/cultnet-rs`, and `vendor/cultmesh-rs`. The old `E:\Projects\CultLib\crates\*` dependency body is dead in this checkout and must not be revived by accident. Vendored CultCache reads/writes `cultcache.store.v1`, so `state/ledgers.msgpack` and `epiphany-state status` are aligned again. The first integrations are deliberately small: status, Verse policy, global room policy, organ contract policy, native operator status, native operator snapshots, and local operator run intent/receipt round-trip through CultMesh. `notes/epiphany-verse-architecture.md` now names the local Verse/Odin/Yggdrasil architecture: Odin sees advertised Verse metadata without bypassing boundaries, Yggdrasil hosts important trusted GameCult Verses such as Bifrost, and prompt assembly should query compact local Verse plus semantic memory packets instead of carrying the whole archive. Role/reorient launch documents now have optional `dynamicPromptContext`; runtime prompt assembly consumes that field into worker instructions, `epiphany-prompt-context-smoke` proves a rendered Verse/memory packet is preserved on a role launch document, live bridge role/reorient launches now feed local Verse plus memory graph context from sibling `local-verse.ccmp` and `memory-graph.msgpack` stores beside runtime-spine, and the bridge launch-context test proves the packet survives into a persisted runtime-spine worker launch request. The memory graph refreshes from current typed thread-state repo graphs when absent, so thin state remains visibly thin. Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-cultmesh-smoke`, `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-cultmesh-status -- smoke --store .\.epiphany-smoke\cultmesh\operator-status.ccmp --runtime-id epiphany-cultmesh-status-smoke`, `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-operator-snapshot -- smoke --store .\.epiphany-smoke\cultmesh\operator-snapshots.ccmp --runtime-id epiphany-operator-snapshot-smoke --snapshot-id smoke-status`, `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-operator-run -- smoke --store .\.epiphany-smoke\cultmesh\operator-runs.ccmp --runtime-id epiphany-operator-run-smoke --run-id smoke-run`, `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-verse-query -- smoke`, and `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-prompt-context-smoke` for the focused proofs. Future local dream/status/Verse work should start from CultMesh, not raw CultNet, unless the task is polishing the CultMesh internals themselves. Preserve the three Verse tiers: `epiphany-internal` for private sub-agent typed state, `gamecult-local` for trusted LAN/Yggdrasil-tunnel GameCult sharing, and `epiphany-global` for untrusted public dreams plus topic-specific threaded public rooms for Face posts. - `notes/codex-auth-spine-inventory.md` is the source-grounded keeper list for that reliquary. Corrected compliance invariant: Codex-compatible auth identity stays anchored in vendored Codex-derived auth machinery. `epiphany-openai-auth-spine` is now a thin Epiphany-named boundary over `codex-login`, not a clean-room clone of credential storage or token refresh. Codex apps, skills, marketplace, plugin UX, broad app-server workflow, and JSON-RPC sprawl remain cuttable because they are not subscription-auth legitimacy. - Edge JSON is allowed for schema description, hostile ingress before immediate typed parsing, sealed forensic artifacts, or named quarantine experiments. When both subsystems are ours, runtime data must remain typed CultCache documents and move over CultNet typed contracts. Generic `serde_json::Value` in worker launch/result/selfPatch/runtime flow is contamination until classified and replaced. - `notes/epiphany-swarm-readiness-plan.md` is the current live-fire direction gate. The local runner proves startup/status/coordinator wiring; it does not authorize unattended swarm operation. Carry VoidBot's lessons forward: one CTB-style initiative scheduler, typed pause/brake, active-turn freeze, cooldown after completion, stale active-turn recovery receipts, parent-side speech eligibility, memory lifecycle phases, and typed operation proposals instead of prompt-owned governance. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index cda6c209d925f05d3e7f91383ea2ec4d111b9012..329f5e1f4c5b80ceaafc94b0f09156929d265228 100644 GIT binary patch delta 268 zcmbPpmTSRzt__lmT$WZwmQlwTn3mOUR%R?@Wc=Mcm8pFy6XW)&Oib)cM5pXDGB7gJ zH2@-`5JO`tLy-E(3&q9!Z(esQ%1lX5Rme#!%}dVEP0r6NNv$YRD9+8#PF2XuFIOl^ z%}YrwDpm*s5~=#Rsk!+@l?o}9d5O81$qG>AItuv(sd>c;iPJ9@GKrOBrot__lmTxM1V=26EOn3h&