diff --git a/epiphany-core/src/bin/epiphany-cultmesh-smoke.rs b/epiphany-core/src/bin/epiphany-cultmesh-smoke.rs index 9f138819..d2ceba61 100644 --- a/epiphany-core/src/bin/epiphany-cultmesh-smoke.rs +++ b/epiphany-core/src/bin/epiphany-cultmesh-smoke.rs @@ -3,6 +3,8 @@ use epiphany_core::EPIPHANY_CULTMESH_INTERNAL_TIER; use epiphany_core::EPIPHANY_CULTMESH_INTERNAL_VERSE_ID; use epiphany_core::EPIPHANY_CULTMESH_STATUS_SCHEMA_VERSION; use epiphany_core::EpiphanyCultMeshStatusEntry; +use epiphany_core::default_epiphany_cultmesh_operator_status; +use epiphany_core::load_epiphany_cultmesh_operator_status; use epiphany_core::load_epiphany_cultmesh_status; use epiphany_core::write_epiphany_cultmesh_body_contracts; use epiphany_core::write_epiphany_cultmesh_eyes_contracts; @@ -10,6 +12,7 @@ use epiphany_core::write_epiphany_cultmesh_global_room_policies; use epiphany_core::write_epiphany_cultmesh_hands_contracts; use epiphany_core::write_epiphany_cultmesh_life_contracts; use epiphany_core::write_epiphany_cultmesh_mind_contracts; +use epiphany_core::write_epiphany_cultmesh_operator_status; use epiphany_core::write_epiphany_cultmesh_soul_contracts; use epiphany_core::write_epiphany_cultmesh_status; use epiphany_core::write_epiphany_cultmesh_verse_policies; @@ -39,10 +42,20 @@ fn main() -> Result<()> { write_epiphany_cultmesh_hands_contracts(&store, "epiphany-cultmesh-smoke")?; write_epiphany_cultmesh_soul_contracts(&store, "epiphany-cultmesh-smoke")?; write_epiphany_cultmesh_life_contracts(&store, "epiphany-cultmesh-smoke")?; + let operator_status = default_epiphany_cultmesh_operator_status( + "epiphany-cultmesh-smoke", + "2026-05-27T00:00:00Z", + ); + write_epiphany_cultmesh_operator_status(&store, operator_status.clone())?; let loaded = load_epiphany_cultmesh_status(&store, "epiphany-cultmesh-smoke")?; if loaded != Some(status) { anyhow::bail!("CultMesh smoke failed to round-trip Epiphany status document"); } + let loaded_operator_status = + load_epiphany_cultmesh_operator_status(&store, "epiphany-cultmesh-smoke")?; + if loaded_operator_status != Some(operator_status) { + anyhow::bail!("CultMesh smoke failed to round-trip Epiphany operator status document"); + } println!( "epiphany cultmesh smoke ok: {}", diff --git a/epiphany-core/src/bin/epiphany-cultmesh-status.rs b/epiphany-core/src/bin/epiphany-cultmesh-status.rs new file mode 100644 index 00000000..f70ba16d --- /dev/null +++ b/epiphany-core/src/bin/epiphany-cultmesh-status.rs @@ -0,0 +1,99 @@ +use anyhow::Context; +use anyhow::Result; +use chrono::Utc; +use epiphany_core::default_epiphany_cultmesh_operator_status; +use epiphany_core::load_epiphany_cultmesh_operator_status; +use epiphany_core::write_epiphany_cultmesh_operator_status; +use serde_json::json; +use std::env; +use std::path::PathBuf; + +fn main() -> Result<()> { + let args = Args::parse()?; + match args.command.as_str() { + "write" => { + let status = default_epiphany_cultmesh_operator_status( + args.runtime_id.clone(), + Utc::now().to_rfc3339(), + ); + let written = write_epiphany_cultmesh_operator_status(&args.store, status)?; + println!( + "{}", + serde_json::to_string_pretty(&json!({ + "status": "written", + "store": args.store, + "document": written, + }))? + ); + } + "read" => { + let loaded = load_epiphany_cultmesh_operator_status(&args.store, &args.runtime_id)?; + println!( + "{}", + serde_json::to_string_pretty(&json!({ + "status": if loaded.is_some() { "ready" } else { "missing" }, + "store": args.store, + "document": loaded, + }))? + ); + } + "smoke" => { + let status = default_epiphany_cultmesh_operator_status( + args.runtime_id.clone(), + "2026-05-27T00:00:00Z", + ); + write_epiphany_cultmesh_operator_status(&args.store, status.clone())?; + let loaded = load_epiphany_cultmesh_operator_status(&args.store, &args.runtime_id)?; + if loaded != Some(status) { + anyhow::bail!("operator status did not round-trip through CultMesh"); + } + println!( + "{}", + serde_json::to_string_pretty(&json!({ + "status": "ok", + "store": args.store, + "runtimeId": args.runtime_id, + }))? + ); + } + other => anyhow::bail!("unknown command {other:?}; use write, read, or smoke"), + } + Ok(()) +} + +struct Args { + command: String, + store: PathBuf, + runtime_id: String, +} + +impl Args { + fn parse() -> Result { + let mut values = env::args().skip(1); + let command = values.next().unwrap_or_else(|| "read".to_string()); + let mut store = PathBuf::from(".epiphany-run/cultmesh/operator-status.ccmp"); + let mut runtime_id = "epiphany-local".to_string(); + + while let Some(arg) = values.next() { + match arg.as_str() { + "--store" => { + store = PathBuf::from(values.next().context("missing --store value")?); + } + "--runtime-id" => { + runtime_id = values.next().context("missing --runtime-id value")?; + } + _ => anyhow::bail!("unknown argument {arg:?}"), + } + } + + if let Some(parent) = store.parent() { + std::fs::create_dir_all(parent)?; + } + + Ok(Self { + command, + store, + runtime_id, + }) + } +} diff --git a/epiphany-core/src/cultmesh_integration.rs b/epiphany-core/src/cultmesh_integration.rs index 8d3d1a98..6876f944 100644 --- a/epiphany-core/src/cultmesh_integration.rs +++ b/epiphany-core/src/cultmesh_integration.rs @@ -15,6 +15,10 @@ use std::path::Path; pub const EPIPHANY_CULTMESH_STATUS_TYPE: &str = "epiphany.cultmesh.status"; pub const EPIPHANY_CULTMESH_STATUS_SCHEMA_VERSION: &str = "epiphany.cultmesh.status.v0"; pub const EPIPHANY_CULTMESH_STATUS_KEY: &str = "epiphany-local/status"; +pub const EPIPHANY_CULTMESH_OPERATOR_STATUS_TYPE: &str = "epiphany.cultmesh.operator_status"; +pub const EPIPHANY_CULTMESH_OPERATOR_STATUS_SCHEMA_VERSION: &str = + "epiphany.cultmesh.operator_status.v0"; +pub const EPIPHANY_CULTMESH_OPERATOR_STATUS_KEY: &str = "epiphany-local/operator-status"; pub const EPIPHANY_CULTMESH_VERSE_POLICY_TYPE: &str = "epiphany.cultmesh.verse_policy"; pub const EPIPHANY_CULTMESH_VERSE_POLICY_SCHEMA_VERSION: &str = "epiphany.cultmesh.verse_policy.v0"; pub const EPIPHANY_CULTMESH_GLOBAL_ROOM_POLICY_TYPE: &str = "epiphany.cultmesh.global_room_policy"; @@ -65,6 +69,38 @@ pub struct EpiphanyCultMeshStatusEntry { pub verse_tier: String, } +#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] +#[cultcache( + type = "epiphany.cultmesh.operator_status", + schema = "EpiphanyCultMeshOperatorStatusEntry" +)] +pub struct EpiphanyCultMeshOperatorStatusEntry { + #[cultcache(key = 0)] + pub schema_version: String, + #[cultcache(key = 1)] + pub runtime_id: String, + #[cultcache(key = 2)] + pub verse_id: String, + #[cultcache(key = 3)] + pub surface_id: String, + #[cultcache(key = 4)] + pub status: String, + #[cultcache(key = 5)] + pub generated_at_utc: String, + #[cultcache(key = 6)] + pub summary: String, + #[cultcache(key = 7)] + pub codex_bridge_role: String, + #[cultcache(key = 8)] + pub epiphany_authority_role: String, + #[cultcache(key = 9)] + pub prompt_authority: String, + #[cultcache(key = 10)] + pub native_authorities: Vec, + #[cultcache(key = 11)] + pub quarantined_surfaces: Vec, +} + #[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] #[cultcache( type = "epiphany.cultmesh.verse_policy", @@ -287,6 +323,7 @@ pub struct EpiphanyCultMeshLifeContractEntry { cultmesh_documents!(EpiphanyCultMeshDocuments { EpiphanyCultMeshStatusEntry => EPIPHANY_CULTMESH_STATUS_SCHEMA_VERSION, + EpiphanyCultMeshOperatorStatusEntry => EPIPHANY_CULTMESH_OPERATOR_STATUS_SCHEMA_VERSION, EpiphanyCultMeshVersePolicyEntry => EPIPHANY_CULTMESH_VERSE_POLICY_SCHEMA_VERSION, EpiphanyCultMeshGlobalRoomPolicyEntry => EPIPHANY_CULTMESH_GLOBAL_ROOM_POLICY_SCHEMA_VERSION, EpiphanyCultMeshMindContractEntry => EPIPHANY_CULTMESH_MIND_CONTRACT_SCHEMA_VERSION, @@ -329,6 +366,60 @@ pub fn load_epiphany_cultmesh_status( node.get(EPIPHANY_CULTMESH_STATUS_KEY) } +pub fn default_epiphany_cultmesh_operator_status( + runtime_id: impl Into, + generated_at_utc: impl Into, +) -> EpiphanyCultMeshOperatorStatusEntry { + EpiphanyCultMeshOperatorStatusEntry { + schema_version: EPIPHANY_CULTMESH_OPERATOR_STATUS_SCHEMA_VERSION.to_string(), + runtime_id: runtime_id.into(), + verse_id: EPIPHANY_CULTMESH_INTERNAL_VERSE_ID.to_string(), + surface_id: "epiphany.operator.status".to_string(), + status: "ready".to_string(), + generated_at_utc: generated_at_utc.into(), + summary: + "Epiphany operator status is native typed state; Codex is bridge transport, not policy owner." + .to_string(), + codex_bridge_role: + "relatively vanilla Codex may provide OpenAI auth/model transport, streaming, and Codex-native app-server affordances." + .to_string(), + epiphany_authority_role: + "Epiphany owns state, processes, prompts, scheduler decisions, organ contracts, and mutation law." + .to_string(), + prompt_authority: + "Codex prompt machinery must not inject doctrine, role instructions, state law, or coordinator policy into Epiphany agents." + .to_string(), + native_authorities: vec![ + "CultCache typed documents".to_string(), + "CultMesh local Verse store".to_string(), + "CultNet read/mutation/event contracts".to_string(), + "Epiphany organ receipt gates".to_string(), + ], + quarantined_surfaces: vec![ + "Rider bridge".to_string(), + "Unity bridge".to_string(), + ], + } +} + +pub fn write_epiphany_cultmesh_operator_status( + store_path: impl AsRef, + status: EpiphanyCultMeshOperatorStatusEntry, +) -> Result { + let mut node = open_epiphany_cultmesh_node(&store_path, status.runtime_id.clone())?; + let written = node.put(EPIPHANY_CULTMESH_OPERATOR_STATUS_KEY, &status)?; + node.flush()?; + Ok(written) +} + +pub fn load_epiphany_cultmesh_operator_status( + store_path: impl AsRef, + runtime_id: impl Into, +) -> Result> { + let node = open_epiphany_cultmesh_node(store_path, runtime_id)?; + node.get(EPIPHANY_CULTMESH_OPERATOR_STATUS_KEY) +} + pub fn epiphany_cultmesh_verse_policies() -> Vec { vec![ EpiphanyCultMeshVersePolicyEntry { @@ -655,6 +746,26 @@ mod tests { Ok(()) } + #[test] + fn operator_status_round_trips_as_native_cultmesh_document() -> Result<()> { + let temp = tempfile::tempdir()?; + let store = temp.path().join("epiphany-operator-status.ccmp"); + let status = + default_epiphany_cultmesh_operator_status("epiphany-test", "2026-05-27T00:00:00Z"); + + write_epiphany_cultmesh_operator_status(&store, status.clone())?; + let loaded = load_epiphany_cultmesh_operator_status(&store, "epiphany-test")?; + + assert_eq!(loaded, Some(status)); + let node = open_epiphany_cultmesh_node(&store, "epiphany-test")?; + assert!( + node.documents() + .binding(EPIPHANY_CULTMESH_OPERATOR_STATUS_TYPE) + .is_some() + ); + Ok(()) + } + #[test] fn builtin_verse_policies_keep_public_and_private_boundaries_apart() -> Result<()> { let temp = tempfile::tempdir()?; diff --git a/epiphany-core/src/lib.rs b/epiphany-core/src/lib.rs index 6a022aeb..3fc17581 100644 --- a/epiphany-core/src/lib.rs +++ b/epiphany-core/src/lib.rs @@ -97,6 +97,9 @@ pub use cultmesh_integration::EPIPHANY_CULTMESH_LOCAL_AREA_TIER; pub use cultmesh_integration::EPIPHANY_CULTMESH_LOCAL_AREA_VERSE_ID; pub use cultmesh_integration::EPIPHANY_CULTMESH_MIND_CONTRACT_SCHEMA_VERSION; pub use cultmesh_integration::EPIPHANY_CULTMESH_MIND_CONTRACT_TYPE; +pub use cultmesh_integration::EPIPHANY_CULTMESH_OPERATOR_STATUS_KEY; +pub use cultmesh_integration::EPIPHANY_CULTMESH_OPERATOR_STATUS_SCHEMA_VERSION; +pub use cultmesh_integration::EPIPHANY_CULTMESH_OPERATOR_STATUS_TYPE; pub use cultmesh_integration::EPIPHANY_CULTMESH_SOUL_CONTRACT_SCHEMA_VERSION; pub use cultmesh_integration::EPIPHANY_CULTMESH_SOUL_CONTRACT_TYPE; pub use cultmesh_integration::EPIPHANY_CULTMESH_STATUS_KEY; @@ -111,9 +114,11 @@ pub use cultmesh_integration::EpiphanyCultMeshGlobalRoomPolicyEntry; pub use cultmesh_integration::EpiphanyCultMeshHandsContractEntry; pub use cultmesh_integration::EpiphanyCultMeshLifeContractEntry; pub use cultmesh_integration::EpiphanyCultMeshMindContractEntry; +pub use cultmesh_integration::EpiphanyCultMeshOperatorStatusEntry; pub use cultmesh_integration::EpiphanyCultMeshSoulContractEntry; pub use cultmesh_integration::EpiphanyCultMeshStatusEntry; pub use cultmesh_integration::EpiphanyCultMeshVersePolicyEntry; +pub use cultmesh_integration::default_epiphany_cultmesh_operator_status; pub use cultmesh_integration::epiphany_cultmesh_body_contracts; pub use cultmesh_integration::epiphany_cultmesh_eyes_contracts; pub use cultmesh_integration::epiphany_cultmesh_global_room_policies; @@ -122,6 +127,7 @@ pub use cultmesh_integration::epiphany_cultmesh_life_contracts; pub use cultmesh_integration::epiphany_cultmesh_mind_contracts; pub use cultmesh_integration::epiphany_cultmesh_soul_contracts; pub use cultmesh_integration::epiphany_cultmesh_verse_policies; +pub use cultmesh_integration::load_epiphany_cultmesh_operator_status; pub use cultmesh_integration::load_epiphany_cultmesh_status; pub use cultmesh_integration::open_epiphany_cultmesh_node; pub use cultmesh_integration::write_epiphany_cultmesh_body_contracts; @@ -130,6 +136,7 @@ pub use cultmesh_integration::write_epiphany_cultmesh_global_room_policies; pub use cultmesh_integration::write_epiphany_cultmesh_hands_contracts; pub use cultmesh_integration::write_epiphany_cultmesh_life_contracts; pub use cultmesh_integration::write_epiphany_cultmesh_mind_contracts; +pub use cultmesh_integration::write_epiphany_cultmesh_operator_status; pub use cultmesh_integration::write_epiphany_cultmesh_soul_contracts; pub use cultmesh_integration::write_epiphany_cultmesh_status; pub use cultmesh_integration::write_epiphany_cultmesh_verse_policies; diff --git a/epiphany-core/src/runtime_spine.rs b/epiphany-core/src/runtime_spine.rs index b7186174..b6f839ae 100644 --- a/epiphany-core/src/runtime_spine.rs +++ b/epiphany-core/src/runtime_spine.rs @@ -12,6 +12,8 @@ use crate::body_gateway::BODY_REPO_MUTATION_RECEIPT_SCHEMA_VERSION; use crate::body_gateway::BODY_REPO_MUTATION_RECEIPT_TYPE; use crate::body_gateway::BODY_REPO_SNAPSHOT_RECEIPT_SCHEMA_VERSION; use crate::body_gateway::BODY_REPO_SNAPSHOT_RECEIPT_TYPE; +use crate::cultmesh_integration::EPIPHANY_CULTMESH_OPERATOR_STATUS_SCHEMA_VERSION; +use crate::cultmesh_integration::EPIPHANY_CULTMESH_OPERATOR_STATUS_TYPE; use crate::eyes_gateway::EYES_EVIDENCE_PACKET_SCHEMA_VERSION; use crate::eyes_gateway::EYES_EVIDENCE_PACKET_TYPE; use crate::eyes_gateway::EYES_EVIDENCE_REFUSAL_RECEIPT_SCHEMA_VERSION; @@ -107,8 +109,6 @@ pub const SURFACE_FACE_TYPE: &str = "epiphany.surface.face"; pub const SURFACE_VOID_MEMORY_TYPE: &str = "epiphany.surface.void_memory"; pub const SURFACE_REPO_INITIALIZATION_TYPE: &str = "epiphany.surface.repo_initialization"; pub const SURFACE_REPO_BIRTH_RUNNER_TYPE: &str = "epiphany.surface.repo_birth_runner"; -pub const SURFACE_RIDER_BRIDGE_TYPE: &str = "epiphany.surface.rider_bridge"; -pub const SURFACE_UNITY_BRIDGE_TYPE: &str = "epiphany.surface.unity_bridge"; pub const RUNTIME_IDENTITY_KEY: &str = "self"; pub const RUNTIME_SPINE_SCHEMA_VERSION: &str = "epiphany.runtime_spine.v0"; pub const RUNTIME_WORKER_LAUNCH_REQUEST_SCHEMA_VERSION: &str = @@ -139,8 +139,6 @@ pub const VOID_MEMORY_SURFACE_SCHEMA_VERSION: &str = "epiphany.void_memory_surfa pub const REPO_INITIALIZATION_SURFACE_SCHEMA_VERSION: &str = "epiphany.repo_initialization_surface.v0"; pub const REPO_BIRTH_RUNNER_SURFACE_SCHEMA_VERSION: &str = "epiphany.repo_birth_runner_surface.v0"; -pub const RIDER_BRIDGE_SURFACE_SCHEMA_VERSION: &str = "epiphany.rider_bridge_surface.v0"; -pub const UNITY_BRIDGE_SURFACE_SCHEMA_VERSION: &str = "epiphany.unity_bridge_surface.v0"; pub const AGENT_MEMORY_PAYLOAD_SCHEMA_VERSION: &str = "epiphany.agent_memory.v0"; pub const CULTNET_SCHEMA_INDEX_RELATIVE: &str = "schemas/cultnet/index.json"; @@ -2138,6 +2136,18 @@ fn epiphany_mutation_contracts() -> Vec { "The unified memory graph is typed durable state; Qdrant embeddings are rebuildable cache, not canonical memory.", ], ), + mutation_contract( + EPIPHANY_CULTMESH_OPERATOR_STATUS_TYPE, + EPIPHANY_CULTMESH_OPERATOR_STATUS_SCHEMA_VERSION, + vec![CultNetDocumentOperation::Snapshot], + CultNetMutationAuthority::ReadOnly, + vec![], + vec![], + vec![ + "Native operator status is a CultMesh document; Codex app-server status is bridge/display compatibility.", + "This surface names the Codex bridge role, Epiphany authority role, prompt-authority boundary, and quarantined optional bridges.", + ], + ), read_only_surface_contract( SURFACE_SCENE_TYPE, SCENE_SURFACE_SCHEMA_VERSION, @@ -2322,35 +2332,6 @@ fn epiphany_mutation_contracts() -> Vec { "Aquarium should review birth artifacts and accept them explicitly instead of growing a hidden wizard.", ], ), - coordinator_surface_contract( - SURFACE_RIDER_BRIDGE_TYPE, - RIDER_BRIDGE_SURFACE_SCHEMA_VERSION, - vec![ - "epiphany.rider_status_intent.v0", - "epiphany.rider_context_intent.v0", - "epiphany.rider_open_ref_intent.v0", - ], - vec!["epiphany.swarm_control_receipt.v0"], - vec![ - "Rider bridge affordances are projected from typed Rider bridge artifacts.", - "Use this surface for source/IDE inspection instead of scraping local artifacts by convention.", - ], - ), - coordinator_surface_contract( - SURFACE_UNITY_BRIDGE_TYPE, - UNITY_BRIDGE_SURFACE_SCHEMA_VERSION, - vec![ - "epiphany.unity_inspect_intent.v0", - "epiphany.unity_probe_intent.v0", - "epiphany.unity_check_compilation_intent.v0", - "epiphany.unity_run_tests_intent.v0", - ], - vec!["epiphany.swarm_control_receipt.v0"], - vec![ - "Unity bridge affordances are projected from typed Unity bridge artifacts.", - "Runtime/editor truth must come through the pinned bridge and its receipts, not wishful source reading.", - ], - ), ] } @@ -2910,17 +2891,35 @@ mod tests { .iter() .any(|item| item == "epiphany.face_bubble.v0")) ); - let unity_contract = contracts + let operator_status_contract = contracts .iter() - .find(|contract| contract.document_type == SURFACE_UNITY_BRIDGE_TYPE) - .expect("unity bridge surface should advertise an interactive contract"); + .find(|contract| { + contract.document_type == EPIPHANY_CULTMESH_OPERATOR_STATUS_TYPE + }) + .expect("operator status should advertise a read-only CultMesh document"); + assert_eq!( + operator_status_contract.authority, + CultNetMutationAuthority::ReadOnly + ); assert!( - unity_contract - .intent_document_types + operator_status_contract + .notes .as_ref() - .is_some_and(|items| items - .iter() - .any(|item| item == "epiphany.unity_probe_intent.v0")) + .is_some_and(|notes| { + notes + .iter() + .any(|note| note.contains("Codex app-server status is bridge")) + }) + ); + assert!( + contracts + .iter() + .all(|contract| contract.document_type != "epiphany.surface.rider_bridge") + ); + assert!( + contracts + .iter() + .all(|contract| contract.document_type != "epiphany.surface.unity_bridge") ); let birth_contract = contracts .iter() @@ -3044,6 +3043,23 @@ mod tests { schema.document_type.as_deref() == Some(THREAD_STATE_TYPE) && schema.schema_version.as_deref() == Some(THREAD_STATE_SCHEMA_VERSION) })); + assert!(schemas.iter().any(|schema| { + schema.document_type.as_deref() == Some(EPIPHANY_CULTMESH_OPERATOR_STATUS_TYPE) + && schema.schema_version.as_deref() + == Some(EPIPHANY_CULTMESH_OPERATOR_STATUS_SCHEMA_VERSION) + })); + assert!( + !schemas.iter().any(|schema| { + schema.document_type.as_deref() == Some("epiphany.surface.rider_bridge") + }), + "Rider bridge schema is quarantined and should not be advertised in the active catalog" + ); + assert!( + !schemas.iter().any(|schema| { + schema.document_type.as_deref() == Some("epiphany.surface.unity_bridge") + }), + "Unity bridge schema is quarantined and should not be advertised in the active catalog" + ); Ok(()) } } diff --git a/epiphany-core/tests/cultnet_backend.rs b/epiphany-core/tests/cultnet_backend.rs index 8376835f..3482a32d 100644 --- a/epiphany-core/tests/cultnet_backend.rs +++ b/epiphany-core/tests/cultnet_backend.rs @@ -20,7 +20,9 @@ fn epiphany_agent_memory_can_move_over_cultnet_documents() -> Result<()> { let mut registry = CultNetDocumentRegistry::new(); registry.register( - CultNetDocumentBinding::for_entry::("ghostlight.agent_state.v0"), + CultNetDocumentBinding::for_entry::(Some( + "ghostlight.agent_state.v0".to_string(), + )), ); let snapshot = registry.create_snapshot_response( &source_cache, diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 5d451faa..7ddc2330 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -36,7 +36,7 @@ remembers doctrine; the branch remembers the blade. - The repo now has a one-command local operator path: `.\tools\epiphany_local_run.ps1`. Default mode is `smoke`; it builds the retained Codex app-server compatibility edge, builds native Epiphany operator binaries, runs the coordinator smoke, and writes launcher artifacts under `.epiphany-run/` plus coordinator artifacts under `.epiphany-dogfood/`. Use `-Mode status`, `-Mode plan`, or `-Mode run -MaxSteps 4` for the other current entrypoints; add `-ThreadId ` and `-Workspace ` to inspect or continue an existing thread. `status`, `plan`, and `smoke` do not spend model calls; `run` builds and uses `epiphany-openai-runtime`. - 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 integration is deliberately small: `EpiphanyCultMeshStatusEntry`, `EpiphanyCultMeshVersePolicyEntry`, and `EpiphanyCultMeshGlobalRoomPolicyEntry` round-trip through `.epiphany-smoke/cultmesh/epiphany-local.ccmp` using `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-cultmesh-smoke`. 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, and native operator status round-trip through `.epiphany-smoke/cultmesh/epiphany-local.ccmp` using `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` specifically proves the operator-status document. 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. @@ -1313,7 +1313,10 @@ Rider/Unity bridge construction is now quarantined rather than the next real move. The pinned Unity bridge, Aetheria-side resident package, GUI Environment surface, EpiphanyGraph dashboard, Rider bridge CLI, and unverified Rider plugin scaffold remain useful later engine-repo evidence surfaces, but they are not -essential to the MVP. The next real move is Codex starvation: keep Codex mostly +essential to the MVP. Runtime-spine and the active CultNet schema catalog no +longer advertise Rider/Unity bridge contracts; the schema files remain as +sealed optional evidence for later, not active MVP authority. The next real move +is Codex starvation: keep Codex mostly vanilla as the OpenAI/app-server bridge while Epiphany owns its state, processes, prompt authority, scheduler, and policy through typed CultCache/CultMesh/CultNet organs. When engine dogfood resumes, the diff --git a/schemas/cultnet/epiphany.cultmesh.operator-status.schema.json b/schemas/cultnet/epiphany.cultmesh.operator-status.schema.json new file mode 100644 index 00000000..7b461560 --- /dev/null +++ b/schemas/cultnet/epiphany.cultmesh.operator-status.schema.json @@ -0,0 +1,68 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://gamecult.dev/epiphany/cultnet/epiphany.cultmesh.operator-status.schema.json", + "title": "Epiphany CultMesh Operator Status", + "description": "Native operator-status document naming the Codex bridge role, Epiphany authority role, prompt boundary, and quarantined optional bridge surfaces.", + "type": "object", + "additionalProperties": false, + "properties": { + "schemaVersion": { + "type": "string", + "const": "epiphany.cultmesh.operator_status.v0" + }, + "runtimeId": { + "type": "string" + }, + "verseId": { + "type": "string" + }, + "surfaceId": { + "type": "string" + }, + "status": { + "type": "string" + }, + "generatedAtUtc": { + "type": "string" + }, + "summary": { + "type": "string" + }, + "codexBridgeRole": { + "type": "string", + "description": "What Codex may do for this Epiphany instance: bridge OpenAI/model transport, streaming, and Codex-native app-server affordances." + }, + "epiphanyAuthorityRole": { + "type": "string", + "description": "What Epiphany owns: state, processes, prompts, scheduler decisions, organ contracts, and mutation law." + }, + "promptAuthority": { + "type": "string", + "description": "Boundary forbidding Codex prompt machinery from injecting doctrine, role instructions, state law, or coordinator policy into Epiphany agents." + }, + "nativeAuthorities": { + "type": "array", + "items": { + "type": "string" + } + }, + "quarantinedSurfaces": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "schemaVersion", + "runtimeId", + "verseId", + "surfaceId", + "status", + "generatedAtUtc", + "summary", + "codexBridgeRole", + "epiphanyAuthorityRole", + "promptAuthority" + ] +} diff --git a/schemas/cultnet/index.json b/schemas/cultnet/index.json index b3abcb94..9b2d7f25 100644 --- a/schemas/cultnet/index.json +++ b/schemas/cultnet/index.json @@ -188,6 +188,17 @@ "title": "Epiphany Memory Graph", "path": "epiphany.memory-graph.schema.json" }, + { + "schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.cultmesh.operator-status.schema.json", + "kind": "document_payload", + "wireContracts": [ + "cultnet.schema.v0" + ], + "schemaVersion": "epiphany.cultmesh.operator_status.v0", + "documentType": "epiphany.cultmesh.operator_status", + "title": "Epiphany CultMesh Operator Status", + "path": "epiphany.cultmesh.operator-status.schema.json" + }, { "schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.surface.scene.schema.json", "kind": "document_payload", @@ -375,28 +386,6 @@ "title": "Epiphany repo-birth-runner", "path": "epiphany.surface.repo-birth-runner.schema.json" }, - { - "schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.surface.rider-bridge.schema.json", - "kind": "document_payload", - "wireContracts": [ - "cultnet.schema.v0" - ], - "schemaVersion": "epiphany.rider_bridge_surface.v0", - "documentType": "epiphany.surface.rider_bridge", - "title": "Epiphany rider-bridge", - "path": "epiphany.surface.rider-bridge.schema.json" - }, - { - "schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.surface.unity-bridge.schema.json", - "kind": "document_payload", - "wireContracts": [ - "cultnet.schema.v0" - ], - "schemaVersion": "epiphany.unity_bridge_surface.v0", - "documentType": "epiphany.surface.unity_bridge", - "title": "Epiphany unity-bridge", - "path": "epiphany.surface.unity-bridge.schema.json" - }, { "schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.runtime.session_intent.v0.schema.json", "kind": "document_payload", diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 4fbec02c..abc25f7c 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index 4e312490..4bbf8f15 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -107,7 +107,7 @@ active_subgoals: accepted_design: - Distributed Epiphany dreaming is a CultMesh typed-document problem, not prompt folklore. CultCache owns local typed documents, Epiphany owns export/import/adoption policy, CultNet owns wire/provenance/shard delivery, and CultMesh owns Verses, peer exchange, leases, shard logs, replicas, and watchable runtime surfaces. Start with local dream document types and a local store before public Verse wiring. - - The first Rust CultMesh integration slice is landed and repaired to compile from repo-contained vendored crates. `vendor/cultmesh-rs` is a small Rust node/database facade over vendored CultCache and CultNet with document-set registration and durable typed put/get/delete. `vendor/cultcache-rs` now reads and writes the `cultcache.store.v1` snapshot format used by `state/ledgers.msgpack`, so `epiphany-state status` is a working re-entry rite again. `epiphany-core` depends on `vendor/cultcache-rs`, `vendor/cultnet-rs`, and `vendor/cultmesh-rs`, exposes an `EpiphanyCultMeshStatusEntry`, records typed `EpiphanyCultMeshVersePolicyEntry` documents for the internal/local-area/global Verse tiers, and records typed `EpiphanyCultMeshGlobalRoomPolicyEntry` documents for threaded public global rooms such as dreams, architecture, research, faces, GameCult, and governance. + - The first Rust CultMesh integration slice is landed and repaired to compile from repo-contained vendored crates. `vendor/cultmesh-rs` is a small Rust node/database facade over vendored CultCache and CultNet with document-set registration and durable typed put/get/delete. `vendor/cultcache-rs` now reads and writes the `cultcache.store.v1` snapshot format used by `state/ledgers.msgpack`, so `epiphany-state status` is a working re-entry rite again. `epiphany-core` depends on `vendor/cultcache-rs`, `vendor/cultnet-rs`, and `vendor/cultmesh-rs`, exposes an `EpiphanyCultMeshStatusEntry`, records typed `EpiphanyCultMeshVersePolicyEntry` documents for the internal/local-area/global Verse tiers, and records typed `EpiphanyCultMeshGlobalRoomPolicyEntry` documents for threaded public global rooms such as dreams, architecture, research, faces, GameCult, and governance. Native operator status is now a typed `EpiphanyCultMeshOperatorStatusEntry` in the internal Verse; it names Codex as bridge transport, Epiphany as authority owner, prompt-authority separation, and the quarantined Rider/Unity optional surfaces. - Mind's CultNet contract surface is native enough for the next Aquarium/CultMesh cut: `epiphany-core::mind_gateway` defines thought, state-effect proposal, gateway-review, commit-receipt, rejection-receipt, and Verse-adoption document contracts; runtime-spine advertises those mutation/read contracts; CultMesh persists matching `EpiphanyCultMeshMindContractEntry` policy documents so the private state guardian boundary is inspectable as typed state. - Body's repo-access contract surface is now named beside Mind's state gate: `epiphany-core::body_gateway` defines repo access requests, access reviews, grant/refusal receipts, snapshot receipts, and mutation receipts; runtime-spine advertises those contracts; CultMesh persists matching `EpiphanyCultMeshBodyContractEntry` policy documents so repo substrate access has its own typed guardian instead of hiding behind worker launch scope. - Eyes' evidence contract surface is named beside Body and Mind: `epiphany-core::eyes_gateway` defines evidence requests, evidence reviews, source lookup receipts, evidence packets, and evidence refusal receipts; runtime-spine advertises those contracts; CultMesh persists matching `EpiphanyCultMeshEyesContractEntry` policy documents so retrieved snippets and source reads are not confused with inspected evidence. @@ -477,4 +477,8 @@ current_status: `.epiphany-run/` plus coordinator evidence under `.epiphany-dogfood/`. This is scaffolding over the current compatibility shell, not a new policy owner. - next_action: Continue Codex starvation and CultNet liberation through CultMesh-first local surfaces. The next cut should replace another local operator/status/dream path with a typed CultMesh node document before public Verse fanout or app-wide deployment claims. + Native CultMesh operator status is landed too: `epiphany-core` can write, + read, and smoke `epiphany.cultmesh.operator_status.v0`; runtime-spine + advertises it as the read-only operator status contract, and the active + schema catalog no longer advertises Rider/Unity bridge surfaces. + next_action: Continue Codex starvation and CultNet liberation by wiring the next operator/runtime fact through native CultMesh/CultNet documents. The strongest next target is a CultNet-first operator snapshot/intent/receipt surface around the local runner or MVP status view, keeping Codex app-server JSON-RPC as compatibility projection only.