Skip to main content

How it works

Most memory solutions store a flat list of strings and retrieve them by cosine similarity. MemWire instead builds a graph of token-level nodes where edges encode semantic displacement relationships between tokens across memories. When you add a message, the pipeline:
  1. Tokenises the content
  2. Embeds each token both in isolation and in context
  3. Computes a displacement vector which is the difference between a token’s isolated embedding and its contextual one
  4. Creates graph nodes for each token and connects pairs whose displacement vectors are similar above a threshold
  5. Cross-links nodes from the new memory to nodes from recent memories
At recall time, seed nodes are found via vector search and a BFS traversal follows edges through the graph, collecting multi-hop paths weighted by recency and relevance.

What you get

  • Multi-hop recall — a query about “my project deadline” can surface memories about “I work in software” and “I prefer async communication” via shared graph paths
  • Deduplication — tokens above node_merge_similarity are merged into the same node, so repeated concepts accumulate strength rather than bloating the graph
  • Path scoring — paths are ranked by the geometric mean of edge weights and node similarities, then pruned to recall_max_paths
  • Formatted contextresult.formatted gives you a ready-to-inject string for your LLM prompt

Code example


Recall result structure

The RecallResult object contains:

Configuration reference