[GH-ISSUE #1268] [Issue]: Memory Vault takes seconds to open because place pickers recompute memory presence every render #648

Closed
opened 2026-10-20 17:29:20 +07:00 by bsakaguchi · 0 comments
Owner

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

Originally assigned to: @Promansis on GitHub.

Summary

The Memory Vault takes several seconds to appear every time Long-Term Memory opens and every time you switch back to the Vault tab. The server answers quickly. The time goes into the browser recomputing the two place pickers on every Vault render.

Affected package

long-term-memory (1.4.15)

Expected behavior

The Vault should open and redraw quickly, and its render cost should not grow with the number of saved memories multiplied by the number of chats, branches, characters and personas.

Actual behavior

Each ScopeTargetPicker (primary and secondary place) sorts every place into "With memories" and "No memories". It runs ltmScopesOverlap against every memory scope in two separate filters (MemoryVault.tsx around lines 305-316). Both pickers sit inside <details> that are closed by default, but their contents are still built on every Vault render.

Measured on a real library (553 chats including 504 branches, 65 groups, 160 characters, 12 personas, 182 memories):

  • Server requests the Vault makes all finish in 2-120 ms (/status, /drafts/pending-count, /settings, /scope-targets?includeAllChats=true, /notes).
  • Replaying the pickers' per-render work on that /scope-targets data with the real ltmScopesOverlap: 790 places per picker, 517,548 overlap calls and roughly 850-940 ms per Vault render.
  • Switching tabs unmounts the Vault, so returning to it pays this again for each of several renders. The place lists are also de-duplicated with findIndex inside filter (quadratic, about 80 ms on this data).

Steps to reproduce

  1. Use a library with a few hundred chats or branches and over 100 saved memories.
  2. Open Long-Term Memory, or switch from another tab back to Memory Vault.
  3. The Vault takes several seconds before it responds.

Environment

  • Marinara Engine version: 2.5.0 (source checkout)
  • Package version: long-term-memory 1.4.15
  • Install type: source
  • OS + version: Windows
  • Browser or app shell: desktop browser (not profiled)

Logs, screenshots, or video

Timings above come from read-only requests to the live server and an offline replay of the picker logic. No private chat data is included.

Additional context

Planned fix: work out memory presence once per place in a single pass, cache it between renders and share it between both pickers, and de-duplicate the place lists with a Set. Grouping, labels and selection behavior stay the same.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Oct 8, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1268 Originally assigned to: @Promansis on GitHub. ## Summary The Memory Vault takes several seconds to appear every time Long-Term Memory opens and every time you switch back to the Vault tab. The server answers quickly. The time goes into the browser recomputing the two place pickers on every Vault render. ## Affected package long-term-memory (1.4.15) ## Expected behavior The Vault should open and redraw quickly, and its render cost should not grow with the number of saved memories multiplied by the number of chats, branches, characters and personas. ## Actual behavior Each `ScopeTargetPicker` (primary and secondary place) sorts every place into "With memories" and "No memories". It runs `ltmScopesOverlap` against every memory scope in two separate filters (`MemoryVault.tsx` around lines 305-316). Both pickers sit inside `<details>` that are closed by default, but their contents are still built on every Vault render. Measured on a real library (553 chats including 504 branches, 65 groups, 160 characters, 12 personas, 182 memories): - Server requests the Vault makes all finish in 2-120 ms (`/status`, `/drafts/pending-count`, `/settings`, `/scope-targets?includeAllChats=true`, `/notes`). - Replaying the pickers' per-render work on that `/scope-targets` data with the real `ltmScopesOverlap`: 790 places per picker, 517,548 overlap calls and roughly 850-940 ms per Vault render. - Switching tabs unmounts the Vault, so returning to it pays this again for each of several renders. The place lists are also de-duplicated with `findIndex` inside `filter` (quadratic, about 80 ms on this data). ## Steps to reproduce 1. Use a library with a few hundred chats or branches and over 100 saved memories. 2. Open Long-Term Memory, or switch from another tab back to Memory Vault. 3. The Vault takes several seconds before it responds. ## Environment - Marinara Engine version: 2.5.0 (source checkout) - Package version: long-term-memory 1.4.15 - Install type: source - OS + version: Windows - Browser or app shell: desktop browser (not profiled) ## Logs, screenshots, or video Timings above come from read-only requests to the live server and an offline replay of the picker logic. No private chat data is included. ## Additional context Planned fix: work out memory presence once per place in a single pass, cache it between renders and share it between both pickers, and de-duplicate the place lists with a `Set`. Grouping, labels and selection behavior stay the same. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:29:20 +07:00
  • closed this issue
  • added the
    bug
    label
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#648
No description provided.