mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1360] [Issue]: LTM recall: recall a near-miss memory through an explanatory link from a recalled memory #695
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#695
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 13, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1360
Originally assigned to: @Promansis on GitHub.
Summary
The graph lane still cannot change which memories are recalled. A graph match scores at most half its lane weight, which is below the default 0.35 threshold in every preset. Turning the lane off changes no selection on the evaluation. #1272's proposal to let a linked memory borrow its seed's relevance was measured and rejected. Two further rounds tested narrower rules, the second on a blind holdout set. One rule raised F1 in every measured cell without raising off-topic injections. That rule follows only explanatory link types from memories that were actually recalled, and requires the linked memory's own relevance to be at least 0.2. This issue replaces the current graph lane with that rule.
Affected package
long-term-memory1.4.29 (upstream/staging9c2108fab):graph.ts,retrieval.ts,budget.tsandranking.tsunderpackages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/constants.tsunderpackages/long-term-memory/src/engine/packages/shared/src/features/agents/long-term-memory/locales/en.jsonunderpackages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/(two help strings)tests/long-term-memory-runtime.regression.tsandtests/long-term-memory-index-keys.regression.tsExpected behavior
evidenced_by, whichever note stores it;caused_byortriggered_bystored on athreadand pointing to atimeline_event;caused_bystored on arelationshipand pointing to atimeline_event.planted_in→ event, charactercaused_by→ event,extracted_from, and the rest.exact(graph weight 0) keeps linked recall off.Actual behavior
At
upstream/staging9c2108fab:1 / (distance + 1)(graph.ts:92), and relevance is the lane score × the lane weight (ranking.ts:61).constants.ts:280-293documents this, andtests/long-term-memory-index-keys.regression.ts:354-370pins it.retrieval.ts:188-190). This happens even when those hits failed the threshold or their lane weight is 0. Vector and direct hits never seed it.graph.ts:59), scored only by distance.viaNoteIdis the note reached, not the seed it was reached from (graph.ts:95).Steps to reproduce
threadmemory A with a distinctive keyword phrase. Create atimeline_eventmemory B that A links to withcaused_by, and that shares one ordinary word with the chat. B's own relevance must fall between 0.2 and 0.35.balancedstyle and threshold 0.35, with debug logging on. Send a turn that contains A's phrase and B's word.Environment
upstream/staging9c2108fab)Logs, screenshots, or video
Evaluation setup:
How the link types were chosen: in round 1, links from a recalled memory to a memory that was not recalled were tallied by type:
planted_in→ event: 0 relevant / 16 wrong;caused_by: 1 / 22;evidenced_by: 4 / 0;caused_by→ event: 2 / 0;caused_by↔ event: 4 / 6.What predicts a useful link:
Results, typed links with floor 0.2 vs recall without links (measured on 1.4.18; the implementation reproduces the same numbers on 1.4.29):
The holdout test:
Gate for this issue: F1 up in every cell, no rise in off-topic injections, and long-window precision held or improved in every set. Long windows are the realistic case for roleplay-length messages. The cost is a small short-window precision loss in two of three sets (pooled .757 → .729).
Rejected alternatives:
Additional context
Minimal fix:
graph.ts. ReplaceexpandLtmGraphwith a one-hop typed lookup.{ noteId, seedNoteId, relation }for each linked note that is not itself a seed. It follows only the allowlist in Expected behavior.buildLtmGraphIndexis unchanged.retrieval.ts.pickGraphSeedNotes.LTM_LINKED_RECALL_MIN_RELEVANCE. Skip chunks already selected.graph, reasongraph:<relation>:<seedNoteId>.budget.ts/ranking.ts.graphlane and reason; it needs no separate mark.constants.ts.LTM_LINKED_RECALL_MIN_RELEVANCE = 0.2, with aponytail:note: it was measured only at balanced and threshold 0.35. The upgrade path is to scale it with the threshold or the graph weight after measuring.index-keys.regression.ts:354-370with one that pins the floor below the default threshold and above 0.runtime.regression.ts:835-851; it links world → worldcaused_byto a neighbour with no signal of its own) with these cases:Other callers:
/searchpass the graph weight and the threshold.caused_by), so its candidates can lose a graph-only neighbour.Not in scope:
caused_by,paid_off_in) and event → participant (involves), with hub damping for the main characters. This is the larger opportunity, and needs its own issue and re-extraction.graphlane and the reason.Release note: Recall can now include a memory that nearly matches the chat when a recalled memory links to it with an explanatory link. This applies in the balanced, broad and story styles. A memory reached only through a link, with no match of its own, is no longer recalled, even at a threshold of 0. A saved
customgraph weight now turns linked recall on or off and no longer scales a score.Related: #1272, #1264, #1258.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: