diff --git a/epiphany-core/src/bin/epiphany-repo-deployment-config-family-smoke.rs b/epiphany-core/src/bin/epiphany-repo-deployment-config-family-smoke.rs index 1a8244e2..fa871c24 100644 --- a/epiphany-core/src/bin/epiphany-repo-deployment-config-family-smoke.rs +++ b/epiphany-core/src/bin/epiphany-repo-deployment-config-family-smoke.rs @@ -2,6 +2,10 @@ use anyhow::Context; use anyhow::Result; use anyhow::anyhow; use chrono::Utc; +use epiphany_core::EpiphanyCultMeshIdunnAftercareAuditReceiptEntry; +use epiphany_core::EpiphanyCultMeshIdunnDeploymentReceiptEntry; +use epiphany_core::write_epiphany_cultmesh_idunn_aftercare_audit_receipt; +use epiphany_core::write_epiphany_cultmesh_idunn_deployment_receipt; use serde_json::Value; use serde_json::json; use std::env; @@ -221,29 +225,53 @@ fn run_smoke(args: Args) -> Result { ], &root, )?; - let idunn_receipt_dir = repo.join(".epiphany").join("work").join("idunn-deployment"); - fs::create_dir_all(&idunn_receipt_dir) - .with_context(|| format!("failed to create {}", idunn_receipt_dir.display()))?; - let idunn_deployment_receipt_path = idunn_receipt_dir.join("fixture-idunn-deployment.json"); - let idunn_aftercare_receipt_path = idunn_receipt_dir.join("fixture-idunn-aftercare.json"); - write_json( - &idunn_deployment_receipt_path, - &json!({ - "schemaVersion": "gamecult.idunn.deployment_receipt.v0", - "status": "deployed", - "trigger": "git-push-observed-by-idunn", - "watchedRef": "refs/heads/main", - "privateStateExposed": false - }), + let current_commit = git_output(["rev-parse", "HEAD"], &repo)?; + let idunn_deployment_receipt_id = "fixture-idunn-deployment"; + let idunn_aftercare_receipt_id = "fixture-idunn-aftercare"; + write_epiphany_cultmesh_idunn_deployment_receipt( + &local_verse, + "repo-deployment-config-family-smoke", + EpiphanyCultMeshIdunnDeploymentReceiptEntry { + schema_version: "gamecult.idunn.deployment_receipt.v0".to_string(), + receipt_id: idunn_deployment_receipt_id.to_string(), + runtime_id: "repo-deployment-config-family-smoke".to_string(), + verse_id: "gamecult-local".to_string(), + status: "deployed".to_string(), + trigger: "git-push-observed-by-idunn".to_string(), + watched_ref: "refs/heads/main".to_string(), + source_commit: current_commit, + result_ref: "idunn://deployment/fixture-idunn-deployment".to_string(), + result_summary: + "Fixture Idunn deployment receipt proves the repo audit can ingest sealed CultMesh receipt refs." + .to_string(), + private_state_exposed: false, + notes: vec![ + "Idunn owns deployment execution; this local Verse row is an operator-safe receipt projection." + .to_string(), + ], + }, )?; - write_json( - &idunn_aftercare_receipt_path, - &json!({ - "schemaVersion": "gamecult.idunn.deployment_aftercare_audit.v0", - "status": "complete", - "checkedRef": "refs/heads/main", - "privateStateExposed": false - }), + write_epiphany_cultmesh_idunn_aftercare_audit_receipt( + &local_verse, + "repo-deployment-config-family-smoke", + EpiphanyCultMeshIdunnAftercareAuditReceiptEntry { + schema_version: "gamecult.idunn.deployment_aftercare_audit.v0".to_string(), + receipt_id: idunn_aftercare_receipt_id.to_string(), + runtime_id: "repo-deployment-config-family-smoke".to_string(), + verse_id: "gamecult-local".to_string(), + status: "complete".to_string(), + checked_ref: "refs/heads/main".to_string(), + deployment_receipt_id: idunn_deployment_receipt_id.to_string(), + audit_ref: "idunn://deployment-aftercare/fixture-idunn-aftercare".to_string(), + result_summary: + "Fixture Idunn aftercare audit receipt proves the repo audit can close from sealed CultMesh receipt refs." + .to_string(), + private_state_exposed: false, + notes: vec![ + "Idunn owns aftercare; this local Verse row exposes status without private deployment state." + .to_string(), + ], + }, )?; let aftercare = cargo_json( &manifest, @@ -252,10 +280,14 @@ fn run_smoke(args: Args) -> Result { "deployment-aftercare-audit", "--workspace", path_str(&repo)?, - "--idunn-deployment-receipt", - path_str(&idunn_deployment_receipt_path)?, - "--aftercare-audit-receipt", - path_str(&idunn_aftercare_receipt_path)?, + "--local-verse-store", + path_str(&local_verse)?, + "--runtime-id", + "repo-deployment-config-family-smoke", + "--idunn-deployment-receipt-ref", + "latest", + "--aftercare-audit-receipt-ref", + "latest", ], &root, )?; @@ -399,6 +431,26 @@ fn run_smoke(args: Args) -> Result { require_bool(&aftercare, &["mergeAuthorized"], false)?; require_bool(&aftercare, &["daemonOwnsExecution"], true)?; require_bool(&aftercare, &["privateStateExposed"], false)?; + require_eq( + &aftercare, + &["idunnDeploymentReceipt", "source"], + "cultmesh", + )?; + require_eq( + &aftercare, + &["idunnDeploymentReceipt", "receiptId"], + idunn_deployment_receipt_id, + )?; + require_eq( + &aftercare, + &["idunnAftercareAuditReceipt", "source"], + "cultmesh", + )?; + require_eq( + &aftercare, + &["idunnAftercareAuditReceipt", "receiptId"], + idunn_aftercare_receipt_id, + )?; require_eq( &aftercare, &["idunnDeploymentReceipt", "schemaVersion"], @@ -434,6 +486,10 @@ fn run_smoke(args: Args) -> Result { "mutatesRemoteWhenRun": runbook["mutatesRemoteWhenRun"], "deploymentAftercareAuditStatus": aftercare["status"], "deploymentComplete": aftercare["deploymentComplete"], + "idunnDeploymentReceiptSource": aftercare["idunnDeploymentReceipt"]["source"], + "idunnAftercareAuditReceiptSource": aftercare["idunnAftercareAuditReceipt"]["source"], + "idunnDeploymentReceiptId": aftercare["idunnDeploymentReceipt"]["receiptId"], + "idunnAftercareAuditReceiptId": aftercare["idunnAftercareAuditReceipt"]["receiptId"], "deploymentTrigger": "git-push-observed-by-idunn", "deploymentOwner": "Idunn", "daemonOwnsExecution": true, diff --git a/epiphany-core/src/bin/epiphany-work.rs b/epiphany-core/src/bin/epiphany-work.rs index cc84aba0..9fec7b45 100644 --- a/epiphany-core/src/bin/epiphany-work.rs +++ b/epiphany-core/src/bin/epiphany-work.rs @@ -31,8 +31,12 @@ use epiphany_core::hands_commit_receipt_for_review; use epiphany_core::hands_patch_receipt_for_review; use epiphany_core::hands_pr_receipt_for_review; use epiphany_core::initialize_runtime_spine; +use epiphany_core::load_epiphany_cultmesh_idunn_aftercare_audit_receipt; +use epiphany_core::load_epiphany_cultmesh_idunn_deployment_receipt; use epiphany_core::load_epiphany_cultmesh_repo_work_overviews; use epiphany_core::load_epiphany_cultmesh_swarm_brake; +use epiphany_core::load_latest_epiphany_cultmesh_idunn_aftercare_audit_receipt; +use epiphany_core::load_latest_epiphany_cultmesh_idunn_deployment_receipt; use epiphany_core::load_latest_epiphany_cultmesh_repo_work_overview; use epiphany_core::mind_state_commit_receipt; use epiphany_core::put_hands_action_intent; @@ -348,9 +352,13 @@ struct DeploymentExecutionRunbookArgs { struct DeploymentAftercareAuditArgs { workspace: PathBuf, artifact_dir: Option, + local_verse_store: Option, + runtime_id: String, runbook_receipt: Option, idunn_deployment_receipt: Option, + idunn_deployment_receipt_ref: Option, aftercare_audit_receipt: Option, + aftercare_audit_receipt_ref: Option, write_receipt: bool, } @@ -1184,9 +1192,13 @@ fn parse_deployment_aftercare_audit_args( ) -> Result { let mut workspace = None; let mut artifact_dir = None; + let mut local_verse_store = None; + let mut runtime_id = "repo-swarm-local".to_string(); let mut runbook_receipt = None; let mut idunn_deployment_receipt = None; + let mut idunn_deployment_receipt_ref = None; let mut aftercare_audit_receipt = None; + let mut aftercare_audit_receipt_ref = None; let mut write_receipt = true; let mut args = args.peekable(); @@ -1194,15 +1206,27 @@ fn parse_deployment_aftercare_audit_args( match arg.as_str() { "--workspace" => workspace = Some(take_path(&mut args, "--workspace")?), "--artifact-dir" => artifact_dir = Some(take_path(&mut args, "--artifact-dir")?), + "--local-verse-store" | "--store" => { + local_verse_store = Some(take_path(&mut args, "--local-verse-store")?); + } + "--runtime-id" => runtime_id = take_string(&mut args, "--runtime-id")?, "--runbook-receipt" => { runbook_receipt = Some(take_path(&mut args, "--runbook-receipt")?) } "--idunn-deployment-receipt" | "--deployment-receipt" => { idunn_deployment_receipt = Some(take_path(&mut args, "--idunn-deployment-receipt")?) } + "--idunn-deployment-receipt-ref" | "--deployment-receipt-ref" => { + idunn_deployment_receipt_ref = + Some(take_string(&mut args, "--idunn-deployment-receipt-ref")?) + } "--aftercare-audit-receipt" | "--aftercare-receipt" => { aftercare_audit_receipt = Some(take_path(&mut args, "--aftercare-audit-receipt")?) } + "--aftercare-audit-receipt-ref" | "--aftercare-receipt-ref" => { + aftercare_audit_receipt_ref = + Some(take_string(&mut args, "--aftercare-audit-receipt-ref")?) + } "--no-write" | "--read-only" => write_receipt = false, other => { return Err(anyhow!( @@ -1214,9 +1238,13 @@ fn parse_deployment_aftercare_audit_args( Ok(DeploymentAftercareAuditArgs { workspace: workspace.context("missing --workspace")?, artifact_dir, + local_verse_store, + runtime_id, runbook_receipt, idunn_deployment_receipt, + idunn_deployment_receipt_ref, aftercare_audit_receipt, + aftercare_audit_receipt_ref, write_receipt, }) } @@ -10639,8 +10667,15 @@ fn run_deployment_aftercare_audit(args: DeploymentAftercareAuditArgs) -> Result< let runbook_receipt_path = args .runbook_receipt .unwrap_or_else(|| artifact_dir.join("deployment-execution-runbook.json")); + let local_verse_store = args + .local_verse_store + .unwrap_or_else(|| workspace.join(".epiphany").join("local-verse.ccmp")); let idunn_deployment_receipt_path = args.idunn_deployment_receipt; + let idunn_deployment_receipt_ref = args.idunn_deployment_receipt_ref; let aftercare_audit_receipt_path = args.aftercare_audit_receipt; + let aftercare_audit_receipt_ref = args.aftercare_audit_receipt_ref; + let runtime_id = args.runtime_id; + let local_verse_store_display = local_verse_store.display().to_string(); let generated_at = Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true); let mut assertions = Vec::new(); @@ -10662,7 +10697,59 @@ fn run_deployment_aftercare_audit(args: DeploymentAftercareAuditArgs) -> Result< .to_string(), ); - let idunn_deployment_summary = if let Some(path) = idunn_deployment_receipt_path.as_ref() { + let idunn_deployment_summary = if let Some(receipt_ref) = idunn_deployment_receipt_ref.as_ref() + { + let receipt = if receipt_ref.trim().is_empty() || receipt_ref.trim() == "latest" { + load_latest_epiphany_cultmesh_idunn_deployment_receipt( + &local_verse_store, + runtime_id.clone(), + )? + } else { + load_epiphany_cultmesh_idunn_deployment_receipt( + &local_verse_store, + runtime_id.clone(), + receipt_ref, + )? + }; + if let Some(receipt) = receipt { + let schema_ok = receipt.schema_version == "gamecult.idunn.deployment_receipt.v0"; + let status_ok = matches!( + receipt.status.as_str(), + "ok" | "complete" | "deployed" | "passed" + ); + let private_ok = !receipt.private_state_exposed; + push_assertion( + &mut assertions, + "idunn-deployment-receipt-valid", + schema_ok && status_ok && private_ok, + "Idunn deployment receipt carries the expected CultMesh contract, successful status, and private-state seal." + .to_string(), + ); + json!({ + "source": "cultmesh", + "store": local_verse_store_display.clone(), + "runtimeId": runtime_id.clone(), + "receiptRef": receipt_ref, + "receiptId": receipt.receipt_id, + "schemaVersion": receipt.schema_version, + "status": receipt.status, + "trigger": receipt.trigger, + "watchedRef": receipt.watched_ref, + "resultRef": receipt.result_ref, + "privateStateExposed": receipt.private_state_exposed + }) + } else { + push_assertion( + &mut assertions, + "idunn-deployment-receipt-present", + false, + format!( + "Idunn deployment receipt ref {receipt_ref:?} was not found in the local Verse store." + ), + ); + Value::Null + } + } else if let Some(path) = idunn_deployment_receipt_path.as_ref() { let receipt = read_json(path)?; let schema_ok = string_from_json(&receipt, &["schemaVersion"]).as_deref() == Some("gamecult.idunn.deployment_receipt.v0"); @@ -10679,6 +10766,7 @@ fn run_deployment_aftercare_audit(args: DeploymentAftercareAuditArgs) -> Result< .to_string(), ); json!({ + "source": "file", "path": path, "schemaVersion": string_from_json(&receipt, &["schemaVersion"]).unwrap_or_else(|| "missing".to_string()), "status": status, @@ -10694,7 +10782,56 @@ fn run_deployment_aftercare_audit(args: DeploymentAftercareAuditArgs) -> Result< Value::Null }; - let aftercare_summary = if let Some(path) = aftercare_audit_receipt_path.as_ref() { + let aftercare_summary = if let Some(receipt_ref) = aftercare_audit_receipt_ref.as_ref() { + let receipt = if receipt_ref.trim().is_empty() || receipt_ref.trim() == "latest" { + load_latest_epiphany_cultmesh_idunn_aftercare_audit_receipt( + &local_verse_store, + runtime_id.clone(), + )? + } else { + load_epiphany_cultmesh_idunn_aftercare_audit_receipt( + &local_verse_store, + runtime_id.clone(), + receipt_ref, + )? + }; + if let Some(receipt) = receipt { + let schema_ok = + receipt.schema_version == "gamecult.idunn.deployment_aftercare_audit.v0"; + let status_ok = matches!(receipt.status.as_str(), "ok" | "complete" | "passed"); + let private_ok = !receipt.private_state_exposed; + push_assertion( + &mut assertions, + "idunn-aftercare-audit-receipt-valid", + schema_ok && status_ok && private_ok, + "Idunn aftercare audit receipt carries the expected CultMesh contract, successful status, and private-state seal." + .to_string(), + ); + json!({ + "source": "cultmesh", + "store": local_verse_store_display.clone(), + "runtimeId": runtime_id.clone(), + "receiptRef": receipt_ref, + "receiptId": receipt.receipt_id, + "schemaVersion": receipt.schema_version, + "status": receipt.status, + "checkedRef": receipt.checked_ref, + "deploymentReceiptId": receipt.deployment_receipt_id, + "auditRef": receipt.audit_ref, + "privateStateExposed": receipt.private_state_exposed + }) + } else { + push_assertion( + &mut assertions, + "idunn-aftercare-audit-receipt-present", + false, + format!( + "Idunn aftercare audit receipt ref {receipt_ref:?} was not found in the local Verse store." + ), + ); + Value::Null + } + } else if let Some(path) = aftercare_audit_receipt_path.as_ref() { let receipt = read_json(path)?; let schema_ok = string_from_json(&receipt, &["schemaVersion"]).as_deref() == Some("gamecult.idunn.deployment_aftercare_audit.v0"); @@ -10711,6 +10848,7 @@ fn run_deployment_aftercare_audit(args: DeploymentAftercareAuditArgs) -> Result< .to_string(), ); json!({ + "source": "file", "path": path, "schemaVersion": string_from_json(&receipt, &["schemaVersion"]).unwrap_or_else(|| "missing".to_string()), "status": status, @@ -10744,6 +10882,8 @@ fn run_deployment_aftercare_audit(args: DeploymentAftercareAuditArgs) -> Result< "workspace": workspace, "receiptPath": receipt_path, "runbookReceiptPath": runbook_receipt_path, + "localVerseStore": local_verse_store_display, + "runtimeId": runtime_id, "idunnDeploymentReceipt": idunn_deployment_summary, "idunnAftercareAuditReceipt": aftercare_summary, "deploymentComplete": status == "complete", @@ -12938,7 +13078,7 @@ fn print_usage() { overview --workspace [--item ] [--accept-receipt ] [--no-write]\n\ deployment-config-audit --workspace [--artifact-dir ] [--no-write]\n\ deployment-execution-runbook --workspace [--artifact-dir ] [--remote origin] [--no-write]\n\ - deployment-aftercare-audit --workspace [--artifact-dir ] [--runbook-receipt ] [--idunn-deployment-receipt ] [--aftercare-audit-receipt ] [--no-write]\n\ + deployment-aftercare-audit --workspace [--artifact-dir ] [--local-verse-store ] [--runtime-id ] [--runbook-receipt ] [--idunn-deployment-receipt-ref |--idunn-deployment-receipt ] [--aftercare-audit-receipt-ref |--aftercare-audit-receipt ] [--no-write]\n\ export-proof --workspace [--item ] [--accept-receipt ] [--output ] [--local-verse-store ] [--runtime-id repo-swarm-local]\n\ tick --workspace [--item ] [--local-verse-store ] [--runtime-store ] [--dry-run]\n\ queue-run --workspace [--local-verse-store ] [--runtime-id repo-swarm-local] [--max-items 1] [--dry-run]" diff --git a/epiphany-core/src/cultmesh_integration.rs b/epiphany-core/src/cultmesh_integration.rs index 9e5388c2..196b3248 100644 --- a/epiphany-core/src/cultmesh_integration.rs +++ b/epiphany-core/src/cultmesh_integration.rs @@ -144,6 +144,14 @@ pub const EPIPHANY_CULTMESH_DAEMON_SERVICE_LIFECYCLE_RECEIPT_SCHEMA_VERSION: &st "epiphany.cultmesh.daemon_service_lifecycle_receipt.v0"; pub const EPIPHANY_CULTMESH_DAEMON_SERVICE_LIFECYCLE_RECEIPT_LATEST_KEY: &str = "epiphany-local/daemon-service-lifecycle-receipt/latest"; +pub const EPIPHANY_CULTMESH_IDUNN_DEPLOYMENT_RECEIPT_SCHEMA_VERSION: &str = + "gamecult.idunn.deployment_receipt.v0"; +pub const EPIPHANY_CULTMESH_IDUNN_DEPLOYMENT_RECEIPT_LATEST_KEY: &str = + "gamecult-local/idunn/deployment-receipt/latest"; +pub const EPIPHANY_CULTMESH_IDUNN_AFTERCARE_AUDIT_RECEIPT_SCHEMA_VERSION: &str = + "gamecult.idunn.deployment_aftercare_audit.v0"; +pub const EPIPHANY_CULTMESH_IDUNN_AFTERCARE_AUDIT_RECEIPT_LATEST_KEY: &str = + "gamecult-local/idunn/deployment-aftercare-audit/latest"; pub const EPIPHANY_CULTMESH_SWARM_BRAKE_TYPE: &str = "epiphany.cultmesh.swarm_brake"; pub const EPIPHANY_CULTMESH_SWARM_BRAKE_SCHEMA_VERSION: &str = "epiphany.cultmesh.swarm_brake.v0"; pub const EPIPHANY_CULTMESH_SWARM_BRAKE_KEY: &str = "epiphany-local/swarm-brake"; @@ -1294,6 +1302,68 @@ pub struct EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry { pub notes: Vec, } +#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] +#[cultcache( + type = "gamecult.idunn.deployment_receipt", + schema = "EpiphanyCultMeshIdunnDeploymentReceiptEntry" +)] +pub struct EpiphanyCultMeshIdunnDeploymentReceiptEntry { + #[cultcache(key = 0)] + pub schema_version: String, + #[cultcache(key = 1)] + pub receipt_id: String, + #[cultcache(key = 2)] + pub runtime_id: String, + #[cultcache(key = 3)] + pub verse_id: String, + #[cultcache(key = 4)] + pub status: String, + #[cultcache(key = 5)] + pub trigger: String, + #[cultcache(key = 6)] + pub watched_ref: String, + #[cultcache(key = 7)] + pub source_commit: String, + #[cultcache(key = 8)] + pub result_ref: String, + #[cultcache(key = 9)] + pub result_summary: String, + #[cultcache(key = 10)] + pub private_state_exposed: bool, + #[cultcache(key = 11)] + pub notes: Vec, +} + +#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] +#[cultcache( + type = "gamecult.idunn.deployment_aftercare_audit", + schema = "EpiphanyCultMeshIdunnAftercareAuditReceiptEntry" +)] +pub struct EpiphanyCultMeshIdunnAftercareAuditReceiptEntry { + #[cultcache(key = 0)] + pub schema_version: String, + #[cultcache(key = 1)] + pub receipt_id: String, + #[cultcache(key = 2)] + pub runtime_id: String, + #[cultcache(key = 3)] + pub verse_id: String, + #[cultcache(key = 4)] + pub status: String, + #[cultcache(key = 5)] + pub checked_ref: String, + #[cultcache(key = 6)] + pub deployment_receipt_id: String, + #[cultcache(key = 7)] + pub audit_ref: String, + #[cultcache(key = 8)] + pub result_summary: String, + #[cultcache(key = 9)] + pub private_state_exposed: bool, + #[cultcache(key = 10)] + pub notes: Vec, +} + #[derive(Clone, Debug, PartialEq, Eq, Serialize)] #[serde(rename_all = "camelCase")] pub struct EpiphanyServiceExecutionAuditCheck { @@ -2216,6 +2286,8 @@ cultmesh_documents!(EpiphanyCultMeshDocuments { EpiphanyCultMeshDaemonRestartPolicyEntry => EPIPHANY_CULTMESH_DAEMON_RESTART_POLICY_SCHEMA_VERSION, EpiphanyCultMeshDaemonSchedulerReceiptEntry => EPIPHANY_CULTMESH_DAEMON_SCHEDULER_RECEIPT_SCHEMA_VERSION, EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry => EPIPHANY_CULTMESH_DAEMON_SERVICE_LIFECYCLE_RECEIPT_SCHEMA_VERSION, + EpiphanyCultMeshIdunnDeploymentReceiptEntry => EPIPHANY_CULTMESH_IDUNN_DEPLOYMENT_RECEIPT_SCHEMA_VERSION, + EpiphanyCultMeshIdunnAftercareAuditReceiptEntry => EPIPHANY_CULTMESH_IDUNN_AFTERCARE_AUDIT_RECEIPT_SCHEMA_VERSION, EpiphanyCultMeshSwarmBrakeEntry => EPIPHANY_CULTMESH_SWARM_BRAKE_SCHEMA_VERSION, EpiphanyCultMeshPersonaSpeechAuditEntry => EPIPHANY_CULTMESH_PERSONA_SPEECH_AUDIT_SCHEMA_VERSION, EpiphanyCultMeshDaemonToolCapabilityEntry => EPIPHANY_CULTMESH_DAEMON_TOOL_CAPABILITY_SCHEMA_VERSION, @@ -3225,6 +3297,76 @@ pub fn load_epiphany_cultmesh_daemon_service_lifecycle_receipts( .collect()) } +pub fn write_epiphany_cultmesh_idunn_deployment_receipt( + store_path: impl AsRef, + runtime_id: impl Into, + receipt: EpiphanyCultMeshIdunnDeploymentReceiptEntry, +) -> Result { + validate_idunn_deployment_receipt(&receipt)?; + let mut node = open_epiphany_cultmesh_node(store_path, runtime_id)?; + let receipt_key = epiphany_cultmesh_idunn_deployment_receipt_key(&receipt.receipt_id); + let written = node.put(receipt_key.as_str(), &receipt)?; + node.put( + EPIPHANY_CULTMESH_IDUNN_DEPLOYMENT_RECEIPT_LATEST_KEY, + &written, + )?; + node.flush()?; + Ok(written) +} + +pub fn load_epiphany_cultmesh_idunn_deployment_receipt( + store_path: impl AsRef, + runtime_id: impl Into, + receipt_ref: impl AsRef, +) -> Result> { + let node = open_epiphany_cultmesh_node(store_path, runtime_id)?; + let key = epiphany_cultmesh_idunn_deployment_receipt_ref_key(receipt_ref.as_ref()); + node.get(key.as_str()) +} + +pub fn load_latest_epiphany_cultmesh_idunn_deployment_receipt( + store_path: impl AsRef, + runtime_id: impl Into, +) -> Result> { + let node = open_epiphany_cultmesh_node(store_path, runtime_id)?; + node.get(EPIPHANY_CULTMESH_IDUNN_DEPLOYMENT_RECEIPT_LATEST_KEY) +} + +pub fn write_epiphany_cultmesh_idunn_aftercare_audit_receipt( + store_path: impl AsRef, + runtime_id: impl Into, + receipt: EpiphanyCultMeshIdunnAftercareAuditReceiptEntry, +) -> Result { + validate_idunn_aftercare_audit_receipt(&receipt)?; + let mut node = open_epiphany_cultmesh_node(store_path, runtime_id)?; + let receipt_key = epiphany_cultmesh_idunn_aftercare_audit_receipt_key(&receipt.receipt_id); + let written = node.put(receipt_key.as_str(), &receipt)?; + node.put( + EPIPHANY_CULTMESH_IDUNN_AFTERCARE_AUDIT_RECEIPT_LATEST_KEY, + &written, + )?; + node.flush()?; + Ok(written) +} + +pub fn load_epiphany_cultmesh_idunn_aftercare_audit_receipt( + store_path: impl AsRef, + runtime_id: impl Into, + receipt_ref: impl AsRef, +) -> Result> { + let node = open_epiphany_cultmesh_node(store_path, runtime_id)?; + let key = epiphany_cultmesh_idunn_aftercare_audit_receipt_ref_key(receipt_ref.as_ref()); + node.get(key.as_str()) +} + +pub fn load_latest_epiphany_cultmesh_idunn_aftercare_audit_receipt( + store_path: impl AsRef, + runtime_id: impl Into, +) -> Result> { + let node = open_epiphany_cultmesh_node(store_path, runtime_id)?; + node.get(EPIPHANY_CULTMESH_IDUNN_AFTERCARE_AUDIT_RECEIPT_LATEST_KEY) +} + pub fn default_epiphany_cultmesh_swarm_brake( generated_at_utc: impl Into, ) -> EpiphanyCultMeshSwarmBrakeEntry { @@ -3497,6 +3639,69 @@ fn validate_daemon_service_lifecycle_receipt( Ok(()) } +fn validate_idunn_deployment_receipt( + receipt: &EpiphanyCultMeshIdunnDeploymentReceiptEntry, +) -> Result<()> { + if receipt.private_state_exposed { + return Err(anyhow!( + "Idunn deployment receipts must not expose private state" + )); + } + if receipt.schema_version != EPIPHANY_CULTMESH_IDUNN_DEPLOYMENT_RECEIPT_SCHEMA_VERSION { + return Err(anyhow!( + "Idunn deployment receipt schema_version must be {:?}", + EPIPHANY_CULTMESH_IDUNN_DEPLOYMENT_RECEIPT_SCHEMA_VERSION + )); + } + for (label, value) in [ + ("receipt id", receipt.receipt_id.as_str()), + ("runtime id", receipt.runtime_id.as_str()), + ("verse id", receipt.verse_id.as_str()), + ("status", receipt.status.as_str()), + ("trigger", receipt.trigger.as_str()), + ("watched ref", receipt.watched_ref.as_str()), + ("result ref", receipt.result_ref.as_str()), + ] { + if value.trim().is_empty() { + return Err(anyhow!("Idunn deployment receipt missing {label}")); + } + } + Ok(()) +} + +fn validate_idunn_aftercare_audit_receipt( + receipt: &EpiphanyCultMeshIdunnAftercareAuditReceiptEntry, +) -> Result<()> { + if receipt.private_state_exposed { + return Err(anyhow!( + "Idunn aftercare audit receipts must not expose private state" + )); + } + if receipt.schema_version != EPIPHANY_CULTMESH_IDUNN_AFTERCARE_AUDIT_RECEIPT_SCHEMA_VERSION { + return Err(anyhow!( + "Idunn aftercare audit receipt schema_version must be {:?}", + EPIPHANY_CULTMESH_IDUNN_AFTERCARE_AUDIT_RECEIPT_SCHEMA_VERSION + )); + } + for (label, value) in [ + ("receipt id", receipt.receipt_id.as_str()), + ("runtime id", receipt.runtime_id.as_str()), + ("verse id", receipt.verse_id.as_str()), + ("status", receipt.status.as_str()), + ("checked ref", receipt.checked_ref.as_str()), + ( + "deployment receipt id", + receipt.deployment_receipt_id.as_str(), + ), + ("audit ref", receipt.audit_ref.as_str()), + ] { + if value.trim().is_empty() { + return Err(anyhow!("Idunn aftercare audit receipt missing {label}")); + } + } + Ok(()) +} + pub fn epiphany_cultmesh_daemon_tool_invocation_intent_from_capability( intent_id: impl Into, requesting_agent_id: impl Into, @@ -5214,6 +5419,36 @@ fn epiphany_cultmesh_daemon_service_lifecycle_receipt_key(receipt_id: &str) -> S format!("epiphany-local/daemon-service-lifecycle-receipt/{receipt_id}") } +fn epiphany_cultmesh_idunn_deployment_receipt_key(receipt_id: &str) -> String { + format!("gamecult-local/idunn/deployment-receipt/{receipt_id}") +} + +fn epiphany_cultmesh_idunn_deployment_receipt_ref_key(receipt_ref: &str) -> String { + let trimmed = receipt_ref.trim(); + if trimmed.is_empty() || trimmed == "latest" { + EPIPHANY_CULTMESH_IDUNN_DEPLOYMENT_RECEIPT_LATEST_KEY.to_string() + } else if trimmed.starts_with("gamecult-local/") { + trimmed.to_string() + } else { + epiphany_cultmesh_idunn_deployment_receipt_key(trimmed) + } +} + +fn epiphany_cultmesh_idunn_aftercare_audit_receipt_key(receipt_id: &str) -> String { + format!("gamecult-local/idunn/deployment-aftercare-audit/{receipt_id}") +} + +fn epiphany_cultmesh_idunn_aftercare_audit_receipt_ref_key(receipt_ref: &str) -> String { + let trimmed = receipt_ref.trim(); + if trimmed.is_empty() || trimmed == "latest" { + EPIPHANY_CULTMESH_IDUNN_AFTERCARE_AUDIT_RECEIPT_LATEST_KEY.to_string() + } else if trimmed.starts_with("gamecult-local/") { + trimmed.to_string() + } else { + epiphany_cultmesh_idunn_aftercare_audit_receipt_key(trimmed) + } +} + fn epiphany_cultmesh_daemon_tool_invocation_receipt_key(receipt_id: &str) -> String { format!("epiphany-local/daemon-tool-invocation-receipt/{receipt_id}") } diff --git a/epiphany-core/src/lib.rs b/epiphany-core/src/lib.rs index 5d756e43..7d5dfd7a 100644 --- a/epiphany-core/src/lib.rs +++ b/epiphany-core/src/lib.rs @@ -257,6 +257,8 @@ pub use cultmesh_integration::EpiphanyCultMeshEyesContractEntry; pub use cultmesh_integration::EpiphanyCultMeshGlobalRoomPolicyEntry; pub use cultmesh_integration::EpiphanyCultMeshHandsActionGateEntry; pub use cultmesh_integration::EpiphanyCultMeshHandsContractEntry; +pub use cultmesh_integration::EpiphanyCultMeshIdunnAftercareAuditReceiptEntry; +pub use cultmesh_integration::EpiphanyCultMeshIdunnDeploymentReceiptEntry; pub use cultmesh_integration::EpiphanyCultMeshImaginationConsensusReceiptEntry; pub use cultmesh_integration::EpiphanyCultMeshMindContractEntry; pub use cultmesh_integration::EpiphanyCultMeshOdinAdvertisementEntry; @@ -322,6 +324,8 @@ pub use cultmesh_integration::load_epiphany_cultmesh_daemon_restart_policy_direc pub use cultmesh_integration::load_epiphany_cultmesh_daemon_service_lifecycle_receipts; pub use cultmesh_integration::load_epiphany_cultmesh_daemon_tool_directory; pub use cultmesh_integration::load_epiphany_cultmesh_eve_surface_directory; +pub use cultmesh_integration::load_epiphany_cultmesh_idunn_aftercare_audit_receipt; +pub use cultmesh_integration::load_epiphany_cultmesh_idunn_deployment_receipt; pub use cultmesh_integration::load_epiphany_cultmesh_operator_snapshot; pub use cultmesh_integration::load_epiphany_cultmesh_operator_status; pub use cultmesh_integration::load_epiphany_cultmesh_repo_work_map_entries; @@ -345,6 +349,8 @@ pub use cultmesh_integration::load_latest_epiphany_cultmesh_daemon_tool_invocati pub use cultmesh_integration::load_latest_epiphany_cultmesh_eve_connection_intent; pub use cultmesh_integration::load_latest_epiphany_cultmesh_eve_connection_receipt; pub use cultmesh_integration::load_latest_epiphany_cultmesh_hands_action_gate; +pub use cultmesh_integration::load_latest_epiphany_cultmesh_idunn_aftercare_audit_receipt; +pub use cultmesh_integration::load_latest_epiphany_cultmesh_idunn_deployment_receipt; pub use cultmesh_integration::load_latest_epiphany_cultmesh_imagination_consensus_receipt; pub use cultmesh_integration::load_latest_epiphany_cultmesh_operator_run_intent; pub use cultmesh_integration::load_latest_epiphany_cultmesh_operator_run_receipt; @@ -384,6 +390,8 @@ pub use cultmesh_integration::write_epiphany_cultmesh_eyes_contracts; pub use cultmesh_integration::write_epiphany_cultmesh_global_room_policies; pub use cultmesh_integration::write_epiphany_cultmesh_hands_action_gate; pub use cultmesh_integration::write_epiphany_cultmesh_hands_contracts; +pub use cultmesh_integration::write_epiphany_cultmesh_idunn_aftercare_audit_receipt; +pub use cultmesh_integration::write_epiphany_cultmesh_idunn_deployment_receipt; pub use cultmesh_integration::write_epiphany_cultmesh_imagination_consensus_receipt; pub use cultmesh_integration::write_epiphany_cultmesh_mind_contracts; pub use cultmesh_integration::write_epiphany_cultmesh_operator_run_intent; diff --git a/notes/epiphany-repo-swarm-mvp-contract.md b/notes/epiphany-repo-swarm-mvp-contract.md index 6ff47f52..e1815a12 100644 --- a/notes/epiphany-repo-swarm-mvp-contract.md +++ b/notes/epiphany-repo-swarm-mvp-contract.md @@ -806,17 +806,21 @@ runbook beside config close and audit. The post-push receipt mouth is now explicit as well. `epiphany-work deployment-aftercare-audit --workspace ---idunn-deployment-receipt --aftercare-audit-receipt ` reads the -operator runbook receipt plus supplied Idunn deployment and aftercare receipts, -checks `gamecult.idunn.deployment_receipt.v0` and +--local-verse-store --idunn-deployment-receipt-ref +--aftercare-audit-receipt-ref ` reads the operator runbook receipt plus +sealed Idunn deployment and aftercare receipt projections from the repo-local +CultMesh store, checks `gamecult.idunn.deployment_receipt.v0` and `gamecult.idunn.deployment_aftercare_audit.v0`, and emits `epiphany.repo_deployment_aftercare_audit.v0`. It reports `complete` only when the runbook is ready and both Idunn receipts carry successful statuses and private-state seals; otherwise it reports the missing gate without mutating -remote refs or granting deployment authority. Smoke -`.epiphany-smoke\repo-deployment-config-family-20260620-215037` proved the -complete ingestion path from explicit fixture receipts with -`deploymentComplete=true` and `privateStateExposed=false`. +remote refs or granting deployment authority. The older explicit receipt-file +flags remain as compatibility reliquaries. Smoke +`.epiphany-smoke\repo-deployment-config-family-20260620-221205` proved the +CultMesh receipt-ref ingestion path with +`idunnDeploymentReceiptSource=cultmesh`, +`idunnAftercareAuditReceiptSource=cultmesh`, `deploymentComplete=true`, and +`privateStateExposed=false`. ### Landed Work Run Gate diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 6623169a..a9e4647c 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -128,7 +128,7 @@ remembers doctrine; the branch remembers the blade. - 2026-06-20: Gjallar now has a branch lens over Mind-admitted repo-work maps. `repoWorkMapBranchLensRows` / `REPO-WORK-MAP-BRANCH` group accepted map consequences by branch with item count, changed-path count, safe-family list, latest item/commit/Mind commit, Bifrost gate, and `privateStateExposed=false`. Smoke `.epiphany-smoke\repo-close-mind-adoption-guard-20260620-210747` reran the counterfeit-adoption guard and proved `gjallarRepoWorkMapBranchLensCount=1` alongside the family/path lenses. This is branch-workbench sight only: Gjallar still does not schedule, publish, merge, deploy, keep daemons alive, or admit Mind state. - 2026-06-20: `epiphany-work deployment-config-audit` is live as the non-mutating Idunn handoff readback for repo deployment config. It reads `.epiphany/deployment.toml`, writes `epiphany.repo_deployment_config_audit.v0`, reports `ready-for-idunn-review` only when the disabled git-push Idunn trigger, CultMesh intent/receipt/aftercare contracts, required receipts, and authority seals are present, and always keeps execution/deployment/SSH/git-push/service/Hands/publication/merge/cross-body authority false. Smoke `.epiphany-smoke\repo-deployment-config-family-20260620-213042` proved the audit beside the `repo.deployment_config` close path with `daemonOwnsExecution=true`, `readyForIdunnReview=true`, and `privateStateExposed=false`. - 2026-06-20: `epiphany-work deployment-execution-runbook` is live as the explicit operator-owned git-push handoff for Idunn deployment. It requires the deployment config audit to pass, writes `.epiphany/work/idunn-deployment/idunn-git-push-runbook.ps1`, emits `epiphany.repo_deployment_execution_runbook.v0`, reports `ready-for-operator-git-push`, includes the exact `git push origin HEAD:refs/heads/main` route, runbook SHA-256, and required Idunn deployment/aftercare receipt contracts, and marks `requiresExplicitOperatorAuthority=true` plus `mutatesRemoteWhenRun=true` while keeping execution/deployment/SSH/git-push/service/Hands/publication/merge/cross-body authority false for the repo agent. Smoke `.epiphany-smoke\repo-deployment-config-family-20260620-214109` proved the runbook with `deploymentExecutionRunbookStatus=ready-for-operator-git-push`, SHA-256 `57560eda912b6e5c15f97acf53500534bb3bcf739098f329add3d88e5a9cd1d3`, and `privateStateExposed=false`. -- 2026-06-20: `epiphany-work deployment-aftercare-audit` is live as the post-operator Idunn receipt ingestion mouth. It reads the deployment runbook receipt plus explicit `gamecult.idunn.deployment_receipt.v0` and `gamecult.idunn.deployment_aftercare_audit.v0` files, emits `epiphany.repo_deployment_aftercare_audit.v0`, reports `complete` only when both Idunn receipts have successful statuses and private-state seals, and remains non-mutating with deployment/SSH/git-push/service/Hands/publication/merge authority false. Smoke `.epiphany-smoke\repo-deployment-config-family-20260620-215037` proved the complete path with fixture Idunn receipts, `deploymentAftercareAuditStatus=complete`, `deploymentComplete=true`, and `privateStateExposed=false`. +- 2026-06-20: `epiphany-work deployment-aftercare-audit` is live as the post-operator Idunn receipt ingestion mouth, and now reads sealed Idunn receipt projections from repo-local CultMesh refs. It reads the deployment runbook receipt plus `gamecult.idunn.deployment_receipt.v0` and `gamecult.idunn.deployment_aftercare_audit.v0` via `--local-verse-store`, `--idunn-deployment-receipt-ref`, and `--aftercare-audit-receipt-ref`, emits `epiphany.repo_deployment_aftercare_audit.v0`, reports `complete` only when both Idunn receipts have successful statuses and private-state seals, and remains non-mutating with deployment/SSH/git-push/service/Hands/publication/merge authority false. The older explicit receipt-file flags remain compatibility reliquaries. Smoke `.epiphany-smoke\repo-deployment-config-family-20260620-221205` proved the CultMesh ref path with `idunnDeploymentReceiptSource=cultmesh`, `idunnAftercareAuditReceiptSource=cultmesh`, `deploymentAftercareAuditStatus=complete`, `deploymentComplete=true`, and `privateStateExposed=false`. - 2026-06-20: Deeper model-authored closure review is now live. `epiphany-work close` accepts `--closure-model-verdict passed|failed|needs-work|blocked`, `--closure-model-finding`, and `--require-closure-model-verdict`; the close review embeds `epiphany.repo_work_model_closure_review.v0` under `modelingReview.closureReview`, records reviewed inputs and gate enforcement, and Soul refuses closure when a supplied or required model verdict does not pass. Focused smoke `.epiphany-smoke\closure-model-gate-20260620-135103` created a disposable repo, ran two `repo.status_section` items through public front doors, closed one with required model verdict `passed`, and blocked one with `needs-work` while `familyAssertions.status=passed`, `pathScopeMatched=true`, and `privateStateExposed=false`. Current remaining repo-swarm MVP organs are deeper interpreter/adoption semantics, more useful repo-owned configuration/action families, and Idunn-owned queue-run service lifecycle under explicit operator authority. - 2026-06-20: Mind adoption/interpreter depth now has a concrete interpretation packet. `epiphany-work adopt` writes `epiphany.repo_work_mind_adoption_decision.v0` before the main adoption receipt, embeds `epiphany.repo_work_mind_interpretation.v0` with input summary, safe-family recognition, requested-path classification, allowed branch-local Hands transition, and forbidden durable-state/publication/service/private transitions, then records Self presentation, Mind evidence review, safe-family requirement, branch-local scope, Bifrost publication gate, Soul closure requirement, and no Hands/durable-state/publication/merge/service/cross-body/private authority inside the Mind decision; the main adoption receipt cites that decision before granting branch-local Hands authority. Focused smoke `.epiphany-smoke\repo-planning-facets-20260620-175503` proves model-authored planning facets survive into Imagination, plan derivation, Mind interpretation, Mind decision, and adoption, while close still passes Soul/family/path checks with `privateStateExposed=false`. Current remaining repo-swarm MVP organs are deeper interpreter semantics beyond the first Mind interpretation packet, more useful repo-owned configuration/action families, and Idunn-owned queue-run service lifecycle under explicit operator authority. - 2026-06-20: `repo-manifest` is now the next non-planning safe family. `epiphany-work derive-plan --action-family repo-manifest` lowers accepted pressure into a structured `epiphany.toml` Body manifest with safe family `repo.body_manifest`, body domain, private/local/public Verse ids, Eve surface id, receipt-required capability hints, arbitrary shell sealed false, and private-state seals. Soul closure assertions now inspect the committed manifest for schema, safe family, summary, body domain, Verse ids, Eve surface, receipt requirement, no arbitrary shell, and private-state seals. Focused smoke `.epiphany-smoke\repo-manifest-family-20260620-141552` ran a disposable repo through init -> online -> accept -> repo-manifest derive-plan -> tick run/adopt/execute/close; Hands committed only `epiphany.toml`, Soul passed with `pathScopeMatched=true`, `familyAssertions.status=passed`, and `privateStateExposed=false`. Current remaining repo-swarm MVP organs are deeper interpreter/adoption semantics, additional useful repo-owned config/action families, and Idunn-owned queue-run service lifecycle under explicit operator authority. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index af02ae6f..49141bd4 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index 56694cb7..6abf264a 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -88,7 +88,7 @@ active_subgoals: - Keep the landed Phase 6 coordinator, limited safe-boundary CRRC automation, and pre-compaction checkpoint intervention ready for the next bridge-equipped dogfood run. - Preserve the Ghostlight-derived heartbeat initiative seam: every lane, including coordinator/Self and Persona, has a organ-state record and competes for heartbeat slots through readiness/reaction timing; initiative heat can raise or cool global, group, arena, role, and agent tempo through typed heartbeat policy; active thinking freezes initiative until completion, so heat never queues a lane already mid-turn; idle winners ruminate instead of inventing project work, and sleep windows distill the accumulated thought pressure into reviewed self-memory or doctrine. - Use `notes/epiphany-swarm-readiness-plan.md` as the live-fire direction gate. The local run path is a compass, not launch clearance: before unattended swarm operation, Epiphany needs typed pause/brake enforcement, one initiative scheduler, completion-gated cooldown, stale active-turn recovery receipts, parent-side Persona speech eligibility, memory lifecycle operations, and CultNet-first operator snapshots/intents/receipts. The local Verse brake document exists, `epiphany-verse-query swarm-brake` can engage/release it, `tools/epiphany_local_run.ps1` refuses live `plan`/`run`/`mvp` modes when the brake is engaged while leaving `status` readable, `epiphany-mvp-coordinator` checks the local Verse brake before app-server startup, and `epiphany-heartbeat-store` guards tick/pump/heat/queue-mention/routine when given `--local-verse-store`. Daemon liveness is now a typed local Verse authority: `epiphany-verse-query daemon-status` writes one daemon status without repainting the table, local Verse seeding preserves existing daemon statuses and swarm brakes, `invoke-tool` refuses when the host daemon is not ready or lacks `submitTypedToolIntent`, and both daemon tool invocation and lifecycle poke fail closed under an engaged matching brake. `epiphany-daemon-supervisor policy` writes durable per-daemon restart policy with command/args/cwd/cooldown/backoff/attempt state plus reconcile cadence and stale-heartbeat threshold; `epiphany-daemon-supervisor reconcile` loads that policy when no override command is supplied, refuses under a matching lifecycle brake, refuses during cooldown/backoff, writes daemon poke intent/receipt, updates daemon status, and updates policy attempt state; `epiphany-daemon-supervisor tick` is an explicit scheduler pulse that scans durable policies, records ready/noop pulses, skips before the configured reconcile interval, marks stale heartbeat status degraded, routes restarts through the same brake/cooldown/poke receipt path, and writes a latest `epiphany.cultmesh.daemon_scheduler_receipt.v0`; `epiphany-daemon-supervisor serve` runs that same pulse on a configurable cadence with bounded `--max-iterations` proof mode or unbounded service mode. `epiphany-daemon-supervisor service-plan`/`install-service` now writes a planned `epiphany.cultmesh.daemon_service_lifecycle_receipt.v0` for the `serve` command, while `service-launch`/`start-service` spawns that `serve` loop through the current executable or `--service-command`, can `--wait-child` for bounded proof, and records command/args/cwd, scheduler id, daemon selector, pid/exit/status, artifact ref, and private-state guard. `service-runbook`, `windows-service-install`/`service-install-plan`, `windows-service-status`, `windows-service-reconcile`, `windows-service-execution-readiness`, and `windows-service-start`/`stop` now record service lifecycle receipts through the same local Verse; the read-only status path has been proved against the real Windows `EventLog` service with receipt `daemon-service-lifecycle-receipt-windows-eventlog-proof-windows-service-status`, status `running`, exit code `0`, and `privateStateExposed=false`; the read-only service-policy reconciliation path has been proved for missing service, real-service drift against `EventLog`, lifecycle-brake refusal, and wrapper/local-Verse receipt `daemon-service-lifecycle-receipt-windows-eventlog-reconcile-proof-windows-service-reconcile`; execution readiness has been proved as a non-mutating `not-elevated` receipt through direct and wrapper paths; start/stop now produce non-mutating `start-planned`/`stop-planned` receipts unless `--execute-control`/`--execute-service-control` is passed, and wrapper `service-start-plan`/`service-stop-plan` proves those receipts against `EventLog`; explicit install/control execution now refuses as `execution-refused-not-elevated` with `executed=false` when the shell lacks Windows administrator authority, and wrapper `service-install-execute`, `service-start-execute`, and `service-stop-execute` prove those refusal receipts without mutation. Service lifecycle actions check the local Verse swarm brake before process launch, artifact writes, service-manager queries, service-policy reconciliation, execution-readiness checks, control planning, elevation-gated execution, or start/stop execution. The local wrapper builds/checks this binary. - - Use `notes/epiphany-repo-swarm-mvp-contract.md` as the repo-swarm autonomy authority map. Autonomous branch-local work inside an Epiphany-owned repo Body is in scope and desired; the safety boundary is typed authority, branch containment, interruption, receipts, private-state sealing, and Bifrost-gated publication/merge/escalation, not asking a human before every local edit. Current safe-family cargo includes repo manifest, tool capability manifest, daemon-hosted tool request cargo, Eve/CultUI surface contract, repo collaboration policy, collaboration topics, consensus/objective/adoption/scheduling/work-order/verification/publication/sync/review/PR/credit/artifact/metrics/doctrine-update/secret-policy/deployment requests, repo deployment config, action-item receipts, Mind adoption interpretation/decision receipts, explicit Mind safe-family refusal proof `.epiphany-smoke\repo-mind-safe-family-guard-20260620-194425`, explicit Mind requested-path/plan changed-path refusal proof `.epiphany-smoke\repo-mind-path-guard-20260620-194239`, overview/public-proof/Gjallar/Eve readbacks, typed swarm-run stop classification, Idunn non-mutating queue-run lifecycle receipts, and fresh-repo upstream-main proof. Latest deployment proof `.epiphany-smoke\repo-deployment-config-family-20260620-215037` shows `repo.deployment_config` closes through Soul, `deployment-config-audit` reports `ready-for-idunn-review`, `deployment-execution-runbook` reports `ready-for-operator-git-push`, and `deployment-aftercare-audit` ingests explicit Idunn deployment/aftercare receipts with status `complete`, `deploymentComplete=true`, `daemonOwnsExecution=true`, no repo-agent execution/deployment/SSH/git-push/service/Hands/publication/merge/cross-body authority, and `privateStateExposed=false`. Latest deployment request proof `.epiphany-smoke\repo-deployment-request-family-20260620-195605` shows `repo.deployment_request` closes through Soul while requesting reviewed git-push-observed-by-Idunn deployment with script/host/secret/rollback/aftercare requirements and no deployment/SSH/git-push/service authority. Latest security cargo proof `.epiphany-smoke\repo-secret-policy-request-family-20260620-193046` shows `repo.secret_policy_request` closes through Soul while requesting reviewed secret/write/export/deployment policy without exposing secrets or granting write/deployment/publication authority. Governance proof `.epiphany-smoke\repo-doctrine-update-request-family-20260620-192140` shows `repo.doctrine_update_request` closes through Soul while requesting reviewed `AGENTS.md` doctrine work without mutating doctrine or granting Hands/service/publication authority. Swarm-run stop proofs now include `.epiphany-smoke\fresh-repo-mvp-20260620-180024` for `iteration-limit` / Self / `self.scheduler-iteration-limit` with upstream-main sync and public-proof export, plus `.epiphany-smoke\swarm-stop-classification-20260620-184717` for `queue-empty` / Gjallar / `repo.work.overview`, `dry-run-preview` / Self / `ready-to-run`, `authority-gated` / Bifrost / `awaiting-publication`, and `authority-gated` / Bifrost/GitHub / `awaiting-upstream-sync`; all stop packets are non-mutating, non-elevated, and `privateStateExposed=false`. Native proof `.epiphany-smoke\repo-work-service-lifecycle-20260620-185853` now proves Idunn-owned non-mutating repo-work queue-run service plan/runbook receipts for exact service id `epiphany-repo-work-queue-runner`, receipt-directory readback, runbook SHA-256 `f2ec67c4f8243a3ebc2f9e915b6b9f5ae2ac2d99d2cdb86905b54667adc456f8`, `hostedBody=repo-work`, no service-manager mutation, no launch, no elevation, and `privateStateExposed=false`. + - Use `notes/epiphany-repo-swarm-mvp-contract.md` as the repo-swarm autonomy authority map. Autonomous branch-local work inside an Epiphany-owned repo Body is in scope and desired; the safety boundary is typed authority, branch containment, interruption, receipts, private-state sealing, and Bifrost-gated publication/merge/escalation, not asking a human before every local edit. Current safe-family cargo includes repo manifest, tool capability manifest, daemon-hosted tool request cargo, Eve/CultUI surface contract, repo collaboration policy, collaboration topics, consensus/objective/adoption/scheduling/work-order/verification/publication/sync/review/PR/credit/artifact/metrics/doctrine-update/secret-policy/deployment requests, repo deployment config, action-item receipts, Mind adoption interpretation/decision receipts, explicit Mind safe-family refusal proof `.epiphany-smoke\repo-mind-safe-family-guard-20260620-194425`, explicit Mind requested-path/plan changed-path refusal proof `.epiphany-smoke\repo-mind-path-guard-20260620-194239`, overview/public-proof/Gjallar/Eve readbacks, typed swarm-run stop classification, Idunn non-mutating queue-run lifecycle receipts, and fresh-repo upstream-main proof. Latest deployment proof `.epiphany-smoke\repo-deployment-config-family-20260620-221205` shows `repo.deployment_config` closes through Soul, `deployment-config-audit` reports `ready-for-idunn-review`, `deployment-execution-runbook` reports `ready-for-operator-git-push`, and `deployment-aftercare-audit` ingests local Verse/CultMesh Idunn deployment/aftercare receipt refs with source `cultmesh`, status `complete`, `deploymentComplete=true`, `daemonOwnsExecution=true`, no repo-agent execution/deployment/SSH/git-push/service/Hands/publication/merge/cross-body authority, and `privateStateExposed=false`; explicit Idunn receipt files remain only compatibility reliquaries. Latest deployment request proof `.epiphany-smoke\repo-deployment-request-family-20260620-195605` shows `repo.deployment_request` closes through Soul while requesting reviewed git-push-observed-by-Idunn deployment with script/host/secret/rollback/aftercare requirements and no deployment/SSH/git-push/service authority. Latest security cargo proof `.epiphany-smoke\repo-secret-policy-request-family-20260620-193046` shows `repo.secret_policy_request` closes through Soul while requesting reviewed secret/write/export/deployment policy without exposing secrets or granting write/deployment/publication authority. Governance proof `.epiphany-smoke\repo-doctrine-update-request-family-20260620-192140` shows `repo.doctrine_update_request` closes through Soul while requesting reviewed `AGENTS.md` doctrine work without mutating doctrine or granting Hands/service/publication authority. Swarm-run stop proofs now include `.epiphany-smoke\fresh-repo-mvp-20260620-180024` for `iteration-limit` / Self / `self.scheduler-iteration-limit` with upstream-main sync and public-proof export, plus `.epiphany-smoke\swarm-stop-classification-20260620-184717` for `queue-empty` / Gjallar / `repo.work.overview`, `dry-run-preview` / Self / `ready-to-run`, `authority-gated` / Bifrost / `awaiting-publication`, and `authority-gated` / Bifrost/GitHub / `awaiting-upstream-sync`; all stop packets are non-mutating, non-elevated, and `privateStateExposed=false`. Native proof `.epiphany-smoke\repo-work-service-lifecycle-20260620-185853` now proves Idunn-owned non-mutating repo-work queue-run service plan/runbook receipts for exact service id `epiphany-repo-work-queue-runner`, receipt-directory readback, runbook SHA-256 `f2ec67c4f8243a3ebc2f9e915b6b9f5ae2ac2d99d2cdb86905b54667adc456f8`, `hostedBody=repo-work`, no service-manager mutation, no launch, no elevation, and `privateStateExposed=false`. - Mind-admitted repo-work map facts now leave local Verse sight. Successful `epiphany-work close` first admits `.epiphany/state/repo-work-map.msgpack` as `epiphany.repo_work_map_store.v0`, then mirrors the accepted item fact into local Verse as `epiphany.cultmesh.repo_work_map_entry.v0` under `gamecult-local/repo-work-map/latest`. `epiphany-verse-query gjallar` exposes `repoWorkMapRows`, `repoWorkMapTuiRows`, and `latestRepoWorkMapEntry` with safe family, changed-path count, Soul verdict id, Mind review/commit ids, Bifrost gate, source map store ref, and `privateStateExposed=false`; proof `.epiphany-smoke\repo-close-mind-adoption-guard-20260620-203717` plus direct Gjallar readback showed one compact `REPO-WORK-MAP` row after counterfeit Mind adoption was refused and the real close passed. This is sight only; Gjallar still does not schedule, publish, merge, deploy, keep daemons alive, or open private state. - Gjallar now derives the first repo-work map semantic lens from Mind-admitted local Verse map rows. `repoWorkMapFamilyLensRows` / `REPO-WORK-MAP-LENS` group accepted repo-work consequences by safe action family, with item count, changed-path count, latest item/commit/Mind commit, Bifrost gate, and `privateStateExposed=false`; proof `.epiphany-smoke\repo-close-mind-adoption-guard-20260620-205055` reran the counterfeit-adoption guard and passed with `gjallarRepoWorkMapFamilyLensCount=1`. This is aggregate sight only, not scheduling, publication, merge, deployment, service lifecycle, or Mind admission authority. - Gjallar now derives a changed-path repo-work map lens from the same Mind-admitted local Verse rows. `repoWorkMapPathLensRows` / `REPO-WORK-MAP-PATH` group accepted consequences by changed repo path, with item count, safe-family list, latest item/commit/Mind commit, Bifrost gate, and `privateStateExposed=false`; proof `.epiphany-smoke\repo-close-mind-adoption-guard-20260620-205740` passed with `gjallarRepoWorkMapPathLensCount=1` beside the family lens. This lets agents see which Body paths have accepted work without opening private receipts or granting Gjallar actuation authority. @@ -638,5 +638,5 @@ current_status: - `tools/epiphany_local_run.ps1 -Mode swarm-online-runbook` now emits an explicit Idunn preflight summary before the operator elevation boundary. Its JSON and one-line summary report `preflightStatus`, child artifact present/hash-verified/mismatch/missing counts, aggregate service execution failed/missing check counts, child preflight rows with expected/actual SHA-256s, and private-state exposure. Live proof `local-20260619-025627-410-9724e2f6` generated the non-mutating parent artifact with `preflightStatus=ready-for-elevated-operator`, two child runbooks present, two hashes verified, zero mismatches, zero missing artifacts, eleven failed sealed service checks, zero missing checks, explicit aftercare audits, and `privateStateExposed=false`. The remaining scar is still explicit elevated operator execution followed by complete Idunn audits, not missing parent/child artifact readiness. - Service lifecycle receipt history is now event-only: `load_epiphany_cultmesh_daemon_service_lifecycle_receipts` filters out the `epiphany-local/daemon-service-lifecycle-receipt/latest` mirror, while `load_latest_epiphany_cultmesh_daemon_service_lifecycle_receipt` remains the latest-state reader. Focused unit test `service_lifecycle_receipt_history_excludes_latest_mirror` proves two per-receipt writes return exactly two history records and latest points at the second. Fresh smoke `verse-query-lifecycle-history-filter-smoke` and live overview/triage `local-20260618-145632-497-efac6f0d` / `local-20260618-145632-321-867947af` prove compact swarm sights still expose service lifecycle attention plus the present elevated runbook artifact without daemon pokes or service mutation. Do not use a broad unscoped cargo test filter for this check on Windows; it fans out across bin harnesses and hit a broken pipe during this pass. - `epiphany-verse-query seed-compact` is the compact seed receipt for wrappers and read-only rites. The older `seed` command still prints the full local Verse context for explicit debugging, but compact wrapper modes now avoid full `seed`/final `query` readback after the combined overview proof exposed Windows debug stack overflow from full-context serialization pressure. - last_completed_repo_swarm_cut: `epiphany-work deployment-aftercare-audit` is now the non-mutating post-operator Idunn receipt ingestion mouth for branch-local deployment. It reads the deployment runbook receipt plus explicit `gamecult.idunn.deployment_receipt.v0` and `gamecult.idunn.deployment_aftercare_audit.v0` files, emits `epiphany.repo_deployment_aftercare_audit.v0`, reports `complete` only when the runbook is ready and both Idunn receipts have successful statuses and private-state seals, and keeps repo-agent execution/deployment/SSH/git-push/service/Hands/publication/merge/cross-body authority false. Proof `.epiphany-smoke\repo-deployment-config-family-20260620-215037` closed the `repo.deployment_config` family through Soul, proved config audit, runbook generation, and complete aftercare ingestion with `deploymentComplete=true` and `privateStateExposed=false`. - next_action: Continue repo-swarm MVP work from the documented Epiphany Online cut order in `notes/epiphany-repo-swarm-mvp-contract.md`. Typed Gjallar repo-work history/queue sight, peer-readable Persona Eve lowering, Self-owned `epiphany-work queue-run`, bounded `epiphany-swarm run`, execute-to-close scheduler handoff through `close-from-execute`, deterministic `derive-plan` families `append-worklog`, `planning-note`, `checklist-note`, `section-note` / `repo.markdown_managed_section`, `task-card` / `repo.task_card`, `repo-status-section` / `repo.status_section`, `repo-manifest` / `repo.body_manifest`, `repo-tool-capabilities` / `repo.tool_capabilities`, `repo-tool-request` / `repo.tool_request`, `repo-eve-surface` / `repo.eve_surface`, `repo-collaboration-policy` / `repo.collaboration_policy`, `repo-collaboration-topic` / `repo.collaboration_topic`, `repo-consensus-brief` / `repo.consensus_brief`, `repo-objective-draft` / `repo.objective_draft`, `repo-adoption-request` / `repo.adoption_request`, `repo-scheduling-request` / `repo.scheduling_request`, `repo-work-order` / `repo.work_order`, `repo-verification-request` / `repo.verification_request`, `repo-publication-request` / `repo.publication_request`, `repo-sync-request` / `repo.sync_request`, `repo-maintainer-review-request` / `repo.maintainer_review_request`, `repo-pr-request` / `repo.pr_request`, `repo-credit-request` / `repo.credit_request`, `repo-artifact-acceptance-request` / `repo.artifact_acceptance_request`, `repo-metrics-request` / `repo.metrics_request`, `repo.doctrine_update_request`, `repo.secret_policy_request`, `repo.deployment_config`, and `repo.deployment_request`, typed Imagination action-item receipts over allowlisted safe families, `epiphany.repo_work_mind_interpretation.v0` plus `epiphany.repo_work_mind_adoption_decision.v0` Mind interpreter receipts, explicit safe-family allowlist refusal, explicit requested-path/plan-changed-path mismatch refusal, Soul closure's Mind-adoption proof guard, durable repo-work map admission before branch-local Hands consequences reach publication gates, local Verse `epiphany.cultmesh.repo_work_map_entry.v0` Gjallar readback for Mind-admitted map facts, hash-backed local proof bundles with Bifrost/GitHub/credit/PR/upstream-main publication rows, redacted `epiphany-work export-proof` public bundles plus local Verse `epiphany.cultmesh.repo_work_public_proof.v0` Gjallar readback, Bifrost-owned `gamecult.bifrost.public_proof_publication_receipt.v0` closure plus wrapper `bifrost-public-proof` for redacted public proofs, Idunn-hosted non-mutating queue-run lifecycle plan/runbook receipts including native proof `.epiphany-smoke\repo-work-service-lifecycle-20260620-185853`, deployment config/audit/runbook/aftercare ingestion proof `.epiphany-smoke\repo-deployment-config-family-20260620-215037`, and the speech-audited `epiphany-work persona-intake` mouth plus wrapper `repo-persona-intake` are live with `privateStateExposed=false`; proofs `.epiphany-smoke\fresh-repo-mvp-20260620-180024`, `.epiphany-smoke\swarm-stop-classification-20260620-184717`, `.epiphany-smoke\repo-mind-safe-family-guard-20260620-194425`, `.epiphany-smoke\repo-mind-path-guard-20260620-194239`, `.epiphany-smoke\repo-doctrine-update-request-family-20260620-192140`, `.epiphany-smoke\repo-secret-policy-request-family-20260620-193046`, `.epiphany-smoke\repo-deployment-config-family-20260620-215037`, `.epiphany-smoke\repo-deployment-request-family-20260620-195605`, `.epiphany-smoke\repo-close-mind-adoption-guard-20260620-201153`, `.epiphany-smoke\repo-close-mind-adoption-guard-20260620-202113`, and `.epiphany-smoke\repo-close-mind-adoption-guard-20260620-203717` show fresh-repo iteration-limit stop classification, empty-queue Gjallar classification, dry-run planning-preview Self classification, Bifrost publication-gate classification, Bifrost/GitHub upstream-sync gate classification, Mind refusal for unsupported safe-family cargo and mismatched requested paths, reviewed doctrine/security/deployment config/request cargo, deployment-config audit readiness for Idunn review, deployment execution runbook readiness for explicit operator git-push handoff, deployment aftercare receipt ingestion, closure refusal for counterfeit Mind adoption, durable repo-map admission only after passing closure, local Verse/Gjallar map projection, closure, publication receipts, upstream-main sync, public-proof export, and private-state sealing. The contract note now explicitly answers that Epiphany is headed toward a functional repo swarm but is not fully online until the typed artery runs as a living repo organism. The next cut is deeper interpreter/closure depth or routing real Idunn receipt refs from CultMesh/Odin instead of explicit files. Preserve Idunn service lifecycle ownership and existing CultMesh/Odin/Eve tool directories; service install/start/deployment execution still requires explicit elevated operator authority. + last_completed_repo_swarm_cut: `epiphany-work deployment-aftercare-audit` is now the non-mutating post-operator Idunn receipt ingestion mouth for branch-local deployment, reading sealed Idunn receipt projections from repo-local CultMesh refs before falling back to explicit-file compatibility. It reads the deployment runbook receipt plus `gamecult.idunn.deployment_receipt.v0` and `gamecult.idunn.deployment_aftercare_audit.v0` via `--local-verse-store`, `--idunn-deployment-receipt-ref`, and `--aftercare-audit-receipt-ref`, emits `epiphany.repo_deployment_aftercare_audit.v0`, reports `complete` only when the runbook is ready and both Idunn receipts have successful statuses and private-state seals, and keeps repo-agent execution/deployment/SSH/git-push/service/Hands/publication/merge/cross-body authority false. Proof `.epiphany-smoke\repo-deployment-config-family-20260620-221205` closed the `repo.deployment_config` family through Soul, proved config audit, runbook generation, and complete CultMesh aftercare ingestion with `idunnDeploymentReceiptSource=cultmesh`, `idunnAftercareAuditReceiptSource=cultmesh`, `deploymentComplete=true`, and `privateStateExposed=false`. + next_action: Continue repo-swarm MVP work from the documented Epiphany Online cut order in `notes/epiphany-repo-swarm-mvp-contract.md`. Typed Gjallar repo-work history/queue sight, peer-readable Persona Eve lowering, Self-owned `epiphany-work queue-run`, bounded `epiphany-swarm run`, execute-to-close scheduler handoff through `close-from-execute`, deterministic `derive-plan` families `append-worklog`, `planning-note`, `checklist-note`, `section-note` / `repo.markdown_managed_section`, `task-card` / `repo.task_card`, `repo-status-section` / `repo.status_section`, `repo-manifest` / `repo.body_manifest`, `repo-tool-capabilities` / `repo.tool_capabilities`, `repo-tool-request` / `repo.tool_request`, `repo-eve-surface` / `repo.eve_surface`, `repo-collaboration-policy` / `repo.collaboration_policy`, `repo-collaboration-topic` / `repo.collaboration_topic`, `repo-consensus-brief` / `repo.consensus_brief`, `repo-objective-draft` / `repo.objective_draft`, `repo-adoption-request` / `repo.adoption_request`, `repo-scheduling-request` / `repo.scheduling_request`, `repo-work-order` / `repo.work_order`, `repo-verification-request` / `repo.verification_request`, `repo-publication-request` / `repo.publication_request`, `repo-sync-request` / `repo.sync_request`, `repo-maintainer-review-request` / `repo.maintainer_review_request`, `repo-pr-request` / `repo.pr_request`, `repo-credit-request` / `repo.credit_request`, `repo-artifact-acceptance-request` / `repo.artifact_acceptance_request`, `repo-metrics-request` / `repo.metrics_request`, `repo.doctrine_update_request`, `repo.secret_policy_request`, `repo.deployment_config`, and `repo.deployment_request`, typed Imagination action-item receipts over allowlisted safe families, `epiphany.repo_work_mind_interpretation.v0` plus `epiphany.repo_work_mind_adoption_decision.v0` Mind interpreter receipts, explicit safe-family allowlist refusal, explicit requested-path/plan-changed-path mismatch refusal, Soul closure's Mind-adoption proof guard, durable repo-work map admission before branch-local Hands consequences reach publication gates, local Verse `epiphany.cultmesh.repo_work_map_entry.v0` Gjallar readback for Mind-admitted map facts, hash-backed local proof bundles with Bifrost/GitHub/credit/PR/upstream-main publication rows, redacted `epiphany-work export-proof` public bundles plus local Verse `epiphany.cultmesh.repo_work_public_proof.v0` Gjallar readback, Bifrost-owned `gamecult.bifrost.public_proof_publication_receipt.v0` closure plus wrapper `bifrost-public-proof` for redacted public proofs, Idunn-hosted non-mutating queue-run lifecycle plan/runbook receipts including native proof `.epiphany-smoke\repo-work-service-lifecycle-20260620-185853`, deployment config/audit/runbook/aftercare CultMesh-ref ingestion proof `.epiphany-smoke\repo-deployment-config-family-20260620-221205`, and the speech-audited `epiphany-work persona-intake` mouth plus wrapper `repo-persona-intake` are live with `privateStateExposed=false`; proofs `.epiphany-smoke\fresh-repo-mvp-20260620-180024`, `.epiphany-smoke\swarm-stop-classification-20260620-184717`, `.epiphany-smoke\repo-mind-safe-family-guard-20260620-194425`, `.epiphany-smoke\repo-mind-path-guard-20260620-194239`, `.epiphany-smoke\repo-doctrine-update-request-family-20260620-192140`, `.epiphany-smoke\repo-secret-policy-request-family-20260620-193046`, `.epiphany-smoke\repo-deployment-config-family-20260620-221205`, `.epiphany-smoke\repo-deployment-request-family-20260620-195605`, `.epiphany-smoke\repo-close-mind-adoption-guard-20260620-201153`, `.epiphany-smoke\repo-close-mind-adoption-guard-20260620-202113`, and `.epiphany-smoke\repo-close-mind-adoption-guard-20260620-203717` show fresh-repo iteration-limit stop classification, empty-queue Gjallar classification, dry-run planning-preview Self classification, Bifrost publication-gate classification, Bifrost/GitHub upstream-sync gate classification, Mind refusal for unsupported safe-family cargo and mismatched requested paths, reviewed doctrine/security/deployment config/request cargo, deployment-config audit readiness for Idunn review, deployment execution runbook readiness for explicit operator git-push handoff, deployment aftercare receipt ingestion from local Verse/CultMesh refs, closure refusal for counterfeit Mind adoption, durable repo-map admission only after passing closure, local Verse/Gjallar map projection, closure, publication receipts, upstream-main sync, public-proof export, and private-state sealing. The contract note now explicitly answers that Epiphany is headed toward a functional repo swarm but is not fully online until the typed artery runs as a living repo organism. The next cut is deeper interpreter/closure depth or wiring the Idunn deployment receipt refs into Odin/Gjallar discovery rows so peers can cite them without opening private state. Preserve Idunn service lifecycle ownership and existing CultMesh/Odin/Eve tool directories; service install/start/deployment execution still requires explicit elevated operator authority.