mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 20:58:37 +07:00
[GH-ISSUE #1251] [Issue]: LTM keyword and metadata buckets are capped before the scope filter #637
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#637
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 7, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1251
Originally assigned to: @Promansis on GitHub.
Summary
Keyword and metadata index buckets are truncated to 128 entries before the scope filter runs, so out-of-scope chunks can crowd in-scope chunks out of the keyword, direct and graph-seed lanes. The fuzzy keyword scan has the same flaw: it caps at 512 keywords across the whole vault.
Affected package
long-term-memory (
packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/keyword-index.ts,metadata-index.ts)Expected behavior
Only chunks allowed for the current chat (scope, status, mode) count toward each bucket's cap and the fuzzy-scan cap.
Actual behavior
keyword-index.ts:80,87,102,109dochunkIds.slice(0, 128). The allowed-set check is only insideadd(:67), after the slice.metadata-index.ts:56,65,69apply the bucket slice and a 128-candidate cap before the retrieval filters (retrieval.ts:142).chunking.ts:80,118). A recurring character or place keyword on ~26+ multi-section notes, including other chats' and archived or resolved notes, exceeds 128 entries. Out-of-scope ids fill the slice first, so in-scope chunks never get the exact (score 3/4) hit and never become graph seeds. The direct lane behaves the same for popular#tags.keyword-index.ts:92-94sorts and slices all keywords in the vault (including out-of-scope and archived) to 512 on every recall. In a vault of ~2000 keywords, a keyword after roughly "d..." can never fuzzy-match.Steps to reproduce
#tag) in other chats or archived notes, so they sort first in the bucket.Environment
staging)src/)Logs, screenshots, or video
None. Code-traced; anchors above. Full write-up: audit findings LTM-SCORE-04 and 08 (local
scratch/audits/ltm-recall-scoring.md, not tracked).Additional context
Proposed fix: apply the scope filter before the caps.
keyword-index.ts, checkallowedChunkswhile walking each bucket and stop after N allowed ids.getLtmMetadataMatches.Template check