mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1964] [Feature]: Long-Term Memory ingests Advanced Memory records without a second model pass #1845
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#1845
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 31, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1964
Originally assigned to: @Promansis on GitHub.
What problem does this solve?
In a roleplay chat with Advanced Memory on, the Engine already summarises every scene with a model call. Long-Term Memory cannot use those recaps: they are not reachable from a package, and even when they become reachable they are prose, so the package would have to run its own extractor over them. Today only Game Mode session summaries skip the model, because their
## timeline_event/Summary: ...blocks are machine-readable (directGameUnits).Engine issue Pasta-Devs/Marinara-Engine#8589 (host-only) makes the Advanced Memory summary call return a structured
memoryblock when Long-Term Memory is active, stores it on the record, and exposes the chat's scene records throughpersistence.listChatSummaries(chatId).advancedMemory(Capability API 1.391). This issue is the package side: read those records, import the block without a model call, and fall back to the existing summary extraction when a record has none.Proposed package or change
Long-Term Memory stops summarising chats the host already summarises. For a chat with Advanced Memory on, its scene records are the chat's summary (continuity is the Engine's compaction of the same scenes and is not imported): Long-Term Memory imports those and runs no chat-summary or transcript import for that chat. Conversation chats keep day and week summaries, game chats keep session summaries, and the transcript-piece importer remains only for chats with no host summary at all. Each enabled scene record becomes one source note; a record with a
memoryblock is turned into memory deterministically, like a Game Mode session summary; a record without one goes through the normalchat_summarymodel extraction. Import happens on the recallrefreshhook when the new Memory Settings switch "Use Advanced Memory recaps" is on, and on demand from the Import panel. Inside that chat, recall leaves the notes made from its own records to Advanced Memory, which already recalls them there.L/server-entry.ts,long-term-memory:runtime) gainssummaryMemoryInstruction()returning the paragraph the Engine appends to the summary request. It asks for the same headed## bucket/Field: valueform the game parser reads, with names rather than ids:## timeline_eventwithSummary:and optionalWhen:;## character_factwithCharacter:andFact:;## relationship_statewithBetween:andState:;## world_factwithFact:.No
threadbucket: Advanced Memory's tail forbids open-thread lists, and threads keep coming from chat extraction.SH/primitives.ts:177adds"advanced_memory";sourceIdis the chat id,entryIdthe record id. Source note id comes fromsourceNoteIdForProvenancelike the other kinds.L/sources/interop.tsbuilds them next to the chat-summary candidates (lines 638-700) fromlistChatSummaries(chat.id).advancedMemory ?? []:sourceId${chat.id}:am-${record.id}, title${chat}, ${record.title},sourceTextthe prosecontent,deterministicSourceTextthe block when present,sourceTagimported_advanced_memory, modes and extraction mode from the chat. Scope follows the record's audience: withaudienceCharacterIdsset, the note'sscope.characterIdsis that audience (intersected with the chat's characters), so a character who was not in the scene does not recall it elsewhere; an empty audience (narrator-only or user-only scene) keeps the chat scope fromresolveChatLtmScope(chat). Re-import is idempotent through the existing source-hash fingerprint: an unchanged record changes nothing, a regenerated or fixed record re-extracts.L/extraction/source-processing.ts: the gate at 204 becomes "the item carriesdeterministicSourceText" instead ofdirectGameMode && extractionMode === "game";useExtractionAgentinimportPackageInterop(1327-1332) testsrow.deterministicSourceTextinstead of the:game-session-string;directGameUnitslearns the two extra headings (character_fact,relationship_state) and resolvesCharacter:/Between:names to the chat's characters the way the normalizer's section adders do. Game Mode keeps today's behaviour and itsuseExtractionAgentOnGameModeswitch.refreshfor a chat with the switch on, list the chat's records, drop ones whose source note already matches the fingerprint, and import the rest that carry a block withextract: true. No connection and no model call are involved in the turn path. Records without a block (made before the Engine change, or cleared by Fix) are left for the backfill below. The Import panel lists "Advanced Memory" as a source for the manual path.5b. Backfill button. "Backfill Advanced Memory" on the Advanced Memory source in the Import panel runs the summary extractor over the chat's scene records that have no block, in batches (default 10 records, a size field next to the button), with progress and Cancel through the existing import operation. For a chat that existed before the Engine change that is its whole scene archive. Pressing it again continues: records already extracted match their fingerprint and are skipped. A scene record whose message range is already covered by a
chat_summaryorchat_transcriptnote from an earlier import of that chat is skipped, so an event enters memory once and no dialog is needed.advancedMemorylist is non-empty contributes only those records: its rolling and legacy summary entries and its transcript pieces are skipped for thechatsandmessagessources. Day, week and game-session entries are untouched because Advanced Memory never runs in those modes. A chat that turns Advanced Memory off later has no records and falls back to today's sources on the next import.{ kind: "advanced_memory", sourceId: <this chat id> }. Advanced Memory already puts those recaps into the prompt; Long-Term Memory contributes what it alone has: the same records' notes in other chats, characters, lorebooks, and other chats' memories within scope. Same shape as the SN-5 package-record echo filter.SH/settings.tsaddsuseAdvancedMemory: boolean(default off), with a switch under the existing chat-import settings inC/settings/MemorySettings.tsx. Off means today's behaviour in every chat: no records imported, no sources skipped, no recall filter.engine-boundarycapabilityApi andengine.minmove to the Engine release that ships 1.391. The host field is read with optional chaining, so a host without it changes nothing.Minimal fix
L =
packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory, SH =packages/long-term-memory/src/engine/packages/shared/src/features/agents/long-term-memory/schema, C = the package client.Why should this be optional?
Only chats that run Advanced Memory produce records, and only users who also run Long-Term Memory want them merged. The switch defaults off, so nothing changes for anyone who does not turn it on. With it on, a roleplay chat's memory is only as fresh as Advanced Memory's scene cut, and a user who wants Long-Term Memory from a roleplay chat must run Advanced Memory, with its own model cost. That trade is the user's to make.
Alternatives considered
Additional context
listChatSummaries(...).advancedMemory,summaryMemoryInstruction, Capability API 1.391).summaryMemoryInstruction), so a format change is a Long-Term Memory release and never an Engine change.memory: nullruns the summary extractor. A turn in that chat shows the recap once, in Advanced Memory's block; a turn in a second chat with the same character shows the note in Long-Term Memory's block.Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: