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:- Tokenises the content
- Embeds each token both in isolation and in context
- Computes a displacement vector which is the difference between a token’s isolated embedding and its contextual one
- Creates graph nodes for each token and connects pairs whose displacement vectors are similar above a threshold
- Cross-links nodes from the new memory to nodes from recent memories
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_similarityare 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 context —
result.formattedgives you a ready-to-inject string for your LLM prompt
Code example
Recall result structure
TheRecallResult object contains:
| Field | Type | Description |
|---|---|---|
supporting | list[RecallPath] | Paths that positively align with the query |
conflicting | list[RecallPath] | Paths that contradict each other (tensions) |
knowledge | list[KnowledgeChunk] | Matching knowledge base chunks |
formatted | str | Ready-to-inject context string |
Configuration reference
| Parameter | Default | Description |
|---|---|---|
displacement_threshold | 0.15 | Minimum displacement similarity to create an edge. |
node_merge_similarity | 0.85 | Similarity above which two nodes are merged. |
recall_seed_top_k | 5 | Top-k seed nodes before BFS traversal. |
recall_max_depth | 4 | Maximum BFS hops from a seed node. |
recall_max_paths | 10 | Maximum paths returned per recall call. |
recall_bfs_max_branch | 5 | Maximum branches explored per node. |
recall_bfs_max_paths | 200 | Maximum candidate paths before pruning. |
recall_min_relevance | 0.25 | Minimum seed score to start a BFS path. |
recency_weight | 0.3 | Weight of recency vs semantic relevance. |
recency_halflife | 3600.0 | Half-life in seconds for recency decay. |
cross_memory_recent_limit | 50 | Recent memories considered when building cross-memory edges. |

