[GH-ISSUE #618] [Issue]: LTM memory edits keep old detail text as unremovable "ghost" content on save #319

Closed
opened 2026-10-20 17:26:27 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Promansis on GitHub (Aug 26, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/618

Originally assigned to: @Promansis on GitHub.

Summary

Editing a memory detail in the Memory Vault and saving keeps the pre-edit text alongside the edit. The old "ghost" lines persist above the new text, so memories accumulate contradicting phrasing that can never be removed by editing.

Affected package

Long-Term Memory (long-term-memory), v1.2.14

Expected behavior

Saving a manual edit replaces the detail's shown text with exactly what the user typed. Deleted lines stay deleted; rewritten lines no longer appear.

Actual behavior

On PATCH /notes/:id, the client sends the full edited sections record as a replacement. Server-side, LongTermMemoryStorage.updateNote() treats the section change as an append: it stacks a new manual contribution on top of all existing contributions and re-renders with renderSectionContributions(). For additive sections (isAdditiveLtmSection() — timeline_event, world, relationship.history, tone.observations, all character sections except items/progression, and anchor-tagged sections), the rendered text is every source contribution's lines plus the latest manual contribution's lines, deduped only on exact normalized line matches. Lines the user deleted live on in their original source contribution and are re-rendered above the edit; partially rewritten lines appear in both forms. Each successive edit stacks another ghost.

Memory types/sections that are not additive render only the latest contribution, and purely manual memories have no source contribution, which is why many memories behave while extracted/imported ones ghost.

Steps to reproduce

  1. Open a memory whose section content came from extraction, of an additive kind (e.g. a world memory).
  2. In the Memory Vault editor, delete a sentence or rewrite part of a detail, then save.
  3. The saved memory shows the original sentence still present alongside the edit.

(Confirmed by code inspection of the save path rather than a live reproduction run.)

Environment

  • Marinara Engine version: user report on Release v2.4.4 (build db43149); root-cause confirmed on current staging source
  • Package version: 1.2.14
  • Install type: installer (report); source (diagnosis)
  • OS + version: not specified in report
  • Browser or app shell: not specified in report

Logs, screenshots, or video

Reporter attached two screenshots of the duplicated memory content (not pasted here).

Additional context

Relevant code: packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/storage.ts (updateNote, section contribution append around line 443), section-contributions.ts (renderSectionContributions), and draft-projector.ts (isAdditiveLtmSection). Contribution merging is the intended behavior for extraction draft mutations (draft-projector path); the fix should scope direct editor saves to supersede that section's accumulated contributions rather than stack on them.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Aug 26, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/618 Originally assigned to: @Promansis on GitHub. ## Summary Editing a memory detail in the Memory Vault and saving keeps the pre-edit text alongside the edit. The old "ghost" lines persist above the new text, so memories accumulate contradicting phrasing that can never be removed by editing. ## Affected package Long-Term Memory (`long-term-memory`), v1.2.14 ## Expected behavior Saving a manual edit replaces the detail's shown text with exactly what the user typed. Deleted lines stay deleted; rewritten lines no longer appear. ## Actual behavior On `PATCH /notes/:id`, the client sends the full edited `sections` record as a replacement. Server-side, `LongTermMemoryStorage.updateNote()` treats the section change as an *append*: it stacks a new `manual` contribution on top of all existing contributions and re-renders with `renderSectionContributions()`. For **additive** sections (`isAdditiveLtmSection()` — `timeline_event`, `world`, `relationship.history`, `tone.observations`, all character sections except `items`/`progression`, and `anchor`-tagged sections), the rendered text is every `source` contribution's lines **plus** the latest manual contribution's lines, deduped only on exact normalized line matches. Lines the user deleted live on in their original `source` contribution and are re-rendered above the edit; partially rewritten lines appear in both forms. Each successive edit stacks another ghost. Memory types/sections that are not additive render only the latest contribution, and purely manual memories have no source contribution, which is why many memories behave while extracted/imported ones ghost. ## Steps to reproduce 1. Open a memory whose section content came from extraction, of an additive kind (e.g. a `world` memory). 2. In the Memory Vault editor, delete a sentence or rewrite part of a detail, then save. 3. The saved memory shows the original sentence still present alongside the edit. (Confirmed by code inspection of the save path rather than a live reproduction run.) ## Environment - Marinara Engine version: user report on Release v2.4.4 (build db43149); root-cause confirmed on current staging source - Package version: 1.2.14 - Install type: installer (report); source (diagnosis) - OS + version: not specified in report - Browser or app shell: not specified in report ## Logs, screenshots, or video Reporter attached two screenshots of the duplicated memory content (not pasted here). ## Additional context Relevant code: `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/storage.ts` (`updateNote`, section contribution append around line 443), `section-contributions.ts` (`renderSectionContributions`), and `draft-projector.ts` (`isAdditiveLtmSection`). Contribution merging is the intended behavior for extraction *draft* mutations (draft-projector path); the fix should scope direct editor saves to supersede that section's accumulated contributions rather than stack on them. ## Template check - [ ] I DID NOT read this template and provide the requested details.
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#319
No description provided.