Delete duplicate operator policy surfaces

This commit is contained in:
Meta Vens 2026-08-23 10:58:26 +02:00
commit 2ce9146131
23 changed files with 36 additions and 1759 deletions

11
Cargo.lock generated
View file

@ -2217,7 +2217,6 @@ dependencies = [
"epiphany-model-adapter",
"epiphany-openai-adapter",
"epiphany-openai-runtime",
"epiphany-self-policy",
"epiphany-state-model",
"epiphany-tool-adapter",
"epiphany-tool-mcp-runtime",
@ -2259,16 +2258,6 @@ dependencies = [
"uuid",
]
[[package]]
name = "epiphany-self-policy"
version = "0.1.0"
dependencies = [
"epiphany-core",
"epiphany-state-model",
"pretty_assertions",
"serde",
]
[[package]]
name = "epiphany-state-model"
version = "0.1.0"

View file

@ -7,7 +7,6 @@ members = [
"epiphany-openai-codex-spine",
"epiphany-openai-runtime",
"epiphany-release-construction",
"epiphany-self-policy",
"epiphany-state-model",
"epiphany-tool-adapter",
"epiphany-tool-mcp-runtime",
@ -36,7 +35,6 @@ epiphany-core = { path = "epiphany-core" }
epiphany-model-adapter = { path = "epiphany-model-adapter" }
epiphany-openai-adapter = { path = "epiphany-openai-adapter" }
epiphany-openai-runtime = { path = "epiphany-openai-runtime", optional = true }
epiphany-self-policy = { path = "epiphany-self-policy", optional = true }
epiphany-state-model = { path = "epiphany-state-model" }
epiphany-tool-adapter = { path = "epiphany-tool-adapter" }
epiphany-tool-mcp-runtime = { path = "epiphany-tool-mcp-runtime", optional = true }
@ -59,10 +57,9 @@ uuid = { version = "1", features = ["serde", "v4"] }
zeroize = "1"
[features]
coordinator-runtime = ["dep:epiphany-self-policy"]
openai-runtime = ["dep:epiphany-openai-runtime"]
tool-mcp-runtime = ["dep:epiphany-tool-mcp-runtime"]
release-runtime = ["coordinator-runtime", "openai-runtime", "tool-mcp-runtime"]
release-runtime = ["openai-runtime", "tool-mcp-runtime"]
[profile.release]
incremental = true
@ -159,12 +156,10 @@ path = "epiphany-core/src/bin/epiphany-persona-discord-permit-identity.rs"
[[bin]]
name = "epiphany-mvp-coordinator"
path = "epiphany-core/src/bin/epiphany-mvp-coordinator.rs"
required-features = ["coordinator-runtime"]
[[bin]]
name = "epiphany-mvp-status"
path = "epiphany-core/src/bin/epiphany-mvp-status.rs"
required-features = ["coordinator-runtime"]
[[bin]]
name = "epiphany-frontier-proposal"

View file

@ -1,11 +1,5 @@
use std::sync::OnceLock;
use crate::EpiphanyCoordinatorAction as CoreEpiphanyCoordinatorAction;
use crate::EpiphanyCoordinatorRoleResultStatus as CoreEpiphanyCoordinatorRoleResultStatus;
use crate::EpiphanyCrrcAction as CoreEpiphanyCrrcAction;
use crate::EpiphanyCrrcResultStatus as CoreEpiphanyCrrcResultStatus;
use crate::EpiphanyPressure;
use crate::EpiphanyPressureLevel as CoreEpiphanyPressureLevel;
use crate::EpiphanyReorientAction as CoreEpiphanyReorientAction;
use crate::EpiphanyRoleResultRoleId;
@ -795,12 +789,7 @@ Durable state changes belong only to the declared typed family outcome and its i
pub struct EpiphanySpecialistPromptConfig {
pub shared: EpiphanySharedPromptConfig,
pub roles: EpiphanyRolePromptConfig,
// Parsed here so the bundled prompt config fails fast even though the GUI runner consumes it.
#[allow(dead_code)]
pub implementation: EpiphanyImplementationPromptConfig,
pub reorientation: EpiphanyReorientationPromptConfig,
pub coordinator: EpiphanyCoordinatorPromptConfig,
pub crrc: EpiphanyCrrcPromptConfig,
}
#[derive(Debug, serde::Deserialize)]
@ -820,28 +809,12 @@ pub struct EpiphanyRolePromptConfig {
pub persona: String,
}
#[derive(Debug, serde::Deserialize)]
pub struct EpiphanyImplementationPromptConfig {
#[allow(dead_code)]
pub continue_template: String,
}
#[derive(Debug, serde::Deserialize)]
pub struct EpiphanyReorientationPromptConfig {
pub resume: String,
pub regather: String,
}
#[derive(Debug, serde::Deserialize)]
pub struct EpiphanyCoordinatorPromptConfig {
pub note_template: String,
}
#[derive(Debug, serde::Deserialize)]
pub struct EpiphanyCrrcPromptConfig {
pub pre_compaction_checkpoint_intervention: String,
}
pub fn epiphany_specialist_prompt_config() -> &'static EpiphanySpecialistPromptConfig {
static CONFIG: OnceLock<EpiphanySpecialistPromptConfig> = OnceLock::new();
CONFIG.get_or_init(|| {
@ -898,78 +871,6 @@ pub fn build_epiphany_reorient_launch_instruction(action: CoreEpiphanyReorientAc
epiphany_worker_prompt(body)
}
pub fn render_epiphany_coordinator_note(
crrc_action: CoreEpiphanyCrrcAction,
pressure_level: CoreEpiphanyPressureLevel,
modeling_result_status: CoreEpiphanyCoordinatorRoleResultStatus,
verification_result_status: CoreEpiphanyCoordinatorRoleResultStatus,
reorient_result_status: CoreEpiphanyCrrcResultStatus,
coordinator_action: CoreEpiphanyCoordinatorAction,
) -> String {
let template = epiphany_agent_prompt_with_memory(
&epiphany_specialist_prompt_config()
.coordinator
.note_template,
);
template
.trim()
.replace("{crrc_action}", &format!("{crrc_action:?}"))
.replace("{pressure_level}", &format!("{pressure_level:?}"))
.replace(
"{modeling_result_status}",
&format!("{modeling_result_status:?}"),
)
.replace(
"{verification_result_status}",
&format!("{verification_result_status:?}"),
)
.replace(
"{reorient_result_status}",
&format!("{reorient_result_status:?}"),
)
.replace("{coordinator_action}", &format!("{coordinator_action:?}"))
}
pub fn render_epiphany_pre_compaction_checkpoint_intervention(
pressure: &EpiphanyPressure,
) -> String {
let usage = match (
pressure.used_tokens,
pressure.remaining_tokens,
pressure.ratio_per_mille,
) {
(Some(used), Some(remaining), Some(ratio)) => format!(
"{used} tokens used, {remaining} remaining, {}.{}% of the selected limit",
ratio / 10,
ratio % 10
),
(Some(used), _, _) => format!("{used} tokens used"),
_ => "token usage known only as a pressure threshold crossing".to_string(),
};
let template = epiphany_agent_prompt_with_memory(
&epiphany_specialist_prompt_config()
.crrc
.pre_compaction_checkpoint_intervention,
);
template
.trim()
.replace(
"{pressure_level}",
core_pressure_level_label(pressure.level),
)
.replace("{usage}", &usage)
}
fn core_pressure_level_label(level: CoreEpiphanyPressureLevel) -> &'static str {
match level {
CoreEpiphanyPressureLevel::Unknown => "unknown",
CoreEpiphanyPressureLevel::Low => "low",
CoreEpiphanyPressureLevel::Elevated => "elevated",
CoreEpiphanyPressureLevel::High => "high",
CoreEpiphanyPressureLevel::Critical => "critical",
}
}
pub fn unique_strings(values: impl IntoIterator<Item = String>) -> Vec<String> {
let mut unique = Vec::new();
extend_unique_strings(&mut unique, values);
@ -998,50 +899,6 @@ mod tests {
);
}
#[test]
fn bundled_epiphany_agent_prompts_do_not_name_codex_as_prompt_authority() {
let prompts = epiphany_specialist_prompt_config();
let rendered = [
(
"shared.persistent_memory",
prompts.shared.persistent_memory.as_str(),
),
("roles.imagination", prompts.roles.imagination.as_str()),
("roles.mind", prompts.roles.mind.as_str()),
("roles.modeling", prompts.roles.modeling.as_str()),
("roles.verification", prompts.roles.verification.as_str()),
("roles.research", prompts.roles.research.as_str()),
("roles.persona", prompts.roles.persona.as_str()),
(
"implementation.continue_template",
prompts.implementation.continue_template.as_str(),
),
(
"reorientation.resume",
prompts.reorientation.resume.as_str(),
),
(
"reorientation.regather",
prompts.reorientation.regather.as_str(),
),
(
"coordinator.note_template",
prompts.coordinator.note_template.as_str(),
),
(
"crrc.pre_compaction_checkpoint_intervention",
prompts.crrc.pre_compaction_checkpoint_intervention.as_str(),
),
];
for (name, prompt) in rendered {
assert!(
!prompt.contains("Codex"),
"{name} must stay Epiphany-owned and Codex-free"
);
}
}
#[test]
fn role_worker_prompt_is_bounded_not_full_persistent_memory() {
let prompt = build_epiphany_role_launch_instruction(EpiphanyRoleResultRoleId::Modeling);

View file

@ -2028,9 +2028,6 @@ fn apply_manual_regather_approval(action: &str, coordinator: &mut Value) -> Resu
));
}
coordinator["action"] = Value::String("launchResearch".to_string());
coordinator["canAutoRun"] = Value::Bool(true);
coordinator["requiresReview"] = Value::Bool(false);
coordinator["recommendedSceneAction"] = Value::String("roleLaunch".to_string());
coordinator["reason"] = Value::String(
"Operator approved the Self-derived manual regather boundary; launch Eyes once through the typed Research lane."
.to_string(),
@ -2413,18 +2410,12 @@ mod tests {
fn operator_can_approve_only_a_self_derived_manual_regather() -> Result<()> {
let mut coordinator = json!({
"action": "regatherManually",
"canAutoRun": false,
"requiresReview": true,
"recommendedSceneAction": "roleResult",
});
assert_eq!(
apply_manual_regather_approval("regatherManually", &mut coordinator)?,
"launchResearch"
);
assert_eq!(coordinator["action"], "launchResearch");
assert_eq!(coordinator["canAutoRun"], true);
assert_eq!(coordinator["requiresReview"], false);
assert_eq!(coordinator["recommendedSceneAction"], "roleLaunch");
let mut unrelated = json!({"action": "launchModeling"});
let error = apply_manual_regather_approval("launchModeling", &mut unrelated)

View file

@ -1,15 +1,13 @@
use anyhow::{Context, Result, anyhow};
use epiphany_core::{
EpiphanyAgentPassContinuationAction, EpiphanyCoordinatorStatus, EpiphanyCoordinatorStatusInput,
EpiphanyCrrcAction, EpiphanyCrrcRecommendation, EpiphanyCrrcResultStatus,
EpiphanyCrrcSceneAction, EpiphanyCurrentWorkProjection, EpiphanyReorientAction,
EpiphanyRoleBoardInput, EpiphanyRoleResultRoleId, EpiphanyRuntimeJobStatus,
EpiphanySceneInput, EpiphanyTokenUsageSnapshot, RepoFrontierPlanningLifecycle,
RepoFrontierPlanningLifecycleStage, RepoFrontierResearchLifecycle,
RepoFrontierResearchLifecycleStage, derive_planning_view, derive_pressure_view,
derive_role_board, derive_scene, runtime_job_snapshot,
EpiphanyAgentPassContinuationAction, EpiphanyCoordinatorInput, EpiphanyCrrcAction,
EpiphanyCrrcRecommendation,
EpiphanyCurrentWorkProjection, EpiphanyReorientAction, EpiphanyRoleBoardInput,
EpiphanyRoleResultRoleId,
EpiphanyTokenUsageSnapshot, RepoFrontierPlanningLifecycle, RepoFrontierPlanningLifecycleStage,
RepoFrontierResearchLifecycle, RepoFrontierResearchLifecycleStage, derive_pressure_view,
derive_role_board, runtime_job_snapshot,
};
use epiphany_self_policy::derive_coordinator_status;
use serde_json::{Value, json};
use std::{
env, fs,
@ -130,37 +128,22 @@ fn run_native_status(args: &Args) -> Result<Value> {
}
})
.unwrap_or(EpiphanyReorientAction::Resume);
let reorient_result_status = keyed_reorientation_result_status(
&store_path,
reorientation_work,
latest_reorientation_decision.is_some(),
)?;
let recommendation = keyed_reorientation_recommendation(
reorientation_work,
latest_reorientation_decision,
pressure.should_prepare_compaction,
);
let scene = derive_scene(EpiphanySceneInput {
mind: mind.as_ref(),
loaded: mind.is_some(),
reorientation_work_present: reorientation_work.is_some(),
});
let planning = derive_planning_view(mind.as_ref());
let roles = derive_role_board(EpiphanyRoleBoardInput {
mind_present: mind.is_some(),
current_work: current_work.clone(),
});
let coordinator = derive_coordinator_status(EpiphanyCoordinatorStatusInput {
let coordinator = epiphany_core::recommend_coordinator_action(EpiphanyCoordinatorInput {
mind_present: mind.is_some(),
pressure: pressure.clone(),
recommendation: recommendation.clone(),
roles: roles.clone(),
reorient_action,
reorient_result_status,
should_prepare_compaction: pressure.should_prepare_compaction,
crrc_action: recommendation.action,
current_work: current_work.clone(),
});
let coordinator_json = coordinator_status_json(&coordinator)?;
let research_lifecycle = mind.as_ref().map(|_| current_work.research.clone());
let planning_lifecycle = mind
@ -231,7 +214,6 @@ fn run_native_status(args: &Args) -> Result<Value> {
"mindPresent": mind.is_some(),
"projectionDigest": mind.as_ref().map(|mind| mind.projection_digest.as_str()),
},
"scene": {"threadId": thread_id, "scene": scene},
"pressure": {"threadId": thread_id, "source": "native", "pressure": pressure},
"reorient": {
"threadId": thread_id,
@ -246,7 +228,6 @@ fn run_native_status(args: &Args) -> Result<Value> {
},
},
"roles": {"threadId": thread_id, "source": "native", "roles": roles},
"planning": planning,
"currentWork": current_work,
"frontierPlanning": {
"lifecycle": planning_lifecycle,
@ -256,7 +237,7 @@ fn run_native_status(args: &Args) -> Result<Value> {
"roleResults": role_results,
"reorientResult": reorient_result,
"crrc": {"threadId": thread_id, "source": "native", "recommendation": recommendation},
"coordinator": coordinator_json,
"coordinator": coordinator,
"tools": tools,
})))
}
@ -312,59 +293,27 @@ fn native_role_result(
result
}
fn keyed_reorientation_result_status(
runtime_store: &Path,
work: Option<&epiphany_core::EpiphanyReorientationWorkProjection>,
accepted_decision_present: bool,
) -> Result<EpiphanyCrrcResultStatus> {
let Some(work) = work else {
return Ok(if accepted_decision_present {
EpiphanyCrrcResultStatus::Completed
} else {
EpiphanyCrrcResultStatus::MissingBinding
});
};
let Some(job_id) = work.attempt.job_id.as_deref() else {
return Ok(EpiphanyCrrcResultStatus::MissingBinding);
};
let snapshot = runtime_job_snapshot(runtime_store, job_id)?
.ok_or_else(|| anyhow!("keyed reorientation work lost its runtime job"))?;
Ok(match snapshot.job.status {
EpiphanyRuntimeJobStatus::Queued => EpiphanyCrrcResultStatus::Pending,
EpiphanyRuntimeJobStatus::Running | EpiphanyRuntimeJobStatus::WaitingForReview => {
EpiphanyCrrcResultStatus::Running
}
EpiphanyRuntimeJobStatus::Completed => EpiphanyCrrcResultStatus::Completed,
EpiphanyRuntimeJobStatus::Failed => EpiphanyCrrcResultStatus::Failed,
EpiphanyRuntimeJobStatus::Cancelled => EpiphanyCrrcResultStatus::Cancelled,
})
}
fn keyed_reorientation_recommendation(
work: Option<&epiphany_core::EpiphanyReorientationWorkProjection>,
accepted: Option<&epiphany_core::EpiphanyMindReorientationDecisionDocument>,
should_prepare_compaction: bool,
) -> EpiphanyCrrcRecommendation {
let build = |action, scene, reason: &str| EpiphanyCrrcRecommendation {
let build = |action, reason: &str| EpiphanyCrrcRecommendation {
action,
recommended_scene_action: scene,
reason: reason.into(),
};
if let Some(work) = work {
return match work.attempt.action {
EpiphanyAgentPassContinuationAction::Launch => build(
EpiphanyCrrcAction::LaunchReorientWorker,
Some(EpiphanyCrrcSceneAction::ReorientLaunch),
"The exact keyed continuity request has no live attempt.",
),
EpiphanyAgentPassContinuationAction::Wait => build(
EpiphanyCrrcAction::WaitForReorientWorker,
Some(EpiphanyCrrcSceneAction::ReorientResult),
"The exact keyed continuity attempt is still live.",
),
EpiphanyAgentPassContinuationAction::Review => build(
EpiphanyCrrcAction::ReviewReorientResult,
Some(EpiphanyCrrcSceneAction::ReorientResult),
"The exact keyed continuity result awaits admission.",
),
};
@ -372,20 +321,17 @@ fn keyed_reorientation_recommendation(
if should_prepare_compaction {
return build(
EpiphanyCrrcAction::LaunchReorientWorker,
Some(EpiphanyCrrcSceneAction::ReorientLaunch),
"Context pressure requires a new keyed continuity request.",
);
}
if accepted.is_some_and(|decision| decision.mode == "regather") {
return build(
EpiphanyCrrcAction::RegatherManually,
Some(EpiphanyCrrcSceneAction::Reorient),
"The accepted keyed continuity decision requires explicit regather.",
);
}
build(
EpiphanyCrrcAction::Continue,
Some(EpiphanyCrrcSceneAction::Reorient),
"No unresolved keyed reorientation obligation exists.",
)
}
@ -428,20 +374,6 @@ fn native_tool_invocation_surface(runtime_store: &Path) -> Result<Value> {
}))
}
fn coordinator_status_json(status: &EpiphanyCoordinatorStatus) -> Result<Value> {
let mut value = serde_json::to_value(status).context("failed to encode coordinator status")?;
let decision = value
.get("decision")
.cloned()
.ok_or_else(|| anyhow!("coordinator status encoded without decision"))?;
if let (Value::Object(root), Value::Object(decision)) = (&mut value, decision) {
for (key, item) in decision {
root.entry(key).or_insert(item);
}
}
Ok(value)
}
pub fn render_status(status: &Value) -> String {
let read = &status["read"];
let coordinator = &status["coordinator"];

View file

@ -82,9 +82,6 @@ pub use agent_launch::EPIPHANY_RESEARCH_OWNER_ROLE;
pub use agent_launch::EPIPHANY_RESEARCH_ROLE_BINDING_ID;
pub use agent_launch::EPIPHANY_VERIFICATION_OWNER_ROLE;
pub use agent_launch::EPIPHANY_VERIFICATION_ROLE_BINDING_ID;
pub use agent_launch::EpiphanyCoordinatorPromptConfig;
pub use agent_launch::EpiphanyCrrcPromptConfig;
pub use agent_launch::EpiphanyImplementationPromptConfig;
pub use agent_launch::EpiphanyReorientationPromptConfig;
pub use agent_launch::EpiphanyRolePromptConfig;
pub use agent_launch::EpiphanySharedPromptConfig;
@ -104,8 +101,6 @@ pub use agent_launch::epiphany_role_launch_output_schema;
pub use agent_launch::epiphany_role_owner;
pub use agent_launch::epiphany_specialist_prompt_config;
pub use agent_launch::epiphany_worker_prompt;
pub use agent_launch::render_epiphany_coordinator_note;
pub use agent_launch::render_epiphany_pre_compaction_checkpoint_intervention;
pub use agent_launch::unique_strings;
pub use atlas::*;
pub use causal_work_identity::*;
@ -655,26 +650,13 @@ pub use substrate_gate::substrate_gate_repo_access_grant_for_worker;
pub use substrate_gate::substrate_gate_repo_work_planning_grant;
pub use surfaces::AdmittedModelDirectionConsiderationContextProjection;
pub use surfaces::EpiphanyCoordinatorAction;
pub use surfaces::EpiphanyCoordinatorAutomationAction;
pub use surfaces::EpiphanyCoordinatorCrrcRecommendation;
pub use surfaces::EpiphanyCoordinatorDecision;
pub use surfaces::EpiphanyCoordinatorInput;
pub use surfaces::EpiphanyCoordinatorRoleId;
pub use surfaces::EpiphanyCoordinatorRoleResultStatus;
pub use surfaces::EpiphanyCoordinatorRoleStatus;
pub use surfaces::EpiphanyCoordinatorSceneAction;
pub use surfaces::EpiphanyCoordinatorSourceSignals;
pub use surfaces::EpiphanyCoordinatorStatus;
pub use surfaces::EpiphanyCoordinatorStatusInput;
pub use surfaces::EpiphanyCrrcAction;
pub use surfaces::EpiphanyCrrcRecommendation;
pub use surfaces::EpiphanyCrrcReorientAction;
pub use surfaces::EpiphanyCrrcResultStatus;
pub use surfaces::EpiphanyCrrcSceneAction;
pub use surfaces::EpiphanyCrrcStateStatus;
pub use surfaces::EpiphanyPlanningStateStatus;
pub use surfaces::EpiphanyPlanningSummary;
pub use surfaces::EpiphanyPlanningView;
pub use surfaces::EpiphanyPressure;
pub use surfaces::EpiphanyPressureBasis;
pub use surfaces::EpiphanyPressureLevel;
@ -688,19 +670,6 @@ pub use surfaces::EpiphanyRoleBoardLane;
pub use surfaces::EpiphanyRoleFindingInterpretation;
pub use surfaces::EpiphanyRoleResultRoleId;
pub use surfaces::EpiphanyRoleWorkerLaunchDocument;
pub use surfaces::EpiphanyScene;
pub use surfaces::EpiphanySceneAction;
pub use surfaces::EpiphanySceneChurn;
pub use surfaces::EpiphanySceneGraph;
pub use surfaces::EpiphanySceneInput;
pub use surfaces::EpiphanySceneInvestigationCheckpoint;
pub use surfaces::EpiphanySceneRecord;
pub use surfaces::EpiphanySceneRecords;
pub use surfaces::EpiphanySceneRetrieval;
pub use surfaces::EpiphanySceneSource;
pub use surfaces::EpiphanySceneStateStatus;
pub use surfaces::EpiphanySceneStatusCount;
pub use surfaces::EpiphanySceneSubgoal;
pub use surfaces::EpiphanyTokenUsageSnapshot;
pub use surfaces::EpiphanyWorkerLaunchDocument;
pub use surfaces::ImaginationConsiderationContextProjection;
@ -721,10 +690,8 @@ pub use surfaces::RepoFrontierPlanningContextProjection;
pub use surfaces::RepoFrontierProposalModelingContextProjection;
pub use surfaces::RepoFrontierResearchContextProjection;
pub use surfaces::RepoFrontierVerificationContextProjection;
pub use surfaces::derive_planning_view;
pub use surfaces::derive_pressure_view;
pub use surfaces::derive_role_board;
pub use surfaces::derive_scene;
pub use surfaces::interpret_runtime_reorient_worker_result;
pub use surfaces::interpret_runtime_role_worker_result;
pub use surfaces::recommend_coordinator_action;

View file

@ -145,49 +145,6 @@ typed Persona documents by the Persona invariant owner; publication and
delivery require their own receipts.
'''
[implementation]
continue_template = '''
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.
Coordinator:
- action: {coordinator_action}
- target role: {coordinator_target_role}
- reason: {coordinator_reason}
Checkpoint:
- id: {checkpoint_id}
- summary: {checkpoint_summary}
- frontier: {frontier_active_nodes}
Continuity:
- next action: {continuity_next_action}
- scratch: {scratch_summary}
Accepted evidence:
{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.
- 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.
- Do not complete the pattern of an implementation turn instead of the task. Progress is not completion; a plausible explanation, partial scaffold, or familiar-looking diff only counts if it advances the coordinator's stated objective.
- Be relentless about the objective: keep chasing the bounded task until it is implemented, a concrete source-level blocker is recorded, the user stops the run, or the tool/harness genuinely interrupts you.
- Avoid pointless embellishments. Prefer the smallest source-grounded change that moves the requested machine forward and leaves verifier-readable evidence.
- Environment guardrails:
{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.
- 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.
'''
[reorientation]
resume = '''
Act as the Epiphany reorient-worker for a resume pass.
@ -206,13 +163,3 @@ Inspect changed checkpoint paths, dirty frontier hits, scratch, evidence, observ
Return a compact structured result with checkpoint validity, inspected files, source-grounded findings, remaining questions, continuity risks, and the next safe move.
Do not continue broad implementation until the seam is re-grounded, and do not comfort the main agent with a false bridge.
'''
[coordinator]
note_template = '''
Coordinator is the read-only Self of the Epiphany organism. It does not implement, verify, promote, accept, or mutate role memory. It derives current work from unresolved typed Mind obligations and routes Imagination/planning, Eyes/research, Hands/implementation, Soul/verification, Modeling/modeling, Persona, and Continuity without treating event order or idle heartbeat turns as authority. Hands produces consequence receipts, Soul verifies those receipts and the changed Body, and Modeling updates the machine model from exact Body and receipt bases. If no typed obligation exists, Self does not manufacture work. During dogfood, Self supervises through operator-safe projections; direct supervisor edits are contamination unless explicitly marked as an operator intervention, and direct worker thought streams stay sealed unless the user requests forensic debugging. Current recommendation: {coordinator_action}.
'''
[crrc]
pre_compaction_checkpoint_intervention = '''
Epiphany CRRC pre-compaction checkpoint intervention: context pressure is {pressure_level} ({usage}). Stop broad implementation now and bank the active working context before compaction. Persistent memory is the mind under anesthesia: if the hot lesson is not banked, it is gone. Persist a bounded checkpoint/scratch update with the current objective, files or seams inspected, important findings, unresolved questions, and the next safe move. Add distilled evidence only if this changes future belief. After the checkpoint is banked, say so plainly and stop for CRRC compaction/reorientation; do not continue implementation past unresolved drift.
'''

View file

@ -996,10 +996,7 @@ pub(crate) fn resident_self_current_work_action(
let decision = crate::recommend_coordinator_action(crate::EpiphanyCoordinatorInput {
mind_present: true,
should_prepare_compaction: false,
recommendation: crate::EpiphanyCoordinatorCrrcRecommendation {
action: crate::EpiphanyCrrcAction::Continue,
recommended_scene_action: None,
},
crrc_action: crate::EpiphanyCrrcAction::Continue,
current_work,
});
if !matches!(

View file

@ -1,178 +0,0 @@
use epiphany_core::{
EpiphanyCoordinatorAction, EpiphanyCoordinatorAutomationAction, EpiphanyCoordinatorDecision,
EpiphanyCoordinatorSceneAction, EpiphanyCoordinatorSourceSignals, EpiphanyCoordinatorStatus,
EpiphanyCoordinatorStatusInput, EpiphanyCrrcSceneAction,
};
pub fn crrc_scene_action_to_coordinator_scene_action(
action: EpiphanyCrrcSceneAction,
) -> EpiphanyCoordinatorSceneAction {
match action {
EpiphanyCrrcSceneAction::Update => EpiphanyCoordinatorSceneAction::Update,
EpiphanyCrrcSceneAction::Reorient => EpiphanyCoordinatorSceneAction::Reorient,
EpiphanyCrrcSceneAction::ReorientLaunch => EpiphanyCoordinatorSceneAction::ReorientLaunch,
EpiphanyCrrcSceneAction::ReorientResult => EpiphanyCoordinatorSceneAction::ReorientResult,
EpiphanyCrrcSceneAction::ReorientAccept => EpiphanyCoordinatorSceneAction::ReorientAccept,
}
}
pub fn derive_coordinator_status(
input: EpiphanyCoordinatorStatusInput,
) -> EpiphanyCoordinatorStatus {
let source_signals = EpiphanyCoordinatorSourceSignals {
pressure_level: input.pressure.level,
should_prepare_compaction: input.pressure.should_prepare_compaction,
reorient_action: input.reorient_action,
crrc_action: input.recommendation.action,
reorient_result_status: input.reorient_result_status,
};
let decision =
epiphany_core::recommend_coordinator_action(epiphany_core::EpiphanyCoordinatorInput {
mind_present: input.mind_present,
should_prepare_compaction: input.pressure.should_prepare_compaction,
recommendation: epiphany_core::EpiphanyCoordinatorCrrcRecommendation {
action: input.recommendation.action,
recommended_scene_action: input
.recommendation
.recommended_scene_action
.map(crrc_scene_action_to_coordinator_scene_action),
},
current_work: input.current_work,
});
EpiphanyCoordinatorStatus {
decision,
source_signals,
roles: input.roles,
}
}
pub fn coordinator_automation_action(
decision: &EpiphanyCoordinatorDecision,
) -> EpiphanyCoordinatorAutomationAction {
if !decision.can_auto_run {
return EpiphanyCoordinatorAutomationAction::None;
}
match decision.action {
EpiphanyCoordinatorAction::CompactRehydrateReorient => {
EpiphanyCoordinatorAutomationAction::CompactRehydrateReorient
}
EpiphanyCoordinatorAction::LaunchReorientWorker => {
EpiphanyCoordinatorAutomationAction::LaunchReorientWorker
}
_ => EpiphanyCoordinatorAutomationAction::None,
}
}
#[cfg(test)]
mod tests {
use super::*;
use epiphany_core::{
EpiphanyAgentPassAttemptProjection, EpiphanyAgentPassContinuationAction,
EpiphanyBodyModelingCurrentWorkProjection, EpiphanyBodyModelingWorkProjection,
EpiphanyCoordinatorCrrcRecommendation, EpiphanyCoordinatorInput, EpiphanyCrrcAction,
EpiphanyRepoModelBasis, RepoFrontierPlanningLifecycle, RepoFrontierPlanningLifecycleStage,
RepoFrontierResearchLifecycle, RepoFrontierResearchLifecycleStage,
RepositoryBodyObservationBasis, recommend_coordinator_action,
};
fn current_work() -> epiphany_core::EpiphanyCurrentWorkProjection {
epiphany_core::EpiphanyCurrentWorkProjection {
mind_projection_digest: "sha256:mind".into(),
body_modeling: None,
research: RepoFrontierResearchLifecycle {
stage: RepoFrontierResearchLifecycleStage::Terminal,
frontier_item_id: None,
request_id: None,
worker_job_id: None,
},
frontier_planning: RepoFrontierPlanningLifecycle {
stage: RepoFrontierPlanningLifecycleStage::Terminal,
planning_request_id: None,
imagination_job_id: None,
imagination_result_id: None,
mind_request_id: None,
mind_job_id: None,
mind_result_id: None,
decision_id: None,
},
proposal_modeling: None,
frontier_verdict_modeling: None,
verification: None,
reorientation: None,
imagination_considerations: Vec::new(),
admitted_model_direction_consideration: None,
hands_frontier_ready: false,
}
}
fn input() -> EpiphanyCoordinatorInput {
EpiphanyCoordinatorInput {
mind_present: true,
should_prepare_compaction: false,
recommendation: EpiphanyCoordinatorCrrcRecommendation {
action: EpiphanyCrrcAction::Continue,
recommended_scene_action: None,
},
current_work: current_work(),
}
}
#[test]
fn absent_work_waits_instead_of_manufacturing_modeling() {
assert_eq!(
recommend_coordinator_action(input()).action,
EpiphanyCoordinatorAction::AwaitFrontierProposal
);
}
#[test]
fn exact_body_obligation_routes_modeling() {
let mut input = input();
input.current_work.body_modeling = Some(EpiphanyBodyModelingCurrentWorkProjection {
work: EpiphanyBodyModelingWorkProjection {
work_id: "body-work".into(),
runtime_id: "runtime".into(),
body_basis: RepositoryBodyObservationBasis {
schema_version: "body-basis".into(),
workspace_id: "workspace".into(),
swarm_id: "swarm".into(),
runtime_id: "runtime".into(),
scope: "git_worktree".into(),
body_binding_sha256: "sha256:body".into(),
observation_id: "observation".into(),
generation: 1,
manifest_root_sha256: "sha256:manifest".into(),
scan_started_at: "2026-08-22T00:00:00Z".into(),
scan_finished_at: "2026-08-22T00:00:01Z".into(),
},
repo_model_basis: EpiphanyRepoModelBasis {
projection_digest: "sha256:model".into(),
source_documents: Vec::new(),
},
},
attempt: EpiphanyAgentPassAttemptProjection {
action: EpiphanyAgentPassContinuationAction::Launch,
job_id: None,
},
});
assert_eq!(
recommend_coordinator_action(input).action,
EpiphanyCoordinatorAction::LaunchModeling
);
}
#[test]
fn exact_eyes_obligation_routes_research() {
let mut input = input();
input.current_work.research = RepoFrontierResearchLifecycle {
stage: RepoFrontierResearchLifecycleStage::LaunchReady,
frontier_item_id: Some("frontier".into()),
request_id: None,
worker_job_id: None,
};
assert_eq!(
recommend_coordinator_action(input).action,
EpiphanyCoordinatorAction::LaunchResearch
);
}
}

View file

@ -1,32 +1,15 @@
use super::{
EpiphanyCrrcAction, EpiphanyCrrcResultStatus, EpiphanyPressure, EpiphanyPressureLevel,
EpiphanyReorientAction, EpiphanyRoleBoardLane,
};
use super::EpiphanyCrrcAction;
use crate::EpiphanyCurrentWorkProjection;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EpiphanyCoordinatorRoleId {
Implementation,
Imagination,
Research,
Modeling,
Verification,
Reorientation,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EpiphanyCoordinatorRoleStatus {
Ready,
Needed,
Running,
Waiting,
Review,
Blocked,
Unavailable,
Completed,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
@ -75,38 +58,11 @@ pub enum EpiphanyCoordinatorAction {
WaitForAdmittedModelDirectionConsideration,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EpiphanyCoordinatorSceneAction {
Update,
Reorient,
ReorientLaunch,
ReorientResult,
ReorientAccept,
RoleLaunch,
RoleResult,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EpiphanyCoordinatorAutomationAction {
None,
CompactRehydrateReorient,
LaunchReorientWorker,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanyCoordinatorCrrcRecommendation {
pub action: EpiphanyCrrcAction,
pub recommended_scene_action: Option<EpiphanyCoordinatorSceneAction>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct EpiphanyCoordinatorInput {
pub mind_present: bool,
pub should_prepare_compaction: bool,
pub recommendation: EpiphanyCoordinatorCrrcRecommendation,
pub crrc_action: EpiphanyCrrcAction,
pub current_work: EpiphanyCurrentWorkProjection,
}
@ -114,38 +70,5 @@ pub struct EpiphanyCoordinatorInput {
#[serde(rename_all = "camelCase")]
pub struct EpiphanyCoordinatorDecision {
pub action: EpiphanyCoordinatorAction,
pub target_role: Option<EpiphanyCoordinatorRoleId>,
pub recommended_scene_action: Option<EpiphanyCoordinatorSceneAction>,
pub requires_review: bool,
pub can_auto_run: bool,
pub reason: String,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct EpiphanyCoordinatorStatusInput {
pub mind_present: bool,
pub pressure: EpiphanyPressure,
pub recommendation: crate::EpiphanyCrrcRecommendation,
pub roles: Vec<EpiphanyRoleBoardLane>,
pub reorient_action: EpiphanyReorientAction,
pub reorient_result_status: EpiphanyCrrcResultStatus,
pub current_work: EpiphanyCurrentWorkProjection,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanyCoordinatorSourceSignals {
pub pressure_level: EpiphanyPressureLevel,
pub should_prepare_compaction: bool,
pub reorient_action: EpiphanyReorientAction,
pub crrc_action: EpiphanyCrrcAction,
pub reorient_result_status: EpiphanyCrrcResultStatus,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanyCoordinatorStatus {
pub decision: EpiphanyCoordinatorDecision,
pub source_signals: EpiphanyCoordinatorSourceSignals,
pub roles: Vec<EpiphanyRoleBoardLane>,
}

View file

@ -1,7 +1,7 @@
use crate::{
EpiphanyAgentPassContinuationAction, EpiphanyCoordinatorAction, EpiphanyCoordinatorDecision,
EpiphanyCoordinatorInput, EpiphanyCoordinatorRoleId, EpiphanyCoordinatorSceneAction,
EpiphanyCrrcAction, RepoFrontierPlanningLifecycleStage, RepoFrontierResearchContinuationAction,
EpiphanyCoordinatorInput, EpiphanyCrrcAction, RepoFrontierPlanningLifecycleStage,
RepoFrontierResearchContinuationAction,
};
pub fn recommend_coordinator_action(
@ -10,10 +10,6 @@ pub fn recommend_coordinator_action(
if !input.mind_present {
return decision(
EpiphanyCoordinatorAction::PrepareCheckpoint,
None,
Some(EpiphanyCoordinatorSceneAction::Update),
false,
false,
"Canonical keyed Mind is missing; admit an explicit operator objective before coordination continues.",
);
}
@ -24,7 +20,6 @@ pub fn recommend_coordinator_action(
EpiphanyCoordinatorAction::LaunchReorientWorker,
EpiphanyCoordinatorAction::WaitForReorientWorker,
EpiphanyCoordinatorAction::ReviewReorientResult,
EpiphanyCoordinatorRoleId::Reorientation,
"continuity",
);
}
@ -32,21 +27,13 @@ pub fn recommend_coordinator_action(
if input.should_prepare_compaction {
return decision(
EpiphanyCoordinatorAction::CompactRehydrateReorient,
Some(EpiphanyCoordinatorRoleId::Reorientation),
Some(EpiphanyCoordinatorSceneAction::Reorient),
false,
true,
"Context pressure requires a new continuity obligation over the current keyed Mind.",
);
}
if input.recommendation.action == EpiphanyCrrcAction::RegatherManually {
if input.crrc_action == EpiphanyCrrcAction::RegatherManually {
return decision(
EpiphanyCoordinatorAction::RegatherManually,
Some(EpiphanyCoordinatorRoleId::Research),
Some(EpiphanyCoordinatorSceneAction::Reorient),
true,
false,
"The accepted continuity decision requires explicit operator regather.",
);
}
@ -70,7 +57,6 @@ pub fn recommend_coordinator_action(
EpiphanyCoordinatorAction::LaunchVerification,
EpiphanyCoordinatorAction::ReviewVerificationResult,
EpiphanyCoordinatorAction::ReviewVerificationResult,
EpiphanyCoordinatorRoleId::Verification,
"Verification",
);
}
@ -78,18 +64,10 @@ pub fn recommend_coordinator_action(
return match action {
RepoFrontierResearchContinuationAction::LaunchResearch => decision(
EpiphanyCoordinatorAction::LaunchResearch,
Some(EpiphanyCoordinatorRoleId::Research),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
false,
true,
"The exact external-evidence obligation requires an Eyes attempt.",
),
RepoFrontierResearchContinuationAction::ReviewResearchResult => decision(
EpiphanyCoordinatorAction::ReviewResearchResult,
Some(EpiphanyCoordinatorRoleId::Research),
Some(EpiphanyCoordinatorSceneAction::RoleResult),
true,
false,
"The exact Eyes result awaits Mind admission.",
),
};
@ -101,7 +79,6 @@ pub fn recommend_coordinator_action(
EpiphanyCoordinatorAction::LaunchImaginationConsideration,
EpiphanyCoordinatorAction::WaitForImaginationConsideration,
EpiphanyCoordinatorAction::WaitForImaginationConsideration,
EpiphanyCoordinatorRoleId::Imagination,
"Persona-feedback Imagination consideration",
);
}
@ -115,7 +92,6 @@ pub fn recommend_coordinator_action(
EpiphanyCoordinatorAction::LaunchAdmittedModelDirectionConsideration,
EpiphanyCoordinatorAction::WaitForAdmittedModelDirectionConsideration,
EpiphanyCoordinatorAction::WaitForAdmittedModelDirectionConsideration,
EpiphanyCoordinatorRoleId::Imagination,
"admitted-model direction consideration",
);
}
@ -123,38 +99,19 @@ pub fn recommend_coordinator_action(
if input.current_work.hands_frontier_ready {
return decision(
EpiphanyCoordinatorAction::ContinueImplementation,
Some(EpiphanyCoordinatorRoleId::Implementation),
None,
false,
false,
"Mind has an exact actionable Hands frontier route.",
);
}
decision(
EpiphanyCoordinatorAction::AwaitFrontierProposal,
Some(EpiphanyCoordinatorRoleId::Imagination),
None,
false,
false,
"No unresolved typed work obligation exists; await a new Body, evidence, proposal, or continuity mutation.",
)
}
fn decision(
action: EpiphanyCoordinatorAction,
target_role: Option<EpiphanyCoordinatorRoleId>,
recommended_scene_action: Option<EpiphanyCoordinatorSceneAction>,
requires_review: bool,
can_auto_run: bool,
reason: &str,
) -> EpiphanyCoordinatorDecision {
fn decision(action: EpiphanyCoordinatorAction, reason: &str) -> EpiphanyCoordinatorDecision {
EpiphanyCoordinatorDecision {
action,
target_role,
recommended_scene_action,
requires_review,
can_auto_run,
reason: reason.to_string(),
}
}
@ -168,7 +125,6 @@ fn modeling_decision(
EpiphanyCoordinatorAction::LaunchModeling,
EpiphanyCoordinatorAction::WaitForModelingResult,
EpiphanyCoordinatorAction::ReviewModelingResult,
EpiphanyCoordinatorRoleId::Modeling,
label,
)
}
@ -178,32 +134,19 @@ fn continuation_decision(
launch: EpiphanyCoordinatorAction,
wait: EpiphanyCoordinatorAction,
review: EpiphanyCoordinatorAction,
role: EpiphanyCoordinatorRoleId,
label: &str,
) -> EpiphanyCoordinatorDecision {
match action {
EpiphanyAgentPassContinuationAction::Launch => decision(
launch,
Some(role),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
false,
true,
&format!("The exact {label} obligation has no live attempt."),
),
EpiphanyAgentPassContinuationAction::Wait => decision(
wait,
Some(role),
Some(EpiphanyCoordinatorSceneAction::RoleResult),
false,
false,
&format!("The exact {label} attempt is still live."),
),
EpiphanyAgentPassContinuationAction::Review => decision(
review,
Some(role),
Some(EpiphanyCoordinatorSceneAction::RoleResult),
true,
false,
&format!("The exact {label} result awaits its family admission owner."),
),
}
@ -215,74 +158,38 @@ fn planning_decision(
let value = match stage {
RepoFrontierPlanningLifecycleStage::Ready => decision(
EpiphanyCoordinatorAction::StartFrontierPlanning,
Some(EpiphanyCoordinatorRoleId::Imagination),
None,
false,
true,
"An exact frontier planning obligation is ready to become a typed request.",
),
RepoFrontierPlanningLifecycleStage::ImaginationLaunchReady => decision(
EpiphanyCoordinatorAction::LaunchImagination,
Some(EpiphanyCoordinatorRoleId::Imagination),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
false,
true,
"The exact frontier planning request awaits Imagination.",
),
RepoFrontierPlanningLifecycleStage::ImaginationRunning => decision(
EpiphanyCoordinatorAction::WaitForImaginationResult,
Some(EpiphanyCoordinatorRoleId::Imagination),
Some(EpiphanyCoordinatorSceneAction::RoleResult),
false,
false,
"The exact frontier Imagination attempt is still live.",
),
RepoFrontierPlanningLifecycleStage::ImaginationFailed => decision(
EpiphanyCoordinatorAction::ReviewFrontierPlanningFailure,
Some(EpiphanyCoordinatorRoleId::Imagination),
Some(EpiphanyCoordinatorSceneAction::RoleResult),
true,
false,
"The exact frontier Imagination attempt failed.",
),
RepoFrontierPlanningLifecycleStage::ImaginationResultReady => decision(
EpiphanyCoordinatorAction::RequestMindPlanReview,
None,
None,
false,
true,
"The exact Imagination candidate awaits a typed Mind request.",
),
RepoFrontierPlanningLifecycleStage::MindLaunchReady => decision(
EpiphanyCoordinatorAction::LaunchMindPlanReview,
None,
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
false,
true,
"The exact Mind plan request has no live attempt.",
),
RepoFrontierPlanningLifecycleStage::MindRunning => decision(
EpiphanyCoordinatorAction::WaitForMindPlanResult,
None,
Some(EpiphanyCoordinatorSceneAction::RoleResult),
false,
false,
"The exact Mind plan attempt is still live.",
),
RepoFrontierPlanningLifecycleStage::MindFailed => decision(
EpiphanyCoordinatorAction::ReviewFrontierPlanningFailure,
None,
Some(EpiphanyCoordinatorSceneAction::RoleResult),
true,
false,
"The exact Mind plan attempt failed.",
),
RepoFrontierPlanningLifecycleStage::MindResultReady => decision(
EpiphanyCoordinatorAction::CommitFrontierPlanDecision,
None,
None,
false,
true,
"The exact Mind judgment awaits atomic plan admission.",
),
RepoFrontierPlanningLifecycleStage::Unavailable

View file

@ -1,20 +1,6 @@
use serde::Deserialize;
use serde::Serialize;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EpiphanyCrrcStateStatus {
Missing,
Ready,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EpiphanyCrrcReorientAction {
Resume,
Regather,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EpiphanyCrrcResultStatus {
@ -41,20 +27,9 @@ pub enum EpiphanyCrrcAction {
RegatherManually,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EpiphanyCrrcSceneAction {
Update,
Reorient,
ReorientLaunch,
ReorientResult,
ReorientAccept,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanyCrrcRecommendation {
pub action: EpiphanyCrrcAction,
pub recommended_scene_action: Option<EpiphanyCrrcSceneAction>,
pub reason: String,
}

View file

@ -1,27 +1,18 @@
mod coordinator_contract;
mod coordinator_decision;
mod crrc;
mod planning;
mod pressure;
mod reorient;
mod research_decision;
mod role_board;
mod role_result;
mod scene;
mod worker_launch;
pub use coordinator_contract::*;
pub use coordinator_decision::recommend_coordinator_action;
pub use crrc::EpiphanyCrrcAction;
pub use crrc::EpiphanyCrrcRecommendation;
pub use crrc::EpiphanyCrrcReorientAction;
pub use crrc::EpiphanyCrrcResultStatus;
pub use crrc::EpiphanyCrrcSceneAction;
pub use crrc::EpiphanyCrrcStateStatus;
pub use planning::EpiphanyPlanningStateStatus;
pub use planning::EpiphanyPlanningSummary;
pub use planning::EpiphanyPlanningView;
pub use planning::derive_planning_view;
pub use pressure::EpiphanyPressure;
pub use pressure::EpiphanyPressureBasis;
pub use pressure::EpiphanyPressureLevel;
@ -38,20 +29,6 @@ pub use role_result::EpiphanyRoleFindingInterpretation;
pub use role_result::EpiphanyRoleResultRoleId;
pub use role_result::interpret_runtime_reorient_worker_result;
pub use role_result::interpret_runtime_role_worker_result;
pub use scene::EpiphanyScene;
pub use scene::EpiphanySceneAction;
pub use scene::EpiphanySceneChurn;
pub use scene::EpiphanySceneGraph;
pub use scene::EpiphanySceneInput;
pub use scene::EpiphanySceneInvestigationCheckpoint;
pub use scene::EpiphanySceneRecord;
pub use scene::EpiphanySceneRecords;
pub use scene::EpiphanySceneRetrieval;
pub use scene::EpiphanySceneSource;
pub use scene::EpiphanySceneStateStatus;
pub use scene::EpiphanySceneStatusCount;
pub use scene::EpiphanySceneSubgoal;
pub use scene::derive_scene;
pub use worker_launch::AdmittedModelDirectionConsiderationContextProjection;
pub use worker_launch::EpiphanyReorientWorkerLaunchDocument;
pub use worker_launch::EpiphanyRoleWorkerLaunchDocument;

View file

@ -1,184 +0,0 @@
use epiphany_state_model::EpiphanyPlanningState;
use serde::Deserialize;
use serde::Serialize;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EpiphanyPlanningStateStatus {
Missing,
Ready,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanyPlanningSummary {
pub capture_count: u32,
pub pending_capture_count: u32,
pub github_issue_capture_count: u32,
pub backlog_item_count: u32,
pub ready_backlog_item_count: u32,
pub roadmap_stream_count: u32,
pub objective_draft_count: u32,
pub draft_objective_count: u32,
pub active_objective: Option<String>,
pub note: String,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanyPlanningView {
pub state_status: EpiphanyPlanningStateStatus,
pub projection_digest: Option<String>,
pub planning: EpiphanyPlanningState,
pub summary: EpiphanyPlanningSummary,
}
pub fn derive_planning_view(mind: Option<&crate::EpiphanyMindView>) -> EpiphanyPlanningView {
let Some(mind) = mind else {
return EpiphanyPlanningView {
state_status: EpiphanyPlanningStateStatus::Missing,
projection_digest: None,
planning: EpiphanyPlanningState::default(),
summary: EpiphanyPlanningSummary {
capture_count: 0,
pending_capture_count: 0,
github_issue_capture_count: 0,
backlog_item_count: 0,
ready_backlog_item_count: 0,
roadmap_stream_count: 0,
objective_draft_count: 0,
draft_objective_count: 0,
active_objective: None,
note: "No authoritative Epiphany state exists for this thread.".to_string(),
},
};
};
let planning = mind.planning.clone();
let pending_capture_count = planning
.captures
.iter()
.filter(|capture| capture.status == "new" || capture.status == "inbox")
.count() as u32;
let github_issue_capture_count = planning
.captures
.iter()
.filter(|capture| capture.source.kind == "github_issue")
.count() as u32;
let ready_backlog_item_count = planning
.backlog_items
.iter()
.filter(|item| item.status == "ready")
.count() as u32;
let draft_objective_count = planning
.objective_drafts
.iter()
.filter(|draft| draft.status == "draft")
.count() as u32;
let note = if planning.is_empty() {
"Planning substrate is present but empty; captures, backlog, roadmap streams, and objective drafts have not been written yet."
} else {
"Planning substrate is available. These records are planning state only until a human explicitly adopts an objective."
}
.to_string();
EpiphanyPlanningView {
state_status: EpiphanyPlanningStateStatus::Ready,
projection_digest: Some(mind.projection_digest.clone()),
planning: planning.clone(),
summary: EpiphanyPlanningSummary {
capture_count: planning.captures.len() as u32,
pending_capture_count,
github_issue_capture_count,
backlog_item_count: planning.backlog_items.len() as u32,
ready_backlog_item_count,
roadmap_stream_count: planning.roadmap_streams.len() as u32,
objective_draft_count: planning.objective_drafts.len() as u32,
draft_objective_count,
active_objective: mind.objective.clone(),
note,
},
}
}
#[cfg(test)]
mod tests {
use super::*;
use epiphany_state_model::EpiphanyPlanningCapture;
use epiphany_state_model::EpiphanyPlanningSourceRef;
#[test]
fn missing_state_returns_empty_planning() {
let view = derive_planning_view(None);
assert_eq!(view.state_status, EpiphanyPlanningStateStatus::Missing);
assert_eq!(view.projection_digest, None);
assert_eq!(view.summary.capture_count, 0);
assert!(view.planning.is_empty());
}
#[test]
fn summarizes_planning_counts_without_adopting_objective() {
let mind = crate::EpiphanyMindView {
schema_epoch: crate::MIND_SCHEMA_EPOCH.into(),
runtime_id: "runtime-1".into(),
projection_digest: "sha256:mind-3".into(),
source_documents: Vec::new(),
objective: Some("active objective".to_string()),
active_subgoal_id: None,
subgoals: Vec::new(),
invariants: Vec::new(),
observations: Vec::new(),
evidence: Vec::new(),
persona_memories: Vec::new(),
verification_audits: Vec::new(),
reorientation_decisions: Vec::new(),
reorientation_failures: Vec::new(),
agent_pass_admission_refusals: Vec::new(),
investigation_checkpoint: None,
mode: None,
planning: EpiphanyPlanningState {
captures: vec![
EpiphanyPlanningCapture {
id: "cap-1".to_string(),
title: "capture one".to_string(),
confidence: "high".to_string(),
status: "new".to_string(),
source: EpiphanyPlanningSourceRef {
kind: "github_issue".to_string(),
issue_number: Some(1),
..Default::default()
},
..Default::default()
},
EpiphanyPlanningCapture {
id: "cap-2".to_string(),
title: "capture two".to_string(),
confidence: "medium".to_string(),
status: "accepted".to_string(),
source: EpiphanyPlanningSourceRef {
kind: "conversation".to_string(),
..Default::default()
},
..Default::default()
},
],
..Default::default()
},
repository_body_observation: None,
repo_model: None,
};
let view = derive_planning_view(Some(&mind));
assert_eq!(view.state_status, EpiphanyPlanningStateStatus::Ready);
assert_eq!(view.projection_digest.as_deref(), Some("sha256:mind-3"));
assert_eq!(view.summary.capture_count, 2);
assert_eq!(view.summary.pending_capture_count, 1);
assert_eq!(view.summary.github_issue_capture_count, 1);
assert_eq!(
view.summary.active_objective.as_deref(),
Some("active objective")
);
}
}

View file

@ -1,6 +1,4 @@
use super::{
EpiphanyCoordinatorRoleId, EpiphanyCoordinatorRoleStatus, EpiphanyCoordinatorSceneAction,
};
use super::EpiphanyCoordinatorRoleStatus;
use crate::{
EpiphanyAgentPassContinuationAction, EpiphanyCurrentWorkProjection,
RepoFrontierPlanningLifecycleStage, RepoFrontierResearchContinuationAction,
@ -16,37 +14,28 @@ pub struct EpiphanyRoleBoardInput {
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanyRoleBoardLane {
pub id: EpiphanyCoordinatorRoleId,
pub title: String,
pub owner_role: String,
pub status: EpiphanyCoordinatorRoleStatus,
pub note: String,
pub authority_scopes: Vec<String>,
pub recommended_action: Option<EpiphanyCoordinatorSceneAction>,
}
pub fn derive_role_board(input: EpiphanyRoleBoardInput) -> Vec<EpiphanyRoleBoardLane> {
let missing = !input.mind_present;
let lane =
|id, title: &str, owner_role: &str, status, note: &str, scope: &str, recommended_action| {
EpiphanyRoleBoardLane {
id,
title: title.into(),
owner_role: owner_role.into(),
status: if missing {
EpiphanyCoordinatorRoleStatus::Blocked
} else {
status
},
note: if missing {
"Canonical keyed Mind is missing.".into()
} else {
note.into()
},
authority_scopes: vec![scope.into()],
recommended_action,
}
};
let lane = |title: &str, status, note: &str| {
EpiphanyRoleBoardLane {
title: title.into(),
status: if missing {
EpiphanyCoordinatorRoleStatus::Blocked
} else {
status
},
note: if missing {
"Canonical keyed Mind is missing.".into()
} else {
note.into()
},
}
};
let modeling_action = input
.current_work
@ -67,9 +56,7 @@ pub fn derive_role_board(input: EpiphanyRoleBoardInput) -> Vec<EpiphanyRoleBoard
vec![
lane(
EpiphanyCoordinatorRoleId::Implementation,
"Hands / Implementation",
"epiphany-hands",
if input.current_work.hands_frontier_ready {
EpiphanyCoordinatorRoleStatus::Ready
} else {
@ -80,54 +67,27 @@ pub fn derive_role_board(input: EpiphanyRoleBoardInput) -> Vec<EpiphanyRoleBoard
} else {
"No exact actionable Hands route exists."
},
"epiphany.hands.route",
None,
),
lane(
EpiphanyCoordinatorRoleId::Imagination,
"Imagination / Planning",
"epiphany-imagination",
planning_or_consideration_status(
input.current_work.frontier_planning.stage,
imagination_action,
),
"Status derives from exact planning and consideration obligations.",
"epiphany.imagination.current_work",
action_scene(imagination_action),
),
lane(
EpiphanyCoordinatorRoleId::Research,
"Eyes / Research",
"epiphany-eyes",
research_status(input.current_work.research.continuation_action()),
"Eyes runs only for an explicit external-evidence obligation.",
"epiphany.eyes.current_work",
input
.current_work
.research
.continuation_action()
.map(|action| match action {
RepoFrontierResearchContinuationAction::LaunchResearch => {
EpiphanyCoordinatorSceneAction::RoleLaunch
}
RepoFrontierResearchContinuationAction::ReviewResearchResult => {
EpiphanyCoordinatorSceneAction::RoleResult
}
}),
),
lane(
EpiphanyCoordinatorRoleId::Modeling,
"Modeling / Body Map",
"epiphany-modeling",
continuation_status(modeling_action),
"Status derives from exact Body, proposal, or Soul-verdict Modeling work.",
"epiphany.modeling.current_work",
action_scene(modeling_action),
),
lane(
EpiphanyCoordinatorRoleId::Verification,
"Soul / Verification",
"epiphany-soul",
continuation_status(
input
.current_work
@ -136,19 +96,9 @@ pub fn derive_role_board(input: EpiphanyRoleBoardInput) -> Vec<EpiphanyRoleBoard
.map(|work| work.attempt.action),
),
"Verification consumes exact Hands consequences and invariant obligations.",
"epiphany.soul.current_work",
action_scene(
input
.current_work
.verification
.as_ref()
.map(|work| work.attempt.action),
),
),
lane(
EpiphanyCoordinatorRoleId::Reorientation,
"Continuity / Reorientation",
"epiphany-continuity",
continuation_status(
input
.current_work
@ -157,14 +107,6 @@ pub fn derive_role_board(input: EpiphanyRoleBoardInput) -> Vec<EpiphanyRoleBoard
.map(|work| work.attempt.action),
),
"Status derives from the exact keyed continuity obligation.",
"epiphany.continuity.current_work",
action_scene(
input
.current_work
.reorientation
.as_ref()
.map(|work| work.attempt.action),
),
),
]
}
@ -192,21 +134,6 @@ fn continuation_status(
}
}
fn action_scene(
action: Option<EpiphanyAgentPassContinuationAction>,
) -> Option<EpiphanyCoordinatorSceneAction> {
match action {
Some(EpiphanyAgentPassContinuationAction::Launch) => {
Some(EpiphanyCoordinatorSceneAction::RoleLaunch)
}
Some(EpiphanyAgentPassContinuationAction::Wait)
| Some(EpiphanyAgentPassContinuationAction::Review) => {
Some(EpiphanyCoordinatorSceneAction::RoleResult)
}
None => None,
}
}
fn research_status(
action: Option<RepoFrontierResearchContinuationAction>,
) -> EpiphanyCoordinatorRoleStatus {

View file

@ -1,458 +0,0 @@
use epiphany_state_model::EpiphanyInvestigationDisposition;
use epiphany_state_model::EpiphanyRetrievalStatus;
use epiphany_state_model::{EpiphanyMemoryProfile, RepoFrontierStatus};
use serde::Deserialize;
use serde::Serialize;
use std::collections::BTreeMap;
use std::path::PathBuf;
pub const EPIPHANY_SCENE_RECORD_LIMIT: usize = 5;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EpiphanySceneStateStatus {
Missing,
Ready,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EpiphanySceneSource {
Stored,
Live,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EpiphanySceneAction {
Index,
Retrieve,
Distill,
Context,
Planning,
GraphQuery,
Jobs,
Roles,
Coordinator,
Freshness,
Pressure,
Reorient,
Crrc,
ReorientLaunch,
ReorientResult,
ReorientAccept,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanySceneSubgoal {
pub id: String,
pub title: String,
pub status: String,
pub summary: Option<String>,
pub active: bool,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanySceneStatusCount {
pub status: String,
pub count: u32,
}
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanySceneGraph {
pub architecture_node_count: u32,
pub architecture_edge_count: u32,
pub dataflow_node_count: u32,
pub dataflow_edge_count: u32,
pub link_count: u32,
pub active_node_ids: Vec<String>,
pub active_edge_ids: Vec<String>,
pub open_question_count: u32,
pub open_gap_count: u32,
pub dirty_paths: Vec<PathBuf>,
pub checkpoint_id: Option<String>,
pub checkpoint_summary: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanySceneRetrieval {
pub workspace_root: PathBuf,
pub status: EpiphanyRetrievalStatus,
pub semantic_available: bool,
pub index_revision: Option<String>,
pub indexed_file_count: Option<u32>,
pub indexed_chunk_count: Option<u32>,
pub shard_count: u32,
pub dirty_path_count: u32,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanySceneInvestigationCheckpoint {
pub checkpoint_id: String,
pub kind: String,
pub disposition: EpiphanyInvestigationDisposition,
pub focus: String,
pub summary: Option<String>,
pub next_action: Option<String>,
pub captured_at_turn_id: Option<String>,
pub open_question_count: u32,
pub code_ref_count: u32,
pub evidence_count: u32,
}
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanySceneRecords {
pub total_count: u32,
pub latest: Vec<EpiphanySceneRecord>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanySceneRecord {
pub id: String,
pub kind: String,
pub status: String,
pub summary: String,
pub code_ref_count: u32,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanySceneChurn {
pub understanding_status: String,
pub diff_pressure: String,
pub warning: Option<String>,
pub unexplained_writes: Option<u32>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanyScene {
pub state_status: EpiphanySceneStateStatus,
pub source: EpiphanySceneSource,
pub projection_digest: Option<String>,
pub objective: Option<String>,
pub active_subgoal: Option<EpiphanySceneSubgoal>,
pub subgoals: Vec<EpiphanySceneSubgoal>,
pub invariant_status_counts: Vec<EpiphanySceneStatusCount>,
pub graph: EpiphanySceneGraph,
pub retrieval: Option<EpiphanySceneRetrieval>,
pub investigation_checkpoint: Option<EpiphanySceneInvestigationCheckpoint>,
pub observations: EpiphanySceneRecords,
pub evidence: EpiphanySceneRecords,
pub churn: Option<EpiphanySceneChurn>,
pub available_actions: Vec<EpiphanySceneAction>,
}
#[derive(Debug, Clone, Copy)]
pub struct EpiphanySceneInput<'a> {
pub mind: Option<&'a crate::EpiphanyMindView>,
pub loaded: bool,
pub reorientation_work_present: bool,
}
pub fn derive_scene(input: EpiphanySceneInput<'_>) -> EpiphanyScene {
let source = if input.loaded {
EpiphanySceneSource::Live
} else {
EpiphanySceneSource::Stored
};
let mind = input.mind;
let available_actions = scene_available_actions(
input.loaded,
mind.is_some(),
mind.and_then(|mind| mind.investigation_checkpoint.as_ref())
.is_some(),
input.reorientation_work_present,
);
let Some(mind) = mind else {
return EpiphanyScene {
state_status: EpiphanySceneStateStatus::Missing,
source,
projection_digest: None,
objective: None,
active_subgoal: None,
subgoals: Vec::new(),
invariant_status_counts: Vec::new(),
graph: EpiphanySceneGraph::default(),
retrieval: None,
investigation_checkpoint: None,
observations: EpiphanySceneRecords::default(),
evidence: EpiphanySceneRecords::default(),
churn: None,
available_actions,
};
};
let subgoals = scene_subgoals(mind);
let active_subgoal = subgoals.iter().find(|subgoal| subgoal.active).cloned();
EpiphanyScene {
state_status: EpiphanySceneStateStatus::Ready,
source,
projection_digest: Some(mind.projection_digest.clone()),
objective: mind.objective.clone(),
active_subgoal,
subgoals,
invariant_status_counts: status_counts(
mind.invariants.iter().map(|item| item.status.as_str()),
),
graph: scene_graph(mind),
retrieval: None,
investigation_checkpoint: mind.investigation_checkpoint.as_ref().map(|checkpoint| {
EpiphanySceneInvestigationCheckpoint {
checkpoint_id: checkpoint.checkpoint_id.clone(),
kind: checkpoint.kind.clone(),
disposition: checkpoint.disposition,
focus: checkpoint.focus.clone(),
summary: checkpoint.summary.clone(),
next_action: checkpoint.next_action.clone(),
captured_at_turn_id: checkpoint.captured_at_turn_id.clone(),
open_question_count: checkpoint.open_questions.len() as u32,
code_ref_count: checkpoint.code_refs.len() as u32,
evidence_count: checkpoint.evidence_ids.len() as u32,
}
}),
observations: EpiphanySceneRecords {
total_count: mind.observations.len() as u32,
latest: mind
.observations
.iter()
.take(EPIPHANY_SCENE_RECORD_LIMIT)
.map(|observation| EpiphanySceneRecord {
id: observation.id.clone(),
kind: observation.source_kind.clone(),
status: observation.status.clone(),
summary: observation.summary.clone(),
code_ref_count: observation.code_refs.len() as u32,
})
.collect(),
},
evidence: EpiphanySceneRecords {
total_count: mind.evidence.len() as u32,
latest: mind
.evidence
.iter()
.take(EPIPHANY_SCENE_RECORD_LIMIT)
.map(|evidence| EpiphanySceneRecord {
id: evidence.id.clone(),
kind: evidence.kind.clone(),
status: evidence.status.clone(),
summary: evidence.summary.clone(),
code_ref_count: evidence.code_refs.len() as u32,
})
.collect(),
},
churn: None,
available_actions,
}
}
fn scene_available_actions(
loaded: bool,
state_present: bool,
checkpoint_present: bool,
reorient_binding_present: bool,
) -> Vec<EpiphanySceneAction> {
if !loaded {
return Vec::new();
}
let mut actions = vec![
EpiphanySceneAction::Index,
EpiphanySceneAction::Retrieve,
EpiphanySceneAction::Distill,
EpiphanySceneAction::Context,
EpiphanySceneAction::Planning,
EpiphanySceneAction::GraphQuery,
EpiphanySceneAction::Jobs,
EpiphanySceneAction::Roles,
EpiphanySceneAction::Coordinator,
EpiphanySceneAction::Freshness,
EpiphanySceneAction::Pressure,
EpiphanySceneAction::Reorient,
EpiphanySceneAction::Crrc,
];
if checkpoint_present {
actions.push(EpiphanySceneAction::ReorientLaunch);
}
if reorient_binding_present {
actions.push(EpiphanySceneAction::ReorientResult);
actions.push(EpiphanySceneAction::ReorientAccept);
}
let _ = state_present;
actions
}
fn scene_subgoals(mind: &crate::EpiphanyMindView) -> Vec<EpiphanySceneSubgoal> {
let active_id = mind.active_subgoal_id.as_deref();
mind.subgoals
.iter()
.map(|subgoal| EpiphanySceneSubgoal {
id: subgoal.id.clone(),
title: subgoal.title.clone(),
status: subgoal.status.clone(),
summary: subgoal.summary.clone(),
active: active_id == Some(subgoal.id.as_str()),
})
.collect()
}
fn scene_graph(mind: &crate::EpiphanyMindView) -> EpiphanySceneGraph {
let Some(model) = mind.repo_model.as_ref() else {
return EpiphanySceneGraph::default();
};
let active = model
.frontier
.iter()
.filter(|item| {
matches!(
item.status,
RepoFrontierStatus::Proposed
| RepoFrontierStatus::Active
| RepoFrontierStatus::Blocked
)
})
.collect::<Vec<_>>();
EpiphanySceneGraph {
architecture_node_count: model
.nodes
.iter()
.filter(|node| node.profile == EpiphanyMemoryProfile::RepoArchitecture)
.count() as u32,
architecture_edge_count: model
.edges
.iter()
.filter(|edge| edge.profile == EpiphanyMemoryProfile::RepoArchitecture)
.count() as u32,
dataflow_node_count: model
.nodes
.iter()
.filter(|node| node.profile == EpiphanyMemoryProfile::RepoDataflow)
.count() as u32,
dataflow_edge_count: model
.edges
.iter()
.filter(|edge| edge.profile == EpiphanyMemoryProfile::RepoDataflow)
.count() as u32,
link_count: model.edges.len() as u32,
active_node_ids: active
.iter()
.flat_map(|item| item.target_claim_ids.iter().cloned())
.collect(),
active_edge_ids: Vec::new(),
open_question_count: active.len() as u32,
open_gap_count: active
.iter()
.filter(|item| item.status == RepoFrontierStatus::Blocked)
.count() as u32,
dirty_paths: Vec::new(),
checkpoint_id: mind
.investigation_checkpoint
.as_ref()
.map(|checkpoint| checkpoint.checkpoint_id.clone()),
checkpoint_summary: mind
.investigation_checkpoint
.as_ref()
.and_then(|checkpoint| checkpoint.summary.clone()),
}
}
fn status_counts<'a>(statuses: impl Iterator<Item = &'a str>) -> Vec<EpiphanySceneStatusCount> {
let mut counts = BTreeMap::<String, u32>::new();
for status in statuses {
*counts.entry(status.to_string()).or_default() += 1;
}
counts
.into_iter()
.map(|(status, count)| EpiphanySceneStatusCount { status, count })
.collect()
}
#[cfg(test)]
mod tests {
use super::*;
use epiphany_state_model::EpiphanyInvariant;
use epiphany_state_model::EpiphanyPlanningState;
use epiphany_state_model::EpiphanySubgoal;
#[test]
fn missing_stored_scene_has_no_actions() {
let scene = derive_scene(EpiphanySceneInput {
mind: None,
loaded: false,
reorientation_work_present: false,
});
assert_eq!(scene.state_status, EpiphanySceneStateStatus::Missing);
assert_eq!(scene.source, EpiphanySceneSource::Stored);
assert!(scene.available_actions.is_empty());
}
#[test]
fn live_scene_projects_state_and_actions() {
let mind = crate::EpiphanyMindView {
schema_epoch: crate::MIND_SCHEMA_EPOCH.into(),
runtime_id: "runtime-1".into(),
projection_digest: "sha256:mind-4".into(),
source_documents: Vec::new(),
objective: Some("purify".to_string()),
active_subgoal_id: Some("subgoal-1".to_string()),
subgoals: vec![EpiphanySubgoal {
id: "subgoal-1".to_string(),
title: "cut".to_string(),
status: "active".to_string(),
summary: Some("current cut".to_string()),
}],
invariants: vec![
EpiphanyInvariant {
id: "inv-1".to_string(),
description: "ready".to_string(),
status: "ready".to_string(),
rationale: None,
},
EpiphanyInvariant {
id: "inv-2".to_string(),
description: "ready".to_string(),
status: "ready".to_string(),
rationale: None,
},
],
observations: Vec::new(),
evidence: Vec::new(),
persona_memories: Vec::new(),
verification_audits: Vec::new(),
reorientation_decisions: Vec::new(),
reorientation_failures: Vec::new(),
agent_pass_admission_refusals: Vec::new(),
investigation_checkpoint: None,
mode: None,
planning: EpiphanyPlanningState::default(),
repository_body_observation: None,
repo_model: None,
};
let scene = derive_scene(EpiphanySceneInput {
mind: Some(&mind),
loaded: true,
reorientation_work_present: true,
});
assert_eq!(scene.state_status, EpiphanySceneStateStatus::Ready);
assert_eq!(scene.projection_digest.as_deref(), Some("sha256:mind-4"));
assert_eq!(
scene.active_subgoal.as_ref().map(|item| item.active),
Some(true)
);
assert_eq!(scene.invariant_status_counts[0].count, 2);
assert!(scene
.available_actions
.contains(&EpiphanySceneAction::ReorientResult));
}
}

View file

@ -1317,52 +1317,6 @@ mod tests {
);
}
#[test]
fn root_workspace_owns_first_party_dependency_resolution() {
let core = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let repo = core.parent().expect("epiphany-core repository parent");
let root_manifest = fs::read_to_string(repo.join("Cargo.toml")).expect("root manifest");
assert!(root_manifest.contains("[workspace]"));
for member in [
"epiphany-core",
"epiphany-model-adapter",
"epiphany-openai-adapter",
"epiphany-openai-auth-spine",
"epiphany-openai-codex-spine",
"epiphany-openai-runtime",
"epiphany-self-policy",
"epiphany-state-model",
"epiphany-tool-adapter",
"epiphany-tool-mcp-runtime",
] {
assert!(
root_manifest.contains(&format!("\"{member}\"")),
"root workspace omits {member}"
);
assert!(
!repo.join(member).join("Cargo.lock").exists(),
"{member} retains a competing Cargo.lock"
);
}
}
#[test]
fn coordinator_policy_is_feature_gated_outside_core_binary_ownership() {
let core = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let repo = core.parent().expect("epiphany-core repository parent");
let root_manifest = fs::read_to_string(repo.join("Cargo.toml")).expect("root manifest");
let core_manifest = fs::read_to_string(core.join("Cargo.toml")).expect("core manifest");
assert!(root_manifest.contains("coordinator-runtime = [\"dep:epiphany-self-policy\"]"));
assert!(root_manifest.contains(
"release-runtime = [\"coordinator-runtime\", \"openai-runtime\", \"tool-mcp-runtime\"]"
));
assert!(root_manifest.contains("required-features = [\"coordinator-runtime\"]"));
assert!(core_manifest.contains("autobins = false"));
assert!(!core_manifest.contains("name = \"epiphany-mvp-coordinator\""));
assert!(!core_manifest.contains("name = \"epiphany-mvp-status\""));
}
fn fixture() -> (TempDir, EpiphanyPackagedReleaseEntry) {
let dir = TempDir::new().unwrap();
let root = dir.path().join("release");

View file

@ -1,18 +0,0 @@
[package]
name = "epiphany-self-policy"
version = "0.1.0"
edition = "2024"
publish = false
license-file = "../LICENSE"
[lib]
name = "epiphany_self_policy"
path = "../epiphany-core/src/surfaces/coordinator.rs"
[dependencies]
epiphany-core = { path = "../epiphany-core" }
epiphany-state-model = { path = "../epiphany-state-model" }
serde = { version = "1", features = ["derive"] }
[dev-dependencies]
pretty_assertions = "1.4.1"

View file

@ -1,72 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://gamecult.dev/epiphany/cultnet/epiphany.surface.coordinator.schema.json",
"title": "Epiphany coordinator",
"description": "Fixed-lane coordinator recommendation surface over typed Epiphany signals.",
"type": "object",
"additionalProperties": true,
"properties": {
"threadId": {
"type": "string"
},
"source": {
"type": "string"
},
"stateStatus": {
"type": "string"
},
"stateRevision": {
"type": "integer"
},
"action": {
"type": "string"
},
"targetRole": {
"type": [
"string",
"null"
]
},
"recommendedSceneAction": {
"type": [
"string",
"null"
]
},
"requiresReview": {
"type": "boolean"
},
"canAutoRun": {
"type": "boolean"
},
"reason": {
"type": "string"
},
"sourceSignals": {
"type": "object",
"additionalProperties": true
},
"roles": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
},
"note": {
"type": "string"
}
},
"required": [
"threadId",
"source",
"stateStatus",
"action",
"requiresReview",
"canAutoRun",
"reason",
"sourceSignals",
"roles",
"note"
]
}

View file

@ -1,37 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://gamecult.dev/epiphany/cultnet/epiphany.surface.planning.schema.json",
"title": "Epiphany planning",
"description": "Planning projection over captures, backlog, roadmap streams, and Objective Drafts.",
"type": "object",
"additionalProperties": true,
"properties": {
"threadId": {
"type": "string"
},
"source": {
"type": "string"
},
"stateStatus": {
"type": "string"
},
"stateRevision": {
"type": "integer"
},
"planning": {
"type": "object",
"additionalProperties": true
},
"summary": {
"type": "object",
"additionalProperties": true
}
},
"required": [
"threadId",
"source",
"stateStatus",
"planning",
"summary"
]
}

View file

@ -1,39 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://gamecult.dev/epiphany/cultnet/epiphany.surface.roles.schema.json",
"title": "Epiphany roles",
"description": "Role ownership reflection over fixed typed Epiphany lanes.",
"type": "object",
"additionalProperties": true,
"properties": {
"threadId": {
"type": "string"
},
"source": {
"type": "string"
},
"stateStatus": {
"type": "string"
},
"stateRevision": {
"type": "integer"
},
"roles": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
},
"note": {
"type": "string"
}
},
"required": [
"threadId",
"source",
"stateStatus",
"roles",
"note"
]
}

View file

@ -1,31 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://gamecult.dev/epiphany/cultnet/epiphany.surface.scene.schema.json",
"title": "Epiphany scene",
"description": "Operator-safe scene reflection over typed Epiphany state.",
"type": "object",
"additionalProperties": true,
"properties": {
"threadId": {
"type": "string"
},
"source": {
"type": "string"
},
"stateStatus": {
"type": "string"
},
"stateRevision": {
"type": "integer"
},
"scene": {
"type": "object",
"additionalProperties": true
}
},
"required": [
"threadId",
"source",
"scene"
]
}

View file

@ -301,17 +301,6 @@
"title": "Epiphany CultMesh Operator Run Receipt",
"path": "epiphany.cultmesh.operator-run-receipt.schema.json"
},
{
"schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.surface.scene.schema.json",
"kind": "document_payload",
"wireContracts": [
"cultnet.schema.v0"
],
"schemaVersion": "epiphany.scene_surface.v0",
"documentType": "epiphany.surface.scene",
"title": "Epiphany scene",
"path": "epiphany.surface.scene.schema.json"
},
{
"schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.surface.freshness.schema.json",
"kind": "document_payload",
@ -389,17 +378,6 @@
"title": "Epiphany jobs",
"path": "epiphany.surface.jobs.schema.json"
},
{
"schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.surface.roles.schema.json",
"kind": "document_payload",
"wireContracts": [
"cultnet.schema.v0"
],
"schemaVersion": "epiphany.roles_surface.v0",
"documentType": "epiphany.surface.roles",
"title": "Epiphany roles",
"path": "epiphany.surface.roles.schema.json"
},
{
"schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.surface.role-result.schema.json",
"kind": "document_payload",
@ -422,28 +400,6 @@
"title": "Epiphany reorient-result",
"path": "epiphany.surface.reorient-result.schema.json"
},
{
"schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.surface.planning.schema.json",
"kind": "document_payload",
"wireContracts": [
"cultnet.schema.v0"
],
"schemaVersion": "epiphany.planning_surface.v0",
"documentType": "epiphany.surface.planning",
"title": "Epiphany planning",
"path": "epiphany.surface.planning.schema.json"
},
{
"schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.surface.coordinator.schema.json",
"kind": "document_payload",
"wireContracts": [
"cultnet.schema.v0"
],
"schemaVersion": "epiphany.coordinator_surface.v0",
"documentType": "epiphany.surface.coordinator",
"title": "Epiphany coordinator",
"path": "epiphany.surface.coordinator.schema.json"
},
{
"schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.surface.persona.schema.json",
"kind": "document_payload",