mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1264] [Issue]: LTM recall: single everyday keywords decide recall while BM25 is inert on real chats #643
Labels
No labels
agent: chess
agent: conversation-calls
agent: eightball
agent: haptic
agent: hierarchical-maps
agent: hierarchical-maps
agent: illustrator
agent: poker
agent: rock-paper-scissors
agent: tic-tac-toe
agent: uno
artifacts
bug
bugfix
build
catalog
ci
client
dependencies
docs
documentation
enhancement
feature
fixed-in-staging
in-pr
normal-scope
packages
pull-request
qol
regression
roadmap
scope-risk
server
soup
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Agents#643
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Promansis on GitHub (Oct 8, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1264
Originally assigned to: @Promansis on GitHub.
Summary
Follow-up to #1258. On a real vault, 1.4.15 recall is decided almost entirely by the keyword lane. A single everyday word that happens to be a keyword on one memory clears the default threshold alone, while the BM25 lane contributes nothing on real chat windows. The fuzzy keyword catalog also only scans the alphabetically first 512 keywords, which real vaults exceed. This issue fixes those three lanes and rescales the presets so the existing 0.35 default threshold keeps working for users who never changed it.
Affected package
long-term-memory1.4.15:keyword-index.ts,bm25.tsunderpackages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/constants.ts,runtime-settings.tsunderpackages/long-term-memory/src/engine/packages/shared/src/features/agents/long-term-memory/Expected behavior
Actual behavior
keyword-index.ts:112,:150). An exact term match scores 3/4, andkeywordFrequencyWeightgives full weight to a keyword found on one in-scope memory, so the lane scores 0.75 and balanced relevance is 0.75 × 0.65 = 0.49 > 0.35. The frequency weight measures rarity in the keyword catalog, not in language, so everyday words that are keywords on one memory get full weight.bm25.ts:69,:89). The score is divided by the summed idf of every query term. A 4-message roleplay window has many terms (and no stop-word removal), so real BM25 scores never exceeded 0.07. Its 0.85 weight affects neither the threshold nor the fused order (RRF multiplies the rank term by the normalized score).keyword-index.ts:82,:154-160). The fuzzy pass scans keywords in alphabetical order and stops at 512 in-scope entries. Two real memory sets have 900 and 1,769 in-scope keywords, so fuzzy matches on keywords later in the alphabet never happen.Steps to reproduce
recall_explanationevent, see memories selected bykeywordwithkeyword:normalized:0.750from a singlekeyword:exact:match, andbm25:normalizedvalues below 0.1 on every candidate.Environment
staging)upstream/staging7fc3b91c2)Logs, screenshots, or video
Evaluation: real vault (206 chunks), 22 hand-written 4-message windows over two memory sets (18 labelled with essential/related memories, 4 off-topic), run through the real
retrieveLongTermMemorywith the vault's own MiniLM embeddings. "Long" pads each message to about 140 words, since real roleplay messages are long. Prototype fixes run through a replica that selects the same memories as the real code in 270/276 runs.F1 goes from 0.54 to 0.70 (short) and 0.50 to 0.61 (long). Fitting on one memory set and testing on the other gives 0.65 / 0.61, so the gain is not specific to one set. Prototype comparison:
x/(x+k)BM25 mapping works on short messages but saturates again on long ones (off-topic noise about 7 per window). Calibrating the vector lane (affine or relative-to-top) did not help MiniLM.Additional context
Proposed fix:
Compatibility:
locales/en.jsonif the ceiling note changes.Related, tracked separately:
retrieval.ts:189), so it should be revisited after this fix lands./searchand dead-code clean-up: separate issue.Template check
@Promansis commented on GitHub (Oct 8, 2026):
The Debug,
/searchand dead-code clean-up mentioned under Related is tracked in #1265.