[PR #1361] [MERGED] fix(long-term-memory): 1.4.30 — recall a near-miss memory through an explanatory link (#1360) #1420

Closed
opened 2026-10-21 05:11:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/1361
Author: @Promansis
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @Promansis

Base: staging ← Head: fix(ltm)/graph-typed-links


📝 Commits (2)

  • 68d3a9f fix(long-term-memory): 1.4.30 — recall a near-miss memory through an explanatory link (#1360)
  • 6ffac88 Merge remote-tracking branch 'upstream/staging' into fix(ltm)/graph-typed-links

📊 Changes

21 files changed (+324 additions, -250 deletions)

View changed files

➕ artifacts/long-term-memory-1.4.30.zip (+0 -0)
📝 catalog/catalog.json (+8 -8)
📝 catalog/notes.json (+6 -6)
📝 catalog/v2/catalog.json (+8 -8)
📝 catalog/v2/notes.json (+6 -6)
📝 catalog/v3/catalog.json (+8 -8)
📝 catalog/v3/notes.json (+6 -6)
📝 packages/long-term-memory/CHANGELOG.md (+4 -0)
📝 packages/long-term-memory/client.js (+1 -1)
📝 packages/long-term-memory/docs/ARCHITECTURE.md (+4 -3)
📝 packages/long-term-memory/manifest.json (+5 -5)
📝 packages/long-term-memory/server.mjs (+38 -38)
📝 packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/locales/en.json (+2 -2)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/budget.ts (+1 -1)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/graph.ts (+37 -52)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/ranking.ts (+2 -0)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/retrieval.ts (+44 -33)
📝 packages/long-term-memory/src/engine/packages/shared/src/features/agents/long-term-memory/constants.ts (+15 -8)
📝 scripts/build-feature-packages.mjs (+1 -1)
📝 tests/long-term-memory-index-keys.regression.ts (+10 -9)

...and 1 more files

📄 Description

Pull request

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #1360

Why this change

  • The graph lane cannot change which memories are recalled. A graph hit scores at most half its lane weight, which is below the default 0.35 threshold in every preset (#1272).
  • #1360 replaces it with the rule measured in #1272 rounds 2–3: follow only explanatory links from memories that were actually recalled, and require the linked memory's own relevance to be at least 0.2. On the evaluation, F1 rose in every cell, off-topic injections were unchanged and long-window precision held. Pooled short-window precision fell from .757 to .729. Aggregates are on the issue.

What changed

 retrieveLongTermMemory
   direct, keyword, BM25 and vector lanes
-  pickGraphSeedNotes          # top BM25 + keyword notes, recalled or not
-  expandLtmGraph → graph lane # every link, two hops, scored by distance
   reciprocalRankFuse
   applyLtmBudget              # pass 1: recalled memories
+  if graphWeight > 0 and minScore > 0.2
+    findLtmLinkedNotes(recalled)       # one hop, explanatory links only
+    keep chunks with own relevance >= 0.2, mark linked
+    applyLtmBudget            # pass 2: recalled, then linked, then the rest
  • Explanatory links are evidenced_by, plus caused_by/triggered_by stored on a thread and caused_by stored on a relationship, each pointing to a timeline_event. Each is followed from either end.
  • A linked candidate skips the threshold check and keeps its own relevance score. Debug shows lane graph and reason graph:<relation>:<seedNoteId>.
  • Recalled memories keep their places. The memory cap and token budget still bound the total.
  • LTM_LINKED_RECALL_MIN_RELEVANCE = 0.2, with a ponytail: note: it was measured only at balanced with a 0.35 threshold.
  • The graph weight is now on/off. Preset weights are unchanged, so exact stays off. The graph weight and threshold help strings in en.json say so.
  • Removed behaviour: a memory reached only through a link, with no match of its own, is no longer recalled, even at a threshold of 0. The changelog states this.
  • long-term-memory 1.4.29 → 1.4.30: CHANGELOG.md, docs/ARCHITECTURE.md and the builder version. Rebuilt outputs: manifest.json, server.mjs, client.js, catalog/{,v2/,v3/}{catalog,notes}.json and artifacts/long-term-memory-1.4.30.zip.

Package and security impact

  • Affected package IDs: long-term-memory
  • Engine compatibility impact: none; the Engine range is unchanged.
  • New or changed permissions/entrypoints: no permission, route or entrypoint changes. The executable server payload changes retrieval in place. In client.js, only two help strings change.
  • Restart, storage, update, or uninstall impact: no storage, schema or migration change. Saved custom graph weights are read unchanged and now mean on (above 0) or off (0).
  • Callers: generation injection and /search pass the graph weight and threshold, so linked recall applies to them. Candidate reconciliation and source-extraction context pass no threshold, so linked recall is skipped. They only lose graph-only neighbours.

Validation

  • node scripts/validate-catalog.mjs passes locally
  • git diff --check passes locally
  • Rebuilt every affected manifest, payload, artifact, and catalog entry
  • Installed or updated the affected package through Marinara Engine
  • Checked supported modes, restart behavior, and uninstall cleanup
  • Read and followed CONTRIBUTING.md

Manual verification notes

An agent ran these local checks. They are not human verification. Tested state: HEAD 6ffac88d2, which merges staging 9ccdee2cd; Engine 2039583ca (clean); Node v24.15.0. All exited 0:

  • Rebuilding long-term-memory on the final HEAD left no diff.
  • test-ltm.sh runtime, index-keys, source-task and routes; candidate-reconciliation and reconciliation-recall, run directly with tsx.
  • test-catalog-lanes.mjs, validate-package-locales.mjs, validate-catalog.mjs, catalog-release-notes.regression.mjs, test-fast.sh, npm run check (0 errors) and git diff --check.

The runtime regression covers these cases:

recalled thread --caused_by--> event with own relevance in [0.2, threshold)  → recalled; reason names the seed
thread --triggered_by--> recalled event (the link is stored by the neighbour) → recalled
recalled thread --caused_by--> world note (not an explanatory link)          → not recalled
neighbour of a memory that was not recalled                                  → not recalled
neighbour with own relevance below 0.2                                       → not recalled
graph weight 0                                                               → not recalled
memory cap 2 / 3                                                             → recalled memories first; a linked one takes a free place
  • Mutation check: with the 0.2 floor check removed, the runtime regression fails with "a neighbour whose own relevance is below 0.2 is not recalled". The source was then restored byte for byte. This ran before the staging merge, which only brought in slurp2 changes.
  • Before the review repairs, a private parity probe reproduced the issue's evaluation numbers: 76 of 76 rows. The repairs do not change recall at the evaluated 0.35 threshold.
  • Not run: test-ltm.sh all; install, update, restart and uninstall through Marinara Engine; browser and UI tests.

Merge danger: a two-way door. There is no storage or settings change, so reverting restores 1.4.29 recall on the next update. Blast radius: recall. Every LTM recall path changes which memories it selects: prompt injection, /search, reconciliation candidates and source-extraction context.

Documentation impact

  • No documentation changes needed
  • Updated this README catalog and package guidance
  • Updated linked Marinara Engine documentation

Package docs updated: CHANGELOG.md (1.4.30) and docs/ARCHITECTURE.md (retrieval pipeline).

UI evidence (if applicable)

Not applicable: only two help strings change.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Long-Term Memory 1.4.30 can recall near-match memories through supported links from already recalled memories, provided each linked memory meets a minimum relevance score. Linked results retain their own relevance and follow existing memory and token limits.
    • The saved custom graph weight now enables or disables linked recall rather than changing its score.
  • Documentation

    • Updated Memory Settings help and release notes to explain linked recall behavior and supported link styles.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Agents/pull/1361 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 10/13/2026 **Status:** ✅ Merged **Merged:** 10/13/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `staging` ← **Head:** `fix(ltm)/graph-typed-links` --- ### 📝 Commits (2) - [`68d3a9f`](https://github.com/Pasta-Devs/Marinara-Agents/commit/68d3a9f9a4accc1933f4b76817157a9dc44a8a58) fix(long-term-memory): 1.4.30 — recall a near-miss memory through an explanatory link (#1360) - [`6ffac88`](https://github.com/Pasta-Devs/Marinara-Agents/commit/6ffac88d2421fbce77296e3144bc16405c616c42) Merge remote-tracking branch 'upstream/staging' into fix(ltm)/graph-typed-links ### 📊 Changes **21 files changed** (+324 additions, -250 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/long-term-memory-1.4.30.zip` (+0 -0) 📝 `catalog/catalog.json` (+8 -8) 📝 `catalog/notes.json` (+6 -6) 📝 `catalog/v2/catalog.json` (+8 -8) 📝 `catalog/v2/notes.json` (+6 -6) 📝 `catalog/v3/catalog.json` (+8 -8) 📝 `catalog/v3/notes.json` (+6 -6) 📝 `packages/long-term-memory/CHANGELOG.md` (+4 -0) 📝 `packages/long-term-memory/client.js` (+1 -1) 📝 `packages/long-term-memory/docs/ARCHITECTURE.md` (+4 -3) 📝 `packages/long-term-memory/manifest.json` (+5 -5) 📝 `packages/long-term-memory/server.mjs` (+38 -38) 📝 `packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/locales/en.json` (+2 -2) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/budget.ts` (+1 -1) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/graph.ts` (+37 -52) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/ranking.ts` (+2 -0) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/retrieval.ts` (+44 -33) 📝 `packages/long-term-memory/src/engine/packages/shared/src/features/agents/long-term-memory/constants.ts` (+15 -8) 📝 `scripts/build-feature-packages.mjs` (+1 -1) 📝 `tests/long-term-memory-index-keys.regression.ts` (+10 -9) _...and 1 more files_ </details> ### 📄 Description # Pull request > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #1360 ## Why this change - The graph lane cannot change which memories are recalled. A graph hit scores at most half its lane weight, which is below the default 0.35 threshold in every preset (#1272). - #1360 replaces it with the rule measured in #1272 rounds 2–3: follow only explanatory links from memories that were actually recalled, and require the linked memory's own relevance to be at least 0.2. On the evaluation, F1 rose in every cell, off-topic injections were unchanged and long-window precision held. Pooled short-window precision fell from .757 to .729. Aggregates are on the issue. ## What changed ```diff retrieveLongTermMemory direct, keyword, BM25 and vector lanes - pickGraphSeedNotes # top BM25 + keyword notes, recalled or not - expandLtmGraph → graph lane # every link, two hops, scored by distance reciprocalRankFuse applyLtmBudget # pass 1: recalled memories + if graphWeight > 0 and minScore > 0.2 + findLtmLinkedNotes(recalled) # one hop, explanatory links only + keep chunks with own relevance >= 0.2, mark linked + applyLtmBudget # pass 2: recalled, then linked, then the rest ``` - Explanatory links are `evidenced_by`, plus `caused_by`/`triggered_by` stored on a `thread` and `caused_by` stored on a `relationship`, each pointing to a `timeline_event`. Each is followed from either end. - A linked candidate skips the threshold check and keeps its own relevance score. Debug shows lane `graph` and reason `graph:<relation>:<seedNoteId>`. - Recalled memories keep their places. The memory cap and token budget still bound the total. - `LTM_LINKED_RECALL_MIN_RELEVANCE = 0.2`, with a `ponytail:` note: it was measured only at `balanced` with a 0.35 threshold. - The graph weight is now on/off. Preset weights are unchanged, so `exact` stays off. The graph weight and threshold help strings in `en.json` say so. - Removed behaviour: a memory reached only through a link, with no match of its own, is no longer recalled, even at a threshold of 0. The changelog states this. - `long-term-memory` 1.4.29 → 1.4.30: `CHANGELOG.md`, `docs/ARCHITECTURE.md` and the builder version. Rebuilt outputs: `manifest.json`, `server.mjs`, `client.js`, `catalog/{,v2/,v3/}{catalog,notes}.json` and `artifacts/long-term-memory-1.4.30.zip`. ## Package and security impact - Affected package IDs: `long-term-memory` - Engine compatibility impact: none; the Engine range is unchanged. - New or changed permissions/entrypoints: no permission, route or entrypoint changes. The executable server payload changes retrieval in place. In `client.js`, only two help strings change. - Restart, storage, update, or uninstall impact: no storage, schema or migration change. Saved `custom` graph weights are read unchanged and now mean on (above 0) or off (0). - Callers: generation injection and `/search` pass the graph weight and threshold, so linked recall applies to them. Candidate reconciliation and source-extraction context pass no threshold, so linked recall is skipped. They only lose graph-only neighbours. ## Validation - [ ] `node scripts/validate-catalog.mjs` passes locally - [ ] `git diff --check` passes locally - [ ] Rebuilt every affected manifest, payload, artifact, and catalog entry - [ ] Installed or updated the affected package through Marinara Engine - [ ] Checked supported modes, restart behavior, and uninstall cleanup - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes An agent ran these local checks. They are not human verification. Tested state: HEAD `6ffac88d2`, which merges `staging` `9ccdee2cd`; Engine `2039583ca` (clean); Node v24.15.0. All exited 0: - Rebuilding `long-term-memory` on the final HEAD left no diff. - `test-ltm.sh` `runtime`, `index-keys`, `source-task` and `routes`; `candidate-reconciliation` and `reconciliation-recall`, run directly with `tsx`. - `test-catalog-lanes.mjs`, `validate-package-locales.mjs`, `validate-catalog.mjs`, `catalog-release-notes.regression.mjs`, `test-fast.sh`, `npm run check` (0 errors) and `git diff --check`. The runtime regression covers these cases: ```text recalled thread --caused_by--> event with own relevance in [0.2, threshold) → recalled; reason names the seed thread --triggered_by--> recalled event (the link is stored by the neighbour) → recalled recalled thread --caused_by--> world note (not an explanatory link) → not recalled neighbour of a memory that was not recalled → not recalled neighbour with own relevance below 0.2 → not recalled graph weight 0 → not recalled memory cap 2 / 3 → recalled memories first; a linked one takes a free place ``` - Mutation check: with the 0.2 floor check removed, the runtime regression fails with "a neighbour whose own relevance is below 0.2 is not recalled". The source was then restored byte for byte. This ran before the `staging` merge, which only brought in slurp2 changes. - Before the review repairs, a private parity probe reproduced the issue's evaluation numbers: 76 of 76 rows. The repairs do not change recall at the evaluated 0.35 threshold. - Not run: `test-ltm.sh all`; install, update, restart and uninstall through Marinara Engine; browser and UI tests. **Merge danger:** a two-way door. There is no storage or settings change, so reverting restores 1.4.29 recall on the next update. Blast radius: recall. Every LTM recall path changes which memories it selects: prompt injection, `/search`, reconciliation candidates and source-extraction context. ## Documentation impact - [ ] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation Package docs updated: `CHANGELOG.md` (1.4.30) and `docs/ARCHITECTURE.md` (retrieval pipeline). ## UI evidence (if applicable) Not applicable: only two help strings change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Long-Term Memory 1.4.30 can recall near-match memories through supported links from already recalled memories, provided each linked memory meets a minimum relevance score. Linked results retain their own relevance and follow existing memory and token limits. * The saved custom graph weight now enables or disables linked recall rather than changing its score. * **Documentation** * Updated Memory Settings help and release notes to explain linked recall behavior and supported link styles. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-21 05:11:12 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Agents#1420
No description provided.