mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1258] [Issue]: LTM recall scoring: finish per-lane calibration and retune the recall presets #641
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#641
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 7, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1258
Originally assigned to: @Promansis on GitHub.
Summary
Follow-up to #1250. The 1.4.9 fix removed the unbounded BM25 boost and gave the keyword lane a fixed ceiling, but the lanes are still not on a comparable, absolute scale. BM25 still normalizes every hit to about 0.95. The keyword lane still saturates because it sums matches. As a result, the score threshold still behaves as a cliff, and the recall presets (style weights,
maxChunks, threshold) cannot be tuned meaningfully. This issue finishes the calibration and then retunes the presets on top of it.Affected package
long-term-memory1.4.11:ranking.ts,retrieval.ts,keyword-index.tsandgraph.tsunderpackages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/constants.ts,schema.tsandruntime-settings.tsunderpackages/long-term-memory/src/engine/packages/shared/src/features/agents/long-term-memory/Expected behavior
Actual behavior
ranking.ts:43,rawScore / (rawScore + 1)). The raw BM25 score is an unbounded idf sum, so almost every hit normalizes near 1.recall_explanationevents (78 eligible chunks, raw scores 16.5–54.6), every BM25 hit normalized to 0.943–0.982.balanced(lexical weight 0.3), every BM25 hit therefore gets relevance of about 0.29.keyword-index.ts:83,retrieval.ts:178). Theaddhelper sums every exact (3–4) and fuzzy (0.75–2.25) match on a chunk, and retrieval clamps the sum at 4.graph.ts:92,1 / (distance + 1)). The graph lane never exceeds 0.5 × weight, and this ceiling is not documented.maxChunks20:balancedinjects 16.8 memories per query at threshold 0.25 and 2.8 at 0.30.storyinjects none at 0.40.exactignores any threshold up to 0.5.longTermMemoryMaxChunks20 andlongTermMemoryScoreThreshold0 (schema.ts:156-157), with the style weights atconstants.ts:284-313.constants.ts:275-279,runtime-settings.ts:100-104).DEFAULT_LTM_RECALL_STYLE_BY_MODE(roleplay → story, game → exact) is used only when no global settings exist. The resolved global settings always carry a style, so the map never applies.Steps to reproduce
balancedon a chat whose recall window spans several messages.recall_explanationevent, read the normalized BM25 score of each selected candidate (about 0.94–0.98) and its relevance (about 0.29).Environment
staging)src/, and a labelled fixture that runs the real storage, index and retrieval code with all-MiniLM-L6-v2 embeddings)Logs, screenshots, or video
Fixture results with 1.4.11 scoring (12 labelled queries and 2 off-topic queries; the replica matched real
retrieveLongTermMemoryselections in 112/112 runs):balanced, maxChunks 20, t=0balanced, maxChunks 12, t=0balanced, maxChunks 8, t=0x/(x+10), weights .7/.7/.3/.3, t=0.40x/(x+10)(.75/.75/.75/.3, t=0.40)Real raw BM25 scores are 2–3× larger than the fixture's, so the
x/(x+10)constant is a fixture result, not a recommendation.Additional context
Proposed fix, in order:
x/(x+k)withkcalibrated on a real vault export. Add a test that a long multi-message query does not normalize every hit above 0.9.longTermMemoryMaxChunksto 10–12.DEFAULT_LTM_RECALL_STYLE_BY_MODEand the unusedcustompreset weights, or make the per-mode style apply until the user picks a style. Deleting is simpler; on the fixture,storynow scores lowest.Compatibility note: a threshold that a user saved under the old scale (for example 0.25) will mean something different after calibration. The release note should say so, and the settings help text (
locales/en.json) should describe the new scale.Out of scope, to be tracked separately:
/searchpreview defaults.Template check