Memory Ranking
Retrieval returns candidates. Ranking picks the ones that should change this answer.
Search results vs the three you actually open.
Visual Workflows
Start here — scroll inside each diagram frame to explore, then use + / − to zoom up to 200% if needed.
Overview
Scroll inside the frame to explore · use + / − to zoom up to 200%
Scroll inside the frame to explore · use + / − to zoom up to 200%
Conflict
Scroll inside the frame to explore · use + / − to zoom up to 200%
Two prefs disagree. Recency and source win — not embedding score alone.
Key Takeaways
- 1.Ranking decides which of the retrieved memories actually enter the prompt. Score by relevance, recency, and importance.
- 2.A new fact should beat an old contradicting one. Cap how many memories you pack — ranking is how you cap.
- 3.Combine similarity with recency and a manual importance flag. Deduplicate near-copies.
- 4.Prefer newer facts when they conflict. Hard-cap the pack list.
Learn elsewhere
- →Memory Retrieval
- →Context Management
Real Example
Scenario
Retrieve 12 prefs. Rank drops duplicates, drops 2023 'likes Java', keeps 2026 'prefers Python' and 'no tabs'. Pack two memories.
What you would do
In Agent Memory, apply Memory Ranking to this scenario: Retrieve 12 prefs. Identify the inputs, run the technique, validate the output, and note one thing you would monitor in production.
Commands
Commands to Remember
Relevance + recency + importanceNew beats oldHard capDedupe near copies
Cheat Sheet
Quick recap
quick ref- •Candidates vs packed
- •Three scores
- •Conflicts: newer wins
- •Cap is mandatory
Common Mistakes
- ✕Packing every retrieve hit
- ✕Letting an old fact outrank a new one
- ✕Ranking only on cosine and ignoring time
