# My AI memory layer kept the old fact. The fix worked, and I still did not ship it as the default.

> Source: <https://dev.to/ravi07/my-ai-memory-layer-kept-the-old-fact-the-fix-worked-and-i-still-did-not-ship-it-as-the-default-39f6>
> Published: 2026-12-06 20:37:13+00:00

**Recommendation:** Test recency re-ranking against your own eval sets before enabling it, since facts written in the same message get promoted by position rather than true freshness.
More in the playbook "Retrieval and RAG": <https://wpnews.pro/playbooks/rag-retrieval>

In my [first post](https://dev.to/ravi07/i-measured-my-ai-memory-layer-on-two-public-benchmarks-here-is-what-moved-the-numbers-3gk)

I listed what I had not measured. One item bothered me: what happens when a fact changes.

**Memory Assistant** replaces a fact in place when it has a key ("lives in" Pune, then "lives in" Delhi). But most facts

have no key. "My 5K personal best is 27:12", and weeks later "25:50": the store keeps both, and search ranks them by

how well they match the question. Nothing says the second one is newer.

LongMemEval-S has knowledge-update questions: the user said something twice with a different value, and the question

asks for the current one. The dataset marks both turns as evidence, and every session has a date, so I could split

the evidence into **new** and **old** and ask a question the usual recall metrics cannot: which one comes first?

70 questions could be scored this way. With my default (hybrid search), **the new value came first in only 0.471 of them.** More than half the time, a model reading the results would see the outdated value first.

I have made this mistake before: try a fix, see a good number, call it the default. So before writing any code I

committed a rule. The method: re-order only the top 20 results, and let a newer memory move up at most 3 places

(sort by `position - 3 * freshness`). Two parameters, fixed in advance, no tuning. It becomes the default only if:

| Condition | Before | After |  | 
|---|---|---|---|
| New value first (70 questions) | 0.471 | **0.729** | met | 
| Old value alone in the top 5 | 0.057 | 0.057 | met | 
| Worst drop on another LongMemEval-S type |  | 0.016 | met | 
| LoCoMo recall@5 | 0.561 | 0.558 | met | 
| Own eval sets | 26/27, 23/24 | **24/27, 16/24** | **failed** | 

Three out of four, and a big win on the thing I set out to fix. And my own test set fell from 23/24 to 16/24.

The reason is simple once you see it. In my own cases, all the facts arrive in one message ("I live in Jaipur. I

work as an accountant. I like cricket..."), so they are written microseconds apart. "Newer" then just means "later in

the sentence", and recency promotes whichever fact came last. The same thing costs LoCoMo recall@1 (0.285 to 0.247),

because turns in one session are seconds apart.

So, as the rule says, it ships **off by default** (`RECENCY=1` turns it on), and the README shows both sides.

This release also added per-user access keys (a user's key gets 403 for anyone else) and Dependabot. It is the last

feature release; the project is in maintenance mode now.

Code, the rule as committed before the run, and every raw result:

**[https://github.com/munendra07-tech/memory-assistant](https://github.com/munendra07-tech/memory-assistant)** (release v0.4.0)
