mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1917] [Feature]: Long-Term Memory: Chat import detail setting (Standard or Detailed) #1821
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#1821
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 30, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1917
Originally assigned to: @Promansis on GitHub.
What problem does this solve?
Chat messages import cuts a chat into pieces of up to 24,000 characters and extracts memories from each piece. On a long roleplay chat, a 24k piece holds many scenes. The extractor keeps the main events and drops the small ones: a minor character, a side remark, a detail that matters later.
We measured this on one long roleplay chat. Each setting was imported twice with Sonnet, and Opus compared the resulting vaults. This ran after #1909, which merges short and full character names into one note.
Smaller pieces find clearly more, beyond the run-to-run noise, for about 1.8 times the cost. They also produce more duplicates and more wrong facts. So neither size is better for everyone. A user with a long, detailed roleplay and a budget for it wants more detail. A user with a cheaper model or a short chat wants today's behaviour.
Proposed package or change
An extraction setting, Chat import detail, with two choices:
Each chat keeps the size it was first imported with. Pieces are named by their first message (
entryId), so cutting an already-imported chat at a new size would produce different pieces. The old ones would then show as outdated in the preview, and importing the new ones would duplicate memories. So:Re-importing an existing chat at a new size is not part of this issue.
Minimal fix
shared/src/features/agents/long-term-memory/schema/settings.tschatImportDetail: z.enum(["standard", "detailed"]).optional()inltmExtractionSettingsFields(~298, next tofinishCutOffAnswers);chatImportDetail: z.enum([...])inltmResolvedExtractionSettingsSchema(~345)."standard"goes inDEFAULT_LTM_EXTRACTION_CONFIG,server/.../extraction/extraction-config.ts(~36).server/src/services/long-term-memory/sources/interop.tschunks(value, cap)(~148) andtranscriptPieces(messages, speaker, isStart, cap = 24_000)(~174) take the cap instead of the hard-coded24_000(~151, ~159 ascap / 2, ~194, ~203).chat_transcriptcandidates addpiece_size:12000to theirevidence(~713). Standard pieces add nothing, so every existing source note keeps its evidence and its extraction fingerprint (candidateFingerprintForNote, ~372, hashesevidence), and nothing shows as updated.existingMatcher(~765) already walks everychat_transcriptsource note to buildpieceStarts; it also records each chat group's size: 12,000 when a note carriespiece_size:12000, otherwise 24,000. The key is the note's chat group (getLtmScopeGroupIds(note.scope)[0]), falling back to the chat id, the same key the branch merge (~420) uses. A branch copies messages under new ids and matches the parent's pieces only by identical text, so a branch that was never imported must cut at its group's size, or it would offer every piece as new.candidates(~575) gets the chat sizes and the current setting next topieceStarts. The messages builder (~694) uses the recorded size of the chat's group (falling back to its chat id), or the setting's size when neither has one. The three callers (previewPackageInterop~916/~935, source details ~1102,importPackageInterop~1144) read the setting withgetLtmExtractionConfig(root).CHAT_PIECE_TAIL_CHARS(3,000) and the branch-merge key (~420) stay as they are.client/src/features/long-term-memory/settings/MemorySettings.tsxenandkostrings inclient/src/features/long-term-memory/locales/.node scripts/validate-package-locales.mjsmust pass.packages/long-term-memory/docs/UI.md(~163) says Chat Messages imports in pieces of up to 24,000 characters; add one sentence on Detailed (12,000) and that each chat keeps the size of its first import.docs/is in.git/info/exclude, so stage the tracked file withgit add -u.Regression
In
tests/long-term-memory-chat-transcript-import.regression.ts, with its fake host and fake language model:transcriptPieceswith a 12,000 cap keeps every piece at or under 12,000 characters. A single message longer than the cap splits into:part:pieces (as the 24k check at ~97 does).piece_size:12000.In
tests/long-term-memory-storage.regression.ts(~319):chatImportDetaildefaults to"standard"and saves.Non-goals
Why should this be optional?
Detailed costs about 1.8 times as much per import and produces more duplicates to review. Standard stays the default, so nobody's cost or results change unless they choose Detailed.
Alternatives considered
Additional context
scratch/cut-point/): 38/38 pieces succeeded in both 12k runs, with 392–422 active memories.Template check