[PR #1548] [MERGED] fix(long-term-memory): save a Char- or Rel- named subject's facts to the memory identity chose (#1543) #1541

Closed
opened 2026-10-22 04:03:14 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: staging ← Head: fix(long-term-memory)/prefix-word-name-id


📝 Commits (5)

  • eedeed5 fix(long-term-memory): save facts for names starting with Char or Rel to the chosen memory (#1543)
  • e14c898 Merge upstream/staging into fix(long-term-memory)/prefix-word-name-id; release long-term-memory 1.4.77
  • fc6ba10 docs(long-term-memory): write the 1.4.77 release note as plain text
  • b3a72b8 fix(long-term-memory): find a summary's character section for an id that repeats its prefix
  • a3faa8c chore(long-term-memory): rebuild 1.4.77 with the summary section fix

📊 Changes

15 files changed (+314 additions, -91 deletions)

View changed files

➕ artifacts/long-term-memory-1.4.77.zip (+0 -0)
📝 catalog/catalog.json (+6 -6)
📝 catalog/notes.json (+6 -6)
📝 catalog/v2/catalog.json (+6 -6)
📝 catalog/v2/notes.json (+6 -6)
📝 catalog/v3/catalog.json (+6 -6)
📝 catalog/v3/notes.json (+6 -6)
📝 packages/long-term-memory/CHANGELOG.md (+4 -0)
📝 packages/long-term-memory/manifest.json (+3 -3)
📝 packages/long-term-memory/server.mjs (+40 -40)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction/evidence-unit-validation.ts (+9 -0)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction/structured-summary-normalizer.ts (+15 -8)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/identity/subject-identity.ts (+6 -3)
📝 scripts/build-feature-packages.mjs (+1 -1)
📝 tests/long-term-memory-extraction-graph.regression.ts (+200 -0)

📄 Description

Pull request

Linked issue

Closes #1543

Why this change

  • A character whose name starts with "Char" (such as "Char Aznable"), or a relationship whose first name starts with "Rel", lost that word from its memory id: identity named the memory char_char_aznable but saved the facts under char_aznable. Events about the character then pointed at a memory that did not exist and were dropped as "linked to a memory this extraction could not find", and where a memory with the full id already existed, extraction proposed a second memory for the same character.

What changed

  • long-term-memory: a new helper unprefixedSubjectId (beside prefixed() in extraction/evidence-unit-validation.ts) removes a note prefix only when the result maps back to the same note. Identity's subjectIdForTarget and the structured-summary normalizer's character and relationship branches that handle identity's output use it; the relationship branch still matches summary hints with the id stripped once, so a summary's relationship dimensions are kept. Matching keys, model-chosen ids and other buckets are unchanged.
  • Regression in tests/long-term-memory-extraction-graph.regression.ts.
  • After review: a summary's character section hint is looked up by identity's id and by the id with its prefix stripped once, since a section written as character_id: char_char_aznable is keyed char_aznable. Without this, keeping the whole id made that lookup miss and the fact fell back to text classification (for example facts instead of a declared core). The regression covers it.
  • Release: long-term-memory 1.4.77 on staging 79d45f80e, with the CHANGELOG entry, version, manifest, rebuilt server.mjs, artifact and catalog entries.

Package and security impact

  • Affected package IDs: long-term-memory
  • Engine compatibility impact: none
  • New or changed permissions/entrypoints: none
  • Restart, storage, update, or uninstall impact: none. No migration: memories already saved under the shortened id keep receiving facts while bound to the character.

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

  • The new extraction-graph case fails on staging (new memories char_aznable and rel_varga_sayla_mass) and passes with the fix: an empty vault gets char_char_aznable and rel_rel_varga_sayla_mass, nothing is dropped, and the event links to char_char_aznable; with those memories already present, a structured summary updates them instead of creating copies, and the summary's relationship dimensions (trust: 80) reach the relationship update. Reverting any changed call site fails the case.
  • Identity: only the written id changes, not which memory is chosen. This covers any chosen memory whose id repeats its prefix, whatever the name: a vault holding char_char_mara linked to Mara (for example from an import) used to get a second memory char_mara and now has the facts added to char_char_mara. That is an improvement, but it changes what extraction does on existing vaults. A vault that already holds char_aznable bound to the character keeps updating it. A shorter-id memory that was never linked to the character, and isn't titled with the full name, no longer receives that character's facts; merge it in the app if it was the same person. A vault with both memories bound to the character is held as ambiguous before and after, and needs a merge in the app.
  • Builds on #1534 (recovery copies of digit-led subject ids): the fixed ids start with a letter, so recovery copies keep them.
  • On the fix commit (base 93dc35a3d): typecheck, npm run check, test-fast.sh, test-ci.sh, the missing-tsc regression, every Long-Term Memory regression suite (browser on the rebuilt client) and the catalog checks pass. On the release head: the package rebuild leaves the tree clean, the catalog, locale and release-notes checks and the typecheck pass, and the extraction-graph suite passes. The release note was then rewritten as plain text (no backticks; the Engine shows notes verbatim); that commit changes only the note and its three generated notes.json copies, and the quick checks, including the release-notes check, pass on it. After review, the character section lookup was fixed (the new summary case lands in facts without it and core with it) and 1.4.77 rebuilt; typecheck, the extraction-graph suite and the quick land checks pass on that head. Hosted CI runs the full suite list on this head.

Documentation impact

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

🤖 Generated with Claude Code


🔄 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/1548 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/21/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `staging` ← **Head:** `fix(long-term-memory)/prefix-word-name-id` --- ### 📝 Commits (5) - [`eedeed5`](https://github.com/Pasta-Devs/Marinara-Agents/commit/eedeed57f2bd76cf2f50b6e1b3bfb17d168ef1fb) fix(long-term-memory): save facts for names starting with Char or Rel to the chosen memory (#1543) - [`e14c898`](https://github.com/Pasta-Devs/Marinara-Agents/commit/e14c8980a6a8bbd031d75cdcb12fc9a30fbff7cf) Merge upstream/staging into fix(long-term-memory)/prefix-word-name-id; release long-term-memory 1.4.77 - [`fc6ba10`](https://github.com/Pasta-Devs/Marinara-Agents/commit/fc6ba10972e37d5ab95df94d96e59a0fa243ca31) docs(long-term-memory): write the 1.4.77 release note as plain text - [`b3a72b8`](https://github.com/Pasta-Devs/Marinara-Agents/commit/b3a72b82aa0ba1204eca6254a0dbcaa349b9de71) fix(long-term-memory): find a summary's character section for an id that repeats its prefix - [`a3faa8c`](https://github.com/Pasta-Devs/Marinara-Agents/commit/a3faa8cc76f89fa0d53a08f546b3fc0b7e22e5e1) chore(long-term-memory): rebuild 1.4.77 with the summary section fix ### 📊 Changes **15 files changed** (+314 additions, -91 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/long-term-memory-1.4.77.zip` (+0 -0) 📝 `catalog/catalog.json` (+6 -6) 📝 `catalog/notes.json` (+6 -6) 📝 `catalog/v2/catalog.json` (+6 -6) 📝 `catalog/v2/notes.json` (+6 -6) 📝 `catalog/v3/catalog.json` (+6 -6) 📝 `catalog/v3/notes.json` (+6 -6) 📝 `packages/long-term-memory/CHANGELOG.md` (+4 -0) 📝 `packages/long-term-memory/manifest.json` (+3 -3) 📝 `packages/long-term-memory/server.mjs` (+40 -40) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction/evidence-unit-validation.ts` (+9 -0) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction/structured-summary-normalizer.ts` (+15 -8) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/identity/subject-identity.ts` (+6 -3) 📝 `scripts/build-feature-packages.mjs` (+1 -1) 📝 `tests/long-term-memory-extraction-graph.regression.ts` (+200 -0) </details> ### 📄 Description # Pull request ## Linked issue Closes #1543 ## Why this change - A character whose name starts with "Char" (such as "Char Aznable"), or a relationship whose first name starts with "Rel", lost that word from its memory id: identity named the memory `char_char_aznable` but saved the facts under `char_aznable`. Events about the character then pointed at a memory that did not exist and were dropped as "linked to a memory this extraction could not find", and where a memory with the full id already existed, extraction proposed a second memory for the same character. ## What changed - `long-term-memory`: a new helper `unprefixedSubjectId` (beside `prefixed()` in `extraction/evidence-unit-validation.ts`) removes a note prefix only when the result maps back to the same note. Identity's `subjectIdForTarget` and the structured-summary normalizer's character and relationship branches that handle identity's output use it; the relationship branch still matches summary hints with the id stripped once, so a summary's relationship dimensions are kept. Matching keys, model-chosen ids and other buckets are unchanged. - Regression in `tests/long-term-memory-extraction-graph.regression.ts`. - After review: a summary's character section hint is looked up by identity's id and by the id with its prefix stripped once, since a section written as `character_id: char_char_aznable` is keyed `char_aznable`. Without this, keeping the whole id made that lookup miss and the fact fell back to text classification (for example `facts` instead of a declared `core`). The regression covers it. - **Release:** `long-term-memory` 1.4.77 on staging 79d45f80e, with the CHANGELOG entry, version, manifest, rebuilt `server.mjs`, artifact and catalog entries. ## Package and security impact - Affected package IDs: `long-term-memory` - Engine compatibility impact: none - New or changed permissions/entrypoints: none - Restart, storage, update, or uninstall impact: none. No migration: memories already saved under the shortened id keep receiving facts while bound to the character. ## 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 - The new extraction-graph case fails on `staging` (new memories `char_aznable` and `rel_varga_sayla_mass`) and passes with the fix: an empty vault gets `char_char_aznable` and `rel_rel_varga_sayla_mass`, nothing is dropped, and the event links to `char_char_aznable`; with those memories already present, a structured summary updates them instead of creating copies, and the summary's relationship dimensions (`trust: 80`) reach the relationship update. Reverting any changed call site fails the case. - Identity: only the written id changes, not which memory is chosen. This covers any chosen memory whose id repeats its prefix, whatever the name: a vault holding `char_char_mara` linked to Mara (for example from an import) used to get a second memory `char_mara` and now has the facts added to `char_char_mara`. That is an improvement, but it changes what extraction does on existing vaults. A vault that already holds `char_aznable` bound to the character keeps updating it. A shorter-id memory that was never linked to the character, and isn't titled with the full name, no longer receives that character's facts; merge it in the app if it was the same person. A vault with both memories bound to the character is held as ambiguous before and after, and needs a merge in the app. - Builds on #1534 (recovery copies of digit-led subject ids): the fixed ids start with a letter, so recovery copies keep them. - On the fix commit (base 93dc35a3d): typecheck, `npm run check`, `test-fast.sh`, `test-ci.sh`, the missing-tsc regression, every Long-Term Memory regression suite (browser on the rebuilt client) and the catalog checks pass. On the release head: the package rebuild leaves the tree clean, the catalog, locale and release-notes checks and the typecheck pass, and the extraction-graph suite passes. The release note was then rewritten as plain text (no backticks; the Engine shows notes verbatim); that commit changes only the note and its three generated `notes.json` copies, and the quick checks, including the release-notes check, pass on it. After review, the character section lookup was fixed (the new summary case lands in `facts` without it and `core` with it) and 1.4.77 rebuilt; typecheck, the extraction-graph suite and the quick land checks pass on that head. Hosted CI runs the full suite list on this head. ## Documentation impact - [ ] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:03:14 +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#1541
No description provided.