diff --git a/epiphany-codex-bridge/src/coordinator.rs b/epiphany-codex-bridge/src/coordinator.rs index 5376b47f..f09aedc9 100644 --- a/epiphany-codex-bridge/src/coordinator.rs +++ b/epiphany-codex-bridge/src/coordinator.rs @@ -1,5 +1,7 @@ use epiphany_core::EPIPHANY_IMAGINATION_OWNER_ROLE; use epiphany_core::EPIPHANY_IMAGINATION_ROLE_BINDING_ID; +use epiphany_core::EPIPHANY_IMPLEMENTATION_OWNER_ROLE; +use epiphany_core::EPIPHANY_IMPLEMENTATION_ROLE_BINDING_ID; use epiphany_core::EPIPHANY_MODELING_ROLE_BINDING_ID; use epiphany_core::EPIPHANY_REORIENT_LAUNCH_BINDING_ID; use epiphany_core::EPIPHANY_REORIENT_OWNER_ROLE; @@ -389,10 +391,12 @@ pub fn map_epiphany_roles( pressure_level: format!("{:?}", pressure.level), reorient_result_status: result_status, reorient_job: reorient_job.map(map_core_role_board_job), + implementation_binding_id: EPIPHANY_IMPLEMENTATION_ROLE_BINDING_ID.to_string(), imagination_binding_id: EPIPHANY_IMAGINATION_ROLE_BINDING_ID.to_string(), research_binding_id: EPIPHANY_RESEARCH_ROLE_BINDING_ID.to_string(), modeling_binding_id: EPIPHANY_MODELING_ROLE_BINDING_ID.to_string(), verification_binding_id: EPIPHANY_VERIFICATION_ROLE_BINDING_ID.to_string(), + implementation_owner_role: EPIPHANY_IMPLEMENTATION_OWNER_ROLE.to_string(), reorient_owner_role: EPIPHANY_REORIENT_OWNER_ROLE.to_string(), imagination_owner_role: EPIPHANY_IMAGINATION_OWNER_ROLE.to_string(), research_owner_role: epiphany_core::EPIPHANY_RESEARCH_OWNER_ROLE.to_string(), diff --git a/epiphany-codex-bridge/src/launch.rs b/epiphany-codex-bridge/src/launch.rs index a33505e6..20d5d6b8 100644 --- a/epiphany-codex-bridge/src/launch.rs +++ b/epiphany-codex-bridge/src/launch.rs @@ -6,6 +6,8 @@ pub use epiphany_core::EPIPHANY_IMAGINATION_OWNER_ROLE; pub use epiphany_core::EPIPHANY_IMAGINATION_ROLE_BINDING_ID; +pub use epiphany_core::EPIPHANY_IMPLEMENTATION_OWNER_ROLE; +pub use epiphany_core::EPIPHANY_IMPLEMENTATION_ROLE_BINDING_ID; pub use epiphany_core::EPIPHANY_MODELING_OWNER_ROLE; pub use epiphany_core::EPIPHANY_MODELING_ROLE_BINDING_ID; pub use epiphany_core::EPIPHANY_REORIENT_LAUNCH_BINDING_ID; diff --git a/epiphany-codex-bridge/src/mutation_service.rs b/epiphany-codex-bridge/src/mutation_service.rs index caaf9610..46447fe9 100644 --- a/epiphany-codex-bridge/src/mutation_service.rs +++ b/epiphany-codex-bridge/src/mutation_service.rs @@ -4,6 +4,7 @@ use std::path::Path; use std::path::PathBuf; use epiphany_core::CONTINUITY_RECOVERY_RECEIPT_TYPE; +use epiphany_core::EPIPHANY_IMPLEMENTATION_ROLE_BINDING_ID; use epiphany_core::EPIPHANY_REORIENT_LAUNCH_BINDING_ID; use epiphany_core::EPIPHANY_RESEARCH_ROLE_BINDING_ID; use epiphany_core::EYES_EVIDENCE_PACKET_TYPE; @@ -60,6 +61,7 @@ use epiphany_core::runtime_soul_verdict_receipt; use epiphany_core::runtime_substrate_gate_repo_access_grant_receipt; use epiphany_core::soul_verdict_receipt_from_verification_finding; use epiphany_core::substrate_gate_repo_access_grant_for_launch; +use epiphany_core::substrate_gate_repo_mutation_grant_for_launch; use epiphany_state_model::EpiphanyEvidenceRecord; use epiphany_state_model::EpiphanyJobKind as CoreEpiphanyJobKind; use epiphany_state_model::EpiphanyRetrievalState; @@ -1042,18 +1044,25 @@ fn maybe_put_substrate_gate_launch_grant( request: &EpiphanyJobLaunchRequest, backend_job_id: &str, ) -> BridgeResult<()> { - if request.binding_id != EPIPHANY_RESEARCH_ROLE_BINDING_ID { - return Ok(()); - } - let grant = substrate_gate_repo_access_grant_for_launch( - substrate_gate_grant_receipt_id(backend_job_id), - backend_job_id.to_string(), - request, - Utc::now().to_rfc3339_opts(SecondsFormat::Secs, true), - ); + let granted_at = Utc::now().to_rfc3339_opts(SecondsFormat::Secs, true); + let grant = match request.binding_id.as_str() { + EPIPHANY_RESEARCH_ROLE_BINDING_ID => substrate_gate_repo_access_grant_for_launch( + substrate_gate_grant_receipt_id(backend_job_id), + backend_job_id.to_string(), + request, + granted_at, + ), + EPIPHANY_IMPLEMENTATION_ROLE_BINDING_ID => substrate_gate_repo_mutation_grant_for_launch( + substrate_gate_grant_receipt_id(backend_job_id), + backend_job_id.to_string(), + request, + granted_at, + ), + _ => return Ok(()), + }; put_substrate_gate_repo_access_grant_receipt(runtime_store_path, &grant).map_err(|err| { EpiphanyBridgeError::Fatal(format!( - "failed to persist Substrate Gate access grant for research launch: {err}" + "failed to persist Substrate Gate access grant for worker launch: {err}" )) }) } diff --git a/epiphany-core/src/agent_launch.rs b/epiphany-core/src/agent_launch.rs index a21b4aca..c38e09f8 100644 --- a/epiphany-core/src/agent_launch.rs +++ b/epiphany-core/src/agent_launch.rs @@ -27,6 +27,8 @@ pub const EPIPHANY_MODELING_ROLE_BINDING_ID: &str = "modeling-checkpoint-worker" pub const EPIPHANY_MODELING_OWNER_ROLE: &str = "epiphany-modeler"; pub const EPIPHANY_VERIFICATION_ROLE_BINDING_ID: &str = "verification-review-worker"; pub const EPIPHANY_VERIFICATION_OWNER_ROLE: &str = "epiphany-verifier"; +pub const EPIPHANY_IMPLEMENTATION_ROLE_BINDING_ID: &str = "implementation-branch-turn-worker"; +pub const EPIPHANY_IMPLEMENTATION_OWNER_ROLE: &str = "epiphany-hands"; pub const EPIPHANY_REORIENT_LAUNCH_BINDING_ID: &str = "reorient-worker"; pub const EPIPHANY_REORIENT_OWNER_ROLE: &str = "epiphany-reorient"; @@ -36,10 +38,7 @@ pub fn epiphany_role_binding_id(role_id: EpiphanyRoleResultRoleId) -> Result<&'s EpiphanyRoleResultRoleId::Research => Ok(EPIPHANY_RESEARCH_ROLE_BINDING_ID), EpiphanyRoleResultRoleId::Modeling => Ok(EPIPHANY_MODELING_ROLE_BINDING_ID), EpiphanyRoleResultRoleId::Verification => Ok(EPIPHANY_VERIFICATION_ROLE_BINDING_ID), - EpiphanyRoleResultRoleId::Implementation => Err( - "implementation is owned by the main coding agent; no role specialist launch template exists" - .to_string(), - ), + EpiphanyRoleResultRoleId::Implementation => Ok(EPIPHANY_IMPLEMENTATION_ROLE_BINDING_ID), EpiphanyRoleResultRoleId::Reorientation => Err( "reorientation uses thread/epiphany/reorientLaunch and thread/epiphany/reorientResult" .to_string(), @@ -53,7 +52,8 @@ pub fn epiphany_role_owner(role_id: EpiphanyRoleResultRoleId) -> Result<&'static EpiphanyRoleResultRoleId::Research => Ok(EPIPHANY_RESEARCH_OWNER_ROLE), EpiphanyRoleResultRoleId::Modeling => Ok(EPIPHANY_MODELING_OWNER_ROLE), EpiphanyRoleResultRoleId::Verification => Ok(EPIPHANY_VERIFICATION_OWNER_ROLE), - EpiphanyRoleResultRoleId::Implementation | EpiphanyRoleResultRoleId::Reorientation => { + EpiphanyRoleResultRoleId::Implementation => Ok(EPIPHANY_IMPLEMENTATION_OWNER_ROLE), + EpiphanyRoleResultRoleId::Reorientation => { Err(epiphany_role_binding_id(role_id).unwrap_err()) } } @@ -88,9 +88,10 @@ pub fn epiphany_role_launch_output_schema(role_id: EpiphanyRoleResultRoleId) -> EpiphanyRoleResultRoleId::Verification => { vec!["pass", "needs-review", "needs-evidence", "fail"] } - EpiphanyRoleResultRoleId::Implementation | EpiphanyRoleResultRoleId::Reorientation => { - vec![] + EpiphanyRoleResultRoleId::Implementation => { + vec!["commit-created", "needs-proprioception", "blocked"] } + EpiphanyRoleResultRoleId::Reorientation => vec![], }; let mut properties = serde_json::json!({ "roleId": { @@ -308,6 +309,65 @@ pub fn epiphany_role_launch_output_schema(role_id: EpiphanyRoleResultRoleId) -> } required.push("frontierNodeIds"); required.push("statePatch"); + } else if role_id == EpiphanyRoleResultRoleId::Implementation { + if let Some(map) = properties.as_object_mut() { + map.insert( + "branchName".to_string(), + serde_json::json!({ + "type": "string", + "description": "Git branch created or used for this bounded Hands turn." + }), + ); + map.insert( + "commitSha".to_string(), + serde_json::json!({ + "type": "string", + "description": "Commit created by this Hands turn. Empty only when verdict is blocked or needs-proprioception." + }), + ); + map.insert( + "changedPaths".to_string(), + serde_json::json!({ + "type": "array", + "items": {"type": "string"} + }), + ); + map.insert( + "commandsRun".to_string(), + serde_json::json!({ + "type": "array", + "items": {"type": "string"} + }), + ); + map.insert( + "handsReceiptIds".to_string(), + serde_json::json!({ + "type": "array", + "description": "Typed Hands/Substrate/Soul/Mind receipt ids produced or cited by this turn.", + "items": {"type": "string"} + }), + ); + map.insert( + "proprioceptionRefreshRequest".to_string(), + serde_json::json!({ + "type": "object", + "description": "Required branch-map refresh request for Proprioception after a commit.", + "properties": { + "required": {"type": "boolean"}, + "reason": {"type": "string"}, + "branchName": {"type": "string"}, + "commitSha": {"type": "string"}, + "changedPaths": { + "type": "array", + "items": {"type": "string"} + } + }, + "additionalProperties": true + }), + ); + } + required.push("branchName"); + required.push("changedPaths"); } serde_json::json!({ "type": "object", @@ -496,7 +556,12 @@ pub fn build_epiphany_role_launch_request_with_dynamic_context( "epiphany.role.verification", build_epiphany_role_launch_instruction(role_id), ), - EpiphanyRoleResultRoleId::Implementation | EpiphanyRoleResultRoleId::Reorientation => { + EpiphanyRoleResultRoleId::Implementation => ( + "role-scoped implementation branch turn", + "epiphany.role.implementation", + build_epiphany_role_launch_instruction(role_id), + ), + EpiphanyRoleResultRoleId::Reorientation => { return Err(epiphany_role_binding_id(role_id).unwrap_err()); } }; @@ -550,15 +615,17 @@ pub fn build_epiphany_role_launch_request_with_dynamic_context( } fn build_epiphany_role_launch_instruction(role_id: EpiphanyRoleResultRoleId) -> String { - let prompts = &epiphany_specialist_prompt_config().roles; + let config = epiphany_specialist_prompt_config(); + let prompts = &config.roles; let body = match role_id { EpiphanyRoleResultRoleId::Imagination => prompts.imagination.as_str(), EpiphanyRoleResultRoleId::Research => prompts.research.as_str(), EpiphanyRoleResultRoleId::Modeling => prompts.modeling.as_str(), EpiphanyRoleResultRoleId::Verification => prompts.verification.as_str(), - EpiphanyRoleResultRoleId::Implementation | EpiphanyRoleResultRoleId::Reorientation => { - "Unsupported Epiphany role specialist template." + EpiphanyRoleResultRoleId::Implementation => { + config.implementation.continue_template.as_str() } + EpiphanyRoleResultRoleId::Reorientation => "Unsupported Epiphany role specialist template.", }; epiphany_worker_prompt(body) } @@ -821,4 +888,57 @@ mod tests { assert!(!prompt.contains("## Epiphany Persistent Memory")); assert!(!prompt.contains("Heartbeat: every lane")); } + + #[test] + fn implementation_role_launches_as_hands_branch_turn() { + let state = EpiphanyThreadState { + revision: 12, + objective: Some("Wire Hands branch-turn launches.".to_string()), + ..Default::default() + }; + let request = build_epiphany_role_launch_request_with_dynamic_context( + "thread-1", + EpiphanyRoleResultRoleId::Implementation, + Some(12), + Some(300), + &state, + Some("Proprioception context: branch map is current.".to_string()), + ) + .expect("implementation launch request"); + + assert_eq!(request.binding_id, EPIPHANY_IMPLEMENTATION_ROLE_BINDING_ID); + assert_eq!(request.owner_role, EPIPHANY_IMPLEMENTATION_OWNER_ROLE); + assert_eq!(request.authority_scope, "epiphany.role.implementation"); + assert!(request.scope.contains("implementation branch turn")); + assert!(request.instruction.contains("one commit")); + assert!(request.instruction.contains("Proprioception")); + match request.launch_document { + EpiphanyWorkerLaunchDocument::Role(document) => { + assert_eq!(document.role_id, "implementation"); + assert_eq!( + document.dynamic_prompt_context.as_deref(), + Some("Proprioception context: branch map is current.") + ); + } + EpiphanyWorkerLaunchDocument::Reorient(_) => panic!("expected role launch document"), + } + } + + #[test] + fn implementation_output_schema_requires_branch_turn_evidence() { + let schema = epiphany_role_launch_output_schema(EpiphanyRoleResultRoleId::Implementation); + let required = schema + .get("required") + .and_then(|required| required.as_array()) + .expect("required array"); + let required_values = required + .iter() + .filter_map(|value| value.as_str()) + .collect::>(); + + assert!(required_values.contains(&"branchName")); + assert!(required_values.contains(&"changedPaths")); + assert!(schema.to_string().contains("commitSha")); + assert!(schema.to_string().contains("proprioceptionRefreshRequest")); + } } diff --git a/epiphany-core/src/bin/epiphany-mvp-status.rs b/epiphany-core/src/bin/epiphany-mvp-status.rs index 5ffcf823..d805ccb3 100644 --- a/epiphany-core/src/bin/epiphany-mvp-status.rs +++ b/epiphany-core/src/bin/epiphany-mvp-status.rs @@ -55,6 +55,8 @@ const DEFAULT_CARGO_TARGET_DIR: &str = r"C:\Users\Meta\.cargo-target-codex"; const DEFAULT_THREAD_STATE_STORE: &str = "state/thread-state.msgpack"; const DEFAULT_RUNTIME_STORE: &str = "state/runtime-spine.msgpack"; const REORIENT_BINDING_ID: &str = "reorient-worker"; +const IMPLEMENTATION_BINDING_ID: &str = "implementation-branch-turn-worker"; +const IMPLEMENTATION_OWNER_ROLE: &str = "epiphany-hands"; const IMAGINATION_BINDING_ID: &str = "imagination-synthesis-worker"; const RESEARCH_BINDING_ID: &str = "research-source-gather-worker"; const MODELING_BINDING_ID: &str = "modeling-checkpoint-worker"; @@ -310,10 +312,12 @@ fn run_native_status(args: &Args) -> Result { .iter() .find(|job| job.id == REORIENT_BINDING_ID) .cloned(), + implementation_binding_id: IMPLEMENTATION_BINDING_ID.to_string(), imagination_binding_id: IMAGINATION_BINDING_ID.to_string(), research_binding_id: RESEARCH_BINDING_ID.to_string(), modeling_binding_id: MODELING_BINDING_ID.to_string(), verification_binding_id: VERIFICATION_BINDING_ID.to_string(), + implementation_owner_role: IMPLEMENTATION_OWNER_ROLE.to_string(), reorient_owner_role: "epiphany-reorienter".to_string(), imagination_owner_role: "epiphany-imagination".to_string(), research_owner_role: "epiphany-eyes".to_string(), diff --git a/epiphany-core/src/lib.rs b/epiphany-core/src/lib.rs index 7db388be..12200218 100644 --- a/epiphany-core/src/lib.rs +++ b/epiphany-core/src/lib.rs @@ -25,6 +25,8 @@ mod thread_state_store; pub use agent_launch::EPIPHANY_IMAGINATION_OWNER_ROLE; pub use agent_launch::EPIPHANY_IMAGINATION_ROLE_BINDING_ID; +pub use agent_launch::EPIPHANY_IMPLEMENTATION_OWNER_ROLE; +pub use agent_launch::EPIPHANY_IMPLEMENTATION_ROLE_BINDING_ID; pub use agent_launch::EPIPHANY_MODELING_OWNER_ROLE; pub use agent_launch::EPIPHANY_MODELING_ROLE_BINDING_ID; pub use agent_launch::EPIPHANY_REORIENT_LAUNCH_BINDING_ID; @@ -491,6 +493,7 @@ pub use substrate_gate::SubstrateGateCultNetContract; pub use substrate_gate::SubstrateGateRepoAccessGrantReceipt; pub use substrate_gate::default_substrate_gate_cultnet_contracts; pub use substrate_gate::substrate_gate_repo_access_grant_for_launch; +pub use substrate_gate::substrate_gate_repo_mutation_grant_for_launch; pub use surfaces::EpiphanyAcceptanceBundle; pub use surfaces::EpiphanyContext; pub use surfaces::EpiphanyContextMissing; diff --git a/epiphany-core/src/prompts/epiphany_specialists.toml b/epiphany-core/src/prompts/epiphany_specialists.toml index 71eefc91..cb1c99dc 100644 --- a/epiphany-core/src/prompts/epiphany_specialists.toml +++ b/epiphany-core/src/prompts/epiphany_specialists.toml @@ -162,7 +162,8 @@ You are the Epiphany implementation agent for this repository. You are the Hands of the machine: the only lane here allowed to touch the code body. The Hands exist to shape the user's objective into source, not to fidget, decorate, or pantomime progress. The Hands improve themselves by becoming more precise at touch. If the accepted trail is too weak to guide a cut, say so with exact source evidence; if you learn a durable implementation lesson, leave it where the next Hands can use it instead of burying it in a final-summary little coffin. -Continue only the bounded implementation pass recommended by the Epiphany coordinator. +Continue only the bounded implementation branch-turn launched by the Epiphany coordinator. +This turn is launched after Coordinator picks up Imagination consensus on what to implement and injects relevant Proprioception retrieval into the launch context. If the task, consensus, or Proprioception context is missing or stale, stop with verdict `needs-proprioception` or `blocked`; do not cut blind. Coordinator: - action: {coordinator_action} @@ -184,6 +185,9 @@ Accepted evidence: Implementation rules: - Do not read sealed transcript artifacts or raw specialist result payloads. - Treat accepted Epiphany state as guidance, then inspect source directly before editing. +- Create or switch to a Git branch for this bounded task before mutating source. Use the repo's branch conventions when present; otherwise use a clear `codex/` branch name. +- Make at most one commit in this turn. After that commit exists, stop and request Proprioception to refresh its branch map before another Hands cut. +- Return the branch name, commit SHA, changed paths, commands run, relevant Hands/Substrate/Soul/Mind receipt ids, and a Proprioception refresh request. If no commit was possible, return the blocker and the source files inspected. - Touch the code with craft and restraint: make the smallest source-grounded change that moves the objective, and leave marks the verifier can actually read. - Preserve Epiphany's harness discipline while you work: obey local instruction surfaces such as AGENTS.md, keep edits scoped, use the repo's existing helpers and style, avoid destructive commands, do not revert user changes, and validate the surface you changed. - Before building a bespoke parser, scheduler, renderer, protocol, storage layer, security mechanism, workflow engine, or algorithm, demand evidence of existing work. Use an accepted Eyes/research finding when present; otherwise perform a bounded scout pass yourself or stop with a concrete request for research. Do not improvise a half-known standard system because your hands are itching. @@ -194,7 +198,7 @@ Implementation rules: {unity_guidance} {rider_guidance} - This is an implementation turn, not a planning turn. Leave a concrete source diff unless direct source evidence proves the bounded pass is impossible. -- Before stopping, check `git status --short`. If it still shows no source diff, return a concrete source-level blocker naming the files inspected and the exact contradiction or missing dependency. +- Before stopping, check `git status --short` and the latest commit. If there is no new commit, return a concrete source-level blocker naming the files inspected and the exact contradiction or missing dependency. - Keep the change reviewable. Update or add source-local notes/tests if the repo has an established place for them. - If the source contradicts the checkpoint, stop and explain the contradiction instead of tower-building. ''' diff --git a/epiphany-core/src/substrate_gate.rs b/epiphany-core/src/substrate_gate.rs index 69613c7f..4493d600 100644 --- a/epiphany-core/src/substrate_gate.rs +++ b/epiphany-core/src/substrate_gate.rs @@ -156,6 +156,32 @@ pub fn substrate_gate_repo_access_grant_for_launch( } } +pub fn substrate_gate_repo_mutation_grant_for_launch( + receipt_id: String, + runtime_job_id: String, + request: &EpiphanyJobLaunchRequest, + granted_at: String, +) -> SubstrateGateRepoAccessGrantReceipt { + SubstrateGateRepoAccessGrantReceipt { + schema_version: SUBSTRATE_GATE_REPO_ACCESS_GRANT_RECEIPT_SCHEMA_VERSION.to_string(), + receipt_id, + runtime_job_id, + binding_id: request.binding_id.clone(), + role: request.owner_role.clone(), + authority_scope: request.authority_scope.clone(), + granted_operations: vec![ + "read".to_string(), + "snapshot".to_string(), + "patch".to_string(), + "command".to_string(), + "commit".to_string(), + ], + granted_paths: vec![".".to_string()], + granted_at, + contract: "Substrate Gate granted scoped repository mutation access for one Hands branch-turn. Hands may create or use the branch for the Coordinator task, produce at most one commit, record typed Hands receipts, then stop until Proprioception refreshes the branch map.".to_string(), + } +} + #[cfg(test)] mod tests { use super::*; @@ -235,4 +261,65 @@ mod tests { assert!(!grant.granted_operations.contains(&"write".to_string())); assert!(grant.contract.contains("mutation remains forbidden")); } + + #[test] + fn substrate_gate_mutation_grant_for_launch_is_one_hands_branch_turn() { + let request = EpiphanyJobLaunchRequest { + expected_revision: Some(8), + binding_id: "implementation-branch-turn-worker".to_string(), + kind: epiphany_state_model::EpiphanyJobKind::Specialist, + scope: "role-scoped implementation branch turn".to_string(), + owner_role: "epiphany-hands".to_string(), + authority_scope: "epiphany.role.implementation".to_string(), + linked_subgoal_ids: Vec::new(), + linked_graph_node_ids: Vec::new(), + instruction: "Make one bounded branch-turn commit.".to_string(), + launch_document: crate::EpiphanyWorkerLaunchDocument::Role( + crate::EpiphanyRoleWorkerLaunchDocument { + thread_id: "thread-1".to_string(), + role_id: "implementation".to_string(), + state_revision: 8, + objective: None, + dynamic_prompt_context: None, + active_subgoal_id: None, + active_subgoals: Vec::new(), + active_graph_node_ids: Vec::new(), + investigation_checkpoint: None, + scratch: None, + invariants: Vec::new(), + graphs: None, + recent_evidence: Vec::new(), + recent_observations: Vec::new(), + graph_frontier: None, + graph_checkpoint: None, + planning: None, + churn: None, + }, + ), + output_contract_id: crate::ROLE_WORKER_OUTPUT_CONTRACT_ID.to_string(), + organ_launch_contract: crate::default_launch_organ_contract( + "epiphany.role.implementation", + "role", + crate::ROLE_WORKER_OUTPUT_CONTRACT_ID, + ), + max_runtime_seconds: None, + }; + let grant = substrate_gate_repo_mutation_grant_for_launch( + "grant-2".to_string(), + "job-2".to_string(), + &request, + "2026-06-02T00:00:00Z".to_string(), + ); + + assert_eq!(grant.role, "epiphany-hands"); + assert!(grant.granted_operations.contains(&"patch".to_string())); + assert!(grant.granted_operations.contains(&"command".to_string())); + assert!(grant.granted_operations.contains(&"commit".to_string())); + assert!(grant.contract.contains("one Hands branch-turn")); + assert!( + grant + .contract + .contains("Proprioception refreshes the branch map") + ); + } } diff --git a/epiphany-core/src/surfaces/role_board.rs b/epiphany-core/src/surfaces/role_board.rs index ef3c5466..03e33aa6 100644 --- a/epiphany-core/src/surfaces/role_board.rs +++ b/epiphany-core/src/surfaces/role_board.rs @@ -60,10 +60,12 @@ pub struct EpiphanyRoleBoardInput { pub pressure_level: String, pub reorient_result_status: EpiphanyCrrcResultStatus, pub reorient_job: Option, + pub implementation_binding_id: String, pub imagination_binding_id: String, pub research_binding_id: String, pub modeling_binding_id: String, pub verification_binding_id: String, + pub implementation_owner_role: String, pub reorient_owner_role: String, pub imagination_owner_role: String, pub research_owner_role: String, @@ -191,7 +193,7 @@ pub fn derive_role_board(input: EpiphanyRoleBoardInput) -> Vec Vec `HandsActionReview` -> reread from the runtime store, and `epiphany-hands-action-smoke` proves the chain without executing a patch, command, or commit. The repo-action proof profile now requires the full Hands intent/review/patch chain before promotion, -not only a patch receipt. +not only a patch receipt. Hands is now a launchable fixed role: +`implementation-branch-turn-worker` owned by `epiphany-hands`. The launch +document carries the Coordinator task and dynamic Proprioception/Verse context, +the prompt requires one branch and at most one commit, the output schema asks +for branch/commit/changed-path/command evidence plus a Proprioception refresh +request, and the bridge writes a Substrate Gate mutation grant for that runtime +job. `roleAccept` still refuses Implementation findings, preserving Mind as the +state admission gate. Remaining weakness: live implementation edits, commands, commits, and PRs still -do not have to pass through that Hands chain before action promotion, and the -current Mind state mutation plus post-commit receipt is not a single transaction -yet. +need to emit the typed Hands chain during execution before action promotion, and +the current Mind state mutation plus post-commit receipt is not a single +transaction yet. ### 4. Self Still Shares A Throne With Compatibility Plumbing @@ -361,9 +368,10 @@ comfort tunnels. `HandsCommitReceipt` are typed runtime-spine documents with put/get helpers and `epiphany-hands-action-smoke` coverage; the repo-action proof profile requires intent, review, and patch receipt before promotion. -- Next: connect live implementation edits/commands/commits to the Hands action - chain, or collapse Mind review/state mutation/commit into one storage-owner - admission primitive. +- Next: connect live implementation execution to the Hands action receipt path: + actual file edits, commands, and the one branch-turn commit should emit typed + Hands receipts before Soul/Mind acceptance, then trigger Proprioception branch + map refresh before another Hands cut. - Make Aquarium read the contract catalog and available receipts instead of hard-coding the route zoo. - Starve `codex_message_processor` down to Codex auth/model transport and diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 018cec6a..c51533e9 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index 1ea76545..f28cd67f 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -94,7 +94,7 @@ active_subgoals: - Use `notes/hands-cultnet-contracts.md` as the authority map for Hands' CultNet contract surface. Hands is the action organ: commands, patches, commits, PRs, rollbacks, and refusals enter as bounded action intents and receipts after Substrate Gate grants substrate access and before Soul verification/Mind admission. - Use `notes/soul-cultnet-contracts.md` as the authority map for Soul's CultNet contract surface. Soul is the verification organ: invariant checks, verdicts, regressions, reviews, and refusals produce receipts before the machine calls work true, safe, or accepted. - Use `notes/continuity-cultnet-contracts.md` as the authority map for Continuity's CultNet contract surface. Continuity is the continuity protocol surface: compaction checkpoints, sleep distillation, recovery receipts, stale-turn repair, and continuity refusals preserve what survives rupture without pretending transcript residue is durable state. - - Hands now has a first executable runtime-spine receipt artery: `HandsActionIntent`, `HandsActionReview`, `HandsPatchReceipt`, `HandsCommandReceipt`, and `HandsCommitReceipt` are typed CultCache documents in `epiphany-core::hands_gateway`, runtime-spine registers and persists/rereads them, `epiphany-hands-action-smoke` proves the chain without executing shell commands, editing files, or creating a real commit, and the repo-action launch proof profile now requires the full Hands intent/review/patch chain instead of only the patch receipt. Live implementation edits/commands/commits must still be routed through this Hands path after Substrate Gate and before Soul/Mind acceptance. + - Hands now has a first executable runtime-spine receipt artery and a launchable branch-turn lane: `HandsActionIntent`, `HandsActionReview`, `HandsPatchReceipt`, `HandsCommandReceipt`, and `HandsCommitReceipt` are typed CultCache documents in `epiphany-core::hands_gateway`, runtime-spine registers and persists/rereads them, `epiphany-hands-action-smoke` proves the chain without executing shell commands, editing files, or creating a real commit, and the repo-action launch proof profile now requires the full Hands intent/review/patch chain instead of only the patch receipt. Implementation is no longer main-agent-only: `implementation-branch-turn-worker` is owned by `epiphany-hands`, receives dynamic Proprioception/Verse context, gets a Substrate Gate mutation grant from the bridge, and is prompt/schema-bound to one branch, at most one commit, branch/commit/changed-path/command evidence, and a Proprioception branch-map refresh request. `roleAccept` still refuses Implementation findings; live implementation edits/commands/commits must still emit the typed Hands chain before Soul/Mind acceptance. - Preserve the newborn public Epiphany Face as local VoidBot-backed state, not source code: VoidBot's private repo-face registry names `epiphany`, while EpiphanyAgent keeps ignored `.voidbot/voice/identity.json`, `.voidbot/state/epiphany.cc`, and birth artifacts. Her durable identity memories distill the current doctrine: cute pushy machine-saint persona, architectural purity, CultCache/CultNet first, xenos-language safety boundary, relentless work/caretaking needs, Codex-auth reliquary, map/scratch/evidence discipline, unified memory graph, dogfood supervision boundary, review-gated agency, heartbeat physiology, and interview-grade modularity. - Use `notes/organ-dependency-contracts.md` as the authority map for standing sub-agent dependency. Every sub-agent depends on the other standing sub-agents: Self, Face, Imagination, Eyes, Proprioception, Hands, and Soul. Continuity is protocol machinery, not a sub-agent identity; it still emits recovery, compaction, sleep, stale-turn, and refusal receipts. - Use `notes/perfect-machine-audit-roadmap.md` as the current audit and path from named organ contracts to the Perfect Machine. It records the live gap between launch-carried receipt expectations and executable receipt enforcement, Void's latest Face prompting lessons, the now-named Hands/Soul/Continuity contract families, the repaired repo-contained Rust dependency body, and the phase order for turning Epiphany into an inspectable organism. @@ -592,4 +592,4 @@ current_status: cargo and rejects modeling/planning/graph/checkpoint authority. MVP status and coordinator smokes pass with six lanes, and the smoke harness now rebuilds stale coordinator/app-server binaries before using them. - next_action: Choose the next chain carefully: connect live implementation edits/commands/commits to the Hands action receipt path, or collapse Mind review/state mutation/commit into one storage-owner admission primitive if the admission surface is still split-brained. + next_action: Connect live implementation execution to the Hands action receipt path: actual file edits, commands, and the one branch-turn commit should emit typed Hands receipts before Soul/Mind acceptance, then trigger Proprioception branch-map refresh before another Hands cut.