diff --git a/epiphany-core/src/bin/epiphany-eve-provider.rs b/epiphany-core/src/bin/epiphany-eve-provider.rs new file mode 100644 index 00000000..a1151190 --- /dev/null +++ b/epiphany-core/src/bin/epiphany-eve-provider.rs @@ -0,0 +1,99 @@ +use anyhow::{Context, Result}; +use epiphany_core::{ + epiphany_cultmesh_eve_connection_receipt_for_intent, + load_latest_epiphany_cultmesh_eve_connection_intent, + write_epiphany_cultmesh_eve_connection_receipt, +}; +use serde_json::json; +use std::{env, path::PathBuf}; + +fn main() -> Result<()> { + let args = Args::parse()?; + let intent = + load_latest_epiphany_cultmesh_eve_connection_intent(&args.store, args.runtime_id.clone())? + .context("Eve provider found no pending connection intent")?; + if intent.target_cluster_id != args.provider_cluster_id { + anyhow::bail!( + "Eve provider {} cannot answer intent owned by {}", + args.provider_cluster_id, + intent.target_cluster_id + ); + } + if let Some(expected_intent_id) = args.intent_id.as_deref() { + if intent.intent_id != expected_intent_id { + anyhow::bail!( + "latest Eve connection intent {:?} does not match requested {:?}", + intent.intent_id, + expected_intent_id + ); + } + } + let receipt = + epiphany_cultmesh_eve_connection_receipt_for_intent(args.receipt_id, &intent, args.status); + let written = write_epiphany_cultmesh_eve_connection_receipt( + &args.store, + args.runtime_id.clone(), + receipt, + )?; + println!( + "{}", + serde_json::to_string_pretty(&json!({ + "schemaVersion": "epiphany.eve_provider_connection_receipt.v0", + "status": written.status, + "runtimeId": args.runtime_id, + "providerClusterId": args.provider_cluster_id, + "intentId": written.intent_id, + "receiptId": written.receipt_id, + "feedbackRoute": written.feedback_route, + "privateStateExposed": written.private_state_exposed, + }))? + ); + Ok(()) +} + +struct Args { + store: PathBuf, + runtime_id: String, + provider_cluster_id: String, + intent_id: Option, + receipt_id: String, + status: String, +} + +impl Args { + fn parse() -> Result { + let mut values = env::args().skip(1); + let command = values.next().unwrap_or_else(|| "accept".to_string()); + if command != "accept" { + anyhow::bail!("unknown command {command:?}; use accept"); + } + let mut store = PathBuf::from(".epiphany-run/cultmesh/local-verse.ccmp"); + let mut runtime_id = "epiphany-local".to_string(); + let mut provider_cluster_id = None; + let mut intent_id = None; + let mut receipt_id = None; + let mut status = "accepted".to_string(); + while let Some(arg) = values.next() { + match arg.as_str() { + "--store" => store = PathBuf::from(values.next().context("missing --store")?), + "--runtime-id" => runtime_id = values.next().context("missing --runtime-id")?, + "--provider-cluster-id" => { + provider_cluster_id = + Some(values.next().context("missing --provider-cluster-id")?) + } + "--intent-id" => intent_id = Some(values.next().context("missing --intent-id")?), + "--receipt-id" => receipt_id = Some(values.next().context("missing --receipt-id")?), + "--status" => status = values.next().context("missing --status")?, + _ => anyhow::bail!("unknown argument {arg:?}"), + } + } + Ok(Self { + store, + runtime_id, + provider_cluster_id: provider_cluster_id.context("missing --provider-cluster-id")?, + intent_id, + receipt_id: receipt_id.context("missing --receipt-id")?, + status, + }) + } +} diff --git a/epiphany-core/src/bin/epiphany-verse-query.rs b/epiphany-core/src/bin/epiphany-verse-query.rs index 10ef858f..4c9a7660 100644 --- a/epiphany-core/src/bin/epiphany-verse-query.rs +++ b/epiphany-core/src/bin/epiphany-verse-query.rs @@ -1332,6 +1332,15 @@ fn run_cli() -> Result<()> { ); } "collaboration-feedback" | "persona-feedback" => { + if args.receipt_id.is_some() + || args.receipt_status.is_some() + || args.imagination_agent_ids.is_some() + || args.consensus_packet_ref.is_some() + { + anyhow::bail!( + "collaboration-feedback accepts Persona feedback fields only; Imagination owns consensus receipt, participants, packet, status, and adoption gate" + ); + } seed_epiphany_local_verse_context( &args.store, args.runtime_id.clone(), @@ -1341,10 +1350,6 @@ fn run_cli() -> Result<()> { .feedback_id .clone() .unwrap_or_else(|| "collaboration-feedback".to_string()); - let consensus_receipt_id = args - .receipt_id - .clone() - .unwrap_or_else(|| "imagination-consensus-receipt".to_string()); let source_persona_id = args .source_persona_id .clone() @@ -1388,17 +1393,6 @@ fn run_cli() -> Result<()> { "collaboration-feedback requires --public-discussion-ref", )?; let candidate_action_refs = args.candidate_action_refs.clone().unwrap_or_default(); - let imagination_agent_ids = args - .imagination_agent_ids - .clone() - .unwrap_or_else(|| vec!["epiphany.Imagination".to_string()]); - let consensus_packet_ref = args.consensus_packet_ref.clone().unwrap_or_else(|| { - format!("gamecult-local/imagination/consensus-packets/{feedback_id}") - }); - let consensus_status = args - .receipt_status - .clone() - .unwrap_or_else(|| "queued-for-consensus-discovery".to_string()); let feedback = epiphany_cultmesh_bifrost_collaboration_feedback( feedback_id, source_persona_id, @@ -1415,50 +1409,29 @@ fn run_cli() -> Result<()> { args.runtime_id.clone(), feedback.clone(), )?; - let consensus = epiphany_cultmesh_imagination_consensus_receipt_for_feedback( - consensus_receipt_id, - &feedback, - consensus_status, - imagination_agent_ids, - consensus_packet_ref, - ); - let written_consensus = write_epiphany_cultmesh_imagination_consensus_receipt( - &args.store, - args.runtime_id.clone(), - consensus, - )?; let latest_feedback = load_latest_epiphany_cultmesh_bifrost_collaboration_feedback( &args.store, args.runtime_id.clone(), )?; - let latest_consensus = load_latest_epiphany_cultmesh_imagination_consensus_receipt( - &args.store, - args.runtime_id.clone(), - )?; if latest_feedback .as_ref() .map(|feedback| feedback.feedback_id.as_str()) != Some(written_feedback.feedback_id.as_str()) - || latest_consensus - .as_ref() - .map(|receipt| receipt.receipt_id.as_str()) - != Some(written_consensus.receipt_id.as_str()) { - anyhow::bail!( - "local Verse query lost collaboration feedback or Imagination consensus receipt after write" - ); + anyhow::bail!("local Verse query lost collaboration feedback after write"); } println!( "{}", serde_json::to_string_pretty(&json!({ - "status": "ok", + "status": "pending-imagination", "store": args.store, "runtimeId": args.runtime_id, "feedbackId": written_feedback.feedback_id, - "consensusReceiptId": written_consensus.receipt_id, + "consensusReceiptId": null, "requestedConsensusRoute": written_feedback.requested_consensus_route, - "consensusPacketRef": written_consensus.consensus_packet_ref, - "adoptionGate": written_consensus.adoption_gate, + "consensusPacketRef": null, + "adoptionGate": null, + "responseOwner": "Imagination", "commands": { "connectEve": WRAPPER_CONNECT_EVE_COMMAND, "bifrostPublication": DIRECT_BIFROST_PUBLICATION_COMMAND, @@ -1468,9 +1441,9 @@ fn run_cli() -> Result<()> { }, "publicDiscussionRefs": written_feedback.public_discussion_refs, "candidateActionRefs": written_feedback.candidate_action_refs, - "tuiRows": collaboration_feedback_tui_rows(&written_feedback, &written_consensus), + "tuiRows": [format!("FEEDBACK | {} | owner={} | status=pending-imagination | route={} | publicRefs={} | candidateActions={} | private=false", written_feedback.collaboration_topic, written_feedback.source_persona_id, written_feedback.requested_consensus_route, written_feedback.public_discussion_refs.len(), written_feedback.candidate_action_refs.len())], "privateStateIncluded": written_feedback.private_state_included, - "privateStateExposed": written_consensus.private_state_exposed, + "privateStateExposed": false, }))? ); } diff --git a/notes/epiphany-current-algorithmic-map.md b/notes/epiphany-current-algorithmic-map.md index d886f7b5..5edb78b1 100644 --- a/notes/epiphany-current-algorithmic-map.md +++ b/notes/epiphany-current-algorithmic-map.md @@ -45,6 +45,15 @@ - Heartbeat owner: `epiphany-cluster-daemon` writes status. On its first run it derives identity/routing fields from persisted topology and authors the first heartbeat itself. - Negative proof: a real provider heartbeat can precede a pending poke; no poke receipt appears, counterfeit `ready` result is rejected, and `set-daemon-status` is unavailable. +## Persona feedback and Imagination consensus boundary (2026-07-12) + +- Eve provider: `epiphany-eve-provider accept` loads the pending connection intent, verifies `provider_cluster_id == target_cluster_id`, and writes the provider receipt. +- Persona owner: `collaboration-feedback` writes public, bounded feedback only after that provider receipt exists. +- Imagination owner: consensus participant selection, packet reference, receipt status/id, and adoption gate. +- Persona output: `pending-imagination` with null consensus fields and `responseOwner=Imagination`. +- Forbidden writers: Persona cannot pass or synthesize Imagination response fields. +- Negative proof: the full consumer-request/provider-accept/Persona-feedback chain persists no consensus receipt until Imagination answers. + This is the source-grounded map of the live machine. Historical route and bridge anatomy belongs in git history and evidence ledgers, not here. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 99011c62..c39a1ec4 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -20,6 +20,10 @@ The conceptual-substitution audit found observation manufacturing the body it cl Single poke, batch poke, and swarm triage now write only `epiphany.cultmesh.daemon_poke_intent`. They report `pending-lifecycle-owner`, leave receipt/result fields null, and reject caller-supplied receipt id/status, resulting daemon status, or artifact result. The generic `daemon-status` / `set-daemon-status` CLI writer was deleted because it let callers proclaim readiness and stamp a heartbeat. `epiphany-cluster-daemon`, the provider body, now creates its own initial status from persisted topology after bootstrap rather than depending on a seeded fake heartbeat. Physical proof: provider heartbeat `degraded`, poke intent observes `degraded`, provider receipt absent, caller-supplied `ready` result rejected, and generic status writer unavailable. +## 2026-07-12 Persona feedback / Imagination consensus split + +`collaboration-feedback` now writes only bounded Persona feedback after verifying the cited Eve provider receipt exists. It returns `pending-imagination`, leaves consensus receipt/packet/adoption gate null, and rejects caller-supplied consensus receipt id/status, participant ids, or packet reference. The new narrow `epiphany-eve-provider accept` executable owns Eve connection acceptance: it loads the pending intent, verifies the provider cluster owns the target, and writes the connection receipt. Physical proof ran consumer request -> provider acceptance -> Persona feedback and showed no persisted Imagination consensus receipt; counterfeit consensus status was rejected. + This is the re-entry rite for `E:\Projects\EpiphanyAgent`: the waking chant for the local machine-spirit before it touches the forge. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 410bf10b..eaf7fbc8 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index f3424ad2..5f9d5bc1 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -70,7 +70,7 @@ data_flow: - move historical proof to git, commits, smoke artifacts, or distilled evidence rather than plan prose active_subgoals: - - Use `notes/conceptual-substitution-audit-2026-07-12.md` as the current authority-corrosion audit. The June 18 typed swarm-surface pass collapsed bootstrap, observation, request routing, and provider receipt authorship into one local CLI. Diagnostics no longer manufacture missing truth. Bifrost publication, daemon tool invocation, Eve connection, and daemon lifecycle poke are requester-only: each persists an intent, reports a pending owner, rejects caller-supplied result fields, and leaves provider receipts absent. The generic CLI daemon-status writer is deleted; the owning cluster-daemon now constructs its first heartbeat from persisted topology. Collaboration feedback requires a real Eve provider receipt. Next cut collaboration consensus response, public-proof publication, artifact acceptance, and metrics. + - Use `notes/conceptual-substitution-audit-2026-07-12.md` as the current authority-corrosion audit. Diagnostics no longer manufacture missing truth. Bifrost publication, daemon tools, Eve connection, daemon poke, and Persona collaboration feedback are requester-only. The generic daemon-status writer is deleted; cluster-daemon owns heartbeat creation. `epiphany-eve-provider` is the narrow provider-side connection receipt writer. Persona feedback requires that real provider receipt, reports `pending-imagination`, and cannot author consensus participants, packet, status, receipt, or adoption gate. Next cut public-proof publication, artifact acceptance, metrics, and audit remaining response writers. - `swarm-overview` is an Epiphany-local, renderer-neutral diagnostic projection over provider-owned typed state. It owns no lifecycle, discovery, composition, or mutation authority. Epiphany publishes clean provider-owned Eve surfaces; Odin may discover them; downstream lowerers and compositors remain outside Epiphany's concern. - Idunn owns daemon survival and service lifecycle physiology. Codex/operator sessions may inspect, generate runbooks, and route explicit operator authority, but keeping daemons alive belongs to Idunn-owned service lifecycle receipts, scheduler policy, audits, and aftercare. Do not let Self, diagnostic projections, or ad hoc wrapper summaries become a second daemon-keeper. Global tool readbacks for Self `service-health`, `service-policy-directory`, and `swarm-online-runbook` state `lifecycleOwner=Idunn` and `hostedBody=Epiphany` without service mutation or private-state exposure. - Use `notes/epiphany-cultmesh-dreaming-roadmap.md` as the design authority for distributed Epiphany dreaming. Public dreams are separately authored typed documents distributed through CultMesh/CultNet; private state remains local and cannot be shared by flipping a visibility flag. Foreign dreams are external thought weather until a reviewed local adoption receipt digests them into memory, planning, doctrine, or governance.