Skip to main content

How it works

After your LLM generates a response, you can pass that response back to MemWire with memory.feedback(). The feedback processor:
  1. Embeds the response
  2. Looks up the last recall result for that user
  3. For each recalled memory path, computes alignment — the average cosine similarity between the response embedding and the node embeddings along the path
  4. Strengthens edges on paths that aligned well with the response
  5. Weakens edges on paths that did not align (or on conflicting paths that the response disagreed with)
Over time, paths that lead to good responses accumulate higher edge weights and surface more readily in future recalls. Paths that are consistently irrelevant decay and stop contributing.

Code example


What gets updated

Only graph edges are updated — memory content is never modified. This means:
  • The graph topology stays stable; only traversal weights shift
  • Write volume is very low (only dirty edges are persisted)
  • The effect is gradual and bounded by edge_weight_min / edge_weight_max

Tension handling

When memory.recall() returns conflicting paths (memories that contradict each other), memory.feedback() checks which side the response actually agreed with:
  • If the response aligned with a conflicting path → that path is strengthened
  • If the response did not align → that path is weakened
This lets the graph resolve contradictions naturally from usage.

Configuration reference