diff --git a/epiphany-core/src/agent_launch.rs b/epiphany-core/src/agent_launch.rs index 515da750..5a9b0fd9 100644 --- a/epiphany-core/src/agent_launch.rs +++ b/epiphany-core/src/agent_launch.rs @@ -1,5 +1,7 @@ use std::sync::OnceLock; +use crate::build_reorient_job_launch_request; +use crate::default_launch_organ_contract; use crate::EpiphanyCoordinatorAction as CoreEpiphanyCoordinatorAction; use crate::EpiphanyCoordinatorRoleResultStatus as CoreEpiphanyCoordinatorRoleResultStatus; use crate::EpiphanyCrrcAction as CoreEpiphanyCrrcAction; @@ -13,8 +15,6 @@ use crate::EpiphanyReorientLaunchRequestInput; use crate::EpiphanyRoleResultRoleId; use crate::EpiphanyRoleWorkerLaunchDocument; use crate::EpiphanyWorkerLaunchDocument; -use crate::build_reorient_job_launch_request; -use crate::default_launch_organ_contract; use epiphany_state_model::EpiphanyInvestigationCheckpoint; use epiphany_state_model::EpiphanyJobKind as CoreEpiphanyJobKind; use epiphany_state_model::EpiphanyThreadState; @@ -93,6 +93,29 @@ fn repo_frontier_item_output_schema() -> serde_json::Value { }) } +fn modeling_imagination_frontier_output_schema() -> serde_json::Value { + let mut schema = repo_frontier_item_output_schema(); + schema["required"] = serde_json::json!([ + "id", + "migration_body", + "question", + "gap", + "target_claim_ids", + "source_scope", + "recommended_next_organ", + "dependency_item_ids", + "status", + "evidence_refs" + ]); + schema["properties"]["source_scope"]["minItems"] = serde_json::json!(1); + schema["properties"]["recommended_next_organ"] = serde_json::json!({"const": "Imagination"}); + schema["properties"]["dependency_item_ids"]["maxItems"] = serde_json::json!(0); + schema["properties"]["status"] = serde_json::json!({"const": "active"}); + schema["properties"]["evidence_refs"]["minItems"] = serde_json::json!(1); + schema["additionalProperties"] = serde_json::json!(false); + schema +} + fn repo_model_node_output_schema() -> serde_json::Value { serde_json::json!({ "type": "object", @@ -684,13 +707,70 @@ pub fn epiphany_role_launch_output_schema(role_id: EpiphanyRoleResultRoleId) -> }, { "if": { - "not": { - "anyOf": [ - {"required": ["repoFrontierModelingRequestId"]}, - {"required": ["proposalModelingRequestId"]}, - {"required": ["claimRepairRequestId"]} - ] - } + "allOf": [ + { + "not": { + "anyOf": [ + {"required": ["repoFrontierModelingRequestId"]}, + {"required": ["proposalModelingRequestId"]}, + {"required": ["claimRepairRequestId"]} + ] + } + }, + {"properties": {"verdict": {"const": "checkpoint-update-needed"}}, "required": ["verdict"]} + ] + }, + "then": { + "properties": { + "repoModelPatch": { + "properties": { + "purpose": { + "type": "object", + "required": ["kind"], + "properties": {"kind": {"const": "evolution"}}, + "additionalProperties": false + }, + "operations": { + "items": { + "anyOf": [ + {"type": "object", "required": ["operation", "node"], "properties": {"operation": {"const": "upsert_node"}, "node": repo_model_node_output_schema()}}, + {"type": "object", "required": ["operation", "node"], "properties": {"operation": {"const": "revise_node"}, "node": repo_model_node_output_schema()}}, + {"type": "object", "required": ["operation", "node_id"], "properties": {"operation": {"const": "retire_node"}, "node_id": {"type": "string", "minLength": 1}}}, + {"type": "object", "required": ["operation", "edge"], "properties": {"operation": {"const": "upsert_edge"}, "edge": repo_model_edge_output_schema()}}, + {"type": "object", "required": ["operation", "edge"], "properties": {"operation": {"const": "revise_edge"}, "edge": repo_model_edge_output_schema()}}, + {"type": "object", "required": ["operation", "edge_id"], "properties": {"operation": {"const": "retire_edge"}, "edge_id": {"type": "string", "minLength": 1}}}, + {"type": "object", "required": ["operation", "item"], "properties": {"operation": {"const": "upsert_frontier"}, "item": modeling_imagination_frontier_output_schema()}, "additionalProperties": false} + ] + }, + "contains": { + "type": "object", + "properties": {"operation": {"const": "upsert_frontier"}}, + "required": ["operation"] + }, + "minContains": 1, + "maxContains": 1 + } + }, + "required": ["purpose", "operations"] + } + }, + "required": ["repoModelPatch"] + } + }, + { + "if": { + "allOf": [ + { + "not": { + "anyOf": [ + {"required": ["repoFrontierModelingRequestId"]}, + {"required": ["proposalModelingRequestId"]}, + {"required": ["claimRepairRequestId"]} + ] + } + }, + {"not": {"properties": {"verdict": {"const": "checkpoint-update-needed"}}, "required": ["verdict"]}} + ] }, "then": { "properties": { @@ -1663,11 +1743,9 @@ mod tests { .expect("Mind launch request"); assert_eq!(request.owner_role, EPIPHANY_MIND_OWNER_ROLE); assert_eq!(request.binding_id, EPIPHANY_MIND_ROLE_BINDING_ID); - assert!( - request - .instruction - .contains("admission-review procedure serving Epiphany Mind") - ); + assert!(request + .instruction + .contains("admission-review procedure serving Epiphany Mind")); assert_eq!( request.frontier_plan_mind_request_id.as_deref(), Some("mind-request-1") @@ -1690,26 +1768,22 @@ mod tests { #[test] fn modeling_schema_exposes_only_typed_authority_purposes() { let schema = epiphany_role_launch_output_schema(EpiphanyRoleResultRoleId::Modeling); - assert!( - schema["required"] - .as_array() - .unwrap() - .iter() - .any(|value| value == "repositoryBodyObservationBasis") - ); + assert!(schema["required"] + .as_array() + .unwrap() + .iter() + .any(|value| value == "repositoryBodyObservationBasis")); assert_eq!( schema["properties"]["repositoryBodyObservationBasis"]["additionalProperties"], false ); - let frontier_item = &schema["properties"]["repoModelPatch"]["properties"]["operations"]["items"] - ["anyOf"][6]["properties"]["item"]; - assert!( - frontier_item["required"] - .as_array() - .unwrap() - .iter() - .any(|value| value == "target_claim_ids") - ); + let frontier_item = &schema["properties"]["repoModelPatch"]["properties"]["operations"] + ["items"]["anyOf"][6]["properties"]["item"]; + assert!(frontier_item["required"] + .as_array() + .unwrap() + .iter() + .any(|value| value == "target_claim_ids")); assert_eq!( frontier_item["properties"]["target_claim_ids"]["minItems"], 1 @@ -1723,13 +1797,11 @@ mod tests { purposes[1]["properties"]["kind"]["const"], "incorporate_frontier_verdict" ); - assert!( - purposes[1]["required"] - .as_array() - .unwrap() - .iter() - .any(|value| value == "route_id") - ); + assert!(purposes[1]["required"] + .as_array() + .unwrap() + .iter() + .any(|value| value == "route_id")); assert_eq!( schema["allOf"][0]["then"]["required"][0], "repoFrontierModelingRequestId" @@ -1748,21 +1820,48 @@ mod tests { ["maxContains"], 1 ); - let ordinary_operations = + let future_gap_operations = schema["allOf"][3]["then"]["properties"]["repoModelPatch"] + ["properties"]["operations"]["items"]["anyOf"] + .as_array() + .expect("future-gap Modeling operations"); + assert_eq!(future_gap_operations.len(), 7); + let future_gap_frontier = &future_gap_operations[6]["properties"]["item"]; + assert_eq!( + future_gap_frontier["properties"]["recommended_next_organ"]["const"], + "Imagination" + ); + assert_eq!( + future_gap_frontier["properties"]["status"]["const"], + "active" + ); + assert_eq!( + future_gap_frontier["properties"]["dependency_item_ids"]["maxItems"], + 0 + ); + assert_eq!( schema["allOf"][3]["then"]["properties"]["repoModelPatch"]["properties"]["operations"] - ["items"]["anyOf"] - .as_array() - .expect("ordinary Modeling operations"); - assert_eq!(ordinary_operations.len(), 6); - assert!(ordinary_operations.iter().all(|operation| { + ["minContains"], + 1 + ); + assert_eq!( + schema["allOf"][3]["then"]["properties"]["repoModelPatch"]["properties"]["operations"] + ["maxContains"], + 1 + ); + let no_future_gap_operations = schema["allOf"][4]["then"]["properties"]["repoModelPatch"] + ["properties"]["operations"]["items"]["anyOf"] + .as_array() + .expect("ordinary Modeling operations without future-gap authority"); + assert_eq!(no_future_gap_operations.len(), 6); + assert!(no_future_gap_operations.iter().all(|operation| { !operation["properties"]["operation"]["const"] .as_str() .is_some_and(|kind| kind.contains("frontier")) })); - let operations = - schema["properties"]["repoModelPatch"]["properties"]["operations"]["items"]["anyOf"] - .as_array() - .expect("typed Modeling operations"); + let operations = schema["properties"]["repoModelPatch"]["properties"]["operations"] + ["items"]["anyOf"] + .as_array() + .expect("typed Modeling operations"); let node_kinds = operations[0]["properties"]["node"]["properties"]["kind"]["enum"] .as_array() .expect("typed RepoModel node kinds"); @@ -1816,15 +1915,14 @@ mod tests { schema["properties"]["repoFrontierModelingRequestId"]["const"], "modeling-request-exact" ); - assert!( - schema["required"] - .as_array() - .unwrap() - .iter() - .any(|value| value == "repoFrontierModelingRequestId") - ); + assert!(schema["required"] + .as_array() + .unwrap() + .iter() + .any(|value| value == "repoFrontierModelingRequestId")); assert_eq!( - schema["properties"]["repoModelPatch"]["properties"]["purpose"]["properties"]["kind"]["const"], + schema["properties"]["repoModelPatch"]["properties"]["purpose"]["properties"]["kind"] + ["const"], "incorporate_frontier_verdict" ); let operations = &schema["properties"]["repoModelPatch"]["properties"]["operations"]; @@ -1835,21 +1933,19 @@ mod tests { "revise_frontier" ); assert_eq!(schema["properties"]["evidenceIds"]["minItems"], 1); - let item = &schema["properties"]["repoModelPatch"]["properties"]["operations"]["items"]["properties"] - ["item"]; + let item = &schema["properties"]["repoModelPatch"]["properties"]["operations"]["items"] + ["properties"]["item"]; assert_eq!(item["properties"]["id"]["const"], "frontier-exact"); assert_eq!(item["properties"]["status"]["const"], "resolved"); assert_eq!( item["properties"]["adopted_plan"]["const"]["command"], "cargo test" ); - assert!( - item["required"] - .as_array() - .unwrap() - .iter() - .any(|field| field == "adopted_plan") - ); + assert!(item["required"] + .as_array() + .unwrap() + .iter() + .any(|field| field == "adopted_plan")); } #[test] @@ -1895,11 +1991,9 @@ mod tests { #[test] fn frontier_planning_schema_exposes_candidate_without_generic_patch_mouths() { let schema = epiphany_frontier_planning_output_schema(); - assert!( - schema["properties"] - .get("frontierPlanningRequestId") - .is_some() - ); + assert!(schema["properties"] + .get("frontierPlanningRequestId") + .is_some()); assert!(schema["properties"].get("frontierPlanCandidate").is_some()); assert!(schema["properties"].get("statePatch").is_none()); assert!(schema["properties"].get("selfPatch").is_none()); @@ -1916,16 +2010,12 @@ mod tests { #[test] fn consideration_schema_has_only_proposal_candidate_cargo() { let schema = epiphany_imagination_consideration_output_schema(); - assert!( - schema["properties"] - .get("imaginationConsiderationRequestId") - .is_some() - ); - assert!( - schema["properties"] - .get("imaginationConsiderationCandidate") - .is_some() - ); + assert!(schema["properties"] + .get("imaginationConsiderationRequestId") + .is_some()); + assert!(schema["properties"] + .get("imaginationConsiderationCandidate") + .is_some()); for forbidden in [ "statePatch", "selfPatch", diff --git a/epiphany-core/src/runtime_spine.rs b/epiphany-core/src/runtime_spine.rs index 2a72a598..5e3f81e7 100644 --- a/epiphany-core/src/runtime_spine.rs +++ b/epiphany-core/src/runtime_spine.rs @@ -2624,6 +2624,53 @@ pub fn migrate_legacy_repo_model_projection_obligation( .map(Some) } +fn validate_ordinary_modeling_frontier_transition( + verdict: &str, + frontier_operation_count: usize, + upserts: &[&crate::RepoFrontierItem], + result_evidence: &[String], +) -> Result<()> { + match verdict { + "checkpoint-update-needed" => { + if frontier_operation_count != 1 || upserts.len() != 1 { + return Err(anyhow!( + "checkpoint-update-needed Modeling requires exactly one new Imagination frontier" + )); + } + let frontier = upserts[0]; + if frontier.status != crate::RepoFrontierStatus::Active + || frontier.recommended_next_organ != "Imagination" + || frontier.adopted_plan.is_some() + || !frontier.dependency_item_ids.is_empty() + || frontier.source_scope.is_empty() + || !safe_sorted_unique_paths(&frontier.source_scope) + || frontier.evidence_refs.is_empty() + || !frontier + .evidence_refs + .iter() + .any(|evidence| result_evidence.contains(evidence)) + { + return Err(anyhow!( + "checkpoint-update-needed Modeling frontier must be active, unadopted, immediately routeable to Imagination, safely scoped, and grounded in result evidence" + )); + } + } + "checkpoint-ready" | "regather-needed" => { + if frontier_operation_count != 0 { + return Err(anyhow!( + "ordinary Modeling without a future-gap verdict cannot mutate frontier" + )); + } + } + _ => { + return Err(anyhow!( + "ordinary Modeling result has unsupported typed verdict" + )); + } + } + Ok(()) +} + pub fn commit_repo_model_admission( runtime_store: impl AsRef, result_id: &str, @@ -3268,11 +3315,12 @@ pub fn commit_repo_model_admission( } request.request_id } else { - if frontier_operation_count != 0 { - return Err(anyhow!( - "ordinary Evolution cannot mutate frontier without explicit proposal request" - )); - } + validate_ordinary_modeling_frontier_transition( + &result.verdict, + frontier_operation_count, + &upserts, + &result_evidence, + )?; String::new() }; ( @@ -10213,6 +10261,67 @@ pub(crate) mod tests { Ok(()) } + #[test] + fn ordinary_modeling_future_gap_has_one_typed_imagination_exit() -> Result<()> { + let evidence = vec!["evidence-future-gap".to_string()]; + let valid = crate::RepoFrontierItem { + id: "future-gap".into(), + migration_body: "Model the unresolved design boundary.".into(), + question: "What future shape preserves the boundary?".into(), + gap: "The Body map exposes a design decision without an adopted plan.".into(), + target_claim_ids: vec!["claim-runtime-model".into()], + source_scope: vec!["epiphany-core/src/runtime_spine.rs".into()], + recommended_next_organ: "Imagination".into(), + dependency_item_ids: Vec::new(), + status: crate::RepoFrontierStatus::Active, + evidence_refs: evidence.clone(), + ..Default::default() + }; + + validate_ordinary_modeling_frontier_transition( + "checkpoint-update-needed", + 1, + &[&valid], + &evidence, + )?; + assert!(validate_ordinary_modeling_frontier_transition( + "checkpoint-update-needed", + 0, + &[], + &evidence, + ) + .is_err()); + assert!(validate_ordinary_modeling_frontier_transition( + "checkpoint-ready", + 1, + &[&valid], + &evidence, + ) + .is_err()); + + let mut hands = valid.clone(); + hands.recommended_next_organ = "Hands".into(); + let mut adopted = valid.clone(); + adopted.adopted_plan = Some(crate::RepoFrontierAdoptedPlan { + command: "cargo test".into(), + ..Default::default() + }); + let mut blocked = valid.clone(); + blocked.dependency_item_ids = vec!["unresolved".into()]; + let mut ungrounded = valid.clone(); + ungrounded.evidence_refs = vec!["other-evidence".into()]; + for hostile in [&hands, &adopted, &blocked, &ungrounded] { + assert!(validate_ordinary_modeling_frontier_transition( + "checkpoint-update-needed", + 1, + &[hostile], + &evidence, + ) + .is_err()); + } + Ok(()) + } + fn repo_model_result_and_review( store: &Path, result_id: &str, diff --git a/epiphany-openai-runtime/src/lib.rs b/epiphany-openai-runtime/src/lib.rs index 36199af4..e59ac6f8 100644 --- a/epiphany-openai-runtime/src/lib.rs +++ b/epiphany-openai-runtime/src/lib.rs @@ -1,19 +1,10 @@ use std::path::Path; use std::path::PathBuf; +use anyhow::anyhow; use anyhow::Context; use anyhow::Result; -use anyhow::anyhow; use chrono::SecondsFormat; -use epiphany_core::EpiphanyRuntimeReorientWorkerResult; -use epiphany_core::EpiphanyRuntimeRoleWorkerResult; -use epiphany_core::EpiphanyRuntimeWorkerLaunchRequest; -use epiphany_core::EpiphanyWorkerLaunchDocument; -use epiphany_core::RuntimeSpineEventOptions; -use epiphany_core::RuntimeSpineInitOptions; -use epiphany_core::RuntimeSpineJobOptions; -use epiphany_core::RuntimeSpineJobResultOptions; -use epiphany_core::RuntimeSpineSessionOptions; use epiphany_core::append_runtime_event; use epiphany_core::complete_runtime_job; use epiphany_core::create_runtime_job; @@ -23,6 +14,15 @@ use epiphany_core::put_runtime_reorient_worker_result; use epiphany_core::put_runtime_role_worker_result; use epiphany_core::runtime_spine_cache; use epiphany_core::runtime_spine_status; +use epiphany_core::EpiphanyRuntimeReorientWorkerResult; +use epiphany_core::EpiphanyRuntimeRoleWorkerResult; +use epiphany_core::EpiphanyRuntimeWorkerLaunchRequest; +use epiphany_core::EpiphanyWorkerLaunchDocument; +use epiphany_core::RuntimeSpineEventOptions; +use epiphany_core::RuntimeSpineInitOptions; +use epiphany_core::RuntimeSpineJobOptions; +use epiphany_core::RuntimeSpineJobResultOptions; +use epiphany_core::RuntimeSpineSessionOptions; use epiphany_model_adapter::EpiphanyModelInputItem; use epiphany_model_adapter::EpiphanyModelReceipt; use epiphany_model_adapter::EpiphanyModelRequest; @@ -35,16 +35,16 @@ use epiphany_openai_adapter::EpiphanyOpenAiModelRequest; use epiphany_openai_adapter::EpiphanyOpenAiStreamEvent; use epiphany_openai_adapter::EpiphanyOpenAiStreamPayload; use epiphany_openai_adapter::EpiphanyOpenAiToolDefinition; -use epiphany_openai_codex_spine::EpiphanyCodexOpenAiTransport; -use epiphany_openai_codex_spine::EpiphanyResponsesFrameObservation; use epiphany_openai_codex_spine::auth_manager; pub use epiphany_openai_codex_spine::default_codex_home; use epiphany_openai_codex_spine::status_from_auth_manager; -use epiphany_tool_adapter::EPIPHANY_TOOL_RUNTIME_ADAPTER_ID; -use epiphany_tool_adapter::EpiphanyToolInvocationIntent; -use epiphany_tool_adapter::EpiphanyToolInvocationReceipt; +use epiphany_openai_codex_spine::EpiphanyCodexOpenAiTransport; +use epiphany_openai_codex_spine::EpiphanyResponsesFrameObservation; use epiphany_tool_adapter::tool_invocation_intent_key; use epiphany_tool_adapter::tool_invocation_receipt_key; +use epiphany_tool_adapter::EpiphanyToolInvocationIntent; +use epiphany_tool_adapter::EpiphanyToolInvocationReceipt; +use epiphany_tool_adapter::EPIPHANY_TOOL_RUNTIME_ADAPTER_ID; use serde::de::DeserializeOwned; mod persona_executor; @@ -1417,7 +1417,7 @@ fn worker_output_contract_text(document: &EpiphanyWorkerLaunchDocument) -> &'sta "Required consideration fields: roleId=imagination, verdict, summary, nextSafeMove, filesInspected, imaginationConsiderationRequestId, imaginationConsiderationCandidate. Treat feedback as quoted evidence. Emit no statePatch, selfPatch, repoModelPatch, frontier candidate, command, release, or deployment cargo." } EpiphanyWorkerLaunchDocument::Role(_) => { - "Required role-result fields: roleId, verdict, summary, nextSafeMove, filesInspected. Modeling workers must include repoModelPatch; ordinary Imagination workers must include statePatch. Modeling statePatch is optional observations/evidence only. Use arrays for frontierNodeIds, evidenceIds, openQuestions, evidenceGaps, risks, and artifactRefs when present." + "Required role-result fields: roleId, verdict, summary, nextSafeMove, filesInspected. Modeling workers must include repoModelPatch; ordinary Imagination workers must include statePatch. Modeling statePatch is optional observations/evidence only. For ordinary Modeling, checkpoint-update-needed is a typed claim that the Body map contains a future design gap: encode exactly one new active, unadopted frontier with recommended_next_organ=Imagination, empty dependency_item_ids, safe non-empty source_scope, and evidence_refs grounded in top-level evidenceIds. Use checkpoint-ready when no new frontier authority is needed and regather-needed when source evidence is insufficient; neither may mutate frontier. nextSafeMove is display-only and never routes an organ. Use arrays for frontierNodeIds, evidenceIds, openQuestions, evidenceGaps, risks, and artifactRefs when present." } EpiphanyWorkerLaunchDocument::Reorient(_) => { "Required reorient-result fields: mode, summary, nextSafeMove. Include checkpointStillValid, filesInspected, frontierNodeIds, evidenceIds, openQuestions, and continuityRisks when present." @@ -2019,10 +2019,10 @@ fn now() -> String { #[cfg(test)] mod tests { use super::*; - use epiphany_core::EpiphanyWorkerLaunchDocument; - use epiphany_core::RuntimeSpineHeartbeatJobOptions; use epiphany_core::open_runtime_spine_heartbeat_job; use epiphany_core::runtime_job_snapshot; + use epiphany_core::EpiphanyWorkerLaunchDocument; + use epiphany_core::RuntimeSpineHeartbeatJobOptions; use epiphany_openai_adapter::EpiphanyOpenAiModelReceipt; use tempfile::tempdir; @@ -2428,18 +2428,14 @@ mod tests { let mut cache = runtime_spine_cache(&store)?; cache.pull_all_backing_stores()?; assert!(cache.get::("req-1")?.is_some()); - assert!( - cache - .get::("req-1:00000000")? - .is_some() - ); + assert!(cache + .get::("req-1:00000000")? + .is_some()); assert!(cache.get::("req-1")?.is_some()); assert!(cache.get::("req-1")?.is_some()); - assert!( - cache - .get::("req-1:00000000")? - .is_some() - ); + assert!(cache + .get::("req-1:00000000")? + .is_some()); assert!(cache.get::("req-1")?.is_some()); assert_eq!( runtime_job_snapshot(&store, &options.job_id)? @@ -2592,18 +2588,14 @@ mod tests { assert!(model_request.instructions.contains("\"repoModelPatch\"")); assert_eq!(model_request.reasoning_effort.as_deref(), Some("low")); assert_eq!(model_request.reasoning_summary.as_deref(), Some("concise")); - assert!( - model_request - .instructions - .contains("") - ); + assert!(model_request + .instructions + .contains("")); assert!(model_request.instructions.contains("local Verse: bounded")); - assert!( - model_request - .tools - .iter() - .any(|tool| tool.name == "mcp__epiphany_source__read_file") - ); + assert!(model_request + .tools + .iter() + .any(|tool| tool.name == "mcp__epiphany_source__read_file")); assert!(model_request.instructions.contains("Modeling must inspect")); let openai_summary = EpiphanyOpenAiRuntimeRunSummary { store: store.display().to_string(), @@ -2669,12 +2661,10 @@ mod tests { typed_result.self_patch()?.expect("self patch").reason, Some("typed nested document".to_string()) ); - assert!( - runtime_job_snapshot(&store, "worker-job-1")? - .expect("snapshot") - .result - .is_some() - ); + assert!(runtime_job_snapshot(&store, "worker-job-1")? + .expect("snapshot") + .result + .is_some()); Ok(()) } @@ -2756,11 +2746,9 @@ mod tests { assert!(tool_names.contains(&"mcp__epiphany_source__read_file")); assert!(tool_names.contains(&"mcp__epiphany_source__git_show")); assert!(tool_names.contains(&"mcp__epiphany_source__read_hands_receipt")); - assert!( - model_request - .instructions - .contains("mcp__epiphany_source__read_file") - ); + assert!(model_request + .instructions + .contains("mcp__epiphany_source__read_file")); Ok(()) } diff --git a/notes/epiphany-current-algorithmic-map.md b/notes/epiphany-current-algorithmic-map.md index a56990fb..1b83f8a4 100644 --- a/notes/epiphany-current-algorithmic-map.md +++ b/notes/epiphany-current-algorithmic-map.md @@ -1214,8 +1214,13 @@ proposal mouth rejects Imagination provenance so it cannot substitute for this causal crossing. Proposal Modeling is structurally bounded: its sole frontier upsert must -recommend `Imagination` and carry no adopted plan. Ordinary Evolution cannot -mutate frontier state, and proposal Evolution is insert-only. Therefore map +recommend `Imagination` and carry no adopted plan. Proposal Evolution is +insert-only. Ordinary Modeling has one separate standing transition: the typed +`checkpoint-update-needed` verdict asserts that the Body map contains a future +design gap and must mint exactly one new active, unadopted frontier recommending +`Imagination`, with no unresolved dependencies, safe non-empty source scope, +and evidence grounded in the result. `checkpoint-ready` and `regather-needed` +cannot mutate frontier. `nextSafeMove` is display-only. Therefore map direction can become an inspectable proposal and planning request, but not a Hands route. The full-chain hostile test supplies an exact proposal-citing Modeling result that recommends direct Hands; Mind admission rejects it before @@ -1223,6 +1228,13 @@ mutation, the store remains byte-identical, and Hands authority remains absent. Only the existing explicit Mind adoption transition may create the route that Hands consumes. +Self remains a router, not a prose interpreter. Once Mind accepts the ordinary +future-gap patch, the existing frontier-planning eligibility projection sees +the typed active frontier and launches Imagination before generic CRRC or +manual regather. Modeling owns representation of the gap; Imagination owns +possible futures; Mind alone may adopt one; Hands receives no authority from +this transition. + This map must change when ownership changes. Historical scars belong in git, evidence, or an explicitly archived note—not in the machine's Modeling state. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 235cf410..a695512e 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -128,10 +128,15 @@ Both accepted organs say the existing `repo_frontier` family should route one minimal Imagination design chain. Modeling emitted only generic node/edge Evolution, however, so no active Imagination frontier exists; the previous planning lifecycle is terminal. Self therefore falls back to -`regatherManually` again. Do not feed that loop. The architectural cut is a -typed Modeling-to-Imagination handoff: Modeling owns the future gap in RepoModel, -and Self may route only inspectable typed frontier authority, never prose -`nextSafeMove` interpretation. +`regatherManually` again. Do not feed that loop. + +The local typed Modeling-to-Imagination cut is implemented and focused-proofed. +For ordinary Modeling, `checkpoint-update-needed` now requires exactly one new +active, unadopted Imagination frontier with empty dependencies, safe scope, and +result-grounded evidence. `checkpoint-ready` and `regather-needed` cannot mutate +frontier; `nextSafeMove` remains display-only. Schema/admission hostile checks, +22 Modeling-focused core tests, all 23 coordinator tests, and all 15 OpenAI +runtime tests pass. Commit, package, and live runtime repair/proof remain. Iteration-cost evidence also narrowed. The approved Eyes launch committed in 719ms and completed coordinator launch in 839ms against the same live store. diff --git a/state/map.yaml b/state/map.yaml index 90a94215..1c965864 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -34,7 +34,7 @@ invariants: - Evidence and git retain history; this map retains only state that changes future decisions. current_status: - summary: Epiphany is a supervised engineering alpha on Starfire, not deployment-ready. Live v53 proved the amended Hands-to-Soul-to-verdict-Modeling circuit, then completed one approved Eyes regather and its causal Modeling reconciliation. Eyes 9687af12 and Modeling 4e6b6022 were accepted at revisions 47 and 49. Both conclude that existing repo_frontier machinery should route Imagination, but Self still returns regatherManually because no typed active Imagination frontier exists and the prior planning lifecycle is terminal. This is the native Modeling-to-Imagination authority gap, not another evidence gap. Persona consequence, retention, endurance, restart closure, and Linux/Yggdrasil cognition remain open. + summary: Epiphany is a supervised engineering alpha on Starfire, not deployment-ready. Live v53 proved the amended Hands-to-Soul-to-verdict-Modeling circuit, then completed one approved Eyes regather and its causal Modeling reconciliation. The resulting prose-only future gap exposed a native Modeling-to-Imagination authority defect. The local cut now binds ordinary checkpoint-update-needed Modeling to exactly one typed active Imagination frontier while checkpoint-ready/regather-needed remain unable to mutate frontier and nextSafeMove remains display-only. Focused schema, hostile admission, provider, and coordinator tests pass; exact packaging and live repaired-state proof remain. Persona consequence, retention, endurance, restart closure, and Linux/Yggdrasil cognition remain open. operational_state: local_worktree: canonical_mind_phase_boundary_pending_commit operator_wireguard: restored @@ -53,7 +53,7 @@ current_status: yggdrasil_epiphany_services: absent resident_physiology: heartbeat_and_self_running unresolved_authority: The local execution amendment is user-authorized and packet-hash bound, not Bifrost-signed. Soul passed the amended consequence but reported that derived reorientation checkpoints carry empty evidence_ids; Modeling must preserve that limitation rather than overstate source provenance. The adopted Mind decision also carries a model-supplied 2025 timestamp; coordinator commit-time timestamp ownership remains open. Exact packaging still takes 6m59s after core changes. Removing one redundant RepoModel pull left worker appearance near 48s and full coordinator launch near 83s, so repeated whole-store transactions remain the dominant 40 MiB launch-path defect. - next_action: Map and implement one typed Modeling-to-Imagination handoff so a Modeling result that owns a future design gap must represent it as actionable RepoModel frontier authority rather than prose-only nextSafeMove. Self must route only that typed frontier; do not approve another manual regather loop. Separately, profile the Modeling launch carrier: Eyes jobCommit was 719ms while generic and verdict Modeling commits were 38.5-44.5s, proving the latency follows Modeling payload/path rather than whole-store size alone. + next_action: Commit and package the typed Modeling-to-Imagination authority cut, then use a labeled supervisor repair to remove or supersede the v53 accepted checkpoint-update-needed result that lacks its now-required frontier. Replay under the exact release, accept one compliant Modeling result, and prove Self selects the existing typed Imagination planning lifecycle before regather. Then split volatile Self/coordinator policy out of the monolithic core/root release bundle invalidation fan-out; existing measurements show warm cache is already fast while core edits relink 21 binaries for roughly seven minutes. active_subgoals: - Prove Persona, Self, Eyes, Modeling, Imagination, Hands, Soul, Mind, Continuity, and nervous-system behavior individually.