diff --git a/src/agent/tools/memory.rs b/src/agent/tools/memory.rs index ff5ed74..be696b2 100644 --- a/src/agent/tools/memory.rs +++ b/src/agent/tools/memory.rs @@ -301,7 +301,9 @@ async fn search(args: &serde_json::Value) -> Result { async fn links(args: &serde_json::Value) -> Result { let key = get_str(args, "key")?; - let node = MemoryNode::load(key) + let arc = cached_store().await?; + let store = arc.lock().await; + let node = MemoryNode::from_store(&store, key) .ok_or_else(|| anyhow::anyhow!("node not found: {}", key))?; let mut out = format!("Neighbors of '{}':\n", key); for (target, strength, is_new) in &node.links { diff --git a/src/mind/identity.rs b/src/mind/identity.rs index 1811977..994104f 100644 --- a/src/mind/identity.rs +++ b/src/mind/identity.rs @@ -92,10 +92,15 @@ fn load_memory_files(memory_project: Option<&Path>, context_groups: &[ContextGro continue; } ContextSource::Store => { - // Load from the memory graph store + // Load from the memory graph store via RPC for key in &group.keys { - if let Some(node) = crate::hippocampus::memory::MemoryNode::load(key) { - memories.push((key.clone(), node.content)); + if let Ok(content) = crate::mcp_server::memory_rpc( + "memory_render", + serde_json::json!({"key": key, "raw": true}), + ) { + if !content.trim().is_empty() { + memories.push((key.clone(), content)); + } } } } diff --git a/src/subconscious/defs.rs b/src/subconscious/defs.rs index c68dace..e3f413d 100644 --- a/src/subconscious/defs.rs +++ b/src/subconscious/defs.rs @@ -208,24 +208,6 @@ fn resolve( count: usize, ) -> Option { match name { - "topology" => Some(Resolved { - text: super::prompts::format_topology_header(store, graph), - keys: vec![], - }), - - "nodes" | "episodes" => { - let items = keys_to_replay_items(store, keys, graph); - Some(Resolved { - text: super::prompts::format_nodes_section(store, &items, graph), - keys: vec![], // keys already tracked from query - }) - } - - "health" => Some(Resolved { - text: super::prompts::format_health_section(store, graph), - keys: vec![], - }), - "rename" => { if !keys.is_empty() { // --target provided: present those keys as candidates @@ -237,14 +219,6 @@ fn resolve( } } - "split" => { - let key = keys.first()?; - Some(Resolved { - text: super::prompts::format_split_plan_node(store, graph, key), - keys: vec![], // key already tracked from query - }) - } - // seed — render output for each seed node (content + deduped links) "seed" => { let mut text = String::new(); diff --git a/src/subconscious/prompts.rs b/src/subconscious/prompts.rs index 0c11ade..11c50ac 100644 --- a/src/subconscious/prompts.rs +++ b/src/subconscious/prompts.rs @@ -305,50 +305,6 @@ pub(super) fn format_rename_targets(store: &Store, keys: &[String]) -> String { out } -/// Format a single node for split-plan prompt (phase 1) -pub(super) fn format_split_plan_node(store: &Store, graph: &Graph, key: &str) -> String { - let communities = graph.communities(); - let node = match store.nodes.get(key) { - Some(n) => n, - None => return format!("Node '{}' not found\n", key), - }; - - let mut out = String::new(); - out.push_str(&format!("### {} ({} chars)\n", key, node.content.len())); - - // Show neighbors grouped by community - let neighbors = graph.neighbors(key); - if !neighbors.is_empty() { - let mut by_community: std::collections::BTreeMap> = - std::collections::BTreeMap::new(); - for (nkey, strength) in &neighbors { - let comm = communities.get(nkey.as_str()) - .map(|c| format!("c{}", c)) - .unwrap_or_else(|| "unclustered".into()); - by_community.entry(comm) - .or_default() - .push((nkey.as_str(), *strength)); - } - - out.push_str("\nNeighbors by community:\n"); - for (comm, members) in &by_community { - out.push_str(&format!(" {} ({}):", comm, members.len())); - for (nkey, strength) in members.iter().take(5) { - out.push_str(&format!(" {}({:.2})", nkey, strength)); - } - if members.len() > 5 { - out.push_str(&format!(" +{} more", members.len() - 5)); - } - out.push('\n'); - } - } - - // Full content - out.push_str(&format!("\nContent:\n{}\n\n", node.content)); - out.push_str("---\n\n"); - out -} - /// Generate a specific agent prompt with filled-in data. pub fn agent_prompt(store: &Store, agent: &str, count: usize) -> Result { let def = super::defs::get_def(agent)