diff --git a/epiphany-codex-bridge/src/launch_context.rs b/epiphany-codex-bridge/src/launch_context.rs
index 3d1d5c4f..1afdd886 100644
--- a/epiphany-codex-bridge/src/launch_context.rs
+++ b/epiphany-codex-bridge/src/launch_context.rs
@@ -10,6 +10,7 @@ use epiphany_core::memory_graph_from_epiphany_graphs;
use epiphany_core::plan_memory_graph_context_cut;
use epiphany_core::query_epiphany_local_verse_context;
use epiphany_core::render_epiphany_prompt_context;
+use epiphany_core::runtime_latest_hands_receipt_chain_after;
use epiphany_core::seed_epiphany_local_verse_context;
use epiphany_core::write_memory_graph_snapshot;
use std::path::Path;
@@ -93,6 +94,75 @@ pub fn render_launch_dynamic_prompt_context(
))
}
+pub fn append_verification_hands_receipt_context(
+ mut context: String,
+ runtime_store_path: &Path,
+ state: &EpiphanyThreadState,
+) -> String {
+ let Some(accepted_at) = latest_accepted_verification_timestamp(state) else {
+ return context;
+ };
+ let Ok(Some(chain)) = runtime_latest_hands_receipt_chain_after(runtime_store_path, accepted_at)
+ else {
+ return context;
+ };
+ context.push_str("\n\n\n");
+ context.push_str(
+ "Soul is reviewing concrete Hands consequence evidence produced after the latest accepted Verification finding.\n",
+ );
+ context.push_str(&format!(
+ "- lowerBoundAcceptedVerificationAt: {accepted_at}\n"
+ ));
+ context.push_str(&format!("- intentId: {}\n", chain.intent_id));
+ context.push_str(&format!("- reviewId: {}\n", chain.review_id));
+ context.push_str(&format!("- runtimeJobId: {}\n", chain.runtime_job_id));
+ context.push_str(&format!(
+ "- receiptIds: patch={}, command={}, commit={}\n",
+ chain.patch_receipt_id, chain.command_receipt_id, chain.commit_receipt_id
+ ));
+ context.push_str(&format!(
+ "- command: `{}` exitCode={}\n",
+ chain.command, chain.exit_code
+ ));
+ context.push_str(&format!("- stdoutArtifact: {}\n", chain.stdout_artifact));
+ context.push_str(&format!("- stderrArtifact: {}\n", chain.stderr_artifact));
+ context.push_str(&format!(
+ "- commit: {} on branch {}\n",
+ chain.commit_sha, chain.branch
+ ));
+ if !chain.changed_paths.is_empty() {
+ context.push_str("- changedPaths:\n");
+ for path in chain.changed_paths {
+ context.push_str(&format!(" - {path}\n"));
+ }
+ }
+ context.push_str(&format!("- summary: {}\n", chain.summary));
+ context.push_str("- sourceRefs:\n");
+ context.push_str(" - epiphany-core/src/bin/epiphany-hands-action.rs\n");
+ context.push_str(" - epiphany-core/src/hands_gateway.rs\n");
+ context.push_str(" - epiphany-core/src/runtime_spine.rs\n");
+ context.push_str(" - epiphany-core/src/bin/epiphany-mvp-coordinator.rs\n");
+ context.push_str(" - epiphany-codex-bridge/src/coordinator.rs\n");
+ context.push_str(
+ "Use these receipts, artifacts, and source references as the concrete Hands evidence under review. Do not ask for generic receipt-path evidence without first judging this packet.\n",
+ );
+ context.push_str("");
+ context
+}
+
+fn latest_accepted_verification_timestamp(state: &EpiphanyThreadState) -> Option<&str> {
+ state
+ .acceptance_receipts
+ .iter()
+ .filter(|receipt| {
+ receipt.role_id == "verification"
+ && receipt.surface == "roleAccept"
+ && receipt.status == "accepted"
+ })
+ .map(|receipt| receipt.accepted_at.as_str())
+ .max()
+}
+
fn launch_memory_context(
runtime_store_path: &Path,
state: &EpiphanyThreadState,
diff --git a/epiphany-codex-bridge/src/mutation_service.rs b/epiphany-codex-bridge/src/mutation_service.rs
index caaf9610..e64ff4ee 100644
--- a/epiphany-codex-bridge/src/mutation_service.rs
+++ b/epiphany-codex-bridge/src/mutation_service.rs
@@ -73,6 +73,7 @@ use crate::jobs::derive_epiphany_jobs;
use crate::jobs::epiphany_blocked_state_job;
use crate::jobs::map_interrupted_epiphany_job;
use crate::jobs::map_launched_epiphany_job;
+use crate::launch_context::append_verification_hands_receipt_context;
use crate::launch_context::render_launch_dynamic_prompt_context;
use crate::launch_context::reorient_launch_context_focus;
use crate::launch_context::role_launch_context_focus;
@@ -704,12 +705,19 @@ pub async fn launch_thread_epiphany_role(
validate_expected_revision(expected_revision, state.revision)?;
let runtime_store_path = thread.epiphany_runtime_spine_store_path().await;
let role_label = epiphany_role_label(role_id);
- let dynamic_prompt_context = render_launch_dynamic_prompt_context(
+ let mut dynamic_prompt_context = render_launch_dynamic_prompt_context(
runtime_store_path.as_path(),
&state,
role_launch_context_focus(&state, role_label),
)
.map_err(EpiphanyBridgeError::Fatal)?;
+ if role_id == EpiphanyRoleResultRoleId::Verification {
+ dynamic_prompt_context = append_verification_hands_receipt_context(
+ dynamic_prompt_context,
+ runtime_store_path.as_path(),
+ &state,
+ );
+ }
let launch_request = build_epiphany_role_launch_request_with_dynamic_context(
thread_id,
role_id,
diff --git a/epiphany-core/src/lib.rs b/epiphany-core/src/lib.rs
index a5c65835..e4a9f977 100644
--- a/epiphany-core/src/lib.rs
+++ b/epiphany-core/src/lib.rs
@@ -408,6 +408,7 @@ pub use runtime_spine::RUNTIME_SESSION_TYPE;
pub use runtime_spine::RUNTIME_SPINE_SCHEMA_VERSION;
pub use runtime_spine::RUNTIME_WORKER_LAUNCH_REQUEST_SCHEMA_VERSION;
pub use runtime_spine::RUNTIME_WORKER_LAUNCH_REQUEST_TYPE;
+pub use runtime_spine::RuntimeHandsReceiptChainSummary;
pub use runtime_spine::RuntimeSpineEventOptions;
pub use runtime_spine::RuntimeSpineHeartbeatJobOptions;
pub use runtime_spine::RuntimeSpineHeartbeatLaunchPlan;
@@ -450,6 +451,7 @@ pub use runtime_spine::runtime_hands_patch_receipt;
pub use runtime_spine::runtime_hands_receipt_chain_after;
pub use runtime_spine::runtime_hello_frame;
pub use runtime_spine::runtime_job_snapshot;
+pub use runtime_spine::runtime_latest_hands_receipt_chain_after;
pub use runtime_spine::runtime_mind_gateway_review;
pub use runtime_spine::runtime_mind_state_commit_receipt;
pub use runtime_spine::runtime_reorient_worker_result;
diff --git a/epiphany-core/src/runtime_spine.rs b/epiphany-core/src/runtime_spine.rs
index 3e047d3f..3a42d808 100644
--- a/epiphany-core/src/runtime_spine.rs
+++ b/epiphany-core/src/runtime_spine.rs
@@ -1423,6 +1423,32 @@ pub fn runtime_hands_receipt_chain_after(
store_path: impl AsRef,
after_timestamp: &str,
) -> Result {
+ Ok(runtime_latest_hands_receipt_chain_after(store_path, after_timestamp)?.is_some())
+}
+
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct RuntimeHandsReceiptChainSummary {
+ pub patch_receipt_id: String,
+ pub command_receipt_id: String,
+ pub commit_receipt_id: String,
+ pub intent_id: String,
+ pub review_id: String,
+ pub runtime_job_id: String,
+ pub changed_paths: Vec,
+ pub command: String,
+ pub exit_code: String,
+ pub stdout_artifact: String,
+ pub stderr_artifact: String,
+ pub commit_sha: String,
+ pub branch: String,
+ pub summary: String,
+ pub emitted_at: String,
+}
+
+pub fn runtime_latest_hands_receipt_chain_after(
+ store_path: impl AsRef,
+ after_timestamp: &str,
+) -> Result