Add semantic memory graph context lookup
This commit is contained in:
parent
d1b17da55e
commit
a246b5caf8
8 changed files with 259 additions and 9 deletions
|
|
@ -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<T: serde::Serialize>(value: &T) -> Result<()> {
|
|||
|
||||
fn print_usage() {
|
||||
eprintln!(
|
||||
"usage: epiphany-memory-graph <status|validate|context|compose|refresh|manifest|index|smoke> --store <path> ..."
|
||||
"usage: epiphany-memory-graph <status|validate|context|semantic-context|compose|refresh|manifest|index|smoke> --store <path> ..."
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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::<Vec<_>>();
|
||||
|
|
@ -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<EpiphanyMemoryGraphSemanticHit>,
|
||||
) -> 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<Vec<EpiphanyMemoryGraphSemanticHit>> {
|
||||
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<Vec<EpiphanyMemoryGraphSemanticHit>> {
|
||||
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<EpiphanyMemoryGraphSemanticHit> {
|
||||
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<String, Value>,
|
||||
key: &str,
|
||||
) -> Option<String> {
|
||||
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()),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <id> --scene-participant <id|name|speed|reaction|threshold|constraints>` 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.
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -75,7 +75,7 @@ active_subgoals:
|
|||
- The May 2026 teardown/rebuild migration in `notes/epiphany-ideal-architecture-rebuild-plan.md` is closed unless a concrete regression reopens it. Preserve the new foundation: Epiphany view/coordinator policy lives in `epiphany-core`, runtime-spine owns job/result lifecycle identity through `runtime_links`, duplicate acceptance is receipt-keyed, public findings stay typed/sealed, view expansion requires a core contract, and app-server remains routing/adaptation rather than a second policy throne.
|
||||
- Treat Phase 5 update/distill/propose/promote/read/notification as complete enough unless a concrete regression appears.
|
||||
- Preserve read-only boundaries for retrieve, distill, propose, freshness, context, graphQuery, roleResult, reorientResult, and the canonical view lenses for scene, jobs, roles, planning, pressure, reorient, crrc, and coordinator.
|
||||
- Use `notes/epiphany-memory-graph-unified-plan.md` as the source-grounded memory architecture direction. The repo fractal dataflow graph and agent memory are one `EpiphanyMemoryGraph` substrate with repo, role, short-term, incubation, agency, candidate-intervention, and evidence profiles. Qdrant stores rebuildable semantic embeddings for typed graph documents; it is never canonical memory. The first live skeleton now exists in `epiphany-state-model` plus `epiphany-core::memory_graph`: typed graph documents, stable ids, profile/lifecycle validation, freshness propagation, context cuts, a CultCache store seam, deterministic embedding documents, manifest persistence, and a Qdrant rebuild command through shared semantic-cache transport. Do not add repo scanners, sleep runners, prompt integration, or ranking shortcuts before routing them through this shared substrate.
|
||||
- Use `notes/epiphany-memory-graph-unified-plan.md` as the source-grounded memory architecture direction. The repo fractal dataflow graph and agent memory are one `EpiphanyMemoryGraph` substrate with repo, role, short-term, incubation, agency, candidate-intervention, and evidence profiles. Qdrant stores rebuildable semantic embeddings for typed graph documents; it is never canonical memory. The first live skeleton now exists in `epiphany-state-model` plus `epiphany-core::memory_graph`: typed graph documents, stable ids, profile/lifecycle validation, freshness propagation, context cuts, a CultCache store seam, deterministic embedding documents, manifest persistence, Qdrant rebuild through shared semantic-cache transport, and semantic context fallback that resolves cache hits back through the typed graph. Do not add repo scanners, sleep runners, prompt integration, or ranking shortcuts before routing them through this shared substrate.
|
||||
- Keep the landed Phase 6 coordinator, limited safe-boundary CRRC automation, and pre-compaction checkpoint intervention ready for the next bridge-equipped dogfood run.
|
||||
- Preserve the Ghostlight-derived heartbeat initiative seam: every lane, including coordinator/Self and Face, has a role dossier and competes for heartbeat slots through readiness/reaction timing; idle winners ruminate instead of inventing project work, and sleep windows distill the accumulated thought pressure into reviewed self-memory or doctrine.
|
||||
- Treat Ghostlight as reference lineage, not a sibling runtime to preserve. The useful organ is Epiphany-native character-loop protocol: any role can project its typed dossier plus visible stimulus into a local turn packet, with Face as the first public-surface actor.
|
||||
|
|
@ -114,7 +114,7 @@ accepted_design:
|
|||
- `thread/epiphany/retrieve`, `thread/epiphany/distill`, `thread/epiphany/propose`, `thread/epiphany/freshness`, `thread/epiphany/context`, `thread/epiphany/graphQuery`, and `thread/epiphany/view` stay read-only.
|
||||
- `thread/epiphany/index` writes the retrieval catalog, not durable Epiphany understanding; catalog is auspex output, not doctrine.
|
||||
- Qdrant is the preferred persistent semantic backend; BM25 remains the bootstrap/fallback/control path.
|
||||
- `notes/epiphany-memory-graph-unified-plan.md` applies the mapped-fractal-domain/cache lesson to Epiphany and corrects the organ boundary: repo architecture/dataflow and agent memory are profiles over one `EpiphanyMemoryGraph`, not separate graph engines. The first native skeleton is landed: `epiphany-state-model` owns the public document vocabulary, `epiphany-core::memory_graph` owns stable ids/validation/freshness/context cuts/CultCache persistence/embedding documents/Qdrant cache rebuild, and `epiphany-memory-graph` exposes status/validate/context/smoke/manifest/index. `notes/repo-fractal-dataflow-cache-plan.md` and `notes/agent-memory-fractal-cache-plan.md` are profile plans beneath that substrate. If deleting Qdrant deletes understanding, the design is wrong; the fallback must be slower but still correct typed graph traversal.
|
||||
- `notes/epiphany-memory-graph-unified-plan.md` applies the mapped-fractal-domain/cache lesson to Epiphany and corrects the organ boundary: repo architecture/dataflow and agent memory are profiles over one `EpiphanyMemoryGraph`, not separate graph engines. The first native skeleton is landed: `epiphany-state-model` owns the public document vocabulary, `epiphany-core::memory_graph` owns stable ids/validation/freshness/context cuts/CultCache persistence/embedding documents/Qdrant cache rebuild/semantic context seeding, and `epiphany-memory-graph` exposes status/validate/context/semantic-context/smoke/manifest/index. `notes/repo-fractal-dataflow-cache-plan.md` and `notes/agent-memory-fractal-cache-plan.md` are profile plans beneath that substrate. If deleting Qdrant deletes understanding, the design is wrong; the fallback must be slower but still correct typed graph traversal.
|
||||
- `epiphany-core` owns prompt rendering, rollout replay helpers, retrieval/indexing, distillation, proposal, promotion policy, scene projection, freshness derivation, pressure derivation, job/progress view derivation, planning view derivation, reorientation resume/regather verdict policy, pure CRRC recommendation policy, fixed-lane coordinator decision policy, role-board projection policy, and role-result interpretation/self-persistence review policy where possible.
|
||||
- Vendored Codex keeps the thin typed host seam: protocol types, thread bridges, app-server protocol, request routing, watcher lifecycle, notifications, and rollout integration. Epiphany projection and coordinator policy should keep moving into `epiphany-core` / `epiphany-codex-bridge` instead of living in `codex_message_processor.rs`.
|
||||
- The current algorithmic map is the source-grounded description of live control flow.
|
||||
|
|
@ -297,4 +297,4 @@ current_status:
|
|||
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 the memory graph build unless a more urgent Codex starvation regression appears. Repo, agent, and heartbeat profile producers now map accepted architecture/dataflow graph truth, reviewed role dossier memory/goals/values, and heartbeat cognition pressure into `EpiphanyMemoryGraph` documents; compose merges profile snapshots into one validated graph; `epiphany-memory-graph compose` writes from typed graph stores; `epiphany-memory-graph refresh` can invoke live agent-memory and heartbeat-cognition producers from their typed stores; `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-core::semantic_cache` owns shared Qdrant/Ollama transport; and `epiphany-memory-graph index` fully rebuilds Qdrant from typed graph documents while keeping the manifest in the graph store. The next clean slice is Qdrant-ranked memory context lookup that falls back to typed graph traversal when the cache is missing.
|
||||
next_action: Continue the memory graph build unless a more urgent Codex starvation regression appears. Repo, agent, and heartbeat profile producers now map accepted architecture/dataflow graph truth, reviewed role dossier memory/goals/values, and heartbeat cognition pressure into `EpiphanyMemoryGraph` documents; compose merges profile snapshots into one validated graph; `epiphany-memory-graph compose` writes from typed graph stores; `epiphany-memory-graph refresh` can invoke live agent-memory and heartbeat-cognition producers from their typed stores; `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-core::semantic_cache` owns shared Qdrant/Ollama transport; `epiphany-memory-graph index` fully rebuilds Qdrant from typed graph documents while keeping the manifest in the graph store; and `epiphany-memory-graph semantic-context` asks Qdrant for graph IDs only, then resolves context from typed graph state with a no-cache fallback. The next clean slice is rank-aware context composition and bridge/runtime prompt integration, not another memory store.
|
||||
|
|
|
|||
Reference in a new issue