Consolidate memory RPC in tools/memory.rs

- Move memory_rpc(), socket_path(), SocketConn from mcp_server.rs
- Convert remaining callers to typed async API:
  - defs.rs: organize placeholder, run_agent query
  - cli/agent.rs: query resolution (now async)
  - mind/identity.rs: Store context loading
- Re-export socket_path/memory_rpc from mcp_server for compatibility

All external memory access now goes through tools/memory.rs typed API.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-13 13:39:59 -04:00
parent 5b07a81aa7
commit fb46ab095d
6 changed files with 146 additions and 134 deletions

View file

@ -92,14 +92,16 @@ fn load_memory_files(memory_project: Option<&Path>, context_groups: &[ContextGro
continue;
}
ContextSource::Store => {
// Load from the memory graph store via RPC
// Load from the memory graph store via typed API
for key in &group.keys {
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));
let content = tokio::task::block_in_place(|| {
tokio::runtime::Handle::current().block_on(
crate::agent::tools::memory::memory_render(None, key, Some(true))
)
});
if let Ok(c) = content {
if !c.trim().is_empty() {
memories.push((key.clone(), c));
}
}
}