[GH-ISSUE #2020] [Issue]: Long-Term Memory: remove the Advanced Memory recap import, so chats that use Advanced Memory are extracted from their own summaries and messages #1878

Closed
opened 2026-11-07 16:37:20 +07:00 by bsakaguchi · 0 comments
Owner

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

Originally assigned to: @Promansis on GitHub.

Summary

"Use Advanced Memory recaps" (1.5.20, #1964) imports a chat's Advanced Memory scene recaps instead of its summaries and messages. It reads the recap's memory block with no AI call. The memories it makes are much thinner than normal extraction:

  • No keywords. Every unit gets keywords: [], so keyword recall never finds them.
  • Almost no links. Only a timeline event gets an extracted_from link back to its recap. Nothing gets a cause or follow-on link.
  • No threads, tone or anchors. The block has only timeline events, character facts, relationships and world facts.
  • "Hide remembered messages" hides nothing. An imported scene keeps only its first and last message ids, not the message range that hiding uses.
  • World facts get a new id per scene, so the same place is saved more than once.

The bigger problem is that the setting replaces normal extraction. Once a chat has scene records, its rolling summaries and Chat Messages pieces are skipped. So that chat never gets the full extractor.

Fixing each gap would rebuild the extractor inside a host recap format tied to an Engine capability API. Removing the feature is simpler. Chats that use Advanced Memory then go through the same import and extraction as every other chat.

Affected package

long-term-memory

Expected behavior

  • Memory Settings → Extraction no longer has "Use Advanced Memory recaps". Import → Chats no longer has "Older scene recaps".
  • A chat that uses Advanced Memory offers its rolling summaries and Chat Messages pieces in Import, and auto-import imports them, like any other chat. The memories have keywords and links, and "Hide remembered messages" works for them.
  • Long-Term Memory no longer gives the Engine a memory block instruction for scene recaps.
  • Memories already imported from recaps stay in the vault. They keep their "Advanced Memory" origin chip and can still be re-extracted.
  • A saved config.json that has useAdvancedMemory: true still loads.

Actual behavior

  • server-entry.ts returns ADVANCED_MEMORY_BLOCK_INSTRUCTION from summaryMemoryInstruction, and the Engine (Capability API 1.391) appends it to every recap request.
  • With useAdvancedMemory on, sources/interop.ts candidates imports scene records and skips the chat's rolling summaries (except Game Mode sessions and conversation summaries) and its Chat Messages pieces.
  • extraction/source-processing.ts advancedMemoryUnits turns the block into units with keywords: [] and no links except extracted_from on timeline events.

Steps to reproduce

  1. Turn on Memory Settings → Extraction → "Use Advanced Memory recaps", in a chat that uses Advanced Memory.
  2. Let a few scene recaps be written, then import (or let auto-import run).
  3. Open the saved memories. None have keywords, none link to each other, and no threads exist. The chat's messages are not offered in Import → Chat Messages, and "Hide remembered messages" hides nothing for the chat.

Environment

  • Marinara Engine version: 2.5.1 (cb8ae38dd), capability API 1.391
  • Package version: long-term-memory 1.5.28
  • Install type: source
  • OS + version: Windows 11 (10.0.26200)
  • Browser or app shell: browser

Logs, screenshots, or video

One chat, 5 scene recaps imported by auto-import: 5 drafts, 32 units, 0 keywords, 0 links between memories, 0 threads. The debug log shows that auto-import run made no extraction request: the chat's messages were never read.

Additional context

History: #1964 (1.5.20) added the import, the block instruction and the backfill. Engine #8592 added the summaryMemoryInstruction hook (Capability API 1.391). The Engine calls the hook optionally (services/generation/long-term-memory-runtime.ts, runtimeService()?.summaryMemoryInstruction?.()), so removing it needs no Engine change. Whether the Engine keeps or drops its unused hook is a separate Engine decision.

Minimal fix

Scope: Long-Term Memory only, one patch release (1.5.29). This is mostly deletion. No Engine change, and no engine.min change.

All paths are under packages/long-term-memory/src/engine/packages/.

Remove (server):

  1. server/.../long-term-memory/server-entry.ts: ADVANCED_MEMORY_BLOCK_INSTRUCTION and the summaryMemoryInstruction entry.
  2. server/.../extraction/source-processing.ts: ADVANCED_MEMORY_BUCKETS, advancedMemoryBlockFields, advancedMemoryUnits, and the advanced_memory branch of the direct-ingest path (advancedMemory flag, the "Directly ingested Advanced Memory scene recap." summary). Keep the Game Mode direct ingest.
  3. server/.../sources/interop.ts:
    • Remove AdvancedMemoryRecord, advancedMemoryRecords, advancedMemoryHosts, advancedMemoryAvailable, advancedMemoryScope and advancedMemoryEnabled.
    • Remove the request fields advancedMemory and advancedMemoryBlocksOnly, and the candidate field sceneMessageIds.
    • In candidates, remove the scene-record loop, the "scene records take over" skip of rolling summaries, and the "imports those instead of its messages" skip.
    • Remove the advancedMemory flags in the preview (including the second candidates walk that runs only because of it), in the import selection and in the import function.
    • Remove the advanced_memory branches of rowDestination, followsRecord, deterministic and useExtractionAgent. Keep the Game Mode cases.
    • Remove advancedMemoryBackfillBatch.
  4. server/.../sources/auto-import-job.ts: drop both advancedMemoryBlocksOnly spreads and their comment. Keep the chats pass, because it also imports rolling summaries.
  5. server/.../recall/generation-injection.ts: remove advancedMemoryEchoes and its call. identity/chat-scope.ts: remove advancedMemoryEchoNoteIds. recall/retrieval.ts: remove the excluded-notes option if nothing else passes it, otherwise just its comment.
  6. server/.../package-runtime.ts: remove the listChatSummaries host type (only the removed code calls it). routes/settings.ts: remove advancedMemoryAvailable. routes/imports.ts: remove the /import/advanced-memory/backfill-batch route.

Remove (shared and client):
7. shared/.../schema/sources.ts: both advancedMemoryBlocksOnly fields and the backfill request and response schemas.
8. shared/.../schema/settings.ts and server/.../extraction/extraction-config.ts: drop useAdvancedMemory from the resolved (.strict()) settings and from the defaults. Keep useAdvancedMemory: z.boolean().optional() in the stored-settings input with a one-line comment that it is ignored, and make sure it is not passed into the resolved object. An existing config.json that has it must still load.
9. client/.../settings/MemorySettings.tsx: the toggle and its form state. client/.../api.ts: advancedMemoryAvailable. client/.../sources/SourcesWorkspace.tsx: the "Older scene recaps" group and everything behind it (ADVANCED_MEMORY_BACKFILL_BATCH, its state and refs, the pending query, backfillAdvancedMemory, both places it is rendered).
10. client/.../locales/en.json and ko.json: the memorysettings.useAdvancedMemory* and sourcesworkspace.advancedMemoryBackfill* keys.

Keep (memories that were already imported): the advanced_memory provenance kind in shared/.../schema/primitives.ts, the Vault origin chip and the draft source label in client/.../vault/MemoryVault.tsx, the chat lookup in Re-extract (routes/notes.ts), and the advanced_memory case in extraction/structured-summary-normalizer.ts.

Tests:

  • Delete tests/long-term-memory-advanced-memory-import.regression.ts, and remove advanced-memory-import from .github/workflows/ltm-browser.yml and tests/README.md (both places).
  • Remove the Advanced Memory cases:
    • tests/long-term-memory-routes.regression.ts: the backfill route in the route list, and the availability case.
    • tests/long-term-memory-browser.regression.ts: the toggle case, and the backfill and stuck-backfill cases.
    • tests/long-term-memory-storage.regression.ts: the advancedMemoryAvailable field.
    • tests/long-term-memory-feedback-clarity-ui.regression.mjs: the backfill batch-size assertions. Keep the Vault origin assertions.
  • Add, in the smallest existing suite that already stubs a chat host:
    • A chat whose host also lists Advanced Memory records still previews and imports its rolling summaries and Chat Messages pieces.
    • A stored extraction config with useAdvancedMemory: true loads, and the resolved config has no useAdvancedMemory key.

Changelog (1.5.29): Long-Term Memory no longer imports Advanced Memory scene recaps. Chats that use Advanced Memory are extracted from their own summaries and messages, so their memories get keywords, links and threads, and "Hide remembered messages" works for them. Memories already imported from recaps stay.

Non-goals:

  • Removing or rewriting memories already imported from recaps. They stay and are recalled like any other memory. If a chat keeps Advanced Memory on in the Engine, those memories can repeat what the recap already puts in the prompt. You can delete them in the Vault by their "Advanced Memory" origin.
  • Any Engine change, including removing the unused summaryMemoryInstruction hook.
  • Stopping both systems from running in the same chat. Using Advanced Memory and Long-Term Memory together stays the user's choice.
Originally created by @Promansis on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/2020 Originally assigned to: @Promansis on GitHub. ## Summary "Use Advanced Memory recaps" (1.5.20, #1964) imports a chat's Advanced Memory scene recaps instead of its summaries and messages. It reads the recap's memory block with no AI call. The memories it makes are much thinner than normal extraction: - No keywords. Every unit gets `keywords: []`, so keyword recall never finds them. - Almost no links. Only a timeline event gets an `extracted_from` link back to its recap. Nothing gets a cause or follow-on link. - No threads, tone or anchors. The block has only timeline events, character facts, relationships and world facts. - "Hide remembered messages" hides nothing. An imported scene keeps only its first and last message ids, not the message range that hiding uses. - World facts get a new id per scene, so the same place is saved more than once. The bigger problem is that the setting **replaces** normal extraction. Once a chat has scene records, its rolling summaries and Chat Messages pieces are skipped. So that chat never gets the full extractor. Fixing each gap would rebuild the extractor inside a host recap format tied to an Engine capability API. Removing the feature is simpler. Chats that use Advanced Memory then go through the same import and extraction as every other chat. ## Affected package long-term-memory ## Expected behavior - Memory Settings → Extraction no longer has "Use Advanced Memory recaps". Import → Chats no longer has "Older scene recaps". - A chat that uses Advanced Memory offers its rolling summaries and Chat Messages pieces in Import, and auto-import imports them, like any other chat. The memories have keywords and links, and "Hide remembered messages" works for them. - Long-Term Memory no longer gives the Engine a memory block instruction for scene recaps. - Memories already imported from recaps stay in the vault. They keep their "Advanced Memory" origin chip and can still be re-extracted. - A saved `config.json` that has `useAdvancedMemory: true` still loads. ## Actual behavior - `server-entry.ts` returns `ADVANCED_MEMORY_BLOCK_INSTRUCTION` from `summaryMemoryInstruction`, and the Engine (Capability API 1.391) appends it to every recap request. - With `useAdvancedMemory` on, `sources/interop.ts` `candidates` imports scene records and skips the chat's rolling summaries (except Game Mode sessions and conversation summaries) and its Chat Messages pieces. - `extraction/source-processing.ts` `advancedMemoryUnits` turns the block into units with `keywords: []` and no links except `extracted_from` on timeline events. ## Steps to reproduce 1. Turn on Memory Settings → Extraction → "Use Advanced Memory recaps", in a chat that uses Advanced Memory. 2. Let a few scene recaps be written, then import (or let auto-import run). 3. Open the saved memories. None have keywords, none link to each other, and no threads exist. The chat's messages are not offered in Import → Chat Messages, and "Hide remembered messages" hides nothing for the chat. ## Environment - Marinara Engine version: 2.5.1 (cb8ae38dd), capability API 1.391 - Package version: long-term-memory 1.5.28 - Install type: source - OS + version: Windows 11 (10.0.26200) - Browser or app shell: browser ## Logs, screenshots, or video One chat, 5 scene recaps imported by auto-import: 5 drafts, 32 units, 0 keywords, 0 links between memories, 0 threads. The debug log shows that auto-import run made no extraction request: the chat's messages were never read. ## Additional context History: #1964 (1.5.20) added the import, the block instruction and the backfill. Engine #8592 added the `summaryMemoryInstruction` hook (Capability API 1.391). The Engine calls the hook optionally (`services/generation/long-term-memory-runtime.ts`, `runtimeService()?.summaryMemoryInstruction?.()`), so removing it needs no Engine change. Whether the Engine keeps or drops its unused hook is a separate Engine decision. ## Minimal fix Scope: Long-Term Memory only, one patch release (1.5.29). This is mostly deletion. No Engine change, and no `engine.min` change. All paths are under `packages/long-term-memory/src/engine/packages/`. **Remove (server):** 1. `server/.../long-term-memory/server-entry.ts`: `ADVANCED_MEMORY_BLOCK_INSTRUCTION` and the `summaryMemoryInstruction` entry. 2. `server/.../extraction/source-processing.ts`: `ADVANCED_MEMORY_BUCKETS`, `advancedMemoryBlockFields`, `advancedMemoryUnits`, and the `advanced_memory` branch of the direct-ingest path (`advancedMemory` flag, the "Directly ingested Advanced Memory scene recap." summary). Keep the Game Mode direct ingest. 3. `server/.../sources/interop.ts`: - Remove `AdvancedMemoryRecord`, `advancedMemoryRecords`, `advancedMemoryHosts`, `advancedMemoryAvailable`, `advancedMemoryScope` and `advancedMemoryEnabled`. - Remove the request fields `advancedMemory` and `advancedMemoryBlocksOnly`, and the candidate field `sceneMessageIds`. - In `candidates`, remove the scene-record loop, the "scene records take over" skip of rolling summaries, and the "imports those instead of its messages" skip. - Remove the `advancedMemory` flags in the preview (including the second `candidates` walk that runs only because of it), in the import selection and in the import function. - Remove the `advanced_memory` branches of `rowDestination`, `followsRecord`, `deterministic` and `useExtractionAgent`. Keep the Game Mode cases. - Remove `advancedMemoryBackfillBatch`. 4. `server/.../sources/auto-import-job.ts`: drop both `advancedMemoryBlocksOnly` spreads and their comment. Keep the `chats` pass, because it also imports rolling summaries. 5. `server/.../recall/generation-injection.ts`: remove `advancedMemoryEchoes` and its call. `identity/chat-scope.ts`: remove `advancedMemoryEchoNoteIds`. `recall/retrieval.ts`: remove the excluded-notes option if nothing else passes it, otherwise just its comment. 6. `server/.../package-runtime.ts`: remove the `listChatSummaries` host type (only the removed code calls it). `routes/settings.ts`: remove `advancedMemoryAvailable`. `routes/imports.ts`: remove the `/import/advanced-memory/backfill-batch` route. **Remove (shared and client):** 7. `shared/.../schema/sources.ts`: both `advancedMemoryBlocksOnly` fields and the backfill request and response schemas. 8. `shared/.../schema/settings.ts` and `server/.../extraction/extraction-config.ts`: drop `useAdvancedMemory` from the resolved (`.strict()`) settings and from the defaults. **Keep** `useAdvancedMemory: z.boolean().optional()` in the stored-settings input with a one-line comment that it is ignored, and make sure it is not passed into the resolved object. An existing `config.json` that has it must still load. 9. `client/.../settings/MemorySettings.tsx`: the toggle and its form state. `client/.../api.ts`: `advancedMemoryAvailable`. `client/.../sources/SourcesWorkspace.tsx`: the "Older scene recaps" group and everything behind it (`ADVANCED_MEMORY_BACKFILL_BATCH`, its state and refs, the pending query, `backfillAdvancedMemory`, both places it is rendered). 10. `client/.../locales/en.json` and `ko.json`: the `memorysettings.useAdvancedMemory*` and `sourcesworkspace.advancedMemoryBackfill*` keys. **Keep (memories that were already imported):** the `advanced_memory` provenance kind in `shared/.../schema/primitives.ts`, the Vault origin chip and the draft source label in `client/.../vault/MemoryVault.tsx`, the chat lookup in Re-extract (`routes/notes.ts`), and the `advanced_memory` case in `extraction/structured-summary-normalizer.ts`. **Tests:** - Delete `tests/long-term-memory-advanced-memory-import.regression.ts`, and remove `advanced-memory-import` from `.github/workflows/ltm-browser.yml` and `tests/README.md` (both places). - Remove the Advanced Memory cases: - `tests/long-term-memory-routes.regression.ts`: the backfill route in the route list, and the availability case. - `tests/long-term-memory-browser.regression.ts`: the toggle case, and the backfill and stuck-backfill cases. - `tests/long-term-memory-storage.regression.ts`: the `advancedMemoryAvailable` field. - `tests/long-term-memory-feedback-clarity-ui.regression.mjs`: the backfill batch-size assertions. Keep the Vault origin assertions. - Add, in the smallest existing suite that already stubs a chat host: - A chat whose host also lists Advanced Memory records still previews and imports its rolling summaries and Chat Messages pieces. - A stored extraction config with `useAdvancedMemory: true` loads, and the resolved config has no `useAdvancedMemory` key. **Changelog (1.5.29):** Long-Term Memory no longer imports Advanced Memory scene recaps. Chats that use Advanced Memory are extracted from their own summaries and messages, so their memories get keywords, links and threads, and "Hide remembered messages" works for them. Memories already imported from recaps stay. Non-goals: - Removing or rewriting memories already imported from recaps. They stay and are recalled like any other memory. If a chat keeps Advanced Memory on in the Engine, those memories can repeat what the recap already puts in the prompt. You can delete them in the Vault by their "Advanced Memory" origin. - Any Engine change, including removing the unused `summaryMemoryInstruction` hook. - Stopping both systems from running in the same chat. Using Advanced Memory and Long-Term Memory together stays the user's choice.
bsakaguchi 2026-11-07 16:37:20 +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#1878
No description provided.