From c914f69675be394c01d3bc1ece3150ad98740614 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 19 May 2026 11:36:36 +0100 Subject: [PATCH] Type heartbeat memory resonance --- epiphany-core/src/heartbeat_state.rs | 126 +++++++----------- .../heartbeat_state/heartbeat_documents.rs | 33 ++++- .../src/heartbeat_state/heartbeat_store.rs | 12 +- .../src/memory_graph/profiles/heartbeat.rs | 57 ++++---- notes/fresh-workspace-handoff.md | 8 +- state/ledgers.msgpack | Bin 129280 -> 129609 bytes state/map.yaml | 18 ++- 7 files changed, 136 insertions(+), 118 deletions(-) diff --git a/epiphany-core/src/heartbeat_state.rs b/epiphany-core/src/heartbeat_state.rs index 4ab33c20..54a08a0f 100644 --- a/epiphany-core/src/heartbeat_state.rs +++ b/epiphany-core/src/heartbeat_state.rs @@ -122,7 +122,7 @@ pub fn run_void_routine_store( "agentStore": options.agent_store, "updatedAt": now_iso(), "sleepCycle": sleep_cycle, - "memoryResonance": resonance, + "memoryResonance": &resonance, "incubation": incubation, "thoughtLanes": thought_lanes, "bridge": bridge, @@ -1424,7 +1424,7 @@ fn apply_mood_timing_from_appraisals(state: &mut EpiphanyHeartbeatStateEntry, ap } } -fn build_memory_resonance(records: &[RoleMemoryRecord]) -> Value { +fn build_memory_resonance(records: &[RoleMemoryRecord]) -> HeartbeatMemoryResonance { let mut pairs = Vec::new(); for (left_index, left) in records.iter().enumerate() { for right in records.iter().skip(left_index + 1) { @@ -1442,44 +1442,39 @@ fn build_memory_resonance(records: &[RoleMemoryRecord]) -> Value { if strength < 0.08 { continue; } - pairs.push(serde_json::json!({ - "leftRole": left.role_id, - "leftMemoryId": left.memory_id, - "leftMemoryKind": left.memory_kind, - "leftSummary": left.summary, - "rightRole": right.role_id, - "rightMemoryId": right.memory_id, - "rightMemoryKind": right.memory_kind, - "rightSummary": right.summary, - "strength": strength, - "sharedTokens": shared_tokens(&left.tokens, &right.tokens), - "sourceRoles": [left.role_id, right.role_id], - "sourceKinds": [left.memory_kind, right.memory_kind], - "evidenceRefs": [left.memory_id, right.memory_id], - })); + pairs.push(HeartbeatMemoryResonancePair { + left_role: left.role_id.clone(), + left_memory_id: left.memory_id.clone(), + left_memory_kind: left.memory_kind.clone(), + left_summary: left.summary.clone(), + right_role: right.role_id.clone(), + right_memory_id: right.memory_id.clone(), + right_memory_kind: right.memory_kind.clone(), + right_summary: right.summary.clone(), + strength, + shared_tokens: shared_tokens(&left.tokens, &right.tokens), + source_roles: vec![left.role_id.clone(), right.role_id.clone()], + source_kinds: vec![left.memory_kind.clone(), right.memory_kind.clone()], + evidence_refs: vec![left.memory_id.clone(), right.memory_id.clone()], + }); } } - pairs.sort_by(|left, right| { - right["strength"] - .as_f64() - .unwrap_or_default() - .total_cmp(&left["strength"].as_f64().unwrap_or_default()) - }); + pairs.sort_by(|left, right| right.strength.total_cmp(&left.strength)); pairs.truncate(8); - serde_json::json!({ - "schema_version": "epiphany.memory_resonance.v0", - "updatedAt": now_iso(), - "source": "epiphany-native-void-routine", - "recordCount": records.len(), - "pairs": pairs, - }) + HeartbeatMemoryResonance { + schema_version: "epiphany.memory_resonance.v0".to_string(), + updated_at: now_iso(), + source: "epiphany-native-void-routine".to_string(), + record_count: records.len(), + pairs, + } } fn build_incubation( previous: &Option, bridge: &Option, candidate_interventions: &Option, - resonance: &Value, + resonance: &HeartbeatMemoryResonance, records: &[RoleMemoryRecord], ) -> Value { let previous_themes = previous @@ -1490,36 +1485,19 @@ fn build_incubation( .unwrap_or_default(); let source_coverage = build_source_coverage(records); let mut themes = Vec::new(); - for pair in resonance - .get("pairs") - .and_then(Value::as_array) - .into_iter() - .flatten() - .take(6) - { - let left_role = pair - .get("leftRole") - .and_then(Value::as_str) - .unwrap_or("left"); - let right_role = pair - .get("rightRole") - .and_then(Value::as_str) - .unwrap_or("right"); + for pair in resonance.pairs.iter().take(6) { + let left_role = pair.left_role.as_str(); + let right_role = pair.right_role.as_str(); let tokens = pair - .get("sharedTokens") - .and_then(Value::as_array) - .map(|items| { - items - .iter() - .filter_map(Value::as_str) - .take(3) - .collect::>() - .join("/") - }) - .unwrap_or_default(); - let source_roles = unique_strings_from_value(pair.get("sourceRoles")); - let source_kinds = unique_strings_from_value(pair.get("sourceKinds")); - let source_memory_ids = unique_strings_from_value(pair.get("evidenceRefs")); + .shared_tokens + .iter() + .take(3) + .cloned() + .collect::>() + .join("/"); + let source_roles = pair.source_roles.clone(); + let source_kinds = pair.source_kinds.clone(); + let source_memory_ids = pair.evidence_refs.clone(); let summary = format!( "{} and {} keep touching {}; let the swarm decide whether that is signal, stale echo, or a branch worth following.", display_name_for_role(left_role), @@ -1566,7 +1544,7 @@ fn build_incubation( .and_then(|theme| theme.get("maturation")) .and_then(Value::as_f64) .unwrap_or(0.32); - let strength = pair.get("strength").and_then(Value::as_f64).unwrap_or(0.0); + let strength = pair.strength; let maturation = round3( (prior_maturation * 0.44 + strength * 0.24 @@ -1716,28 +1694,26 @@ fn build_incubation( } fn build_thought_lanes( - resonance: &Value, + resonance: &HeartbeatMemoryResonance, incubation: &Value, records: &[RoleMemoryRecord], ) -> Value { let analytic_threads = resonance - .get("pairs") - .and_then(Value::as_array) - .into_iter() - .flatten() + .pairs + .iter() .take(4) .enumerate() .map(|(index, pair)| { - let left_role = pair.get("leftRole").and_then(Value::as_str).unwrap_or("left"); - let right_role = pair.get("rightRole").and_then(Value::as_str).unwrap_or("right"); - let strength = pair.get("strength").and_then(Value::as_f64).unwrap_or(0.0); + let left_role = pair.left_role.as_str(); + let right_role = pair.right_role.as_str(); + let strength = pair.strength; serde_json::json!({ "threadId": format!("analytic-{left_role}-{right_role}-{index}"), "topic": format!("{left_role}/{right_role} evidence seam"), "claim": format!("{} and {} share a recurring memory edge; inspect whether this changes lane routing or evidence expectations.", display_name_for_role(left_role), display_name_for_role(right_role)), "evidenceRefs": [ - pair.get("leftMemoryId").and_then(Value::as_str).unwrap_or_default(), - pair.get("rightMemoryId").and_then(Value::as_str).unwrap_or_default() + &pair.left_memory_id, + &pair.right_memory_id, ], "salience": round3(strength), "confidence": round3((0.55 + strength).min(0.95)), @@ -1814,7 +1790,7 @@ fn build_thought_lanes( fn build_thought_bridge( previous: &Option, thought_lanes: &Value, - resonance: &Value, + resonance: &HeartbeatMemoryResonance, incubation: &Value, ) -> Value { let analytic_count = thought_lanes @@ -1827,11 +1803,7 @@ fn build_thought_bridge( .and_then(Value::as_array) .map(Vec::len) .unwrap_or_default(); - let resonance_count = resonance - .get("pairs") - .and_then(Value::as_array) - .map(Vec::len) - .unwrap_or_default(); + let resonance_count = resonance.pairs.len(); let strongest_theme = incubation .get("themes") .and_then(Value::as_array) diff --git a/epiphany-core/src/heartbeat_state/heartbeat_documents.rs b/epiphany-core/src/heartbeat_state/heartbeat_documents.rs index 779d332b..fabcf761 100644 --- a/epiphany-core/src/heartbeat_state/heartbeat_documents.rs +++ b/epiphany-core/src/heartbeat_state/heartbeat_documents.rs @@ -61,7 +61,7 @@ pub struct EpiphanyHeartbeatCognitionEntry { #[cultcache(key = 5, default)] pub sleep_cycle: Option, #[cultcache(key = 6, default)] - pub memory_resonance: Option, + pub memory_resonance: Option, #[cultcache(key = 7, default)] pub incubation: Option, #[cultcache(key = 8, default)] @@ -167,6 +167,37 @@ pub struct HeartbeatAdaptivePacingSignals { pub contract: String, } +#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +#[serde(default)] +pub struct HeartbeatMemoryResonance { + #[serde(rename = "schema_version")] + pub schema_version: String, + pub updated_at: String, + pub source: String, + pub record_count: usize, + pub pairs: Vec, +} + +#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +#[serde(default)] +pub struct HeartbeatMemoryResonancePair { + pub left_role: String, + pub left_memory_id: String, + pub left_memory_kind: String, + pub left_summary: String, + pub right_role: String, + pub right_memory_id: String, + pub right_memory_kind: String, + pub right_summary: String, + pub strength: f64, + pub shared_tokens: Vec, + pub source_roles: Vec, + pub source_kinds: Vec, + pub evidence_refs: Vec, +} + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct HeartbeatInitiativeHeatPolicy { #[serde(default = "default_heat_schema_version")] diff --git a/epiphany-core/src/heartbeat_state/heartbeat_store.rs b/epiphany-core/src/heartbeat_state/heartbeat_store.rs index d75eda62..e2d808a4 100644 --- a/epiphany-core/src/heartbeat_state/heartbeat_store.rs +++ b/epiphany-core/src/heartbeat_state/heartbeat_store.rs @@ -126,7 +126,7 @@ fn legacy_heartbeat_cognition_entry( latest_artifact_ref: None, source, sleep_cycle: legacy.sleep_cycle, - memory_resonance: legacy.memory_resonance, + memory_resonance: decode_legacy_document(legacy.memory_resonance)?, incubation: legacy.incubation, thought_lanes: legacy.thought_lanes, bridge: legacy.bridge, @@ -136,6 +136,16 @@ fn legacy_heartbeat_cognition_entry( })) } +fn decode_legacy_document(value: Option) -> Result> +where + T: serde::de::DeserializeOwned, +{ + value + .map(serde_json::from_value) + .transpose() + .map_err(Into::into) +} + pub fn validate_heartbeat_state(state: &EpiphanyHeartbeatStateEntry) -> Result<()> { if state.schema_version != HEARTBEAT_STATE_SCHEMA_VERSION { return Err(anyhow!( diff --git a/epiphany-core/src/memory_graph/profiles/heartbeat.rs b/epiphany-core/src/memory_graph/profiles/heartbeat.rs index 6df93338..c84eda7a 100644 --- a/epiphany-core/src/memory_graph/profiles/heartbeat.rs +++ b/epiphany-core/src/memory_graph/profiles/heartbeat.rs @@ -1,4 +1,8 @@ use crate::heartbeat_state::EpiphanyHeartbeatCognitionEntry; +#[cfg(test)] +use crate::heartbeat_state::HeartbeatMemoryResonance; +#[cfg(test)] +use crate::heartbeat_state::HeartbeatMemoryResonancePair; use crate::memory_graph::EpiphanyMemoryDomain; use crate::memory_graph::EpiphanyMemoryGraphSnapshot; use crate::memory_graph::EpiphanyMemoryLifecycle; @@ -49,26 +53,18 @@ fn import_resonance( let Some(resonance) = cognition.memory_resonance.as_ref() else { return; }; - let Some(pairs) = resonance.get("pairs").and_then(Value::as_array) else { - return; - }; let domain_id = push_domain( domains, EpiphanyMemoryProfile::ShortTerm, "heartbeat resonance", ); let before = nodes.len(); - for pair in pairs.iter().take(8) { - let left = string_at(pair, "leftSummary"); - let right = string_at(pair, "rightSummary"); - let left_role = string_at(pair, "leftRole"); - let right_role = string_at(pair, "rightRole"); - let id_seed = format!( - "{}:{}:{}", - left_role, - right_role, - string_at(pair, "leftMemoryId") - ); + for pair in resonance.pairs.iter().take(8) { + let left = pair.left_summary.clone(); + let right = pair.right_summary.clone(); + let left_role = pair.left_role.clone(); + let right_role = pair.right_role.clone(); + let id_seed = format!("{}:{}:{}", left_role, right_role, pair.left_memory_id); nodes.push(EpiphanyMemoryNode { id: memory_graph_node_id(&domain_id, "resonance", id_seed, None), domain_id: domain_id.clone(), @@ -84,7 +80,7 @@ fn import_resonance( .to_string(), source_hashes: vec!["anchor:missing".to_string()], lifecycle: EpiphanyMemoryLifecycle::Active, - salience: score_to_u32(number_at(pair, "strength")), + salience: score_to_u32(pair.strength), confidence: 55, ..Default::default() }); @@ -383,16 +379,27 @@ mod tests { latest_artifact_ref: None, source: Some("unit-test".to_string()), sleep_cycle: None, - memory_resonance: Some(serde_json::json!({ - "pairs": [{ - "leftRole": "body", - "rightRole": "soul", - "leftMemoryId": "mem-a", - "leftSummary": "Architecture needs anchors.", - "rightSummary": "Verification needs receipts.", - "strength": 0.8 - }] - })), + memory_resonance: Some(HeartbeatMemoryResonance { + schema_version: "epiphany.memory_resonance.v0".to_string(), + updated_at: "2026-05-18T00:00:00Z".to_string(), + source: "unit-test".to_string(), + record_count: 2, + pairs: vec![HeartbeatMemoryResonancePair { + left_role: "body".to_string(), + left_memory_id: "mem-a".to_string(), + left_memory_kind: "note".to_string(), + left_summary: "Architecture needs anchors.".to_string(), + right_role: "soul".to_string(), + right_memory_id: "mem-b".to_string(), + right_memory_kind: "note".to_string(), + right_summary: "Verification needs receipts.".to_string(), + strength: 0.8, + shared_tokens: vec!["evidence".to_string()], + source_roles: vec!["body".to_string(), "soul".to_string()], + source_kinds: vec!["note".to_string()], + evidence_refs: vec!["mem-a".to_string(), "mem-b".to_string()], + }], + }), incubation: Some(serde_json::json!({ "themes": [{ "themeId": "theme-body-soul", diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index a1a2c4b8..b75a2e84 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -61,7 +61,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`, role/default construction lives in `epiphany-core/src/heartbeat_state/heartbeat_roles.rs`, persistence/validation lives in `epiphany-core/src/heartbeat_state/heartbeat_store.rs`, and status/artifact JSON projection lives in `epiphany-core/src/heartbeat_state/heartbeat_projection.rs`. Adaptive pacing, scene protocol, participant personality/mood timing, initiative heat projection, birth personality seed receipts, and pending-turn freeze/multiplier facts are typed fields rather than `extra` maps; only the sealed legacy combined-state reader still carries `extra` for old `voidRoutine` migration. The root `heartbeat_state.rs` keeps scheduling and Void cognition orchestration for the next cuts. +- Heartbeat durable document/schema types now live in `epiphany-core/src/heartbeat_state/heartbeat_documents.rs`, role/default construction lives in `epiphany-core/src/heartbeat_state/heartbeat_roles.rs`, persistence/validation lives in `epiphany-core/src/heartbeat_state/heartbeat_store.rs`, and status/artifact JSON projection lives in `epiphany-core/src/heartbeat_state/heartbeat_projection.rs`. Adaptive pacing, scene protocol, participant personality/mood timing, initiative heat projection, birth personality seed receipts, pending-turn freeze/multiplier facts, and Void routine memory-resonance pairs are typed fields rather than `extra` maps or generic JSON cargo; only the sealed legacy combined-state reader still carries `extra` for old `voidRoutine` migration. The root `heartbeat_state.rs` keeps scheduling and the remaining Void cognition orchestration for the next cuts. - Heartbeat role/default and store seams now have module-local unit tests: fixed lane catalog, Ghostlight scene role projection, and typed state/cognition CultCache round-trip. Keep future heartbeat cuts aligned to those seam tests instead of growing root integration-only coverage. - Heartbeat adaptive pacing now lives in `epiphany-core/src/heartbeat_state/heartbeat_pacing.rs`, including running-turn count and effective cooldown multipliers. It has a module-local unit test for pending-turn counting; root scheduling calls the pacing seam instead of owning pressure/concurrency math directly. - 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. @@ -95,13 +95,13 @@ remembers doctrine; the branch remembers the blade. - The machine-priest voice now says the quiet part plainly: crusade/heresy/purity language is aimed at technical rot, hidden state, duplicate truth, drift, and lying structures, not at humans. Future Epiphany swarms should inherit severity toward systems and curiosity toward people. - The Ghostlight memory pass is landed. `epiphany_specialists.toml` now has a shared persistent-memory projection prepended by the harness to fixed role specialists, reorientation workers, coordinator notes, and CRRC checkpoint interventions. The rendered base doctrine also states the Perfect Machine rule directly: prompt is projection, durable typed state is the mind, every lane must improve its own memory/model/prompt/evidence habit or name the repair, and each lane phrases that duty in its own organ language so the salience sticks. - The role self-memory persistence pass is native now. Each lane has a Ghostlight-shaped typed dossier in `state/agents.msgpack`, and specialists may return optional `selfPatch` requests beside their normal role result. Relationship, event, scene, and perceived-overlay arrays are typed dossier documents, not JSON cargo, and the durable structs do not keep unknown `extra` maps. `roleResult`/`roleAccept` project coordinator review as `selfPersistence`: accepted requests are role-matched, bounded lane memory/goal/value/private-note mutations; refused requests explain wrong role, project-truth smuggling, authority grabs, bloat, missing reason, or malformed records. GUI/coordinator accept paths apply accepted `selfPatch` requests through the native `epiphany-agent-memory-store` binary; project truth still belongs only in `EpiphanyThreadState`. -- The heartbeat initiative pass is landed as a bounded tool seam. `state/agent-heartbeats.msgpack` tracks Self, Face, Imagination, Eyes, Body, Hands, Soul, and Life as Ghostlight-style initiative participants with arena, participant kind, speed, next-ready time, reaction bias, interrupt threshold, load, status, constraints, personality cooldown, mood cooldown, effective cooldown, adaptive pacing, history, and pending turns through `epiphany-core::EpiphanyHeartbeatStateEntry` and the native `epiphany-heartbeat-store` binary. Role dossiers set baseline timing; appraisal mood/anxiety bends it through urgency, arousal, thought pressure, guardedness, and reaction intensity, so Hands-like work pressure and high-need anxious lanes recover sooner without being heartbeaten while a prior turn is running. `epiphany-heartbeat-store pump` computes pressure from external urgency, mood/anxiety, reaction intensity, thought pressure, and current pending load, then chooses tempo plus target concurrency: calm can launch zero and sleep slow; alarm can fill most active lanes. Idle turns are for rumination: light thought shuffling, role-quality attention, and candidate selfPatch pressure. Sleep/dream cycle passes are the intended distillation window for durable self-memory and doctrine. JSON heartbeat state, Python wrapper state, and live heartbeat timing `extra` maps are gone; general CultCache schema sync, polyglot domain loading, and debug display tools belong in CultLib. This is a callable scheduler seam, not yet an always-on daemon; a heart valve, not a whole circulatory god. +- The heartbeat initiative pass is landed as a bounded tool seam. `state/agent-heartbeats.msgpack` tracks Self, Face, Imagination, Eyes, Body, Hands, Soul, and Life as Ghostlight-style initiative participants with arena, participant kind, speed, next-ready time, reaction bias, interrupt threshold, load, status, constraints, personality cooldown, mood cooldown, effective cooldown, adaptive pacing, history, and pending turns through `epiphany-core::EpiphanyHeartbeatStateEntry` and the native `epiphany-heartbeat-store` binary. Role dossiers set baseline timing; appraisal mood/anxiety bends it through urgency, arousal, thought pressure, guardedness, and reaction intensity, so Hands-like work pressure and high-need anxious lanes recover sooner without being heartbeaten while a prior turn is running. `epiphany-heartbeat-store pump` computes pressure from external urgency, mood/anxiety, reaction intensity, thought pressure, and current pending load, then chooses tempo plus target concurrency: calm can launch zero and sleep slow; alarm can fill most active lanes. Idle turns are for rumination: light thought shuffling, role-quality attention, and candidate selfPatch pressure. Sleep/dream cycle passes are the intended distillation window for durable self-memory and doctrine. JSON heartbeat state, Python wrapper state, live heartbeat timing `extra` maps, and JSON `memoryResonance` persistence are gone; general CultCache schema sync, polyglot domain loading, and debug display tools belong in CultLib. This is a callable scheduler seam, not yet an always-on daemon; a heart valve, not a whole circulatory god. - Heartbeat initiative heat is now part of that seam. `EpiphanyHeartbeatStateEntry` owns `initiative_heat`, pacing applies active global/all/agent/role/arena/participant-kind/group/constraint multipliers into per-participant `initiativeHeatMultiplier`, and recovery divides by that multiplier. The CLI exposes `epiphany-heartbeat-store heat`, status/schedule projections show heat, and the CultNet catalog advertises both `epiphany.heartbeat_initiative_heat.v0` and coordinator intent `epiphany.heartbeat_heat_intent.v0`; runtime-spine hello lists the heat intent on the heartbeat mutation contract. Smoke proves a heated implementation lane reaches the live action catalog with `initiative_heat_multiplier: 4.0`. - Active heartbeat turns now freeze initiative explicitly. A running pending turn carries `initiativeFrozen` and `initiativeFreezeReason`; schedule/status/readiness projections expose `initiative_frozen`; the scheduler still rejects attempts to wake that lane again; and completion receipts mark `cooldownStartedAfterCompletion: true`. A focused high-heat test proves a 25x heated implementation lane cannot be queued again while it is still thinking. - The first Ghostlight-derived timing slice is landed in Epiphany, but Ghostlight is reference lineage rather than a sibling runtime to preserve. `epiphany-heartbeat-store init --profile ghostlight-scene --scene-id --scene-participant ` creates a typed CultCache MessagePack scene heartbeat store whose participants are `arena=scene`, `participantKind=character`; `tick` emits `ghostlight.initiative_schedule.v0` receipts with `scene_turn` actions and local-affordance basis. The generic Epiphany maintenance lanes are not auto-patched into scene stores. -- The first Void-derived routine slice is landed in Epiphany, but VoidBot is reference lineage rather than a runtime dependency. `epiphany-heartbeat-store routine --store .\state\agent-heartbeats.msgpack --artifact-dir .\.epiphany-heartbeats --agent-store .\state\agents.msgpack` reads typed role dossiers, computes bounded memory resonance, maintains incubation themes, runs analytic and associative cognition lanes, writes bridge syntheses/saturation/tension, projects the active thought cluster through each role's Ghostlight-shaped personality vectors, derives participant-local reactions, applies personality/mood timing, advances the sleep/dream cycle, updates the typed heartbeat store, and emits an auditable `epiphany.void_routine.v0` receipt. The routine now also carries anti-loop physiology imported from Void's calmer brain: `noveltyToSelf`, `noveltyToRoom`, source coverage, saturation pressure, refractory cooling, and explicit permission to let a live unsaturated thought deepen without forcing novelty theater every pass. This mutates only heartbeat physiology fields: project truth and role memory mutation remain on their reviewed surfaces. +- The first Void-derived routine slice is landed in Epiphany, but VoidBot is reference lineage rather than a runtime dependency. `epiphany-heartbeat-store routine --store .\state\agent-heartbeats.msgpack --artifact-dir .\.epiphany-heartbeats --agent-store .\state\agents.msgpack` reads typed role dossiers, computes typed bounded memory resonance, maintains incubation themes, runs analytic and associative cognition lanes, writes bridge syntheses/saturation/tension, projects the active thought cluster through each role's Ghostlight-shaped personality vectors, derives participant-local reactions, applies personality/mood timing, advances the sleep/dream cycle, updates the typed heartbeat store, and emits an auditable `epiphany.void_routine.v0` receipt. The routine now also carries anti-loop physiology imported from Void's calmer brain: `noveltyToSelf`, `noveltyToRoom`, source coverage, saturation pressure, refractory cooling, and explicit permission to let a live unsaturated thought deepen without forcing novelty theater every pass. This mutates only heartbeat physiology fields: project truth and role memory mutation remain on their reviewed surfaces. - The next memory foundation must not build separate engines for repo graph and agent mind. Heartbeat cognition, role self-memory, repo architecture/dataflow, evidence scars, incubation, agency pressure, and context packets should converge through `EpiphanyMemoryGraph` profiles so one typed graph owns anchors, lifecycle, summaries, freshness, context cuts, and Qdrant embedding manifests. Repo, agent, and heartbeat profile producers now map accepted graph truth, reviewed role dossier memories/goals/values, and provisional heartbeat short-term/incubation/agency/candidate pressure into memory graph documents without scanner/Qdrant/model work. Heartbeat import deliberately does not mark durable promotion. Compose now merges profile snapshots into one validated graph and rejects duplicate authority; `epiphany-memory-graph compose` writes a composed typed CultCache graph from typed source graph stores; `epiphany-memory-graph refresh` can invoke live agent-memory plus heartbeat-cognition producers from their typed stores into one graph store; `epiphany-core` has a native typed `EpiphanyThreadState` CultCache store seam; the bridge mirrors loaded Codex-thread Epiphany state into `state/thread-state.msgpack`; and CultNet now advertises logical `EpiphanyThreadState` plus `EpiphanyMemoryGraph` snapshot contracts. The next clean slice is local refresh/dogfood once a mirrored thread-state store exists, then a Qdrant embedding cache writer that treats embeddings as rebuildable manifests, not canonical memory. - Manual Codex-run rumination still has an explicit aftercare rule until Epiphany owns the full sleep consolidator. In the intended Epiphany cycle, sub-agents ruminate when idle and distill when they sleep; in this supervising Codex thread, a heartbeat/routine vigil is only physiology until a separate closing pass reviews the receipts and decides whether map, handoff, evidence, or role self-memory should change. - The Face public-surface pass is landed as a bounded lane. Face's role dossier lives in `state/agents.msgpack`; `epiphany_specialists.toml` gives it a VoidBot-heartbeat-derived prompt stripped of moderation authority; `state/face-discord.toml` and the native `epiphany-face-discord` binary enforce that Face may interact only through #aquarium. Missing channel id or token writes candidate chat artifacts instead of posting elsewhere. If a Face has a persona name/avatar, `post` uses the shared Discord webhook pipe so each Epiphany can speak with its own nickname and avatar without a separate bot identity. @@ -198,7 +198,7 @@ The current spine, blessed but not yet finished: - distilled shared and config-backed prompt doctrine through the base prompt, rendered Epiphany state prompt files, modeling/Body, implementation/Hands, verification/Soul, reorientation/Life, coordinator/Self, and CRRC intervention surfaces - shared Ghostlight-derived persistent memory projection across Imagination, Body, Soul, Life, Self, CRRC checkpoint steering, and the GUI-launched Hands implementation lane - Ghostlight-derived heartbeat initiative scheduling through the native `epiphany-heartbeat-store` binary, with Self and Face included as first-class Epiphany maintenance participants, Ghostlight scene characters supported through the same timing law, role-personality cooldowns, appraisal mood/anxiety cooldowns, effective recovery timing, adaptive pressure-based pump tempo/concurrency, idle rumination feeding candidate self-memory pressure, sleep/dream passes serving as the distillation window, and heartbeat state persisted through typed CultCache MessagePack stores -- Void-derived native routine physiology through `epiphany-heartbeat-store routine`, with sleep cycle, memory resonance, incubation, analytic/associative cognition lanes, bridge judgment, candidate interventions, Ghostlight-style personality appraisals, mood/anxiety timing, derived reactions, and dream maintenance stored in the typed heartbeat store +- Void-derived native routine physiology through `epiphany-heartbeat-store routine`, with sleep cycle, typed memory resonance, incubation, analytic/associative cognition lanes, bridge judgment, candidate interventions, Ghostlight-style personality appraisals, mood/anxiety timing, derived reactions, and dream maintenance stored in the typed heartbeat store - Epiphany-native character-loop packet projection through `epiphany-character-loop`, with Face as the first public-surface actor over its typed role dossier - Face as the public #aquarium-only surface for translating agent thought-weather into short chats or candidate drafts, with persona webhook presentation and Void memory/search access, without moderator authority - Ghostlight-shaped role dossiers in `state/agents.msgpack`, plus `selfPatch` review projection through `roleResult`/`roleAccept` and accepted memory application through the native `epiphany-agent-memory-store` binary diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 1fc9e5b3a058331368e2afbbb7634bfc1282d07e..56bad14d9c20e7541b9ca2bb42327b14dead1908 100644 GIT binary patch delta 355 zcmZ9Iu}T9`5Jg#=l!BdwFd%k`*{noxEz{TtBEiBYjPFg7r@L=9Z)TCLBKQM>LcT)~ z#82=O{0$KVE1!X&*v&2G-gEEGd+YV1b+^6twf?v>OOn~`B6(gU$?$XI;U!D6{Z88N z^bUr-G~esr5EPl0yT5ggtsgfC31Ey3hfdDS>5Em*h2vz_mJ0 zVAzX>+NfjSj%woF&j}R;aiSDW+ECC0O#_w;+bGf7Wzsw}ok_rI3a+d;D0sdGj-RLm z(c@^vb-ctnT~T#U&;@WYn9u@`K`2-nT}J3UKf|J?Ll{R=`P;2q1s=PCKuI*ViVVHq X;-aXvbfx4gf(k`;pZ+hFXX*JjuSI~P delta 48 zcmX^4g}vbu`vhgCAICPT7BVsxG*4&TKAn*< - The first `EpiphanyMemoryGraph` skeleton is implemented. Public typed - graph documents live in `epiphany-state-model`; `epiphany-core::memory_graph` - owns stable ids, profile/lifecycle legality, snapshot validation, - freshness propagation, summary-versus-child context cuts, and a validated - CultCache store entry; the native `epiphany-memory-graph` binary can - status/validate/query/smoke the store without Qdrant. - next_action: Continue Codex starvation before outward feature growth. The prompt-state renderer now lives with `epiphany-state-model`, and `codex-core` no longer depends on `epiphany-core`: `CodexThread` now exposes only host persistence/path facts while `epiphany-codex-bridge` owns state-update application, retrieval/indexing execution, and heartbeat job launch/interrupt policy. The next clean cut is reducing app-server JSON-RPC Epiphany route exposure toward CultNet contracts, unless another vendored Codex policy dependency appears. + The heartbeat memory-resonance routine document is typed. Native routine + construction, cognition persistence, legacy decode, and memory-graph import + now operate on `HeartbeatMemoryResonance` / `HeartbeatMemoryResonancePair` + instead of generic JSON; status still projects JSON only as operator glass. + next_action: Continue internal CultCache purification before outward feature growth. The remaining high-signal internal JSON is the rest of `EpiphanyHeartbeatCognitionEntry`: `sleep_cycle`, `incubation`, `thought_lanes`, `bridge`, `candidate_interventions`, `appraisals`, and `reactions` still persist as `serde_json::Value`. Type those cognition documents one bounded organ at a time, keeping JSON only at artifact/status/wire projections and legacy decode seams; then return to app-server JSON-RPC route starvation toward CultNet contracts.