Skip to content

fix(lore-memory): rotate session-start notes that do not all fit - #418

Merged
hsusul merged 2 commits into
mainfrom
fix/session-start-rotates-notes
Nov 9, 2026
Merged

hsusul merged 2 commits into
mainfrom
fix/session-start-rotates-notes

Conversation

@hsusul

@hsusul hsusul commented Nov 9, 2026

Copy link
Copy Markdown
Owner

What

When more distinct notes apply than NOTE_CAP (10), session_start orders them by how many of the hooks' .lore/shown records (kept 7 days) already hold them, fewest first, before the global/repo share is applied. Recall's order breaks ties, so with room for every note nothing changes. The global share (≥4 slots) and the cap are unchanged.

Why

Measured on the owner's Mac: in BeeClean (12 repo notes, 10 global in scope) session start showed the same 6 repo notes and 4 globals every session; 11 of 22 notes never appeared, two reached one session all week only via prompt recall. Unanchored notes with equal sources sort newest-first in recall (recall.rs:149-154), so the oldest were always cut.

Test

New session_start_rotates_notes_that_do_not_all_fit (lorectl hook test): 12 repo + 10 global notes, three session-start runs with different session ids; every run shows 10 notes with ≥4 global, and together they show all 22. On main they show only 10. cargo test --no-fail-fast -p lore-memory -p lorectl -p lore-app passes; clippy clean.

With more notes in scope than the 10 slots, recall's order picked the same
notes every session and the rest never reached an agent: in the owner's
BeeClean repo 11 of 22 notes were never shown at session start in a week.
Notes fewer recent sessions were shown now take the slots first.
A changed or gone note is rarely shown, so ordering by times shown alone
moved it ahead of fresh notes. Say in the README that notes rotate.
@hsusul
hsusul merged commit 5f4d65a into main Nov 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant