[GH-ISSUE #1083] [Feature]: Expand Long-Term Memory keyword stop words and add a global custom stop-word list #550

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

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

Originally assigned to: @Promansis on GitHub.

What problem does this solve?

Long-Term Memory's keyword lane filters tokens through a fixed STOP_WORDS set in packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/keyword-extract.ts. The list misses common discourse/filler terms, so low-information tokens can still be extracted as note keywords and matched as query terms. Users also cannot tune the list, so keyword-recall precision is fixed by the package rather than by the user.

Proposed package or change

Affected package: Long-Term Memory. Server source, a global settings field, and client settings UI.

Two parts:

  1. Refine the built-in list. Add low-recall-risk terms (remaining prepositions, modals, and discourse/filler markers) and, importantly, stop filtering tokens that carry meaning in a memory note — e.g. get, go, make, say, know, think, and negative contractions such as don't/can't/won't, which encode polarity the keyword lane already handles lossily. Normalize the curly right single quotation mark (U+2019, ’) — and optionally U+2018 — to the straight apostrophe (') inside normalizeKeywordToken before the stop-word check, so contraction entries need only one spelling instead of two.
  2. Add a global custom stop-word list setting. Apply it to both query normalization and note keyword extraction (generated keywords only), and invalidate/rebuild the keyword index when it changes so stored entries do not go stale. Manual user keywords stay user-owned and are not silently deleted or rewritten.

Supports Conversation, Roleplay, and Game modes. Needs server and client code, a package version bump with a CHANGELOG.md entry, and a rebuild of generated artifacts/catalog from source.

Why should this be optional?

This is Long-Term Memory-specific keyword tuning, not lightweight Engine core behavior, so it belongs in the downloadable package and its settings rather than the host.

Alternatives considered

  • Per-chat / character / persona / mode stop-word scoping. Deferred: it would need extra storage and UI, and a shared note should not get context-dependent stored keywords. Global first; scoped layers can follow with a concrete use case.
  • Listing every contraction twice (straight and curly apostrophe). Rejected in favor of one-time apostrophe normalization.
  • Adding every candidate from the two reference word lists. Rejected for meaning-bearing words (still, yet, well, back, way, much, many, get, go, make, let, say, know, think) that would reduce recall quality.

Additional context

Investigation only; no code changed in this issue's scope. Reference points: keyword-extract.ts (STOP_WORDS at line 9, normalizeKeywordToken at line 135), keyword index build in keyword-index.ts, rebuild path in rebuild.ts. Focused tests: tests/long-term-memory-runtime.regression.ts, tests/long-term-memory-storage.regression.ts. Only the keyword lane is affected; the BM25 lane is independent.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Sep 26, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1083 Originally assigned to: @Promansis on GitHub. ## What problem does this solve? Long-Term Memory's keyword lane filters tokens through a fixed `STOP_WORDS` set in `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/keyword-extract.ts`. The list misses common discourse/filler terms, so low-information tokens can still be extracted as note keywords and matched as query terms. Users also cannot tune the list, so keyword-recall precision is fixed by the package rather than by the user. ## Proposed package or change **Affected package:** Long-Term Memory. Server source, a global settings field, and client settings UI. Two parts: 1. **Refine the built-in list.** Add low-recall-risk terms (remaining prepositions, modals, and discourse/filler markers) and, importantly, stop filtering tokens that carry meaning in a memory note — e.g. `get`, `go`, `make`, `say`, `know`, `think`, and negative contractions such as `don't`/`can't`/`won't`, which encode polarity the keyword lane already handles lossily. Normalize the curly right single quotation mark (`U+2019`, `’`) — and optionally `U+2018` — to the straight apostrophe (`'`) inside `normalizeKeywordToken` before the stop-word check, so contraction entries need only one spelling instead of two. 2. **Add a global custom stop-word list setting.** Apply it to both query normalization and note keyword extraction (generated keywords only), and invalidate/rebuild the keyword index when it changes so stored entries do not go stale. Manual user keywords stay user-owned and are not silently deleted or rewritten. Supports Conversation, Roleplay, and Game modes. Needs server and client code, a package version bump with a `CHANGELOG.md` entry, and a rebuild of generated artifacts/catalog from source. ## Why should this be optional? This is Long-Term Memory-specific keyword tuning, not lightweight Engine core behavior, so it belongs in the downloadable package and its settings rather than the host. ## Alternatives considered - **Per-chat / character / persona / mode stop-word scoping.** Deferred: it would need extra storage and UI, and a shared note should not get context-dependent stored keywords. Global first; scoped layers can follow with a concrete use case. - **Listing every contraction twice (straight and curly apostrophe).** Rejected in favor of one-time apostrophe normalization. - **Adding every candidate from the two reference word lists.** Rejected for meaning-bearing words (`still`, `yet`, `well`, `back`, `way`, `much`, `many`, `get`, `go`, `make`, `let`, `say`, `know`, `think`) that would reduce recall quality. ## Additional context Investigation only; no code changed in this issue's scope. Reference points: `keyword-extract.ts` (`STOP_WORDS` at line 9, `normalizeKeywordToken` at line 135), keyword index build in `keyword-index.ts`, rebuild path in `rebuild.ts`. Focused tests: `tests/long-term-memory-runtime.regression.ts`, `tests/long-term-memory-storage.regression.ts`. Only the keyword lane is affected; the BM25 lane is independent. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:28:31 +07:00
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#550
No description provided.