[GH-ISSUE #2287] [Issue]: Memory recall dropped its 0.25 relevance floor, admitting any positive-cosine match #1122

Closed
opened 2026-10-21 05:27:23 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Romuromylus on GitHub (Jun 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2287

Originally assigned to: @Xelvanis on GitHub.

Summary

The refactor admits any weakly-positive memory match (cosine > 0, further loosened by an additive lexical bonus) into recall. Main required similarity >= 0.25 and injected no memories block when nothing cleared the floor.

Expected behavior

Memory recall should enforce a minimum relevance floor (main uses 0.25) so that when only weak matches exist, no low-relevance fragments are injected and no context budget is spent.

Actual behavior

The refactor filters only similarity > 0, so faint matches (a weak positive cosine or a single shared lexical token bucket) are admitted and up to 8 fragments are injected, spending budget on low-relevance noise. The top-8 slice and the recall token budget bound the blast radius.

Steps to reproduce

  1. In a chat with stored memories unrelated to the current message, enable memory recall.
  2. Generate.
  3. Observe weakly-related memory fragments injected in the refactor; on main no memories block would appear.

Impact area

  • Chat mode
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • React-free engine behavior, contracts, agents, or capability ports

Regression notes

Worked on main. Main defines SIMILARITY_THRESHOLD = 0.25 and filters >= SIMILARITY_THRESHOLD (packages/server/src/services/memory-recall.ts:19,259); an empty result skips the memories block (generate.routes.ts:5052). The refactor computes cosineSimilarity(...) + Math.min(0.2, lexicalScore * 0.025) and filters only > 0 (src/engine/generation/prompt-assembly.ts:1867,1870). Grepping src, src-tauri, and crates for the floor (0.25, SIMILARITY_THRESHOLD, threshold) found only unrelated values; packRecalledMemories enforces only a token budget (prompt-assembly.ts:1738). Minor because top-8 plus the recall token budget bound it.

Environment

  • Branch or commit: refactor @ 5ddb9840 (compared against main @ b4ab97f)
  • Run mode: Tauri desktop
  • OS + version: Windows 11
  • Node + pnpm versions: not relevant (static source comparison)
  • Rust version, if relevant: not relevant (static source comparison)
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: see body

Template check

Please uncheck 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 @Romuromylus on GitHub (Jun 5, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2287 Originally assigned to: @Xelvanis on GitHub. ## Summary The refactor admits any weakly-positive memory match (cosine > 0, further loosened by an additive lexical bonus) into recall. Main required similarity >= 0.25 and injected no memories block when nothing cleared the floor. ## Expected behavior Memory recall should enforce a minimum relevance floor (main uses 0.25) so that when only weak matches exist, no low-relevance fragments are injected and no context budget is spent. ## Actual behavior The refactor filters only `similarity > 0`, so faint matches (a weak positive cosine or a single shared lexical token bucket) are admitted and up to 8 fragments are injected, spending budget on low-relevance noise. The top-8 slice and the recall token budget bound the blast radius. ## Steps to reproduce 1. In a chat with stored memories unrelated to the current message, enable memory recall. 2. Generate. 3. Observe weakly-related memory fragments injected in the refactor; on main no memories block would appear. ## Impact area - [x] Chat mode - [x] Runtime systems: generation, world-state, visuals, tracker, or haptics - [x] React-free engine behavior, contracts, agents, or capability ports ## Regression notes Worked on main. Main defines `SIMILARITY_THRESHOLD = 0.25` and filters `>= SIMILARITY_THRESHOLD` (`packages/server/src/services/memory-recall.ts:19,259`); an empty result skips the memories block (`generate.routes.ts:5052`). The refactor computes `cosineSimilarity(...) + Math.min(0.2, lexicalScore * 0.025)` and filters only `> 0` (`src/engine/generation/prompt-assembly.ts:1867,1870`). Grepping src, src-tauri, and crates for the floor (0.25, SIMILARITY_THRESHOLD, threshold) found only unrelated values; `packRecalledMemories` enforces only a token budget (`prompt-assembly.ts:1738`). Minor because top-8 plus the recall token budget bound it. ## Environment - Branch or commit: refactor @ 5ddb9840 (compared against main @ b4ab97f) - Run mode: Tauri desktop - OS + version: Windows 11 - Node + pnpm versions: not relevant (static source comparison) - Rust version, if relevant: not relevant (static source comparison) - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: see body ## Template check Please uncheck 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-21 05:27:23 +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-Engine#1122
No description provided.