mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1914] [Feature]: Long-Term Memory: optionally hide imported chat messages from the AI #1819
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#1819
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/1914
Originally assigned to: @Promansis on GitHub.
What problem does this solve?
The Engine's chat summary has "Hide summarised messages": once messages are summarised, they stop being sent to the AI, and the summary stands in for them. Long-Term Memory's Chat messages import has no equivalent. After a long chat is imported into memory, every imported message is still sent with each reply, alongside the memories recalled from it. The prompt carries the same history twice, and long chats keep paying for it.
Proposed package or change
An opt-in setting, off by default: Hide imported messages from the AI. When it is on, LTM hides the messages of each Chat messages piece it has imported, except the most recent ones. Turning it off shows them again.
Depends on Pasta-Devs/Marinara-Engine#8491 (
persistence.setMessagesHiddenFromAI). LTM feature-detects that method: on an Engine without it, the setting is disabled with a short note, and nothing else changes. So noengine.minbump is needed, and the manifest keepscapabilityApi1.387: declaring 1.388 would make every Engine at 1.387 refuse the package.Behaviour:
summaryTailMessagesin the chat's metadata, the Engine's "keep last N messages"; default 10 when unset, 0 hides everything:SUMMARY_TAIL_MESSAGES, Engineshared/src/types/chat.ts~305), so one setting governs both features. Like the Engine'scomputeSummaryHideIds, it counts the last N visible messages. As the chat grows, messages of imported pieces leave the tail; each later import (and turning the setting on) also hides those, as the summary re-hides a drifted tail.visibilityManual), LTM drops it from its ownership record and never changes it again. From then on LTM reads it like any other message: shown by hand, it stays in its piece; hidden by hand, it leaves the piece as today, and the piece's source note shows as updated.Minimal fix
Server, under
packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/:package-runtime.ts(~75): add the optionalsetMessagesHiddenFromAIto thepersistencehost type.sources/interop.tstranscriptPieces(~174;TranscriptPiece~167)TranscriptPiecealso lists itsmessageIds.visibilityManual. Today it skips everyhiddenFromAImessage (~188), so without this the next preview would lose every hidden piece andoutdatedSourceNotes(~801) would offer to remove its source note.chat.metadata, ~619).processLongTermMemorySourceBatchcall, ~1283), hide the committedchat_transcriptpieces' messages, minus the tail, and record what was flipped. No Engine chat lock: LTM never callswithChatLocktoday, and none is needed, because ownership is only what the Engine reports flipped. A message the summary or the user hid first is never claimed, and a deleted id is simply not returned.persistence/storage.tsevidencecaps at 100 entries, which a 24k-character piece can exceed, so the record lives beside the notes.deleteNotesPermanently(~1095) shows the deleted source notes' owned messages again and drops their records. Moving a note to trash does not show them; restoring it keeps them hidden. It is also reached from scope pruning (~1363) and trash purge, so the show pass tolerates a chat that no longer exists (the host rejects with "was not found") and still drops the record.shared/src/features/agents/long-term-memory/schema/settings.tsgets the boolean onltmGlobalSettingsSchema(~43). Turning it on or off runs the hide or show pass described above.chat-writetopermissions. This is a permission change and needs explicit validation notes; existing installs see the new permission on update. LTM calls only the new method; it gains but does not useappendMessages,patchChatMetadata,createChatNote,createChatInfluenceandupdateCharacterStatus, and the PR's validation notes say so.capabilityApistays 1.387 andengine.minstays 2.5.1.enandkostrings;node scripts/validate-package-locales.mjsmust pass.Regression: a deterministic test with a fake host and fake language model, next to
tests/long-term-memory-chat-transcript-import.regression.ts:Non-goals
Why should this be optional?
Hidden messages reach the AI only when recall brings them back as memories. A summary is always in the prompt, but LTM recall is selective, so continuity in a chat with this setting on depends on recall quality. That is a trade-off each user should choose, which is why it is off by default and keeps a recent tail.
Alternatives considered
Additional context
hiddenMessageIdson each summary entry (summaryHidingPatch,generate-route-utils.ts~867); this follows that model.hiddenFromAIonto the copied messages. If it does, a branch's copies of hidden messages are not owned by LTM, and its Chat messages import would skip them like any other hidden message.Template check