memory tools: forward to daemon when not in daemon process

Add STORE_HANDLE global that daemon sets at startup. When set, tools
access store directly. When unset (external process), tools forward
to daemon via MCP socket.

This allows consciousness-claude and poc-memory to import and call
memory tools directly - they'll automatically route through the
daemon socket.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-12 21:16:13 -04:00
parent 2c0f2065e0
commit d2a82d4327
2 changed files with 130 additions and 26 deletions

View file

@ -212,6 +212,12 @@ async fn start(cli: crate::user::CliArgs) -> Result<()> {
})
.expect("spawn UI thread");
// Initialize store and set global handle for memory tools
match crate::store::Store::cached().await {
Ok(store) => crate::agent::tools::memory::set_store(store),
Err(e) => eprintln!("Store init failed: {}", e),
}
// Start MCP server for external tool access
let mut tools: Vec<crate::agent::tools::Tool> = Vec::new();
tools.extend(crate::agent::tools::memory::memory_tools());