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 81a42156..c38b54d8 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index b7ff01ab..c620a256 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -660,4 +660,4 @@ current_status: - 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: Huginn live-fire has crossed the first real repo Body from Persona pressure to branch-local Hands commit and Soul/Mind closure, and now has repeatable closure and redacted-public-proof mouths. On `E:\Projects\Huginn` branch `epiphany/huginn/first-awakening`, `tools/epiphany_local_run.ps1 -Mode repo-persona-intake` accepted item `huginn-inspection-readback-livefire`, Weksa/Persona intake remained sealed, and `epiphany-work derive-plan` lowered it to model-authored safe family `repo.status_section` for `README.md` only. `tools/epiphany_local_run.ps1 -Mode repo-swarm-run` advanced four bounded pulses: run-from-plan, adopt-from-plan, execute-from-plan, and close-from-execute. Huginn commit `e9b07c38fceabbdc89ea35c2156326c80c0393a2` updated only `README.md`; closure receipt `.epiphany\work\work-close-huginn-inspection-readback-livefire.json` records status `closed`, Soul verdict `passed`, Mind state commit `repo-work-close-huginn-inspection-readback-livefire-mind-commit`, safe family `repo.status_section`, path scope `README.md`, Bifrost publication gate, and `privateStateExposed=false`. Verification also ran Huginn's TypeScript compiler through concrete Node path: `C:\Program Files\nodejs\node.exe E:\Projects\Huginn\node_modules\typescript\bin\tsc -p tsconfig.json` passed. Native verifier `epiphany-repo-livefire-closure-smoke --workspace E:\Projects\Huginn --item huginn-inspection-readback-livefire --expected-path README.md --expected-family repo.status_section --expected-gate awaiting-publication --expected-blocker bifrost-publication-missing` checks closure receipt, Mind map entry, overview gate/blocker, authority seals, and `git show` changed paths, returning `status=ok`, `soulVerdict=passed`, `publicationGate=Bifrost`, and `privateStateExposed=false`. Wrapper `tools/epiphany_local_run.ps1 -Mode repo-livefire-closure -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exposes the same read-only proof through the local operator mouth; artifact `local-20260621-190156-803-2f85ba15` printed commit, path, gate, blocker, Soul verdict, Mind commit receipt, and `privateStateExposed=False` without push, merge, publication, or target mutation. New wrapper `tools/epiphany_local_run.ps1 -Mode repo-work-public-proof -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exports the redacted proof bundle and repo-local Verse index without publishing; artifact `local-20260621-190645-345-4555b1dc` wrote `.epiphany\public\proof-bundles\repo-work-public-proof-huginn-inspection-readback-livefire.json`, proof id `repo-work-public-proof-huginn-inspection-readback-livefire`, SHA-256 `857545b199f3e37eb06c2e757e5cfc201958e46667bb1f8403fd333a22620f63`, nine artifact rows, zero publication rows, and `privateStateExposed=False`. swarm overview readback `local-20260621-190701-140-b9519ec6` sees the `REPO-WORK-PUBLIC-PROOF` row and action row from Huginn's repo-local Verse with the same SHA-256 while Bifrost publication remains missing. Launcher compact modes are now named compact operator-context modes instead of read-only modes, and `bifrost-public-proof` summaries print item, target public Verse, room, proof SHA-256, review receipts, and credit receipts so publication receipts are auditable without claiming upstream sync. - next_action: Continue the conceptual-substitution modeling pass beyond receipt writers. Operational/evidence/self-state and operator surfaces with owned clocks are event-time ordered; operator receipts bind intents by run identity rather than global chronology; repo-work projections follow owning time; writerless readiness-review is deleted. Bifrost provider receipts still need a provider-owned chronology contract rather than consumer inference. Continue auditing other evidence/security mirrors, service configuration claims, adapters, and destructive path consumers for borrowed authority. + next_action: Continue the conceptual-substitution modeling pass beyond receipt writers. Operational/evidence/self-state and operator surfaces with owned clocks are event-time ordered; operator receipts bind intents by run identity rather than global chronology; prompt context joins Eve/tool receipts only by typed intent identity; repo-work projections follow owning time; writerless readiness-review is deleted. Bifrost provider receipts still need a provider-owned chronology contract rather than consumer inference. Continue auditing other evidence/security mirrors, service configuration claims, adapters, and destructive path consumers for borrowed authority.