Add native MVP status source

This commit is contained in:
Meta Vens 2026-05-27 21:32:29 +01:00
commit 2438b25dab
8 changed files with 468 additions and 62 deletions

View file

@ -1,6 +1,34 @@
use anyhow::Context;
use anyhow::Result;
use anyhow::anyhow;
use epiphany_core::EpiphanyCoordinatorRoleResultStatus;
use epiphany_core::EpiphanyCoordinatorStatusInput;
use epiphany_core::EpiphanyCrrcInput;
use epiphany_core::EpiphanyCrrcReorientAction;
use epiphany_core::EpiphanyCrrcResultStatus;
use epiphany_core::EpiphanyCrrcStateStatus;
use epiphany_core::EpiphanyJobsInput;
use epiphany_core::EpiphanyReorientAction;
use epiphany_core::EpiphanyReorientFreshnessStatus;
use epiphany_core::EpiphanyReorientInput;
use epiphany_core::EpiphanyReorientPressureLevel;
use epiphany_core::EpiphanyRoleBoardCheckpointSummary;
use epiphany_core::EpiphanyRoleBoardInput;
use epiphany_core::EpiphanyRoleBoardJob;
use epiphany_core::EpiphanyRoleBoardJobStatus;
use epiphany_core::EpiphanyRoleBoardPlanningSummary;
use epiphany_core::EpiphanySceneInput;
use epiphany_core::EpiphanyTokenUsageSnapshot;
use epiphany_core::derive_coordinator_finding_signals;
use epiphany_core::derive_coordinator_status;
use epiphany_core::derive_jobs;
use epiphany_core::derive_planning_view;
use epiphany_core::derive_pressure_view;
use epiphany_core::derive_role_board;
use epiphany_core::derive_scene;
use epiphany_core::load_thread_state_entry;
use epiphany_core::recommend_crrc_action;
use epiphany_core::recommend_reorientation;
use serde_json::Value;
use serde_json::json;
use std::env;
@ -19,6 +47,11 @@ use std::time::{Duration, Instant};
const DEFAULT_APP_SERVER: &str = r"C:\Users\Meta\.cargo-target-codex\debug\codex-app-server.exe";
const DEFAULT_CARGO_TARGET_DIR: &str = r"C:\Users\Meta\.cargo-target-codex";
const DEFAULT_THREAD_STATE_STORE: &str = "state/thread-state.msgpack";
const REORIENT_BINDING_ID: &str = "reorient-worker";
const IMAGINATION_BINDING_ID: &str = "imagination-synthesis-worker";
const MODELING_BINDING_ID: &str = "modeling-checkpoint-worker";
const VERIFICATION_BINDING_ID: &str = "verification-review-worker";
const SEALED_DIRECT_THOUGHT_KEYS: &[&str] = &[
"rawResult",
"turns",
@ -42,12 +75,16 @@ fn main() -> Result<()> {
format!("{}\n", serde_json::to_string_pretty(&status)?),
)
.with_context(|| format!("failed to write {}", result.display()))?;
write_transcript_telemetry(&args.transcript, &result.with_extension("telemetry.json"))?;
if args.source == StatusSource::Codex {
write_transcript_telemetry(&args.transcript, &result.with_extension("telemetry.json"))?;
}
}
if args.source == StatusSource::Codex {
write_transcript_telemetry(
&args.transcript,
&args.transcript.with_extension("telemetry.json"),
)?;
}
write_transcript_telemetry(
&args.transcript,
&args.transcript.with_extension("telemetry.json"),
)?;
if args.json {
println!("{}", serde_json::to_string_pretty(&status)?);
} else {
@ -56,12 +93,20 @@ fn main() -> Result<()> {
Ok(())
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum StatusSource {
Native,
Codex,
}
#[derive(Debug)]
struct Args {
source: StatusSource,
app_server: PathBuf,
codex_home: PathBuf,
thread_id: Option<String>,
cwd: PathBuf,
thread_state_store: PathBuf,
ephemeral: bool,
json: bool,
result: Option<PathBuf>,
@ -74,12 +119,14 @@ impl Args {
let root = env::current_dir().context("failed to resolve current directory")?;
let mut args = env::args().skip(1);
let mut parsed = Args {
source: StatusSource::Codex,
app_server: PathBuf::from(DEFAULT_APP_SERVER),
codex_home: env::var_os("CODEX_HOME")
.map(PathBuf::from)
.unwrap_or_else(|| home_dir().join(".codex")),
thread_id: None,
cwd: root.clone(),
thread_state_store: PathBuf::from(DEFAULT_THREAD_STATE_STORE),
ephemeral: true,
json: false,
result: None,
@ -92,10 +139,16 @@ impl Args {
};
while let Some(arg) = args.next() {
match arg.as_str() {
"--source" => parsed.source = take_source(&mut args, "--source")?,
"--native" => parsed.source = StatusSource::Native,
"--codex" => parsed.source = StatusSource::Codex,
"--app-server" => parsed.app_server = take_path(&mut args, "--app-server")?,
"--codex-home" => parsed.codex_home = take_path(&mut args, "--codex-home")?,
"--thread-id" => parsed.thread_id = Some(take_string(&mut args, "--thread-id")?),
"--cwd" => parsed.cwd = take_path(&mut args, "--cwd")?,
"--thread-state-store" => {
parsed.thread_state_store = take_path(&mut args, "--thread-state-store")?
}
"--ephemeral" => parsed.ephemeral = true,
"--no-ephemeral" => parsed.ephemeral = false,
"--json" => parsed.json = true,
@ -110,6 +163,255 @@ impl Args {
}
fn run_status(args: &Args) -> Result<Value> {
match args.source {
StatusSource::Native => run_native_status(args),
StatusSource::Codex => run_codex_status(args),
}
}
fn run_native_status(args: &Args) -> Result<Value> {
let cwd = absolute_path(&args.cwd)?;
let store_path = absolute_path(&args.thread_state_store)?;
let state_entry = if store_path.exists() {
load_thread_state_entry(&store_path)
.with_context(|| format!("failed to load {}", store_path.display()))?
} else {
None
};
let thread_id = args
.thread_id
.clone()
.or_else(|| state_entry.as_ref().map(|entry| entry.thread_id.clone()))
.unwrap_or_else(|| "native-local".to_string());
let state = state_entry
.as_ref()
.map(|entry| entry.state())
.transpose()
.context("failed to decode native Epiphany thread state")?;
let state_ref = state.as_ref();
let loaded = state_ref.is_some();
let scene = derive_scene(EpiphanySceneInput {
state: state_ref,
loaded,
reorient_binding_id: REORIENT_BINDING_ID,
});
let pressure = derive_pressure_view(None::<&EpiphanyTokenUsageSnapshot>);
let reorient_pressure_level = match pressure.level {
epiphany_core::EpiphanyPressureLevel::Unknown => EpiphanyReorientPressureLevel::Unknown,
epiphany_core::EpiphanyPressureLevel::Low => EpiphanyReorientPressureLevel::Low,
epiphany_core::EpiphanyPressureLevel::Elevated => EpiphanyReorientPressureLevel::Medium,
epiphany_core::EpiphanyPressureLevel::High => EpiphanyReorientPressureLevel::High,
epiphany_core::EpiphanyPressureLevel::Critical => EpiphanyReorientPressureLevel::Critical,
};
let (reorient_state_status, reorient_decision) =
recommend_reorientation(EpiphanyReorientInput {
checkpoint: state_ref.and_then(|state| state.investigation_checkpoint.as_ref()),
state_present: state_ref.is_some(),
pressure_level: reorient_pressure_level,
retrieval_status: EpiphanyReorientFreshnessStatus::Unknown,
retrieval_dirty_paths: Vec::new(),
graph_status: EpiphanyReorientFreshnessStatus::Unknown,
graph_dirty_paths: Vec::new(),
watcher_status: EpiphanyReorientFreshnessStatus::Unknown,
watcher_changed_paths: Vec::new(),
watcher_graph_node_ids: Vec::new(),
active_frontier_node_ids: state_ref
.and_then(|state| state.graph_frontier.as_ref())
.map(|frontier| frontier.active_node_ids.clone())
.unwrap_or_default(),
watched_root: Some(cwd.clone()),
});
let planning = derive_planning_view(state_ref);
let jobs = derive_jobs(EpiphanyJobsInput {
state: state_ref,
retrieval_override: None,
});
let state_status = if state_ref.is_some() {
EpiphanyCrrcStateStatus::Ready
} else {
EpiphanyCrrcStateStatus::Missing
};
let reorient_action = match reorient_decision.action {
EpiphanyReorientAction::Resume => EpiphanyCrrcReorientAction::Resume,
EpiphanyReorientAction::Regather => EpiphanyCrrcReorientAction::Regather,
};
let result_status = EpiphanyCrrcResultStatus::BackendMissing;
let recommendation = recommend_crrc_action(EpiphanyCrrcInput {
loaded,
state_status,
should_prepare_compaction: pressure.should_prepare_compaction,
reorient_action,
result_status,
checkpoint_present: state_ref
.and_then(|state| state.investigation_checkpoint.as_ref())
.is_some(),
finding_present: false,
finding_accepted: false,
});
let role_jobs = jobs
.iter()
.map(|job| EpiphanyRoleBoardJob {
id: job.id.clone(),
owner_role: job.owner_role.clone(),
status: role_job_status(job.status),
progress_note: job.progress_note.clone(),
blocking_reason: job.blocking_reason.clone(),
})
.collect::<Vec<_>>();
let roles = derive_role_board(EpiphanyRoleBoardInput {
state_present: state_ref.is_some(),
planning: EpiphanyRoleBoardPlanningSummary {
capture_count: planning.summary.capture_count as usize,
backlog_item_count: planning.summary.backlog_item_count as usize,
roadmap_stream_count: planning.summary.roadmap_stream_count as usize,
objective_draft_count: planning.summary.objective_draft_count as usize,
},
checkpoint: state_ref.and_then(|state| {
state.investigation_checkpoint.as_ref().map(|checkpoint| {
EpiphanyRoleBoardCheckpointSummary {
disposition: Some(format!("{:?}", checkpoint.disposition)),
next_action: checkpoint.next_action.clone(),
}
})
}),
reorient_next_action: reorient_decision.next_action.clone(),
jobs: role_jobs.clone(),
crrc_action: recommendation.action,
crrc_recommended_scene_action: recommendation
.recommended_scene_action
.map(epiphany_core::crrc_scene_action_to_coordinator_scene_action),
crrc_reason: recommendation.reason.clone(),
reorient_decision_action: format!("{:?}", reorient_decision.action),
pressure_level: format!("{:?}", pressure.level),
reorient_result_status: result_status,
reorient_job: role_jobs
.iter()
.find(|job| job.id == REORIENT_BINDING_ID)
.cloned(),
imagination_binding_id: IMAGINATION_BINDING_ID.to_string(),
modeling_binding_id: MODELING_BINDING_ID.to_string(),
verification_binding_id: VERIFICATION_BINDING_ID.to_string(),
reorient_owner_role: "epiphany-reorienter".to_string(),
imagination_owner_role: "epiphany-imagination".to_string(),
});
let finding_signals = derive_coordinator_finding_signals(state_ref, None, None, None);
let coordinator = derive_coordinator_status(EpiphanyCoordinatorStatusInput {
state_status,
checkpoint_present: state_ref
.and_then(|state| state.investigation_checkpoint.as_ref())
.is_some(),
pressure: pressure.clone(),
recommendation: recommendation.clone(),
roles: roles.clone(),
reorient_action: reorient_decision.action,
modeling_result_status: EpiphanyCoordinatorRoleResultStatus::BackendMissing,
verification_result_status: EpiphanyCoordinatorRoleResultStatus::BackendMissing,
reorient_result_status: result_status,
modeling_result_accepted: finding_signals.modeling_result_accepted,
modeling_result_reviewable: finding_signals.modeling_result_reviewable,
modeling_result_accepted_after_verification: finding_signals
.modeling_result_accepted_after_verification,
implementation_evidence_after_verification: finding_signals
.implementation_evidence_after_verification,
verification_result_cites_implementation_evidence: finding_signals
.verification_result_cites_implementation_evidence,
verification_result_covers_current_modeling: finding_signals
.verification_result_covers_current_modeling,
verification_result_accepted: finding_signals.verification_result_accepted,
verification_result_allows_implementation: finding_signals
.verification_result_allows_implementation,
verification_result_needs_evidence: finding_signals.verification_result_needs_evidence,
reorient_finding_accepted: finding_signals.reorient_finding_accepted,
});
let coordinator_json = coordinator_status_json(&coordinator)?;
let root = env::current_dir().context("failed to resolve current directory")?;
let native_aux = native_auxiliary_status(&root)?;
let status = json!({
"threadId": thread_id,
"read": {
"source": "native",
"threadStateStore": store_path,
"statePresent": state_ref.is_some(),
},
"view": {
"source": "native",
"scene": scene,
"pressure": pressure,
"jobs": jobs,
"roles": {
"threadId": thread_id,
"source": "native",
"stateStatus": crrc_state_status_text(state_status),
"roles": roles,
},
"planning": planning,
"reorient": {
"threadId": thread_id,
"source": "native",
"stateStatus": reorient_state_status,
"decision": reorient_decision,
},
"crrc": {
"threadId": thread_id,
"source": "native",
"recommendation": recommendation,
},
"coordinator": coordinator_json,
},
"scene": {
"threadId": thread_id,
"scene": scene,
},
"pressure": {
"threadId": thread_id,
"source": "native",
"pressure": pressure,
},
"reorient": {
"threadId": thread_id,
"source": "native",
"stateStatus": reorient_state_status,
"decision": reorient_decision,
},
"jobs": {
"threadId": thread_id,
"source": "native",
"jobs": jobs,
},
"roles": {
"threadId": thread_id,
"source": "native",
"stateStatus": crrc_state_status_text(state_status),
"roles": roles,
},
"planning": planning,
"roleResults": {
"imagination": native_role_result(IMAGINATION_BINDING_ID),
"modeling": native_role_result(MODELING_BINDING_ID),
"verification": native_role_result(VERIFICATION_BINDING_ID),
},
"reorientResult": {
"source": "native",
"status": "backendMissing",
"bindingId": REORIENT_BINDING_ID,
"note": "Native status is provider-neutral and does not query model-worker runtime results yet.",
},
"crrc": {
"threadId": thread_id,
"source": "native",
"recommendation": recommendation,
},
"coordinator": coordinator_json,
"heartbeat": native_aux.heartbeat,
"face": native_aux.face,
"voidMemory": native_aux.void_memory,
});
Ok(sanitize_for_operator(status))
}
fn run_codex_status(args: &Args) -> Result<Value> {
let app_server = absolute_path(&args.app_server)?;
let codex_home = absolute_path(&args.codex_home)?;
let cwd = absolute_path(&args.cwd)?;
@ -199,6 +501,35 @@ fn run_status(args: &Args) -> Result<Value> {
.cloned()
.unwrap_or_else(|| json!(null));
let root = env::current_dir().context("failed to resolve current directory")?;
let native_aux = native_auxiliary_status(&root)?;
let status = json!({
"threadId": thread_id,
"read": read,
"view": view,
"scene": scene,
"pressure": pressure,
"reorient": reorient,
"jobs": jobs,
"roles": roles,
"planning": planning,
"roleResults": role_results,
"reorientResult": reorient_result,
"crrc": crrc,
"coordinator": coordinator,
"heartbeat": native_aux.heartbeat,
"face": native_aux.face,
"voidMemory": native_aux.void_memory,
});
Ok(sanitize_for_operator(status))
}
struct NativeAuxiliaryStatus {
heartbeat: Value,
face: Value,
void_memory: Value,
}
fn native_auxiliary_status(root: &Path) -> Result<NativeAuxiliaryStatus> {
let heartbeat_dir = root.join(".epiphany-heartbeats");
let face_dir = root.join(".epiphany-face");
let heartbeat = native_json(
@ -237,25 +568,56 @@ fn run_status(args: &Args) -> Result<Value> {
&["status", "--config", "state/void-memory.toml"],
)
.unwrap_or_else(|error| json!({"ok": false, "error": error.to_string()}));
let status = json!({
"threadId": thread_id,
"read": read,
"view": view,
"scene": scene,
"pressure": pressure,
"reorient": reorient,
"jobs": jobs,
"roles": roles,
"planning": planning,
"roleResults": role_results,
"reorientResult": reorient_result,
"crrc": crrc,
"coordinator": coordinator,
"heartbeat": heartbeat,
"face": face,
"voidMemory": void_memory,
});
Ok(sanitize_for_operator(status))
Ok(NativeAuxiliaryStatus {
heartbeat,
face,
void_memory,
})
}
fn native_role_result(binding_id: &str) -> Value {
json!({
"source": "native",
"status": "backendMissing",
"bindingId": binding_id,
"note": "Native status is provider-neutral and does not query model-worker runtime results yet.",
})
}
fn coordinator_status_json(status: &epiphany_core::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)
}
fn crrc_state_status_text(status: EpiphanyCrrcStateStatus) -> &'static str {
match status {
EpiphanyCrrcStateStatus::Missing => "missing",
EpiphanyCrrcStateStatus::Ready => "ready",
}
}
fn role_job_status(status: epiphany_core::EpiphanyJobStatus) -> EpiphanyRoleBoardJobStatus {
match status {
epiphany_core::EpiphanyJobStatus::Idle => EpiphanyRoleBoardJobStatus::Idle,
epiphany_core::EpiphanyJobStatus::Needed => EpiphanyRoleBoardJobStatus::Needed,
epiphany_core::EpiphanyJobStatus::Pending => EpiphanyRoleBoardJobStatus::Pending,
epiphany_core::EpiphanyJobStatus::Running => EpiphanyRoleBoardJobStatus::Running,
epiphany_core::EpiphanyJobStatus::Completed => EpiphanyRoleBoardJobStatus::Completed,
epiphany_core::EpiphanyJobStatus::Failed => EpiphanyRoleBoardJobStatus::Failed,
epiphany_core::EpiphanyJobStatus::Cancelled => EpiphanyRoleBoardJobStatus::Cancelled,
epiphany_core::EpiphanyJobStatus::Blocked => EpiphanyRoleBoardJobStatus::Blocked,
epiphany_core::EpiphanyJobStatus::Unavailable => EpiphanyRoleBoardJobStatus::Unavailable,
}
}
pub struct AppServerClient {
@ -807,6 +1169,16 @@ fn take_path(args: &mut impl Iterator<Item = String>, name: &str) -> Result<Path
Ok(PathBuf::from(take_string(args, name)?))
}
fn take_source(args: &mut impl Iterator<Item = String>, name: &str) -> Result<StatusSource> {
match take_string(args, name)?.as_str() {
"native" => Ok(StatusSource::Native),
"codex" => Ok(StatusSource::Codex),
other => Err(anyhow!(
"{name} must be 'native' or 'codex', received {other:?}"
)),
}
}
fn home_dir() -> PathBuf {
env::var_os("USERPROFILE")
.or_else(|| env::var_os("HOME"))

View file

@ -172,7 +172,8 @@ pub struct EpiphanyCoordinatorStatusInput {
pub reorient_finding_accepted: bool,
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanyCoordinatorStatus {
pub decision: EpiphanyCoordinatorDecision,
pub source_signals: EpiphanyCoordinatorSourceSignals,

View file

@ -1,13 +1,17 @@
use epiphany_state_model::EpiphanyPlanningState;
use epiphany_state_model::EpiphanyThreadState;
use serde::Deserialize;
use serde::Serialize;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EpiphanyPlanningStateStatus {
Missing,
Ready,
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanyPlanningSummary {
pub capture_count: u32,
pub pending_capture_count: u32,
@ -21,7 +25,8 @@ pub struct EpiphanyPlanningSummary {
pub note: String,
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanyPlanningView {
pub state_status: EpiphanyPlanningStateStatus,
pub state_revision: Option<u64>,

View file

@ -1,24 +1,29 @@
use epiphany_state_model::EpiphanyInvestigationDisposition;
use epiphany_state_model::EpiphanyRetrievalStatus;
use epiphany_state_model::EpiphanyThreadState;
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)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EpiphanySceneStateStatus {
Missing,
Ready,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EpiphanySceneSource {
Stored,
Live,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EpiphanySceneAction {
Index,
Retrieve,
@ -46,7 +51,8 @@ pub enum EpiphanySceneAction {
Update,
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanySceneSubgoal {
pub id: String,
pub title: String,
@ -55,13 +61,15 @@ pub struct EpiphanySceneSubgoal {
pub active: bool,
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[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)]
#[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,
@ -77,7 +85,8 @@ pub struct EpiphanySceneGraph {
pub checkpoint_summary: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanySceneRetrieval {
pub workspace_root: PathBuf,
pub status: EpiphanyRetrievalStatus,
@ -89,7 +98,8 @@ pub struct EpiphanySceneRetrieval {
pub dirty_path_count: u32,
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanySceneInvestigationCheckpoint {
pub checkpoint_id: String,
pub kind: String,
@ -103,13 +113,15 @@ pub struct EpiphanySceneInvestigationCheckpoint {
pub evidence_count: u32,
}
#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[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)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanySceneRecord {
pub id: String,
pub kind: String,
@ -118,7 +130,8 @@ pub struct EpiphanySceneRecord {
pub code_ref_count: u32,
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanySceneChurn {
pub understanding_status: String,
pub diff_pressure: String,
@ -127,7 +140,8 @@ pub struct EpiphanySceneChurn {
pub unexplained_writes: Option<u32>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanyScene {
pub state_status: EpiphanySceneStateStatus,
pub source: EpiphanySceneSource,

View file

@ -33,9 +33,10 @@ remembers doctrine; the branch remembers the blade.
## Current Orientation
- Do not copy exact branch or HEAD from this note. Run `git status --short --branch` and `git log --oneline -5`.
- The repo now has a one-command local operator path: `.\tools\epiphany_local_run.ps1`. Default mode is `smoke`; it builds the retained Codex app-server compatibility edge, builds native Epiphany operator binaries, runs the coordinator smoke, and writes launcher artifacts under `.epiphany-run/` plus coordinator artifacts under `.epiphany-dogfood/`. Use `-Mode status`, `-Mode plan`, or `-Mode run -MaxSteps 4` for the other current entrypoints; add `-ThreadId <id>` and `-Workspace <path>` to inspect or continue an existing thread. `status`, `plan`, and `smoke` do not spend model calls; `run` builds and uses `epiphany-openai-runtime`.
- The repo now has a one-command local operator path: `.\tools\epiphany_local_run.ps1`. Default mode is `smoke`; it builds the retained Codex app-server compatibility edge, builds native Epiphany operator binaries, runs the coordinator smoke, and writes launcher artifacts under `.epiphany-run/` plus coordinator artifacts under `.epiphany-dogfood/`. `-Mode status` is now Epiphany-native: it builds only Epiphany operator binaries, reads `state/thread-state.msgpack` when present, derives status through `epiphany-core`, and does not start or require `codex-app-server`. Use `-Mode plan` or `-Mode run -MaxSteps 4` for the bridge-equipped coordinator entrypoints; add `-ThreadId <id>` and `-Workspace <path>` to inspect or continue an existing thread. `status`, `plan`, and `smoke` do not spend model calls; `run` builds and uses `epiphany-openai-runtime`.
- Local operator runs now write typed CultMesh intent/receipt documents to `.epiphany-run/cultmesh/operator-runs.ccmp` through `epiphany-operator-run`. The wrapper writes intent before acting and a completion receipt after success; this is the local consent/trace rail, not a hidden scheduler queue.
- Status-mode local runs now also write a native CultMesh operator snapshot to `.epiphany-run/cultmesh/operator-snapshots.ccmp` through `epiphany-operator-snapshot`. That snapshot distills the operator-safe MVP status artifact into typed fields such as thread id, state status, coordinator action, CRRC action, reorient action, available actions, and artifact refs; it does not preserve the raw JSON status blob as internal state.
- `epiphany-mvp-status --source native` is the current provider-neutral status boundary. It projects scene, pressure, jobs, roles, planning, reorient, CRRC, and coordinator status from native core surfaces and returns provider/runtime worker results as `backendMissing` placeholders instead of asking Codex for model-worker state. Keep future pluggable model-provider work behind launch/result/runtime documents; do not let provider choice leak into status, prompt authority, scheduler policy, or durable `EpiphanyThreadState`.
- The active foundation directive is now `notes/codex-starvation-and-cultnet-liberation-plan.md`. The previous Codex app-server control-plane rebuild made Epiphany less rotten inside Codex, but that is not the destination. Epiphany must become a native CultCache/CultMesh/CultNet runtime while remaining an honest modified Codex-derived backend for subscription auth/model use. Codex should remain relatively vanilla and keep doing Codex things, including useful app-server and streaming bridge affordances, but it must not own Epiphany state, processes, prompts, scheduler decisions, or policy. The bridge handles interop; Codex and Epiphany do not get to rummage around in each other's organs.
- `notes/epiphany-cultmesh-dreaming-roadmap.md` is the new concrete design for distributed Epiphany dreaming. The invariant is hard: private state stays local; public dreams are separately authored typed documents distributed through CultMesh/CultNet; foreign dreams are thought weather until a reviewed local adoption receipt digests them. The first code slice should be dream schemas plus a local CultMesh-backed store, not public fanout.
- CultMesh is now the preferred Rust abstraction for that local store work. The compile-time Rust substrate is repo-contained: `vendor/cultcache-rs`, `vendor/cultnet-rs`, and `vendor/cultmesh-rs`. The old `E:\Projects\CultLib\crates\*` dependency body is dead in this checkout and must not be revived by accident. Vendored CultCache reads/writes `cultcache.store.v1`, so `state/ledgers.msgpack` and `epiphany-state status` are aligned again. The first integrations are deliberately small: status, Verse policy, global room policy, organ contract policy, native operator status, native operator snapshots, and local operator run intent/receipt round-trip through CultMesh. Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-cultmesh-smoke`, `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-cultmesh-status -- smoke --store .\.epiphany-smoke\cultmesh\operator-status.ccmp --runtime-id epiphany-cultmesh-status-smoke`, `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-operator-snapshot -- smoke --store .\.epiphany-smoke\cultmesh\operator-snapshots.ccmp --runtime-id epiphany-operator-snapshot-smoke --snapshot-id smoke-status`, and `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-operator-run -- smoke --store .\.epiphany-smoke\cultmesh\operator-runs.ccmp --runtime-id epiphany-operator-run-smoke --run-id smoke-run` for the focused proofs. Future local dream/status/Verse work should start from CultMesh, not raw CultNet, unless the task is polishing the CultMesh internals themselves. Preserve the three Verse tiers: `epiphany-internal` for private sub-agent typed state, `gamecult-local` for trusted LAN/Yggdrasil-tunnel GameCult sharing, and `epiphany-global` for untrusted public dreams plus topic-specific threaded public rooms for Face posts.

Binary file not shown.

View file

@ -495,4 +495,13 @@ current_status:
completion; `tools/epiphany_local_run.ps1 -Mode status` now writes intent,
legacy status artifact, operator snapshot, and completion receipt in that
order.
next_action: Continue Codex starvation and CultNet liberation by moving coordinator plan/run outputs into typed CultNet receipts and by reducing the local wrapper's dependence on Codex app-server JSON-RPC projections for facts Epiphany already owns natively.
The first native status cut is landed: `epiphany-mvp-status` has an
explicit `--source native` mode that reads `state/thread-state.msgpack`
when present and derives scene, pressure, jobs, roles, planning, reorient,
CRRC, and coordinator status through `epiphany-core` instead of Codex
JSON-RPC. `tools/epiphany_local_run.ps1 -Mode status` now builds only
Epiphany operator binaries, does not start or require `codex-app-server`,
and still writes operator intent, status artifact, snapshot, and completion
receipt. Codex status remains as a compatibility source for legacy smokes
and bridge-equipped coordinator paths, not the MVP status authority.
next_action: Continue Codex starvation and CultNet liberation by moving coordinator plan/run outputs into typed CultNet receipts and by defining a narrow provider/runtime boundary so future non-OpenAI providers can swap behind Epiphany-owned launch/result documents without touching status, scheduler, prompts, or durable state.

View file

@ -84,13 +84,15 @@ $operatorSnapshotStore = Join-Path $Root ".epiphany-run\cultmesh\operator-snapsh
$operatorSnapshotId = "$runId-status"
if (-not $SkipBuild) {
Invoke-Checked `
-Label "build Codex app-server compatibility organ" `
-FilePath "cargo" `
-Arguments @("build", "-p", "codex-app-server", "--manifest-path", ".\vendor\codex\codex-rs\Cargo.toml") `
-WorkingDirectory $Root `
-StdoutPath (Join-Path $artifactRoot "build-codex-app-server.stdout.log") `
-StderrPath (Join-Path $artifactRoot "build-codex-app-server.stderr.log")
if ($Mode -ne "status") {
Invoke-Checked `
-Label "build Codex app-server compatibility organ" `
-FilePath "cargo" `
-Arguments @("build", "-p", "codex-app-server", "--manifest-path", ".\vendor\codex\codex-rs\Cargo.toml") `
-WorkingDirectory $Root `
-StdoutPath (Join-Path $artifactRoot "build-codex-app-server.stdout.log") `
-StderrPath (Join-Path $artifactRoot "build-codex-app-server.stderr.log")
}
Invoke-Checked `
-Label "build Epiphany operator binaries" `
@ -105,7 +107,8 @@ if (-not $SkipBuild) {
"--bin", "epiphany-mvp-coordinator-smoke",
"--bin", "epiphany-heartbeat-store",
"--bin", "epiphany-face-discord",
"--bin", "epiphany-agent-telemetry"
"--bin", "epiphany-agent-telemetry",
"--bin", "epiphany-void-memory"
) `
-WorkingDirectory $Root `
-StdoutPath (Join-Path $artifactRoot "build-epiphany-core.stdout.log") `
@ -122,7 +125,11 @@ if (-not $SkipBuild) {
}
}
foreach ($required in @($codexAppServer, $statusExe, $operatorRunExe, $operatorSnapshotExe, $coordinatorExe)) {
$requiredBinaries = @($statusExe, $operatorRunExe, $operatorSnapshotExe)
if ($Mode -ne "status") {
$requiredBinaries += @($codexAppServer, $coordinatorExe)
}
foreach ($required in $requiredBinaries) {
if (-not (Test-Path -LiteralPath $required)) {
throw "required binary not found: $required"
}
@ -169,17 +176,14 @@ if ($Mode -eq "status") {
$statusJson = Join-Path $artifactRoot "status.json"
$resultPath = $statusJson
$statusArgs = @(
"--app-server", $codexAppServer,
"--codex-home", $CodexHome,
"--source", "native",
"--cwd", $Workspace,
$ephemeralArg,
"--thread-state-store", (Join-Path $Root "state\thread-state.msgpack"),
"--json",
"--result", $statusJson,
"--transcript", (Join-Path $artifactRoot "status-transcript.jsonl"),
"--stderr", (Join-Path $artifactRoot "status-app-server.stderr.log")
"--result", $statusJson
)
if ($ThreadId -ne "") {
$statusArgs += @("--thread-id", $ThreadId, "--no-ephemeral")
$statusArgs += @("--thread-id", $ThreadId)
}
Invoke-Checked `
-Label "run operator status" `
@ -297,10 +301,10 @@ $summary = @"
- coordinatorBinary: $coordinatorExe
- openaiRuntimeBinary: $openaiRuntimeExe
This is an operator entrypoint over the current compatibility shell. Codex
app-server remains the JSON-RPC edge for now; Epiphany state, heartbeat, role
memory, runtime-spine, operator snapshots, and artifacts remain typed native
surfaces behind it.
This is an operator entrypoint over the current MVP shell. Status mode is
Epiphany-native and does not start Codex app-server; coordinator plan/smoke/run
modes still use the sealed Codex compatibility bridge until their provider
boundary is cut.
"@
Set-Content -LiteralPath (Join-Path $artifactRoot "README.md") -Value $summary -Encoding UTF8