mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1514] [Issue]: Long-Term Memory: the Memory Vault slows down with many memories because it draws every row #1500
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#1500
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 21, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1514
Originally assigned to: @Promansis on GitHub.
Summary
The Memory Vault slows down as a place gets more memories, because it draws a row for every memory, even inside closed groups, and every search letter redraws all of them. At 8,000 memories a single letter can take 3–4 s on a fast desktop and 13 s on a phone-speed CPU, and opening the Vault stalls the page for 1.7 s (6 s on the phone proxy). Even the real 197-memory vault crosses 100 ms on the first letter.
Affected package
long-term-memory1.4.55 (upstream/staging8b72729f1). Measured on 1.4.54 (UI-1) and re-timed on 1.4.55; the Vault client is unchanged since 1.4.53.C=packages/long-term-memory/src/engine/packages/client/src/features/long-term-memoryExpected behavior
Actual behavior
Measured with the UI-1 harness (headless Chromium, Ryzen 5 3600X; the phone proxy is 4× CPU throttling on the Pixel 7 viewport). Each letter waits for the whole list, so "input" and "results" are the same time:
When typing at a normal pace, keys queue behind the renders: at 8,000 memories on desktop the worst letter appears after 4.7 s, and on the phone proxy 28 letters take 80 s to work through.
Cause (CPU profile at 8,000 memories):
C/vault/MemoryVault.tsx:2504-2527in the base).MemoryVault's own render code is about 1.2 s, roughly 8%.:700) and the row previews are rebuilt on every render with the current text, so the letter can't paint before the list is rebuilt.Steps to reproduce
Minimal fix
One PR, patch bump. Client only: the small fix plus a 100-row cap per group with Show more, and no screen split.
C/vault/MemoryVault.tsx:useDeferredValue(search)drives the filter, the previews and the open groups. The filtered, sorted list is auseMemo, so the letter paints first and the list follows.C/vault/VaultRow.tsx, aReact.memocomponent with primitive props. Its handlers go through a ref thatMemoryVaultupdates on every render, so a row only re-renders when its own data changes. The row markup is unchanged apart from adata-ltm-note-idattribute.ui.longTermMemory.memoryvault.showMoreMemories, "Show {{value1}} more", N at most 100). The button names its group througharia-describedby, adds the next 100 rows and moves focus to the first row it added. A new search, filter, sort or place starts again at 100.packages/long-term-memory/docs/UI.md: the Memory Vault contract gains the cap and what it does not change.## Unreleased: one bullet, for example: "The Vault stays responsive in places with many memories. Letters typed into the search appear at once and the list follows, and each type shows its first 100 memories with a Show more button. Search, the filters, the counts and Select visible still include every memory."Not included
useMutation. The profile shows the screen's own code is about 8% of the work, so the split would not make the Vault faster. It stays an optional architecture tidy-up.Regression proof
In
tests/long-term-memory-browser.regression.ts, a new block after the desktop debug rows. A place with 250 world memories, one of them (number 230) mentioning a lighthouse:250 !== 100).tests/long-term-memory-feedback-clarity-ui.regression.mjsreads the row's classes fromVaultRow.tsx(new entry intests/long-term-memory-source-paths.mjs).Environment
stagingcheckout, unchanged; Playwright Chromium 153 from itsnode_modules)upstream/staging8b72729f1)Logs, screenshots, or video
UI-1's full write-up and its data are kept privately. The fixture clones the 197 real notes, so sizes and search match rates follow real data, and the mock answers every place with the whole fixture.
Re-timed with the fix on 1.4.55 (2026-10-20), 8,000 memories, base and patched interleaved in one run. The raw data and the full table are kept privately; the summary:
Typing a key every 150 ms on desktop, 28 keys now take 4.2 s instead of 16.4 s, and the worst letter is 295 ms instead of 3.6 s. The results match UI-1's measurement of the same approach (variant C) within run-to-run noise.
Additional context
Tracker items UI-2 (this change) and UI-1 (the timing checkpoint that measured it). UI-2 first read "split state ownership in the screens (A-003, A-005), starting with the Vault". UI-1 showed that drawing fewer rows is what helps, so this fix replaces the split.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: