From d65e02d448f8482b90cac0fe2fc060406403752c Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 13 Jul 2026 01:20:14 +0100 Subject: [PATCH] Join prompt receipts by intent identity --- epiphany-core/src/prompt_context.rs | 55 +++++++++++++++++- ...onceptual-substitution-audit-2026-07-12.md | 11 ++++ notes/fresh-workspace-handoff.md | 3 + state/ledgers.msgpack | Bin 454729 -> 455077 bytes state/map.yaml | 2 +- 5 files changed, 67 insertions(+), 4 deletions(-) diff --git a/epiphany-core/src/prompt_context.rs b/epiphany-core/src/prompt_context.rs index 0033a09e..134a12be 100644 --- a/epiphany-core/src/prompt_context.rs +++ b/epiphany-core/src/prompt_context.rs @@ -93,7 +93,12 @@ pub fn render_epiphany_prompt_context(input: &EpiphanyPromptContextInput) -> Str intent.feedback_route, intent.private_state_requested )); - if let Some(receipt) = input.local_verse.latest_eve_connection_receipt.as_ref() { + if let Some(receipt) = input + .local_verse + .latest_eve_connection_receipt + .as_ref() + .filter(|receipt| receipt.intent_id == intent.intent_id) + { lines.push(format!( "- Receipt `{}`: status={}, private_state_exposed={}", receipt.receipt_id, receipt.status, receipt.private_state_exposed @@ -189,6 +194,7 @@ pub fn render_epiphany_prompt_context(input: &EpiphanyPromptContextInput) -> Str .local_verse .latest_daemon_tool_invocation_receipt .as_ref() + .filter(|receipt| receipt.intent_id == intent.intent_id) { lines.push(format!( "- Receipt `{}`: status={}, receipt_contract={}, private_state_exposed={}", @@ -389,6 +395,8 @@ mod tests { use crate::epiphany_cultmesh_bifrost_github_publication_receipt_for_publication; use crate::epiphany_cultmesh_daemon_tool_invocation_intent_from_capability; use crate::epiphany_cultmesh_daemon_tool_invocation_receipt_for_intent; + use crate::epiphany_cultmesh_eve_connection_intent_from_advertisement; + use crate::epiphany_cultmesh_eve_connection_receipt_for_intent; use crate::load_epiphany_cultmesh_cluster_topology; use crate::publish_epiphany_cultmesh_provider_state; use crate::query_epiphany_local_verse_context; @@ -399,6 +407,8 @@ mod tests { use crate::write_epiphany_cultmesh_bifrost_github_publication_receipt; use crate::write_epiphany_cultmesh_daemon_tool_invocation_intent; use crate::write_epiphany_cultmesh_daemon_tool_invocation_receipt; + use crate::write_epiphany_cultmesh_eve_connection_intent; + use crate::write_epiphany_cultmesh_eve_connection_receipt; use crate::write_epiphany_cultmesh_work_loop_telemetry; use epiphany_state_model::EpiphanyMemoryContextPacket; use epiphany_state_model::EpiphanyMemoryFreshnessStatus; @@ -420,6 +430,24 @@ mod tests { capability.capability_id == "epiphany.cluster.hands.tool.repo-action" }) .expect("Hands repo-action capability exists"); + let advertisement = seeded_verse + .odin_advertisements + .first() + .expect("seeded Verse advertises at least one cluster"); + let eve_intent = epiphany_cultmesh_eve_connection_intent_from_advertisement( + "eve-intent-prompt-test", + "epiphany.cluster.persona", + advertisement, + "prompt context identity proof", + "requestFeedback", + ); + write_epiphany_cultmesh_eve_connection_intent(&store, "epiphany-test", eve_intent.clone())?; + let eve_receipt = epiphany_cultmesh_eve_connection_receipt_for_intent( + "eve-receipt-prompt-test", + &eve_intent, + "accepted", + ); + write_epiphany_cultmesh_eve_connection_receipt(&store, "epiphany-test", eve_receipt)?; let tool_intent = epiphany_cultmesh_daemon_tool_invocation_intent_from_capability( "daemon-tool-intent-prompt-test", "epiphany.Persona", @@ -575,11 +603,12 @@ mod tests { ..Default::default() }; - let rendered = render_epiphany_prompt_context(&EpiphanyPromptContextInput { + let mut prompt_input = EpiphanyPromptContextInput { focus: "Assemble context for a bounded worker prompt.".to_string(), local_verse, memory_context, - }); + }; + let rendered = render_epiphany_prompt_context(&prompt_input); assert!(rendered.contains("")); assert!(rendered.contains("Odin")); @@ -592,6 +621,8 @@ mod tests { assert!(rendered.contains("Daemon Tool Directory")); assert!(rendered.contains("available_to_all_agents=true")); assert!(rendered.contains("Daemon Tool Invocation")); + assert!(rendered.contains("eve-intent-prompt-test")); + assert!(rendered.contains("eve-receipt-prompt-test")); assert!(rendered.contains("daemon-tool-intent-prompt-test")); assert!(rendered.contains("receipt_contract=epiphany.hands.action_review")); assert!(rendered.contains("Agent State SoA")); @@ -616,6 +647,24 @@ mod tests { assert!(rendered.contains("Shared graph law")); assert!(rendered.contains("Mind reviews durable state effects")); assert!(!rendered.contains("raw worker transcript")); + + prompt_input + .local_verse + .latest_daemon_tool_invocation_receipt + .as_mut() + .expect("tool receipt remains available for mismatch probe") + .intent_id = "another-tool-intent".to_string(); + prompt_input + .local_verse + .latest_eve_connection_receipt + .as_mut() + .expect("Eve receipt remains available for mismatch probe") + .intent_id = "another-eve-intent".to_string(); + let mismatched = render_epiphany_prompt_context(&prompt_input); + assert!(mismatched.contains("daemon-tool-intent-prompt-test")); + assert!(!mismatched.contains("receipt_contract=epiphany.hands.action_review")); + assert!(mismatched.contains("eve-intent-prompt-test")); + assert!(!mismatched.contains("eve-receipt-prompt-test")); Ok(()) } } diff --git a/notes/conceptual-substitution-audit-2026-07-12.md b/notes/conceptual-substitution-audit-2026-07-12.md index b628f733..ea003568 100644 --- a/notes/conceptual-substitution-audit-2026-07-12.md +++ b/notes/conceptual-substitution-audit-2026-07-12.md @@ -647,6 +647,17 @@ receipt writers validate schema, internal Verse, required identity/path fields, and RFC3339 time. Delayed writes remain addressable by identity without rewinding either mirror. +## Adjacent latest mirrors substituted for a causal chain + +Prompt assembly rendered the globally latest Eve connection receipt beneath +the globally latest Eve intent, and did the same for daemon tool invocation, +without checking the typed `intent_id` relationship. Concurrent or reordered +requests could therefore tell the model that one intent had received another +intent's outcome. The prompt projection now renders a receipt under an intent +only when their `intent_id` values match. Unmatched receipts remain persisted +for identity-aware diagnostics; adjacency in two convenience mirrors no longer +manufactures causality in the Mind's context. + ## Unresolved: provider receipts without chronology Bifrost body-change/GitHub publication receipts are externally owned and their diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 47a7473e..31d36fcd 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -162,6 +162,9 @@ The confirmed conceptual substitutions have been cut: - Operator-run receipt admission resolves its intent by `run_id`, not by the unrelated global latest mirror. Intent/receipt mirrors are validated and owner-time ordered; concurrent runs retain independent identity. +- Prompt assembly joins Eve and daemon-tool receipts to intents only by matching + `intent_id`; independent latest mirrors can no longer fabricate a causal + completion in model context. - Bifrost provider receipt contracts still lack provider timestamp/revision. Do not invent consumer-side ordering; repair that in a Bifrost-owned schema. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 81a42156050a5fd6d228fca8844492d0ce28c00d..c38b54d84ed7059ebaf19d032c3b5e217b2cb881 100644 GIT binary patch delta 346 zcmXv}F;2rk5X6R9LiqqvC|07Ni4rRX1&9)AL>C%#*o(8mzPsG59b83%f)_+?Y3M;9 z@dG4&0iq7#39JhjbGw?^o1Ojq8a(|Bo_B)&BtDD}E*d=_p9(>6$XN~ zZVI*pz4uiZy{((+OVn@dI_ia!xcQ!jyUSpB=1gH35~CS!8LY#KOzHC)G9J4VwI82Z%dniSBolIh-g