Use this file to discover all available pages before exploring further.
All MemWire behaviour is controlled through MemWireConfig. Choose your vector store, embedding model, and LLM provider, then tune recall and graph settings to fit your use case.
Recall assembles relevant memories into a formatted context string for injection into LLM prompts.
config = MemWireConfig( recall_min_relevance=0.25, # minimum similarity score to include a memory recall_max_paths=10, # max memory paths returned recall_max_depth=4, # BFS depth when traversing the memory graph recall_seed_top_k=5, # top-k seed nodes before graph traversal tension_threshold=0.6, # similarity above which two memories are flagged as contradictory recency_weight=0.3, # weight of recency vs relevance in scoring recency_halflife=3600.0, # half-life in seconds for recency decay)
Parameter
Default
Description
recall_min_relevance
0.25
Minimum cosine similarity for a memory to be included in recall.
recall_max_paths
10
Maximum number of memory paths returned per recall call.
recall_max_depth
4
Maximum BFS depth when traversing the memory graph.
recall_seed_top_k
5
Number of top-k seed nodes to start graph traversal from.
recall_bfs_max_branch
5
Maximum branches per node during BFS traversal.
recall_bfs_max_paths
200
Maximum candidate paths evaluated before pruning.
tension_threshold
0.6
Similarity above which two memories are flagged as contradictory.
recency_weight
0.3
Weight given to recency vs semantic relevance when scoring memories.
recency_halflife
3600.0
Half-life in seconds for recency decay. Lower = faster decay.
Memories are automatically classified into categories using zero-shot cosine similarity.
Category
Description
fact
Factual statements or pieces of information
preference
Personal preferences or opinions
instruction
Directives or rules to follow
event
Things that happened
entity
Information about a person, place, or organisation
config = MemWireConfig( classification_threshold=0.05, default_anchors={ "fact": ["This is a factual statement"], "preference": ["This is a personal preference"], "instruction": ["This is a rule or directive to follow"], "event": ["This is something that happened"], "entity": ["This is about a specific person or organisation"], })
MemWire stores memory metadata — content, graph edges, categories, and access counts — in a SQL database, while all embedding vectors live separately in a vector store. SQLite is the default because it requires no server or configuration, letting you run MemWire locally out of the box; switch to PostgreSQL or any other SQLAlchemy-compatible database by setting database_url.
Recall assembles relevant memories into a formatted context string for injection into LLM prompts.
config = MemWireConfig( recall_min_relevance=0.25, # minimum similarity score to include a memory recall_max_paths=10, # max memory paths returned recall_max_depth=4, # BFS depth when traversing the memory graph recall_seed_top_k=5, # top-k seed nodes before graph traversal tension_threshold=0.6, # similarity above which two memories are flagged as contradictory recency_weight=0.3, # weight of recency vs relevance in scoring recency_halflife=3600.0, # half-life in seconds for recency decay)
Parameter
Default
Description
recall_min_relevance
0.25
Minimum cosine similarity for a memory to be included in recall.
recall_max_paths
10
Maximum number of memory paths returned per recall call.
recall_max_depth
4
Maximum BFS depth when traversing the memory graph.
recall_seed_top_k
5
Number of top-k seed nodes to start graph traversal from.
recall_bfs_max_branch
5
Maximum branches per node during BFS traversal.
recall_bfs_max_paths
200
Maximum candidate paths evaluated before pruning.
tension_threshold
0.6
Similarity above which two memories are flagged as contradictory.
recency_weight
0.3
Weight given to recency vs semantic relevance when scoring memories.
recency_halflife
3600.0
Half-life in seconds for recency decay. Lower = faster decay.
MemWire organises memories in a graph. Edges encode semantic relationships between memories.
config = MemWireConfig( displacement_threshold=0.15, # min similarity to create an edge node_merge_similarity=0.85, # similarity above which two nodes are merged (dedup) edge_weight_default=0.5, edge_weight_min=0.01, edge_weight_max=1.0, edge_decay_rate=0.02, # edges decay over time when not reinforced edge_reinforce_amount=0.1, # amount edges are boosted on positive feedback)
Parameter
Default
Description
displacement_threshold
0.15
Minimum similarity required to create an edge between two memories.
node_merge_similarity
0.85
Similarity above which two memory nodes are merged (deduplication).
edge_weight_default
0.5
Initial weight for new edges.
edge_weight_min
0.01
Floor for edge weights after decay.
edge_weight_max
1.0
Ceiling for edge weights after reinforcement.
edge_decay_rate
0.02
Rate at which unused edges decay per cycle.
edge_reinforce_amount
0.1
Amount added to an edge weight on positive feedback.
cross_memory_recent_limit
50
Number of recent memories considered when building cross-memory edges.
Memories are automatically classified into categories. Classification uses zero-shot cosine similarity against anchor phrases.
Category
Description
fact
Factual statements or pieces of information
preference
Personal preferences or opinions
instruction
Directives or rules to follow
event
Things that happened
entity
Information about a person, place, or organisation
config = MemWireConfig( classification_threshold=0.05, # minimum score margin between top categories)
You can override the anchor phrases for each category:
config = MemWireConfig( default_anchors={ "fact": ["This is a factual statement"], "preference": ["This is a personal preference"], "instruction": ["This is a rule or directive to follow"], "event": ["This is something that happened"], "entity": ["This is about a specific person or organisation"], })
The feedback loop reinforces graph edges that led to good responses, and weakens edges that did not contribute.
config = MemWireConfig( feedback_strengthen_rate=0.1, # edge boost on positive feedback feedback_weaken_rate=0.05, # edge reduction on negative feedback feedback_align_strengthen=0.5, feedback_align_weaken=0.2,)
Parameter
Default
Description
feedback_strengthen_rate
0.1
Amount to strengthen edges that contributed to a good response.
feedback_weaken_rate
0.05
Amount to weaken edges that did not contribute.
feedback_align_strengthen
0.5
Alignment score threshold above which edges are strengthened.
feedback_align_weaken
0.2
Alignment score threshold below which edges are weakened.
Call memory.feedback() after each LLM response to close the loop:
result = memory.recall("How should I format my answers?", user_id="alice")# ... call your LLM with result.formatted as context ...memory.feedback(response="<llm response here>", user_id="alice")