From a246b5caf89d7bcfa0ec83e9829dd2584d876701 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 18 May 2026 02:47:58 +0100 Subject: [PATCH] Add semantic memory graph context lookup --- .../src/bin/epiphany-memory-graph.rs | 11 +- epiphany-core/src/lib.rs | 3 + epiphany-core/src/memory_graph/mod.rs | 3 + epiphany-core/src/memory_graph/qdrant.rs | 234 +++++++++++++++++- notes/epiphany-memory-graph-unified-plan.md | 7 +- notes/fresh-workspace-handoff.md | 4 +- state/ledgers.msgpack | Bin 134817 -> 135313 bytes state/map.yaml | 6 +- 8 files changed, 259 insertions(+), 9 deletions(-) diff --git a/epiphany-core/src/bin/epiphany-memory-graph.rs b/epiphany-core/src/bin/epiphany-memory-graph.rs index d89ad6de..6a775013 100644 --- a/epiphany-core/src/bin/epiphany-memory-graph.rs +++ b/epiphany-core/src/bin/epiphany-memory-graph.rs @@ -30,6 +30,7 @@ use epiphany_core::memory_graph_from_epiphany_graphs; use epiphany_core::memory_graph_from_heartbeat_cognition; use epiphany_core::memory_graph_node_id; use epiphany_core::plan_memory_graph_context_cut; +use epiphany_core::plan_memory_graph_context_cut_with_semantic_cache; use epiphany_core::rebuild_memory_graph_embedding_cache; use epiphany_core::validate_memory_graph_snapshot; use epiphany_core::write_memory_graph_snapshot; @@ -75,6 +76,14 @@ fn main() -> Result<()> { let packet = plan_memory_graph_context_cut(&snapshot, &query); print_json(&packet)?; } + "semantic-context" => { + let store = require_path_arg(&mut args, "--store")?; + let query = read_context_query(args)?; + let snapshot = load_memory_graph_snapshot(&store)? + .ok_or_else(|| anyhow!("memory graph store {} is missing", store.display()))?; + let packet = plan_memory_graph_context_cut_with_semantic_cache(&snapshot, &query); + print_json(&packet)?; + } "compose" => { let compose = read_compose_args(args)?; let output = compose_memory_graph_store(compose)?; @@ -590,7 +599,7 @@ fn print_json(value: &T) -> Result<()> { fn print_usage() { eprintln!( - "usage: epiphany-memory-graph --store ..." + "usage: epiphany-memory-graph --store ..." ); } diff --git a/epiphany-core/src/lib.rs b/epiphany-core/src/lib.rs index ed9e2894..760d52d9 100644 --- a/epiphany-core/src/lib.rs +++ b/epiphany-core/src/lib.rs @@ -95,6 +95,7 @@ pub use memory_graph::EpiphanyMemoryEmbeddingManifest; pub use memory_graph::EpiphanyMemoryGraphEmbeddingCacheReport; pub use memory_graph::EpiphanyMemoryGraphEmbeddingCacheRequest; pub use memory_graph::EpiphanyMemoryGraphEntry; +pub use memory_graph::EpiphanyMemoryGraphSemanticHit; pub use memory_graph::EpiphanyMemoryGraphSnapshot; pub use memory_graph::EpiphanyMemoryGraphValidationError; pub use memory_graph::EpiphanyMemoryLifecycleReceipt; @@ -118,6 +119,8 @@ pub use memory_graph::memory_graph_from_epiphany_graphs; pub use memory_graph::memory_graph_from_heartbeat_cognition; pub use memory_graph::memory_graph_node_id; pub use memory_graph::plan_memory_graph_context_cut; +pub use memory_graph::plan_memory_graph_context_cut_with_semantic_cache; +pub use memory_graph::query_memory_graph_semantic_cache; pub use memory_graph::rebuild_memory_graph_embedding_cache; pub use memory_graph::validate_memory_graph_entry; pub use memory_graph::validate_memory_graph_snapshot; diff --git a/epiphany-core/src/memory_graph/mod.rs b/epiphany-core/src/memory_graph/mod.rs index 4f7285c2..db0ebebb 100644 --- a/epiphany-core/src/memory_graph/mod.rs +++ b/epiphany-core/src/memory_graph/mod.rs @@ -41,6 +41,9 @@ pub use profiles::memory_graph_from_epiphany_graphs; pub use profiles::memory_graph_from_heartbeat_cognition; pub use qdrant::EpiphanyMemoryGraphEmbeddingCacheReport; pub use qdrant::EpiphanyMemoryGraphEmbeddingCacheRequest; +pub use qdrant::EpiphanyMemoryGraphSemanticHit; +pub use qdrant::plan_memory_graph_context_cut_with_semantic_cache; +pub use qdrant::query_memory_graph_semantic_cache; pub use qdrant::rebuild_memory_graph_embedding_cache; pub use store::EpiphanyMemoryGraphEntry; pub use store::MEMORY_GRAPH_KEY; diff --git a/epiphany-core/src/memory_graph/qdrant.rs b/epiphany-core/src/memory_graph/qdrant.rs index 50c67088..a4efd74b 100644 --- a/epiphany-core/src/memory_graph/qdrant.rs +++ b/epiphany-core/src/memory_graph/qdrant.rs @@ -1,7 +1,11 @@ +use super::EpiphanyMemoryContextPacket; +use super::EpiphanyMemoryContextQuery; use super::EpiphanyMemoryEmbeddingManifest; use super::EpiphanyMemoryGraphSnapshot; use super::memory_graph_embedding_documents; use super::memory_graph_embedding_manifest; +use super::plan_memory_graph_context_cut; +use super::push_unique; use crate::semantic_cache::OllamaConfig; use crate::semantic_cache::OllamaEmbedder; use crate::semantic_cache::QdrantClient; @@ -13,6 +17,7 @@ use crate::semantic_cache::validate_embedding_batch; use anyhow::Context; use anyhow::Result; use serde::Serialize; +use serde_json::Value; use serde_json::json; use sha1::Digest; use sha1::Sha1; @@ -38,6 +43,15 @@ pub struct EpiphanyMemoryGraphEmbeddingCacheReport { pub manifest: EpiphanyMemoryEmbeddingManifest, } +#[derive(Clone, Debug, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct EpiphanyMemoryGraphSemanticHit { + pub document_id: String, + pub source_id: String, + pub document_kind: String, + pub score: f32, +} + pub fn rebuild_memory_graph_embedding_cache( snapshot: &mut EpiphanyMemoryGraphSnapshot, request: EpiphanyMemoryGraphEmbeddingCacheRequest, @@ -115,7 +129,6 @@ fn rebuild_memory_graph_embedding_cache_with_config( "profile": document.profile, "lifecycle": document.lifecycle, "sourceHashes": document.source_hashes, - "text": document.text, }), }) .collect::>(); @@ -140,6 +153,138 @@ fn rebuild_memory_graph_embedding_cache_with_config( }) } +pub fn plan_memory_graph_context_cut_with_semantic_cache( + snapshot: &EpiphanyMemoryGraphSnapshot, + query: &EpiphanyMemoryContextQuery, +) -> EpiphanyMemoryContextPacket { + let hits = match query_memory_graph_semantic_cache(snapshot, query) { + Ok(hits) => hits, + Err(err) => { + let mut packet = plan_memory_graph_context_cut(snapshot, query); + packet.warnings.push(format!( + "semantic cache unavailable; used typed graph traversal: {err}" + )); + return packet; + } + }; + plan_memory_graph_context_cut_from_semantic_hits(snapshot, query, hits) +} + +fn plan_memory_graph_context_cut_from_semantic_hits( + snapshot: &EpiphanyMemoryGraphSnapshot, + query: &EpiphanyMemoryContextQuery, + hits: Vec, +) -> EpiphanyMemoryContextPacket { + let mut warnings = Vec::new(); + if hits.is_empty() { + return plan_memory_graph_context_cut(snapshot, query); + } + + let mut seeded_query = query.clone(); + for hit in &hits { + match hit.document_kind.as_str() { + "node" => push_unique(&mut seeded_query.node_ids, hit.source_id.clone()), + "edge" => push_unique(&mut seeded_query.edge_ids, hit.source_id.clone()), + "summary" => { + if let Some(summary) = snapshot + .summaries + .iter() + .find(|summary| summary.id == hit.source_id) + { + for node_id in &summary.covers_node_ids { + push_unique(&mut seeded_query.node_ids, node_id.clone()); + } + for edge_id in &summary.covers_edge_ids { + push_unique(&mut seeded_query.edge_ids, edge_id.clone()); + } + } else { + warnings.push(format!( + "semantic cache hit missing summary {}", + hit.source_id + )); + } + } + other => warnings.push(format!( + "semantic cache hit {} had unknown document kind {other}", + hit.document_id + )), + } + } + + let mut packet = plan_memory_graph_context_cut(snapshot, &seeded_query); + packet.warnings.push(format!( + "semantic cache seeded {} typed graph document(s)", + hits.len() + )); + packet.warnings.extend(warnings); + packet +} + +pub fn query_memory_graph_semantic_cache( + snapshot: &EpiphanyMemoryGraphSnapshot, + query: &EpiphanyMemoryContextQuery, +) -> Result> { + let mut ollama_config = ollama_config_from_env(DEFAULT_MEMORY_GRAPH_QUERY_INSTRUCTION); + if let Some(manifest) = &snapshot.embedding_manifest { + ollama_config.model = manifest.embedding_model.clone(); + } + query_memory_graph_semantic_cache_with_config( + snapshot, + query, + qdrant_config_from_env(), + ollama_config, + ) +} + +fn query_memory_graph_semantic_cache_with_config( + snapshot: &EpiphanyMemoryGraphSnapshot, + query: &EpiphanyMemoryContextQuery, + qdrant_config: QdrantConfig, + ollama_config: OllamaConfig, +) -> Result> { + let query_text = query + .text + .as_deref() + .map(str::trim) + .filter(|text| !text.is_empty()) + .context("semantic cache context requires query.text")?; + let manifest = snapshot + .embedding_manifest + .as_ref() + .context("memory graph has no embedding manifest")?; + let collection_name = manifest + .collection_name + .as_deref() + .context("memory graph embedding manifest has no collection name")?; + + let query_vector = OllamaEmbedder::new(ollama_config)?.embed_query(query_text)?; + let limit = query.budget.unwrap_or(12).clamp(1, 64) as usize; + let qdrant = QdrantClient::new(qdrant_config)?; + let hits = qdrant.query_points(collection_name, &query_vector, limit)?; + Ok(hits.into_iter().filter_map(map_semantic_hit).collect()) +} + +fn map_semantic_hit( + point: crate::semantic_cache::QdrantQueryPoint, +) -> Option { + let document_id = string_payload(&point.payload, "documentId")?; + let source_id = string_payload(&point.payload, "sourceId")?; + let document_kind = string_payload(&point.payload, "documentKind")?; + Some(EpiphanyMemoryGraphSemanticHit { + document_id, + source_id, + document_kind, + score: point.score, + }) +} + +fn string_payload( + payload: &std::collections::BTreeMap, + key: &str, +) -> Option { + payload.get(key).and_then(Value::as_str).map(str::to_string) +} + fn default_memory_graph_collection_name(graph_id: &str) -> String { format!("epiphany_memory_graph_{}", short_hash(graph_id)) } @@ -246,6 +391,93 @@ mod tests { Ok(()) } + #[test] + fn memory_graph_semantic_query_returns_ids_not_cached_payload_text() -> Result<()> { + let runtime = tokio::runtime::Runtime::new()?; + let qdrant = runtime.block_on(MockServer::start()); + let ollama = runtime.block_on(MockServer::start()); + + runtime.block_on(async { + Mock::given(method("POST")) + .and(path("/api/embed")) + .respond_with(ResponseTemplate::new(200).set_body_json(json!({ + "embeddings": [[0.1_f32, 0.2_f32, 0.3_f32]] + }))) + .mount(&ollama) + .await; + Mock::given(method("POST")) + .and(path("/collections/test_memory_graph/points/query")) + .respond_with(ResponseTemplate::new(200).set_body_json(json!({ + "result": { + "points": [{ + "score": 0.91_f32, + "payload": { + "documentId": "memembed-node-test", + "sourceId": "node-auth-spine", + "documentKind": "node", + "text": "cached text must not become canonical context" + } + }] + } + }))) + .mount(&qdrant) + .await; + }); + + let mut snapshot = test_snapshot(); + snapshot.embedding_manifest = Some(memory_graph_embedding_manifest( + &snapshot, + "test_memory_graph", + "test-embedding", + Some(3), + )); + let hits = query_memory_graph_semantic_cache_with_config( + &snapshot, + &EpiphanyMemoryContextQuery { + id: "semantic-query-test".to_string(), + text: Some("who owns auth".to_string()), + budget: Some(3), + ..Default::default() + }, + QdrantConfig { + url: qdrant.uri(), + api_key: None, + timeout_ms: 1_000, + }, + OllamaConfig { + base_url: ollama.uri(), + model: "test-embedding".to_string(), + timeout_ms: 1_000, + query_instruction: DEFAULT_MEMORY_GRAPH_QUERY_INSTRUCTION.to_string(), + }, + )?; + + assert_eq!(hits.len(), 1); + assert_eq!(hits[0].source_id, "node-auth-spine"); + assert_eq!(hits[0].document_kind, "node"); + + let packet = plan_memory_graph_context_cut_from_semantic_hits( + &snapshot, + &EpiphanyMemoryContextQuery { + id: "semantic-query-test".to_string(), + text: Some("who owns auth".to_string()), + budget: Some(3), + ..Default::default() + }, + hits, + ); + assert_eq!(packet.nodes.len(), 1); + assert_eq!(packet.nodes[0].id, "node-auth-spine"); + assert!( + packet + .warnings + .iter() + .any(|warning| warning.contains("semantic cache seeded 1")) + ); + + Ok(()) + } + fn test_snapshot() -> EpiphanyMemoryGraphSnapshot { EpiphanyMemoryGraphSnapshot { schema_version: Some("epiphany.memory_graph.v0".to_string()), diff --git a/notes/epiphany-memory-graph-unified-plan.md b/notes/epiphany-memory-graph-unified-plan.md index 6ae889ff..ce182b3e 100644 --- a/notes/epiphany-memory-graph-unified-plan.md +++ b/notes/epiphany-memory-graph-unified-plan.md @@ -379,9 +379,12 @@ Qdrant/Ollama transport cache used by both workspace retrieval and memory graph indexing. `epiphany-memory-graph index` rebuilds a Qdrant collection from typed memory graph embedding documents and writes only the resulting `EpiphanyMemoryEmbeddingManifest` back to the typed graph store. +`epiphany-memory-graph semantic-context` asks Qdrant for graph document IDs, +then resolves all real context from the typed graph. If Qdrant is missing, the +command falls back to typed graph traversal with an explicit warning. -Still open: Qdrant candidate ranking should feed context-cut planning but never -emit canonical memory payloads. +Still open: rank-aware context composition should preserve Qdrant ordering more +precisely when many candidate IDs compete for a small budget. ### Phase 7: Sleep And Repo Refresh diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index c2d40aa5..45a8f9dc 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -39,7 +39,7 @@ remembers doctrine; the branch remembers the blade. - `epiphany-openai-runtime` worker result ingress now parses assistant output directly into typed role/reorient ingress structs selected from the durable launch document, stores nested `statePatch` and `selfPatch` as typed MessagePack in `EpiphanyRuntimeRoleWorkerResult`, and no longer passes worker result data through generic `serde_json::Value`. JSON survives there only as the OpenAI text-output edge before typed deserialization. - Agent self-memory review/application now has typed `AgentSelfPatch` core APIs. JSON-value selfPatch functions are compatibility wrappers for CLI/artifact ingress; native callers should parse once at the edge and then call `review_agent_self_patch_document` / `apply_agent_self_patch_document`. Role-result self-persistence no longer exports a JSON-value reviewer; the live API is `review_role_self_patch_document`. - `epiphany-openai-codex-spine` no longer uses Codex's Responses client, model-provider layer, `codex-api`, `codex-model-provider`, `codex-model-provider-info`, or `codex-protocol` for outbound model requests. It reaches `codex-login` only through `epiphany-openai-auth-spine` so credential loading/refresh stays Codex-compatible while request/status/event/runtime surfaces stay typed Epiphany documents. -- `notes/epiphany-memory-graph-unified-plan.md` is the current memory architecture direction drawn from `Fractal Domains And The Cache That Bites` plus the VoidBot memory scar tissue. The repo semantic architecture/dataflow graph and agent memory are one `EpiphanyMemoryGraph` substrate with repo, role, short-term, incubation, agency, candidate-intervention, and evidence profiles. The first native skeleton is landed: `epiphany-state-model` owns shared graph document types, `epiphany-core::memory_graph` owns stable ids, validation, freshness, context cuts, and CultCache persistence, and `epiphany-memory-graph` can status/validate/context/smoke/index the store. `epiphany-core::semantic_cache` now owns the shared Qdrant/Ollama transport used by workspace retrieval and memory graph indexing, so Qdrant remains a rebuildable contribution cache for typed graph documents, not truth. `notes/repo-fractal-dataflow-cache-plan.md` and `notes/agent-memory-fractal-cache-plan.md` are profile plans, not rival organs. +- `notes/epiphany-memory-graph-unified-plan.md` is the current memory architecture direction drawn from `Fractal Domains And The Cache That Bites` plus the VoidBot memory scar tissue. The repo semantic architecture/dataflow graph and agent memory are one `EpiphanyMemoryGraph` substrate with repo, role, short-term, incubation, agency, candidate-intervention, and evidence profiles. The first native skeleton is landed: `epiphany-state-model` owns shared graph document types, `epiphany-core::memory_graph` owns stable ids, validation, freshness, context cuts, and CultCache persistence, and `epiphany-memory-graph` can status/validate/context/semantic-context/smoke/index the store. `epiphany-core::semantic_cache` now owns the shared Qdrant/Ollama transport used by workspace retrieval and memory graph indexing, so Qdrant remains a rebuildable contribution cache for typed graph documents, not truth. `notes/repo-fractal-dataflow-cache-plan.md` and `notes/agent-memory-fractal-cache-plan.md` are profile plans, not rival organs. - Durable Epiphany state types now live in root crate `epiphany-state-model`. `codex-protocol` re-exports them only so old rollout/API callers keep compiling; do not add new durable `Epiphany*` state structs under `vendor/codex`. `epiphany-core` imports the native model directly and no longer depends on `codex-protocol`. Pressure derives from native `EpiphanyTokenUsageSnapshot`; Codex token telemetry is mapped at the bridge. Codex rollout/event reconstruction now lives in `codex-core::epiphany_rollout`, where the Codex `RolloutItem` / `EventMsg` types belong. Exact retrieval path matching is native to `epiphany-core`, so `epiphany-core` has no direct vendored Codex crate dependency. - State-update contract proof and job launch/interrupt DTO ownership now live in native `epiphany-core`. The old giant `codex_thread.rs` Epiphany state-update test fixture was cut, and `epiphany-codex-bridge` no longer imports Epiphany job launch request types from `codex_core`; vendored `CodexThread` may call the native mutation/launch law for compatibility, but it must not regain ownership of state-update semantics, heartbeat launch-plan policy, or Epiphany DTOs. - MCP remains JSON because MCP is a JSON protocol. The latest processor cut only moved MCP refresh/OAuth/status/resource/tool-call route handling into `codex_message_processor/mcp_routes.rs`, reducing the root processor to about 8,977 lines; it did not claim MCP payloads are CultNet or make MCP an Epiphany-owned runtime contract. @@ -96,7 +96,7 @@ remembers doctrine; the branch remembers the blade. - 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 and Python wrapper state 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 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 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/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`; CultNet advertises logical `EpiphanyThreadState` plus `EpiphanyMemoryGraph` snapshot contracts; memory graph nodes/edges/summaries project into deterministic typed embedding documents; `epiphany-memory-graph manifest` writes the embedding manifest back to the typed graph store; and `epiphany-memory-graph index` fully rebuilds a Qdrant cache collection through the shared semantic cache transport. The next clean slice is using Qdrant candidates to accelerate context cuts while keeping typed graph traversal as the source of truth. +- 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/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`; CultNet advertises logical `EpiphanyThreadState` plus `EpiphanyMemoryGraph` snapshot contracts; memory graph nodes/edges/summaries project into deterministic typed embedding documents; `epiphany-memory-graph manifest` writes the embedding manifest back to the typed graph store; `epiphany-memory-graph index` fully rebuilds a Qdrant cache collection through the shared semantic cache transport; and `epiphany-memory-graph semantic-context` uses Qdrant IDs to seed typed graph context while falling back to graph traversal when the cache is absent. The next clean slice is rank-aware context composition and bridge/runtime prompt integration, not another memory store. - 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. - The Void memory bridge is now native enough to keep the useful organs attached. `state/void-memory.toml` and `epiphany-void-memory` can check Void's Docker Postgres state spine, query Qdrant Discord-history and source/lore collections with the configured Ollama embedding model, and fetch raw archive context windows from Void's file-backed Discord archive. Native `epiphany-mvp-status` includes a `voidMemory` block so Aquarium/backend clients can inspect whether the mouth and memory are actually wired. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index d217b6024a08f02ebcc27b2e647698c87fc5bfe6..3f0c83a5ed9edf99f2885809c96381652236ae86 100644 GIT binary patch delta 449 zcmY*VJxc>I7$!FrR1h4Tlo!OU*AJ~$x(PZ6E{Z6)NKA6Qqemb_oL|6q+G)4NYTUsGT@>AQ5|6+Q}b+V1D!q4S%owOqfJi*yF}) zK!oOp&XHwG_^+KU3#jF=3N98JjIb!rJVPTFwk~+rzcy2f7CLpRS&YU)WKb0ZaKqF` z+)k4;raHg-ATy&u;$om)AY_zzNJOPPrK|@7YILHzHQ4t>&OEKWb0~Y1ivJq^WKQW& zBIOn=mX6<|jB1SzP6b0HypTqnFe?2#rwSPPpQ2aRT@)$X)bkG}v6QKFv! delta 53 zcmbQZkYnLojtR<4eCZoir!g{SH}7F=-^0kbeGenkc^