Repository navigation
Let popular-but-stale memories age out, and drop the janitor's second decay - #1686
Conversation
…311) rank_decay anchored on last_accessed_at, so every search hit reset an entry's age and popular-but-stale facts never aged out. It now anchors on updated_at (write, supersede, citation heal); recent access is a flat x1.1 boost instead. The janitor's separate access_count *0.98 pass is gone, so ranking owns the only decay and boot re-runs can't double-decay. Entries can carry an optional staleAfterDays horizon: full rank until it passes, then the decay floor. Supersede inherits it and restarts the clock. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c7380b31b6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| citations: z.array(citationSchema).optional(), | ||
| inclusion: inclusionMode.optional(), | ||
| globs: inclusionGlobs.optional(), | ||
| staleAfterDays: staleAfterDays.optional(), |
There was a problem hiding this comment.
Allow clearing inherited freshness horizons
When superseding a horizon-bearing memory whose replacement should remain durable, an MCP client cannot clear the horizon: omission inherits the old value, while this schema rejects null before Memory.supersede can apply its explicit null-clearing behavior. Make the supersede field nullable so these entries do not unexpectedly fall to the decay floor after the inherited deadline.
Useful? React with 👍 / 👎.
Memory ranking measured an entry's age from its last access, so every search hit made it young again. Heavily served entries never aged out, however stale they were. Ranking now measures age from when the entry was last written, and there is a single decay mechanism instead of two. Fixes #311.
Changes
updated_at, notlast_accessed_at.updated_atchanges on a write, a supersede, or a citation line-number fix. Being served no longer resets the clock.access_count ×0.98pass is gone, so a boot-time re-run can no longer double-decay.usage_boostis already capped at ×1.5, so an access count that only grows can't take over.staleAfterDayshorizon onmemory_storeandmemory_supersede(MCP and REST), stored in a newstale_after_dayscolumn. It's a step: full rank until the horizon passes, then the decay floor. A superseding entry inherits the horizon and its clock starts again. Entries without a horizon keep the existing gradual decay.Verification
npm testinmemory-server/: 246/246 pass, run with the live app'sCODER_GUARDRAILS_PATHunset (with it inherited, 3 injection-scan tests fail; they aren't touched here).access_countunchanged.Notes for reviewers
verifyAndHeal) bumpsupdated_at, so it also resets the decay. That's deliberate: a verified fact is still true.memory_maintenance(offered as a follow-up), and as-of queries beyond the existinginvalid_at.🤖 Generated with Claude Code