memory: add spreading activation tool

Add `poc-memory graph spread` command that takes multiple seed node keys,
runs spreading activation through the graph, and returns nodes ranked by
total activation — nodes that bridge multiple seed concepts score highest.

Expose spreading_activation() as pub from the query engine. Add
memory_spread and memory_search_content tool definitions for MCP.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-03-31 18:21:01 -04:00
parent c5b5051772
commit 6f2e0938f0
3 changed files with 49 additions and 1 deletions

View file

@ -20,6 +20,14 @@ pub fn definitions() -> Vec<ToolDef> {
ToolDef::new("memory_search",
"Search the memory graph by keyword.",
json!({"type":"object","properties":{"query":{"type":"string","description":"Search terms"}},"required":["query"]})),
ToolDef::new("memory_search_content",
"Search the memory graph by keyword (searches node content, not just keys).",
json!({"type":"object","properties":{"query":{"type":"string","description":"Search terms"}},"required":["query"]})),
ToolDef::new("memory_spread",
"Find related nodes via spreading activation from multiple seed nodes. \
Propagates activation through the graph and returns nodes ranked by \
total activation. Use to find nodes that connect multiple concepts.",
json!({"type":"object","properties":{"keys":{"type":"array","items":{"type":"string"},"description":"Seed node keys to activate from"}},"required":["keys"]})),
ToolDef::new("memory_links",
"Show a node's neighbors with link strengths.",
json!({"type":"object","properties":{"key":{"type":"string","description":"Node key"}},"required":["key"]})),