diff --git a/epiphany-codex-bridge/src/mutation_service.rs b/epiphany-codex-bridge/src/mutation_service.rs index 31a0001a..59301fbf 100644 --- a/epiphany-codex-bridge/src/mutation_service.rs +++ b/epiphany-codex-bridge/src/mutation_service.rs @@ -33,14 +33,18 @@ use epiphany_core::build_epiphany_role_launch_request; use epiphany_core::clear_epiphany_job_binding_backend; use epiphany_core::epiphany_role_label; use epiphany_core::epiphany_state_update_validation_errors; +use epiphany_core::eyes_evidence_packet_from_research_finding; use epiphany_core::evaluate_receipt_proof_profiles; use epiphany_core::evaluate_promotion; use epiphany_core::open_runtime_spine_heartbeat_job; use epiphany_core::plan_runtime_spine_heartbeat_launch; +use epiphany_core::put_eyes_evidence_packet; use epiphany_core::receipt_proof_evaluation_errors; use epiphany_core::replace_or_append_epiphany_job_binding; use epiphany_core::runtime_job_snapshot; +use epiphany_core::runtime_eyes_evidence_packet; use epiphany_core::runtime_mind_gateway_review; +use epiphany_core::EYES_EVIDENCE_PACKET_TYPE; use epiphany_state_model::EpiphanyEvidenceRecord; use epiphany_state_model::EpiphanyJobKind as CoreEpiphanyJobKind; use epiphany_state_model::EpiphanyRetrievalState; @@ -483,14 +487,32 @@ pub async fn apply_thread_epiphany_role_accept( "failed to persist Mind review receipt before role state admission: {err}" )) })?; - let available_document_types = persisted_mind_review_receipt_types( + let mut available_document_types = persisted_mind_review_receipt_types( runtime_store_path.as_path(), acceptance_update.mind_review.gateway_id.as_str(), )?; + if role_id == EpiphanyRoleResultRoleId::Research { + let packet = eyes_evidence_packet_from_research_finding( + format!("eyes-packet-{accepted_receipt_id}"), + &finding, + &applied_patch, + Utc::now().to_rfc3339_opts(SecondsFormat::Secs, true), + ); + put_eyes_evidence_packet(runtime_store_path.as_path(), &packet).map_err(|err| { + EpiphanyBridgeError::Fatal(format!( + "failed to persist Eyes evidence packet before research state admission: {err}" + )) + })?; + available_document_types.extend(persisted_eyes_evidence_packet_types( + runtime_store_path.as_path(), + packet.packet_id.as_str(), + )?); + } enforce_current_receipt_proofs( &organ_contract, &role_acceptance_claimed_effects(role_id, &changed_fields), &available_document_types, + &role_acceptance_enforceable_receipts(role_id), )?; let mind_review = acceptance_update.mind_review.clone(); let epiphany_state = @@ -586,6 +608,7 @@ pub async fn apply_thread_epiphany_reorient_accept( &organ_contract, &reorient_acceptance_claimed_effects(), &available_document_types, + &[MIND_GATEWAY_REVIEW_TYPE.to_string()], )?; let mind_review = acceptance_update.mind_review.clone(); let epiphany_state = @@ -859,13 +882,13 @@ fn enforce_current_receipt_proofs( contract: &EpiphanyLaunchOrganContract, claimed_effects: &[EpiphanyReceiptEffectKind], available_document_types: &[String], + enforceable_document_types: &[String], ) -> BridgeResult<()> { - let enforceable_document_types = vec![MIND_GATEWAY_REVIEW_TYPE.to_string()]; let evaluations = evaluate_receipt_proof_profiles( contract, claimed_effects, - &available_document_types, - &enforceable_document_types, + available_document_types, + enforceable_document_types, ); let errors = receipt_proof_evaluation_errors(&evaluations); if errors.is_empty() { @@ -894,6 +917,22 @@ fn persisted_mind_review_receipt_types( .unwrap_or_default()) } +fn persisted_eyes_evidence_packet_types( + runtime_store_path: &Path, + packet_id: &str, +) -> BridgeResult> { + let packet = runtime_eyes_evidence_packet(runtime_store_path, packet_id).map_err(|err| { + EpiphanyBridgeError::Fatal(format!( + "failed to verify persisted Eyes evidence packet {:?}: {err}", + packet_id + )) + })?; + Ok(packet + .is_some() + .then(|| vec![EYES_EVIDENCE_PACKET_TYPE.to_string()]) + .unwrap_or_default()) +} + fn role_acceptance_claimed_effects( role_id: EpiphanyRoleResultRoleId, changed_fields: &[EpiphanyStateUpdatedField], @@ -913,6 +952,14 @@ fn role_acceptance_claimed_effects( effects } +fn role_acceptance_enforceable_receipts(role_id: EpiphanyRoleResultRoleId) -> Vec { + let mut receipts = vec![MIND_GATEWAY_REVIEW_TYPE.to_string()]; + if role_id == EpiphanyRoleResultRoleId::Research { + receipts.push(EYES_EVIDENCE_PACKET_TYPE.to_string()); + } + receipts +} + fn reorient_acceptance_claimed_effects() -> Vec { vec![ EpiphanyReceiptEffectKind::StateAdmission, diff --git a/epiphany-core/src/eyes_gateway.rs b/epiphany-core/src/eyes_gateway.rs index a27b681d..322ca23c 100644 --- a/epiphany-core/src/eyes_gateway.rs +++ b/epiphany-core/src/eyes_gateway.rs @@ -1,3 +1,6 @@ +use crate::EpiphanyRoleFindingInterpretation; +use crate::EpiphanyRoleStatePatchDocument; +use cultcache_rs::DatabaseEntry; use serde::Deserialize; use serde::Serialize; @@ -14,6 +17,35 @@ pub const EYES_EVIDENCE_PACKET_SCHEMA_VERSION: &str = "epiphany.eyes.evidence_pa pub const EYES_EVIDENCE_REFUSAL_RECEIPT_SCHEMA_VERSION: &str = "epiphany.eyes.evidence_refusal_receipt.v0"; +#[derive(Debug, Clone, PartialEq, Eq, DatabaseEntry)] +#[cultcache(type = "epiphany.eyes.evidence_packet", schema = "EyesEvidencePacket")] +pub struct EyesEvidencePacket { + #[cultcache(key = 0)] + pub schema_version: String, + #[cultcache(key = 1)] + pub packet_id: String, + #[cultcache(key = 2)] + pub source_result_id: String, + #[cultcache(key = 3)] + pub source_job_id: String, + #[cultcache(key = 4)] + pub source_role_id: String, + #[cultcache(key = 5)] + pub evidence_ids: Vec, + #[cultcache(key = 6)] + pub observation_ids: Vec, + #[cultcache(key = 7)] + pub source_refs: Vec, + #[cultcache(key = 8)] + pub summary: String, + #[cultcache(key = 9)] + pub uncertainty: String, + #[cultcache(key = 10)] + pub emitted_at: String, + #[cultcache(key = 11)] + pub contract: String, +} + #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct EyesCultNetContract { @@ -95,6 +127,80 @@ pub fn default_eyes_cultnet_contracts() -> Vec { ] } +pub fn eyes_evidence_packet_from_research_finding( + packet_id: String, + finding: &EpiphanyRoleFindingInterpretation, + patch: &EpiphanyRoleStatePatchDocument, + emitted_at: String, +) -> EyesEvidencePacket { + let evidence_ids = patch + .evidence + .iter() + .filter_map(|evidence| non_empty_string(&evidence.id)) + .collect::>(); + let observation_ids = patch + .observations + .iter() + .filter_map(|observation| non_empty_string(&observation.id)) + .collect::>(); + let mut source_refs = Vec::new(); + for evidence in &patch.evidence { + for code_ref in &evidence.code_refs { + let mut rendered = code_ref.path.display().to_string(); + if let Some(start_line) = code_ref.start_line { + rendered.push(':'); + rendered.push_str(&start_line.to_string()); + } + if let Some(end_line) = code_ref.end_line + && Some(end_line) != code_ref.start_line + { + rendered.push('-'); + rendered.push_str(&end_line.to_string()); + } + if let Some(symbol) = code_ref.symbol.as_deref().filter(|value| !value.is_empty()) { + rendered.push('#'); + rendered.push_str(symbol); + } + push_unique(&mut source_refs, rendered); + } + } + EyesEvidencePacket { + schema_version: EYES_EVIDENCE_PACKET_SCHEMA_VERSION.to_string(), + packet_id, + source_result_id: finding.runtime_result_id.clone().unwrap_or_default(), + source_job_id: finding.runtime_job_id.clone().unwrap_or_default(), + source_role_id: "research".to_string(), + evidence_ids, + observation_ids, + source_refs, + summary: finding.summary.clone().unwrap_or_default(), + uncertainty: if finding.evidence_gaps.is_empty() && finding.risks.is_empty() { + "no declared research gaps or risks".to_string() + } else { + finding + .evidence_gaps + .iter() + .chain(finding.risks.iter()) + .cloned() + .collect::>() + .join("; ") + }, + emitted_at, + contract: "Eyes packet emitted from a reviewed Research lane finding; it makes the source-gathering evidence claim citable before Mind admission.".to_string(), + } +} + +fn non_empty_string(value: &str) -> Option { + let value = value.trim(); + (!value.is_empty()).then(|| value.to_string()) +} + +fn push_unique(out: &mut Vec, value: String) { + if !out.contains(&value) { + out.push(value); + } +} + #[cfg(test)] mod tests { use super::*; @@ -121,4 +227,71 @@ mod tests { .contains(&EYES_EVIDENCE_PACKET_TYPE.to_string()) ); } + + #[test] + fn research_finding_builds_evidence_packet() { + let finding = EpiphanyRoleFindingInterpretation { + verdict: Some("evidence-ready".to_string()), + summary: Some("Found source proof.".to_string()), + next_safe_move: Some("Review evidence.".to_string()), + checkpoint_summary: None, + scratch_summary: None, + files_inspected: vec!["src/lib.rs".to_string()], + frontier_node_ids: Vec::new(), + evidence_ids: vec!["ev-source".to_string()], + artifact_refs: Vec::new(), + runtime_result_id: Some("result-1".to_string()), + runtime_job_id: Some("job-1".to_string()), + open_questions: Vec::new(), + evidence_gaps: Vec::new(), + risks: Vec::new(), + state_patch: None, + self_patch: None, + self_persistence: None, + job_error: None, + item_error: None, + }; + let mut patch = EpiphanyRoleStatePatchDocument::default(); + patch + .evidence + .push(epiphany_state_model::EpiphanyEvidenceRecord { + id: "ev-source".to_string(), + kind: "source".to_string(), + status: "ok".to_string(), + summary: "Source proof.".to_string(), + code_refs: vec![epiphany_state_model::EpiphanyCodeRef { + path: "src/lib.rs".into(), + start_line: Some(12), + end_line: None, + symbol: Some("thing".to_string()), + note: None, + }], + }); + patch + .observations + .push(epiphany_state_model::EpiphanyObservation { + id: "obs-source".to_string(), + summary: "Observed source proof.".to_string(), + source_kind: "research".to_string(), + status: "ok".to_string(), + code_refs: Vec::new(), + evidence_ids: vec!["ev-source".to_string()], + }); + + let packet = eyes_evidence_packet_from_research_finding( + "eyes-packet-1".to_string(), + &finding, + &patch, + "2026-05-30T00:00:00Z".to_string(), + ); + assert_eq!(packet.source_role_id, "research"); + assert!(packet.evidence_ids.contains(&"ev-source".to_string())); + assert!(packet.observation_ids.contains(&"obs-source".to_string())); + assert!( + packet + .source_refs + .iter() + .any(|item| item.contains("src/lib.rs")) + ); + } } diff --git a/epiphany-core/src/lib.rs b/epiphany-core/src/lib.rs index 7f7a1a57..62857747 100644 --- a/epiphany-core/src/lib.rs +++ b/epiphany-core/src/lib.rs @@ -210,7 +210,9 @@ pub use eyes_gateway::EYES_EVIDENCE_REVIEW_TYPE; pub use eyes_gateway::EYES_SOURCE_LOOKUP_RECEIPT_SCHEMA_VERSION; pub use eyes_gateway::EYES_SOURCE_LOOKUP_RECEIPT_TYPE; pub use eyes_gateway::EyesCultNetContract; +pub use eyes_gateway::EyesEvidencePacket; pub use eyes_gateway::default_eyes_cultnet_contracts; +pub use eyes_gateway::eyes_evidence_packet_from_research_finding; pub use face_turn::FACE_INTERPRETER_PROMPT_SCHEMA_VERSION; pub use face_turn::FACE_PROJECTOR_PROMPT_SCHEMA_VERSION; pub use face_turn::FACE_TURN_PROMPT_SCHEMA_VERSION; @@ -415,11 +417,13 @@ pub use runtime_spine::initialize_runtime_spine; pub use runtime_spine::open_runtime_spine_heartbeat_job; pub use runtime_spine::plan_runtime_spine_heartbeat_launch; pub use runtime_spine::put_coordinator_run_receipt; +pub use runtime_spine::put_eyes_evidence_packet; pub use runtime_spine::put_mind_gateway_review; pub use runtime_spine::put_mind_state_commit_receipt; pub use runtime_spine::put_runtime_reorient_worker_result; pub use runtime_spine::put_runtime_role_worker_result; pub use runtime_spine::replace_or_append_epiphany_job_binding; +pub use runtime_spine::runtime_eyes_evidence_packet; pub use runtime_spine::runtime_hello_frame; pub use runtime_spine::runtime_job_snapshot; pub use runtime_spine::runtime_mind_gateway_review; diff --git a/epiphany-core/src/runtime_spine.rs b/epiphany-core/src/runtime_spine.rs index 4d68b98a..55e82d54 100644 --- a/epiphany-core/src/runtime_spine.rs +++ b/epiphany-core/src/runtime_spine.rs @@ -19,6 +19,7 @@ use crate::eyes_gateway::EYES_EVIDENCE_REVIEW_SCHEMA_VERSION; use crate::eyes_gateway::EYES_EVIDENCE_REVIEW_TYPE; use crate::eyes_gateway::EYES_SOURCE_LOOKUP_RECEIPT_SCHEMA_VERSION; use crate::eyes_gateway::EYES_SOURCE_LOOKUP_RECEIPT_TYPE; +use crate::eyes_gateway::EyesEvidencePacket; use crate::hands_gateway::*; use crate::heartbeat_state::HEARTBEAT_STATE_SCHEMA_VERSION; use crate::heartbeat_state::HEARTBEAT_STATE_TYPE; @@ -711,6 +712,7 @@ pub fn runtime_spine_cache(store_path: impl AsRef) -> Result { cache.register_entry_type::()?; cache.register_entry_type::()?; cache.register_entry_type::()?; + cache.register_entry_type::()?; cache.register_entry_type::()?; cache.register_entry_type::()?; cache.register_entry_type::()?; @@ -1172,6 +1174,38 @@ pub fn runtime_mind_state_commit_receipt( cache.get::(receipt_id) } +pub fn put_eyes_evidence_packet( + store_path: impl AsRef, + packet: &EyesEvidencePacket, +) -> Result<()> { + validate_non_empty(&packet.packet_id, "Eyes evidence packet id")?; + validate_non_empty( + &packet.source_result_id, + "Eyes evidence packet source result", + )?; + validate_non_empty(&packet.source_job_id, "Eyes evidence packet source job")?; + validate_non_empty(&packet.source_role_id, "Eyes evidence packet source role")?; + validate_non_empty(&packet.emitted_at, "Eyes evidence packet timestamp")?; + if packet.evidence_ids.is_empty() { + return Err(anyhow!("Eyes evidence packet must reference evidence ids")); + } + let mut cache = runtime_spine_cache(store_path)?; + cache.pull_all_backing_stores()?; + require_identity(&cache)?; + cache.put(&packet.packet_id, packet)?; + Ok(()) +} + +pub fn runtime_eyes_evidence_packet( + store_path: impl AsRef, + packet_id: &str, +) -> Result> { + validate_non_empty(packet_id, "Eyes evidence packet id")?; + let mut cache = runtime_spine_cache(store_path)?; + cache.pull_all_backing_stores()?; + cache.get::(packet_id) +} + pub fn put_coordinator_run_receipt( store_path: impl AsRef, receipt: &EpiphanyCoordinatorRunReceipt, @@ -3120,6 +3154,21 @@ mod tests { "2026-05-06T00:04:00Z".to_string(), ); put_mind_state_commit_receipt(&store, &commit)?; + let eyes_packet = EyesEvidencePacket { + schema_version: crate::EYES_EVIDENCE_PACKET_SCHEMA_VERSION.to_string(), + packet_id: "eyes-packet-1".to_string(), + source_result_id: "result-1".to_string(), + source_job_id: "job-1".to_string(), + source_role_id: "research".to_string(), + evidence_ids: vec!["ev-1".to_string()], + observation_ids: vec!["obs-1".to_string()], + source_refs: vec!["src/lib.rs:1".to_string()], + summary: "Evidence packet.".to_string(), + uncertainty: "none declared".to_string(), + emitted_at: "2026-05-06T00:05:00Z".to_string(), + contract: "Eyes packet persists as runtime-spine proof.".to_string(), + }; + put_eyes_evidence_packet(&store, &eyes_packet)?; let stored = runtime_mind_gateway_review(&store, "mind-role-modeling-job-1")? .expect("Mind review receipt should persist"); @@ -3127,6 +3176,9 @@ mod tests { let stored_commit = runtime_mind_state_commit_receipt(&store, "mind-commit-1")? .expect("Mind state commit receipt should persist"); assert_eq!(stored_commit, commit); + let stored_packet = runtime_eyes_evidence_packet(&store, "eyes-packet-1")? + .expect("Eyes evidence packet should persist"); + assert_eq!(stored_packet, eyes_packet); Ok(()) } diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 12cc13ce..73f7d82b 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -34,7 +34,7 @@ remembers doctrine; the branch remembers the blade. - Do not copy exact branch or HEAD from this note. Run `git status --short --branch` and `git log --oneline -5`. - Canonical anatomy now lives in `notes/epiphany-anatomy.md`. Embodied sub-agents are Self, Face, Imagination, Eyes, Proprioception, Hands, and Soul. Body, Mind, Continuity, and Substrate Gate are substrate/state/protocol surfaces, not sub-agent identities. State is split by layer: `work_organ` for resident Epiphany sub-agents, `persona` for portable public/person-shaped state shared by Epiphany Face, VoidBot repo Faces, and Ghostlight characters, and heartbeat/swarm state for scheduling and coordination physiology. Persona state now carries provenance, required public presentation, `date-time` timestamps, typed `candidateActions`, strict anchored thoughts with non-authoritative extensions, custom enum companion labels, and typed affect records for bonds/status reads/doctrine stances. - 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/`. `-Mode status` is now Epiphany-native: it builds only Epiphany operator binaries, reads `state/thread-state.msgpack` when present, derives status through `epiphany-core`, and does not start or require `codex-app-server`. Use `-Mode plan` or `-Mode run -MaxSteps 4` for the raw bridge-equipped coordinator entrypoints; use `-Mode mvp -FaceInput "" -MaxSteps 4` for the local product cycle that projects Face's character turn, writes a Face/Aquarium bubble, bootstraps a minimal local checkpoint for fresh threads, runs the coordinator with auto-tools, then runs heartbeat sleep/dream maintenance. Live plan/run/mvp modes use the workspace `state/runtime-spine.msgpack`, because CodexThread launch writes worker requests there; the run bundle remains artifact evidence, not runtime lifecycle authority. Add `-ThreadId ` and `-Workspace ` to inspect or continue an existing thread. `status`, `plan`, and `smoke` do not spend model calls; `run` and `mvp` build and use `epiphany-openai-runtime`. Coordinator workers now launch detached and are polled through runtime-spine instead of blocking the coordinator. MVP runs are non-ephemeral by default so `-ThreadId ` can resume and poll later. `-MaxRuntimeSeconds ` is passed into worker runtime; timeout writes a failed worker receipt and exits. Failed modeling now blocks downstream verification until the failed result is reviewed. -- Current Mom-ready status: the normal MVP pass reaches Face -> coordinator -> detached runtime -> heartbeat sleep, and modeling workers now complete through the ChatGPT subscription transport. The first failure was a stack of violated observability/runtime invariants: worker prompts prepended the whole shared persistent-memory rite, Responses frame liveness was invisible until completion, and the runtime tried to persist hundreds of text deltas before completing the worker job. Role/reorient workers now get a compact Epiphany worker boundary instead of full persistent memory; runtime-spine records sampled raw Responses frame kinds with small previews; contiguous reasoning/text deltas compact before durable storage; and live proofs completed `2fe38dcd-d99e-4c73-9a58-afcc81f851c7`, `241e3851-e3ea-4877-a63b-0d2bbd96a7e2`, and `85149a26-6975-403f-ac93-092b717c5825` instead of timing out. The second failure was stale lifecycle authority: completed runtime jobs remained as unresolved `runtime_links`, replacement launches treated historical active links as current, and one bad validation path opened an orphan job before rejecting the state patch. Latest-link-wins is now the runtime-link invariant, terminal links project completed jobs, stale active history cannot veto replacement, launch validation happens before opening runtime jobs, and completed-but-unreviewable modeling findings stop for review instead of relaunching the same lane. The Eyes/source-gather fork is now landed: Research is a fixed Eyes lane with launch/result/accept/status/coordinator/protocol support, and `regather-needed` modeling findings route to `LaunchResearch` instead of relaunching blind Proprioception. Research statePatch admission is Eyes-shaped only: observations, evidence, scratch, and optional investigationCheckpoint; no graph, planning, objective, or checkpoint authority. Mind admission now leaves typed runtime-spine proof: role/reorient acceptance persists `epiphany.mind.gateway_review` before state admission and `epiphany.mind.state_commit_receipt` after admission with the resulting durable revision. Launch contracts now split the broad receipt catalogue from effect-specific proof profiles for state admission, evidence promotion, repo action, verification, and continuity recovery, so gates do not accidentally demand the whole organ catalogue for every finding. Acceptance evaluates claimed effects against the launch-carried profiles, rereads the persisted Mind gateway review from runtime-spine, enforces currently available Mind proof, and defers non-Mind missing proofs until their producers exist. The next concrete rebuild layer is the first non-Mind receipt producer. +- Current Mom-ready status: the normal MVP pass reaches Face -> coordinator -> detached runtime -> heartbeat sleep, and modeling workers now complete through the ChatGPT subscription transport. The first failure was a stack of violated observability/runtime invariants: worker prompts prepended the whole shared persistent-memory rite, Responses frame liveness was invisible until completion, and the runtime tried to persist hundreds of text deltas before completing the worker job. Role/reorient workers now get a compact Epiphany worker boundary instead of full persistent memory; runtime-spine records sampled raw Responses frame kinds with small previews; contiguous reasoning/text deltas compact before durable storage; and live proofs completed `2fe38dcd-d99e-4c73-9a58-afcc81f851c7`, `241e3851-e3ea-4877-a63b-0d2bbd96a7e2`, and `85149a26-6975-403f-ac93-092b717c5825` instead of timing out. The second failure was stale lifecycle authority: completed runtime jobs remained as unresolved `runtime_links`, replacement launches treated historical active links as current, and one bad validation path opened an orphan job before rejecting the state patch. Latest-link-wins is now the runtime-link invariant, terminal links project completed jobs, stale active history cannot veto replacement, launch validation happens before opening runtime jobs, and completed-but-unreviewable modeling findings stop for review instead of relaunching the same lane. The Eyes/source-gather fork is now landed: Research is a fixed Eyes lane with launch/result/accept/status/coordinator/protocol support, and `regather-needed` modeling findings route to `LaunchResearch` instead of relaunching blind Proprioception. Research statePatch admission is Eyes-shaped only: observations, evidence, scratch, and optional investigationCheckpoint; no graph, planning, objective, or checkpoint authority. Mind admission now leaves typed runtime-spine proof: role/reorient acceptance persists `epiphany.mind.gateway_review` before state admission and `epiphany.mind.state_commit_receipt` after admission with the resulting durable revision. Launch contracts now split the broad receipt catalogue from effect-specific proof profiles for state admission, evidence promotion, repo action, verification, and continuity recovery, so gates do not accidentally demand the whole organ catalogue for every finding. Acceptance evaluates claimed effects against the launch-carried profiles, rereads persisted receipts from runtime-spine, enforces Mind proof generally, and now enforces Eyes evidence-packet proof for accepted Research findings. The next concrete rebuild layer is Substrate Gate access proof for Research or Soul verdict proof for Verification. - Local operator runs now write typed CultMesh intent/receipt documents to `.epiphany-run/cultmesh/operator-runs.ccmp` through `epiphany-operator-run`. The wrapper writes intent before acting and a completion receipt after success; this is the local consent/trace rail, not a hidden scheduler queue. - Status-mode local runs now also write a native CultMesh operator snapshot to `.epiphany-run/cultmesh/operator-snapshots.ccmp` through `epiphany-operator-snapshot`. That snapshot distills the operator-safe MVP status artifact into typed fields such as thread id, state status, coordinator action, CRRC action, reorient action, available actions, and artifact refs; it does not preserve the raw JSON status blob as internal state. - `epiphany-mvp-status --source native` is the current provider-neutral status boundary. It projects scene, pressure, jobs, roles, planning, reorient, CRRC, coordinator status, and runtime-linked worker lifecycle from native core surfaces. It reads runtime-spine job/result receipts for linked jobs so failed workers show as failed in role results, jobs, roles, and coordinator source signals, while successful semantic findings still require typed role/reorient worker result documents. Keep future pluggable model-provider work behind launch/result/runtime documents; do not let provider choice leak into status, prompt authority, scheduler policy, or durable `EpiphanyThreadState`. @@ -1427,8 +1427,10 @@ former is gate law. Profiles currently cover state admission, evidence promotion, repo action, verification, and continuity recovery. Role/reorient acceptance evaluates the claimed effects through those profiles. It currently enforces only persisted Mind gateway review, verified by rereading -runtime-spine after the review write, and records non-Mind profile gaps as -deferred because those producers are not live yet. +runtime-spine after the review write. Research acceptance now also emits, +persists, rereads, and enforces an `epiphany.eyes.evidence_packet` built from +the accepted Eyes-shaped statePatch. Other non-Mind profile gaps remain deferred +because those producers are not live yet. Mind review is now a persisted receipt chain for acceptance rather than an in-memory blessing: the bridge writes `epiphany.mind.gateway_review` before role/reorient state admission and `epiphany.mind.state_commit_receipt` after diff --git a/notes/perfect-machine-audit-roadmap.md b/notes/perfect-machine-audit-roadmap.md index 304475e8..5cb246cd 100644 --- a/notes/perfect-machine-audit-roadmap.md +++ b/notes/perfect-machine-audit-roadmap.md @@ -136,10 +136,13 @@ those profiles, rereads the persisted Mind gateway review from runtime-spine, and enforces that available proof. Mind's first executable proof chain is now persisted: acceptance writes `epiphany.mind.gateway_review` before state admission and `epiphany.mind.state_commit_receipt` after admission with the -resulting state revision. Remaining weakness: the non-Mind organ receipts are -still launch-carried expectations, not enforced proof chains before state/action -promotion, and the current Mind state mutation plus post-commit receipt is not a -single transaction yet. +resulting state revision. Research acceptance also emits a typed +`epiphany.eyes.evidence_packet` from its accepted Eyes-shaped statePatch, +persists it in runtime-spine, rereads it, and enforces Eyes packet proof for the +evidence-promotion profile. Remaining weakness: Substrate Gate, Hands, Soul, and +Continuity receipts are still mostly launch-carried expectations, not enforced +proof chains before state/action promotion, and the current Mind state mutation +plus post-commit receipt is not a single transaction yet. ### 4. Self Still Shares A Throne With Compatibility Plumbing @@ -329,9 +332,11 @@ comfort tunnels. receipt availability, enforces the currently live Mind gateway-review proof, and defers unavailable non-Mind producer gaps instead of using them as false blockers. -- Next: create the first non-Mind receipt producer, preferably Eyes evidence - packets for Research findings or Soul verdict receipts for Verification - findings, then make that profile proof enforceable. +- Landed: accepted Research findings produce and enforce typed Eyes evidence + packets for the evidence-promotion proof profile. +- Next: add Substrate Gate access/snapshot receipts for Research launches or + Soul verdict receipts for Verification findings, then make that profile proof + enforceable. - Make Aquarium read the contract catalog and available receipts instead of hard-coding the route zoo. - Starve `codex_message_processor` down to Codex auth/model transport and diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 20570d7e..912739fd 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index 5924b827..ae10af95 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -116,7 +116,7 @@ accepted_design: - Substrate Gate contract surface is now named beside Mind's state gate: `epiphany-core::substrate_gate` defines repo access requests, access reviews, grant/refusal receipts, snapshot receipts, and mutation receipts; runtime-spine advertises those contracts; CultMesh persists matching `EpiphanyCultMeshSubstrateGateContractEntry` 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 Substrate Gate 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. - Hands, Soul, and Continuity now have first-class contract catalogs beside Mind/Substrate Gate/Eyes. `epiphany-core::hands_gateway` defines action intents, reviews, command/patch/commit/PR/rollback/refusal receipts; `epiphany-core::soul_gateway` defines verification requests, invariant checks, verdict/regression/review/refusal receipts; `epiphany-core::continuity_gateway` defines continuity packets, compaction checkpoints, sleep distillation, recovery, stale-turn repair, and continuity refusal receipts. Runtime-spine advertises them and CultMesh persists matching Verse-scoped contract policy documents. - - Worker launch packets now carry `EpiphanyLaunchOrganContract` beside the typed launch document. The contract derives from authority scope, document kind, and output contract id; carries the full standing sub-agent dependency matrix, a receipt document catalogue, and effect-specific receipt proof profiles for state admission, evidence promotion, repo action, verification, and continuity recovery. Runtime-spine validates and persists this contract on `EpiphanyRuntimeWorkerLaunchRequest`; bridge role/reorient/generic launch builders populate it. Role/reorient acceptance now refuses completed runtime-spine findings if their original worker launch request is missing, mismatched by document kind, or lacks a state-admission proof profile requiring Mind review. Acceptance computes claimed effects from the role/reorient state change, rereads the persisted Mind gateway review from runtime-spine, enforces that currently available Mind proof, and defers non-Mind profile gaps until Substrate Gate/Eyes/Hands/Soul/Continuity producers exist. The first executable Mind proof is landed: acceptance persists `epiphany.mind.gateway_review` before state admission and `epiphany.mind.state_commit_receipt` after admission with the resulting revision. + - Worker launch packets now carry `EpiphanyLaunchOrganContract` beside the typed launch document. The contract derives from authority scope, document kind, and output contract id; carries the full standing sub-agent dependency matrix, a receipt document catalogue, and effect-specific receipt proof profiles for state admission, evidence promotion, repo action, verification, and continuity recovery. Runtime-spine validates and persists this contract on `EpiphanyRuntimeWorkerLaunchRequest`; bridge role/reorient/generic launch builders populate it. Role/reorient acceptance now refuses completed runtime-spine findings if their original worker launch request is missing, mismatched by document kind, or lacks a state-admission proof profile requiring Mind review. Acceptance computes claimed effects from the role/reorient state change, rereads the persisted Mind gateway review from runtime-spine, enforces that currently available Mind proof, and defers non-Mind profile gaps until their producers exist. The first executable Mind proof is landed: acceptance persists `epiphany.mind.gateway_review` before state admission and `epiphany.mind.state_commit_receipt` after admission with the resulting revision. The first non-Mind producer is also landed: accepted Research findings emit typed `epiphany.eyes.evidence_packet` receipts from their Eyes-shaped statePatch, runtime-spine persists/verifies those packets, and Research evidence-promotion proof now enforces Eyes packet availability while Substrate Gate proof remains deferred. - `notes/perfect-machine-audit-roadmap.md` is the current architectural audit. The main finding is that organ contracts are now named, launch-carried, and minimally acceptance-gated against naked runtime jobs, while Mind admission has the first persisted review/commit receipt chain. The old all-receipts list is now only a catalogue; proof profiles say which receipts are required for each effect type. Substrate Gate, Eyes, Hands, Soul, and Continuity receipts are still expectations rather than mandatory receipt chains. The current Mind receipt write is not transactional across state mutation and receipt persistence; future state admission should collapse mutation plus post-commit receipt into one owner when the storage layer supports it. The Rust dependency body repair is landed: the missing `E:\Projects\CultLib\crates\*` paths were replaced with repo-contained vendored CultCache/CultNet/CultMesh crates, and `cargo test --manifest-path .\epiphany-core\Cargo.toml --lib` passes. - `notes/codex-starvation-and-cultnet-liberation-plan.md` is the active foundation directive. It supersedes outward product/bridge/dogfood work and supersedes the weaker goal of merely making Codex app-server a cleaner adapter. Epiphany must become a native CultCache/CultNet runtime; Codex remains only as an OpenAI subscription auth/model-transport reliquary until that too can be replaced or minimized. - `notes/codex-auth-spine-inventory.md` is the current source-grounded inventory of the Codex organ that may survive. Corrected compliance invariant: Codex-compatible auth identity should remain anchored in retained vendored Codex-derived auth machinery, while Epiphany owns typed request/status/event/runtime surfaces around it. Codex app-server, apps, skills, marketplace, plugin UX, MCP OAuth handlers, and collaboration-mode surfaces are not part of the keeper spine. @@ -588,4 +588,4 @@ current_status: cargo and rejects modeling/planning/graph/checkpoint authority. MVP status and coordinator smokes pass with six lanes, and the smoke harness now rebuilds stale coordinator/app-server binaries before using them. - next_action: Continue the Perfect Machine rebuild by creating the first non-Mind receipt producer. The receipt catalogue/profile split and proof-profile evaluator are landed; acceptance enforces persisted Mind review and records non-Mind gaps as deferred. The next cut should choose a narrow producer, preferably Eyes evidence packet for Research findings or Soul verdict receipt for Verification findings, then make that profile enforceable. + next_action: Continue the Perfect Machine rebuild by adding the next receipt producer or tightening the Eyes chain. The narrow Eyes packet producer for Research is landed and enforced; the remaining evidence-promotion gap is Substrate Gate access proof. A sensible next cut is either Substrate Gate read/snapshot grant receipts for Research launches or Soul verdict receipts for Verification findings.