From b5992869498d98a4ed8cc3953dc54eabe6dcfa80 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 18 May 2026 00:30:16 +0100 Subject: [PATCH] Split heartbeat document surface --- epiphany-core/src/heartbeat_state.rs | 279 +---------------- .../heartbeat_state/heartbeat_documents.rs | 280 ++++++++++++++++++ notes/fresh-workspace-handoff.md | 1 + state/ledgers.msgpack | Bin 126251 -> 126601 bytes state/map.yaml | 10 +- 5 files changed, 288 insertions(+), 282 deletions(-) create mode 100644 epiphany-core/src/heartbeat_state/heartbeat_documents.rs diff --git a/epiphany-core/src/heartbeat_state.rs b/epiphany-core/src/heartbeat_state.rs index 6de7f897..166fe9cf 100644 --- a/epiphany-core/src/heartbeat_state.rs +++ b/epiphany-core/src/heartbeat_state.rs @@ -3,10 +3,7 @@ use anyhow::Result; use anyhow::anyhow; use chrono::Duration; use cultcache_rs::CultCache; -use cultcache_rs::DatabaseEntry; use cultcache_rs::SingleFileMessagePackBackingStore; -use serde::Deserialize; -use serde::Serialize; use serde_json::Value; use std::cmp::Reverse; use std::collections::BTreeMap; @@ -14,15 +11,8 @@ use std::collections::BTreeSet; use std::fs; use std::path::Path; -pub const HEARTBEAT_STATE_TYPE: &str = "epiphany.agent_heartbeat"; -pub const HEARTBEAT_STATE_KEY: &str = "default"; -pub const HEARTBEAT_STATE_SCHEMA_VERSION: &str = "epiphany.agent_heartbeat.v0"; -pub const HEARTBEAT_COGNITION_TYPE: &str = "epiphany.agent_heartbeat_cognition"; -pub const HEARTBEAT_COGNITION_KEY: &str = "default"; -pub const HEARTBEAT_COGNITION_SCHEMA_VERSION: &str = "epiphany.agent_heartbeat_cognition.v0"; -pub const HEARTBEAT_STATUS_SCHEMA_VERSION: &str = "epiphany.agent_heartbeat_status.v0"; -pub const INITIATIVE_SCHEMA_VERSION: &str = "ghostlight.initiative_schedule.v0"; -pub const VOID_ROUTINE_SCHEMA_VERSION: &str = "epiphany.void_routine.v0"; +mod heartbeat_documents; +pub use heartbeat_documents::*; const HEARTBEAT_ARENA_MAINTENANCE: &str = "maintenance"; const HEARTBEAT_ARENA_SCENE: &str = "scene"; @@ -40,271 +30,6 @@ const ROLE_ORDER: &[&str] = &[ "reorientation", ]; -#[derive(Clone, Debug, PartialEq, DatabaseEntry)] -#[cultcache( - type = "epiphany.agent_heartbeat", - schema = "EpiphanyHeartbeatStateEntry" -)] -pub struct EpiphanyHeartbeatStateEntry { - #[cultcache(key = 0)] - pub schema_version: String, - #[cultcache(key = 1)] - pub target_heartbeat_rate: f64, - #[cultcache(key = 2)] - pub scene_clock: f64, - #[cultcache(key = 3)] - pub selection_policy: HeartbeatSelectionPolicy, - #[cultcache(key = 4)] - pub pacing_policy: HeartbeatPacingPolicy, - #[cultcache(key = 5)] - pub participants: Vec, - #[cultcache(key = 6)] - pub history: Vec, - #[cultcache(key = 15, default)] - pub extra: BTreeMap, -} - -#[derive(Clone, Debug, PartialEq, DatabaseEntry)] -#[cultcache( - type = "epiphany.agent_heartbeat_cognition", - schema = "EpiphanyHeartbeatCognitionEntry" -)] -pub struct EpiphanyHeartbeatCognitionEntry { - #[cultcache(key = 0)] - pub schema_version: String, - #[cultcache(key = 1)] - pub updated_at: String, - #[cultcache(key = 2, default)] - pub latest_run_id: Option, - #[cultcache(key = 3, default)] - pub latest_artifact_ref: Option, - #[cultcache(key = 4, default)] - pub source: Option, - #[cultcache(key = 5, default)] - pub sleep_cycle: Option, - #[cultcache(key = 6, default)] - pub memory_resonance: Option, - #[cultcache(key = 7, default)] - pub incubation: Option, - #[cultcache(key = 8, default)] - pub thought_lanes: Option, - #[cultcache(key = 9, default)] - pub bridge: Option, - #[cultcache(key = 10, default)] - pub candidate_interventions: Option, - #[cultcache(key = 11, default)] - pub appraisals: Option, - #[cultcache(key = 12, default)] - pub reactions: Option, - #[cultcache(key = 13, default)] - pub extra: BTreeMap, -} - -#[derive(Clone, Debug, PartialEq, DatabaseEntry)] -#[cultcache( - type = "epiphany.agent_heartbeat", - schema = "EpiphanyHeartbeatStateEntry" -)] -struct LegacyHeartbeatStateWithCognition { - #[cultcache(key = 0)] - schema_version: String, - #[cultcache(key = 1)] - target_heartbeat_rate: f64, - #[cultcache(key = 2)] - scene_clock: f64, - #[cultcache(key = 3)] - selection_policy: HeartbeatSelectionPolicy, - #[cultcache(key = 4)] - pacing_policy: HeartbeatPacingPolicy, - #[cultcache(key = 5)] - participants: Vec, - #[cultcache(key = 6)] - history: Vec, - #[cultcache(key = 7, default)] - sleep_cycle: Option, - #[cultcache(key = 8, default)] - memory_resonance: Option, - #[cultcache(key = 9, default)] - incubation: Option, - #[cultcache(key = 10, default)] - thought_lanes: Option, - #[cultcache(key = 11, default)] - bridge: Option, - #[cultcache(key = 12, default)] - candidate_interventions: Option, - #[cultcache(key = 13, default)] - appraisals: Option, - #[cultcache(key = 14, default)] - reactions: Option, - #[cultcache(key = 15, default)] - extra: BTreeMap, -} - -#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] -pub struct HeartbeatSelectionPolicy { - pub mode: String, - pub reaction_precedence: bool, - pub minimum_speed: f64, - pub tie_breakers: Vec, - #[serde(flatten)] - pub extra: BTreeMap, -} - -#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] -pub struct HeartbeatPacingPolicy { - pub cooldown_starts_after_turn_completion: bool, - pub work_base_recovery: f64, - pub idle_base_recovery: f64, - pub sleep_heartbeat_rate_multiplier: f64, - pub minimum_effective_rate: f64, - #[serde(flatten)] - pub extra: BTreeMap, -} - -#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] -pub struct HeartbeatParticipant { - pub agent_id: String, - pub role_id: String, - pub display_name: String, - #[serde(default)] - pub arena: String, - #[serde(default)] - pub participant_kind: String, - pub initiative_speed: f64, - pub next_ready_at: f64, - pub reaction_bias: f64, - pub interrupt_threshold: f64, - pub current_load: f64, - pub status: String, - pub constraints: Vec, - pub last_action_id: Option, - pub last_woke_at: Option, - pub last_finished_at: Option, - pub pending_turn: Option, - #[serde(flatten)] - pub extra: BTreeMap, -} - -#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] -pub struct HeartbeatPendingTurn { - pub status: String, - #[serde(rename = "scheduleId")] - pub schedule_id: String, - #[serde(rename = "actionId")] - pub action_id: String, - #[serde(rename = "actionType")] - pub action_type: String, - #[serde(rename = "actionScale", default)] - pub action_scale: String, - #[serde(rename = "localAffordanceBasis", default)] - pub local_affordance_basis: Vec, - #[serde(rename = "startedAt")] - pub started_at: String, - #[serde(rename = "startedSceneClock")] - pub started_scene_clock: f64, - #[serde(rename = "baseRecovery")] - pub base_recovery: f64, - pub recovery: f64, - #[serde(rename = "cooldownPolicy")] - pub cooldown_policy: String, - #[serde(rename = "completedAt", default)] - pub completed_at: Option, - #[serde(rename = "completedSceneClock", default)] - pub completed_scene_clock: Option, - #[serde(rename = "nextReadyAt", default)] - pub next_ready_at: Option, - #[serde(flatten)] - pub extra: BTreeMap, -} - -#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] -pub struct HeartbeatHistoryEvent { - pub ts: String, - #[serde(rename = "scheduleId")] - pub schedule_id: String, - #[serde(rename = "selectedRole")] - pub selected_role: String, - #[serde(rename = "selectedAgentId")] - pub selected_agent_id: String, - #[serde(rename = "actionId")] - pub action_id: String, - #[serde(rename = "actionType")] - pub action_type: String, - #[serde(default)] - pub arena: String, - #[serde(rename = "participantKind", default)] - pub participant_kind: String, - #[serde(rename = "actionScale", default)] - pub action_scale: String, - #[serde(rename = "coordinatorAction", default)] - pub coordinator_action: Option, - #[serde(rename = "targetRole", default)] - pub target_role: Option, - #[serde(rename = "workRole", default)] - pub work_role: Option, - #[serde(rename = "sceneClock", default)] - pub scene_clock: Option, - #[serde(rename = "nextReadyAt", default)] - pub next_ready_at: Option, - #[serde(rename = "turnStatus", default)] - pub turn_status: Option, - #[serde(rename = "cooldownStartedAfterCompletion", default)] - pub cooldown_started_after_completion: Option, - #[serde(flatten)] - pub extra: BTreeMap, -} - -#[derive(Clone, Debug, PartialEq)] -pub struct HeartbeatTickOptions { - pub target_heartbeat_rate: f64, - pub coordinator_action: Option, - pub target_role: Option, - pub urgency: f64, - pub schedule_id: String, - pub source_scene_ref: String, - pub defer_completion: bool, - pub agent_store: Option, -} - -#[derive(Clone, Debug, PartialEq)] -pub struct HeartbeatPumpOptions { - pub base_heartbeat_rate: f64, - pub min_heartbeat_rate: f64, - pub max_heartbeat_rate: f64, - pub min_concurrency: usize, - pub max_concurrency: usize, - pub max_ticks: usize, - pub external_urgency: f64, - pub coordinator_action: Option, - pub target_role: Option, - pub schedule_id: String, - pub source_scene_ref: String, - pub agent_store: Option, -} - -#[derive(Clone, Debug, PartialEq)] -pub struct HeartbeatCompleteOptions { - pub role: String, - pub action_id: Option, -} - -#[derive(Clone, Debug, PartialEq)] -pub struct VoidRoutineOptions { - pub agent_store: Option, - pub source: String, - pub allow_dream: bool, -} - -#[derive(Clone, Debug, PartialEq)] -pub struct GhostlightSceneParticipantSeed { - pub agent_id: String, - pub display_name: String, - pub initiative_speed: f64, - pub reaction_bias: f64, - pub interrupt_threshold: f64, - pub constraints: Vec, -} - #[derive(Clone, Debug, PartialEq)] struct HeartbeatAction { action_id: String, diff --git a/epiphany-core/src/heartbeat_state/heartbeat_documents.rs b/epiphany-core/src/heartbeat_state/heartbeat_documents.rs new file mode 100644 index 00000000..4187e84a --- /dev/null +++ b/epiphany-core/src/heartbeat_state/heartbeat_documents.rs @@ -0,0 +1,280 @@ +use cultcache_rs::DatabaseEntry; +use serde::Deserialize; +use serde::Serialize; +use serde_json::Value; +use std::collections::BTreeMap; + +pub const HEARTBEAT_STATE_TYPE: &str = "epiphany.agent_heartbeat"; +pub const HEARTBEAT_STATE_KEY: &str = "default"; +pub const HEARTBEAT_STATE_SCHEMA_VERSION: &str = "epiphany.agent_heartbeat.v0"; +pub const HEARTBEAT_COGNITION_TYPE: &str = "epiphany.agent_heartbeat_cognition"; +pub const HEARTBEAT_COGNITION_KEY: &str = "default"; +pub const HEARTBEAT_COGNITION_SCHEMA_VERSION: &str = "epiphany.agent_heartbeat_cognition.v0"; +pub const HEARTBEAT_STATUS_SCHEMA_VERSION: &str = "epiphany.agent_heartbeat_status.v0"; +pub const INITIATIVE_SCHEMA_VERSION: &str = "ghostlight.initiative_schedule.v0"; +pub const VOID_ROUTINE_SCHEMA_VERSION: &str = "epiphany.void_routine.v0"; + +#[derive(Clone, Debug, PartialEq, DatabaseEntry)] +#[cultcache( + type = "epiphany.agent_heartbeat", + schema = "EpiphanyHeartbeatStateEntry" +)] +pub struct EpiphanyHeartbeatStateEntry { + #[cultcache(key = 0)] + pub schema_version: String, + #[cultcache(key = 1)] + pub target_heartbeat_rate: f64, + #[cultcache(key = 2)] + pub scene_clock: f64, + #[cultcache(key = 3)] + pub selection_policy: HeartbeatSelectionPolicy, + #[cultcache(key = 4)] + pub pacing_policy: HeartbeatPacingPolicy, + #[cultcache(key = 5)] + pub participants: Vec, + #[cultcache(key = 6)] + pub history: Vec, + #[cultcache(key = 15, default)] + pub extra: BTreeMap, +} + +#[derive(Clone, Debug, PartialEq, DatabaseEntry)] +#[cultcache( + type = "epiphany.agent_heartbeat_cognition", + schema = "EpiphanyHeartbeatCognitionEntry" +)] +pub struct EpiphanyHeartbeatCognitionEntry { + #[cultcache(key = 0)] + pub schema_version: String, + #[cultcache(key = 1)] + pub updated_at: String, + #[cultcache(key = 2, default)] + pub latest_run_id: Option, + #[cultcache(key = 3, default)] + pub latest_artifact_ref: Option, + #[cultcache(key = 4, default)] + pub source: Option, + #[cultcache(key = 5, default)] + pub sleep_cycle: Option, + #[cultcache(key = 6, default)] + pub memory_resonance: Option, + #[cultcache(key = 7, default)] + pub incubation: Option, + #[cultcache(key = 8, default)] + pub thought_lanes: Option, + #[cultcache(key = 9, default)] + pub bridge: Option, + #[cultcache(key = 10, default)] + pub candidate_interventions: Option, + #[cultcache(key = 11, default)] + pub appraisals: Option, + #[cultcache(key = 12, default)] + pub reactions: Option, + #[cultcache(key = 13, default)] + pub extra: BTreeMap, +} + +#[derive(Clone, Debug, PartialEq, DatabaseEntry)] +#[cultcache( + type = "epiphany.agent_heartbeat", + schema = "EpiphanyHeartbeatStateEntry" +)] +pub(super) struct LegacyHeartbeatStateWithCognition { + #[cultcache(key = 0)] + pub(super) schema_version: String, + #[cultcache(key = 1)] + pub(super) target_heartbeat_rate: f64, + #[cultcache(key = 2)] + pub(super) scene_clock: f64, + #[cultcache(key = 3)] + pub(super) selection_policy: HeartbeatSelectionPolicy, + #[cultcache(key = 4)] + pub(super) pacing_policy: HeartbeatPacingPolicy, + #[cultcache(key = 5)] + pub(super) participants: Vec, + #[cultcache(key = 6)] + pub(super) history: Vec, + #[cultcache(key = 7, default)] + pub(super) sleep_cycle: Option, + #[cultcache(key = 8, default)] + pub(super) memory_resonance: Option, + #[cultcache(key = 9, default)] + pub(super) incubation: Option, + #[cultcache(key = 10, default)] + pub(super) thought_lanes: Option, + #[cultcache(key = 11, default)] + pub(super) bridge: Option, + #[cultcache(key = 12, default)] + pub(super) candidate_interventions: Option, + #[cultcache(key = 13, default)] + pub(super) appraisals: Option, + #[cultcache(key = 14, default)] + pub(super) reactions: Option, + #[cultcache(key = 15, default)] + pub(super) extra: BTreeMap, +} + +#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] +pub struct HeartbeatSelectionPolicy { + pub mode: String, + pub reaction_precedence: bool, + pub minimum_speed: f64, + pub tie_breakers: Vec, + #[serde(flatten)] + pub extra: BTreeMap, +} + +#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] +pub struct HeartbeatPacingPolicy { + pub cooldown_starts_after_turn_completion: bool, + pub work_base_recovery: f64, + pub idle_base_recovery: f64, + pub sleep_heartbeat_rate_multiplier: f64, + pub minimum_effective_rate: f64, + #[serde(flatten)] + pub extra: BTreeMap, +} + +#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] +pub struct HeartbeatParticipant { + pub agent_id: String, + pub role_id: String, + pub display_name: String, + #[serde(default)] + pub arena: String, + #[serde(default)] + pub participant_kind: String, + pub initiative_speed: f64, + pub next_ready_at: f64, + pub reaction_bias: f64, + pub interrupt_threshold: f64, + pub current_load: f64, + pub status: String, + pub constraints: Vec, + pub last_action_id: Option, + pub last_woke_at: Option, + pub last_finished_at: Option, + pub pending_turn: Option, + #[serde(flatten)] + pub extra: BTreeMap, +} + +#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] +pub struct HeartbeatPendingTurn { + pub status: String, + #[serde(rename = "scheduleId")] + pub schedule_id: String, + #[serde(rename = "actionId")] + pub action_id: String, + #[serde(rename = "actionType")] + pub action_type: String, + #[serde(rename = "actionScale", default)] + pub action_scale: String, + #[serde(rename = "localAffordanceBasis", default)] + pub local_affordance_basis: Vec, + #[serde(rename = "startedAt")] + pub started_at: String, + #[serde(rename = "startedSceneClock")] + pub started_scene_clock: f64, + #[serde(rename = "baseRecovery")] + pub base_recovery: f64, + pub recovery: f64, + #[serde(rename = "cooldownPolicy")] + pub cooldown_policy: String, + #[serde(rename = "completedAt", default)] + pub completed_at: Option, + #[serde(rename = "completedSceneClock", default)] + pub completed_scene_clock: Option, + #[serde(rename = "nextReadyAt", default)] + pub next_ready_at: Option, + #[serde(flatten)] + pub extra: BTreeMap, +} + +#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] +pub struct HeartbeatHistoryEvent { + pub ts: String, + #[serde(rename = "scheduleId")] + pub schedule_id: String, + #[serde(rename = "selectedRole")] + pub selected_role: String, + #[serde(rename = "selectedAgentId")] + pub selected_agent_id: String, + #[serde(rename = "actionId")] + pub action_id: String, + #[serde(rename = "actionType")] + pub action_type: String, + #[serde(default)] + pub arena: String, + #[serde(rename = "participantKind", default)] + pub participant_kind: String, + #[serde(rename = "actionScale", default)] + pub action_scale: String, + #[serde(rename = "coordinatorAction", default)] + pub coordinator_action: Option, + #[serde(rename = "targetRole", default)] + pub target_role: Option, + #[serde(rename = "workRole", default)] + pub work_role: Option, + #[serde(rename = "sceneClock", default)] + pub scene_clock: Option, + #[serde(rename = "nextReadyAt", default)] + pub next_ready_at: Option, + #[serde(rename = "turnStatus", default)] + pub turn_status: Option, + #[serde(rename = "cooldownStartedAfterCompletion", default)] + pub cooldown_started_after_completion: Option, + #[serde(flatten)] + pub extra: BTreeMap, +} + +#[derive(Clone, Debug, PartialEq)] +pub struct HeartbeatTickOptions { + pub target_heartbeat_rate: f64, + pub coordinator_action: Option, + pub target_role: Option, + pub urgency: f64, + pub schedule_id: String, + pub source_scene_ref: String, + pub defer_completion: bool, + pub agent_store: Option, +} + +#[derive(Clone, Debug, PartialEq)] +pub struct HeartbeatPumpOptions { + pub base_heartbeat_rate: f64, + pub min_heartbeat_rate: f64, + pub max_heartbeat_rate: f64, + pub min_concurrency: usize, + pub max_concurrency: usize, + pub max_ticks: usize, + pub external_urgency: f64, + pub coordinator_action: Option, + pub target_role: Option, + pub schedule_id: String, + pub source_scene_ref: String, + pub agent_store: Option, +} + +#[derive(Clone, Debug, PartialEq)] +pub struct HeartbeatCompleteOptions { + pub role: String, + pub action_id: Option, +} + +#[derive(Clone, Debug, PartialEq)] +pub struct VoidRoutineOptions { + pub agent_store: Option, + pub source: String, + pub allow_dream: bool, +} + +#[derive(Clone, Debug, PartialEq)] +pub struct GhostlightSceneParticipantSeed { + pub agent_id: String, + pub display_name: String, + pub initiative_speed: f64, + pub reaction_bias: f64, + pub interrupt_threshold: f64, + pub constraints: Vec, +} diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 6df61963..a6060b2f 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -58,6 +58,7 @@ remembers doctrine; the branch remembers the blade. - Thread start route handling and its async lifecycle task now live in `codex_message_processor/thread_start_routes.rs`; root no longer owns `thread_start_task`. - Thread config helpers now live in `codex_message_processor/thread_config.rs`: instruction-source loading, thread config override construction, config-load error shaping, and dynamic-tool validation. The pure dynamic-tool validation contract has module-local unit tests. - Turn control routes now live in `codex_message_processor/turn_routes.rs`: turn start, thread item injection, app-server client info setting, turn steer, turn interrupt, mode normalization, and input-limit validation with module-local unit tests. +- Heartbeat durable document/schema types now live in `epiphany-core/src/heartbeat_state/heartbeat_documents.rs`; the root `heartbeat_state.rs` keeps store access, scheduling, status rendering, and Void cognition orchestration for the next cuts. Focused heartbeat tests and `epiphany-core` check pass after the split. - Thread projection now lives in `codex_message_processor/thread_projection.rs`: state-db/thread-store/rollout summary projection, `ConversationSummary` to API `Thread` mapping, thread-title attachment helpers, turn pagination, and rollout turn reconstruction. `codex_message_processor.rs` is about 1,009 lines after this extraction and mostly owns JSON-RPC dispatch, processor construction, shared thread lookup/submit/error helpers, and lifecycle shutdown. - Turn paging/reconstruction now lives in `codex_message_processor/thread_turn_projection.rs`; `thread_projection.rs` keeps state-db/thread-store/rollout summary projection and `ConversationSummary` to API `Thread` mapping. Focused `thread_turns_list` cursor tests and stale in-progress turn interruption coverage pass. - The `thread/turns/list` route handler now lives in `codex_message_processor/thread_turn_routes.rs`, beside the turn projection helpers it consumes. `thread_read_routes.rs` is back to persisted/live thread listing, `thread/read`, loaded-thread listing, and summary reads. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index a9000abb42956c39ee348ce3513bc1006006a8a7..0d55c1f69096189a9fa86511e15df9fc540b6065 100644 GIT binary patch delta 289 zcmZ2|i@ozM`vhgCcm5kyr!g{yHSb~EzK4-9^7Zr%cSgSH3!X5tG8r387reu$qj!r@ z$|E(gs3a*hu|y%Iv?wttCsiROKe;qFHLpY=F)u}-I5{IVH&LOavLLm1x`RHWczsc- zesNK` or `` prompt compatibility, memory usage classification, snapshot normalization, or cleanup paths. Remaining product-shaped skill residue is also cut from memory templates, app-server docs/tests/warnings, TUI tooltips/placeholders/warnings/comments, app-server v1 docs, agent-tool schema text, stale `UserInput::Skill` test arms, and obsolete feature flags/schema entries. App-instruction prompt compatibility is cut too: no `APPS_INSTRUCTIONS` protocol constants, no `` snapshot canonicalization, and MCP fixture tests now use neutral `demo_mcp` / `calendar_mcp` names instead of `codex_apps` / `/api/codex/apps` branding. The TUI app connector product path is also deleted: no `/apps` slash command, app-link view, connector AppEvent variants, app connector cache/popup/refresh loop, app mention insertion, `app://` mention codec support, stale app-popup tests, or TUI browser-opening shim remains. The `app/list` route and `app/list/updated` notification are gone from app-server protocol, generated schemas, app-server dispatch, test helpers, and docs; `AppInfo`/app-list metadata schema structs are deleted; the orphaned `codex-connectors` crate and `core::connectors` shim are deleted from the workspace; Codex app analytics no longer tracks `codex_app_mentioned` / `codex_app_used` facts, events, reducer arms, client APIs, or dedupe cache state; `[apps.*]`, `Feature::Apps`, `include_apps_instructions`, app config/read schemas, app managed requirements, app prompt tests, and app file-MCP tests are gone; `Feature::Plugins`, `Feature::RemotePlugin`, `plugin://` structured mentions, plugin instruction tags, and stale plugin popup snapshots are gone too; `[plugins]` / `[marketplaces]`, `PluginConfig`, `MarketplaceConfig`, marketplace edit helpers, stale plugin/external-agent README route claims, and generated schema entries are removed from config; and the bundled `codex-skills` sample-skill crate plus embedded imagegen/openai-docs/plugin-creator/skill-creator/skill-installer payloads are deleted from the workspace. The vendored `vendor/codex/sdk` subtree is deleted as non-spine app-server client/release scaffolding, including stale generated Python SDK route types for removed product surfaces; the root pnpm workspace no longer lists `sdk/typescript`. Live MCP tool approval is named `McpToolApproval`, not `AppToolApproval`, and remains under MCP server config; live structured user-input mentions are MCP-shaped only. `codex_message_processor.rs` is about 1,009 lines after route/lifecycle/projection/resume-helper/config-helper extraction; root `message_processor.rs` is about 1,292 lines after the external-agent/config-product cuts; `epiphany_read_routes.rs` is about 579 lines after the full view and read-response extractions; `epiphany_mutation_routes.rs` is about 694 lines after route-load/notification helper cuts and product-surface starvation; the old vendored `epiphany_state_helpers.rs` rollout-state loader is deleted and its remaining function lives in `epiphany-codex-bridge::state`; and `codex_thread.rs` is about 1,425 lines after state-update law moved native. `epiphany-openai-adapter` defines CultCache `DatabaseEntry` request/event/receipt/auth-status documents with no Codex app-server or generic JSON dependency. `epiphany-openai-codex-spine` owns the native OpenAI model transport path: it exposes `default_codex_home` and `auth_manager`, projects `epiphany-openai-auth-spine` `AuthManager` / `CodexAuth` into typed `EpiphanyOpenAiAdapterStatus`, builds a local serializable OpenAI Responses request body instead of Codex protocol request/item/config types, opens HTTP Responses streams through `codex-client`, parses Responses SSE frames into typed stream events and receipts, and no longer directly or transitively depends on Codex's Responses client, model-provider stack, `codex-protocol`, `codex-api`, `codex-model-provider`, or `codex-model-provider-info`; it intentionally reaches retained vendored `codex-login` only through `epiphany-openai-auth-spine`. Auth identity, credential storage, and ChatGPT token refresh remain owned by the Codex-compatible auth organ; external bearer command auth and agent identity remain retained Codex auth capabilities to expose only if a typed Epiphany surface needs them. `epiphany-openai-runtime` no longer depends directly on `codex-login`; it writes OpenAI status/request/stream-event/receipt records plus runtime sessions/jobs/results/events into `epiphany-core::runtime_spine_cache`, can emit the assistant text artifact for legacy result consumers, is now the default executor for startup-only repo birth specialists, and now has `run-worker` to load a durable `EpiphanyRuntimeWorkerLaunchRequest`, call the typed OpenAI runtime through the spine, persist typed `EpiphanyRuntimeRoleWorkerResult` / `EpiphanyRuntimeReorientWorkerResult` documents, and complete the original heartbeat/specialist runtime job without Codex worker execution; `codex exec` survives only as explicit fallback in repo-birth startup. `epiphany-mvp-coordinator` now invokes `epiphany-openai-runtime run-worker` for launched runtime job ids and no longer creates a second coordinator-owned shadow runtime job/result as a compensator. `epiphany-core::plan_runtime_spine_heartbeat_launch` validates launch contracts/conflicts and projects durable job bindings/runtime links; `epiphany-core::open_runtime_spine_heartbeat_job` owns the initialize-runtime/ensure-session/create-job sequence and now persists `EpiphanyRuntimeWorkerLaunchRequest` CultCache records keyed by runtime job id, with indexed kind/contract fields plus MessagePack-encoded typed launch documents instead of discarding work intent after queue receipt creation; `roleResult` and `reorientResult` now require typed worker result documents; generic job summaries are lifecycle receipts, not reviewable findings; `epiphany-core::EpiphanyStateUpdate`, `epiphany_state_update_validation_errors`, and `apply_epiphany_state_update` own state-update document shape and mutation law while `codex-core` calls them for compatibility. Vendored `CodexThread::epiphany_launch_job` is now mostly revision check, persistence validation, launch request handoff, and rollout/session writeback for the compatibility route. Vendored `codex-core` no longer has `epiphany_distillation`, `epiphany_promotion`, `epiphany_proposal`, or `epiphany_retrieval` husk modules; it re-exports native surfaces from `epiphany-core` directly, and now owns only the real Codex rollout adapter because it is a host seam. `epiphany-runtime-spine` advertises OpenAI adapter status/model-request/stream-event/receipt CultNet schemas and mutation contracts, so the native caller now has a real storage route instead of only JSON-RPC. MCP itself is correctly JSON at its protocol edge; the target is typed Epiphany intent/result/receipt wrappers around MCP, not replacing MCP JSON. The current OpenAI request path no longer pulls `codex-api`; `codex-login` remains deliberately sealed behind `epiphany-openai-auth-spine`, and the next spine decision is another Epiphany-in-vendor evacuation surface unless a concrete typed auth-status/runtime need requires exposing external bearer or agent-identity auth. latest_cut: > - Role-result self-persistence stopped exporting the raw JSON reviewer and - live role-result policy no longer manufactures `serde_json::Value::Null` - to validate typed worker results. Runtime role results keep statePatch and - selfPatch as typed documents; JSON remains only in test fixtures and edge - ingress compatibility. + Heartbeat durable document/schema types were split into + `heartbeat_state/heartbeat_documents.rs`, leaving root `heartbeat_state.rs` + as the remaining store/scheduling/status/cognition orchestration organ. + Focused heartbeat tests and `epiphany-core` check pass. next_action: Continue the Codex starvation campaign at the next Epiphany-in-vendor evacuation surface; keep vendored Codex code as host routing/lifecycle glue only, preserve retained `codex-login` auth ownership, and prefer cuts that expose testable ownership boundaries over line-count theater.