[GH-ISSUE #1265] [Issue]: LTM recall clean-up: /search parity, Debug recall order, dead cooldowns, small-budget serializer drops #645

Closed
opened 2026-10-20 17:29:18 +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/1265

Originally assigned to: @Promansis on GitHub.

Summary

Recall clean-up left over from the #1250 / #1258 scoring audit (scoring follow-up: #1264). /search does not reproduce a real recall turn, the Debug recall list shows relevance in an order that relevance does not explain, cooldown plumbing in ranking is dead, and the prompt serializer still drops selected memories at very small budgets. None of these change recall scoring.

Affected package

long-term-memory 1.4.15:

  • routes.ts, retrieval.ts, ranking.ts, budget.ts, prompt.ts under packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/
  • ActivityView.tsx under packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/

Expected behavior

  • POST /search without explicit settings returns what a chat turn would recall: the resolved recall settings (style weights, threshold, max memories, include-resolved), the prompt-overhead reserve and prompt-normalized token estimates. Explicit body fields still override. This makes it usable for an in-app "test recall" panel.
  • The Debug recall list makes clear why a memory with higher relevance can be cut by the memory cap while a lower one is injected.
  • Ranking has no unused cooldown parameters.
  • At small prompt budgets, memories retrieval selected are not silently dropped by the serializer, or the drop is reported.

Actual behavior

  1. /search defaults differ from a turn (routes.ts:1426, retrieval.ts:161-236). With no weights in the body, the semantic lane is disabled (semanticWeight ?? 0), lexical, keyword and graph run at weight 1, maxChunks is 20, there is no threshold, no overhead reserve and no prompt-normalized estimate. A query sent to /search can return a very different set from the same text in a chat turn. The client does not call /search.
  2. Debug list order vs relevance (ActivityView.tsx:556). Candidates are listed in fused (RRF) order with their relevance score, but no rank. The memory cap cuts in fused order, so a candidate rejected as lower_rank can show higher relevance than one that was injected (for example 0.45 cut beside 0.35 injected), which reads as a bug.
  3. Dead cooldowns (ranking.ts:36, :82-89; cooldownPenalty in budget.ts). reciprocalRankFuse accepts cooldowns, but its only caller (retrieval.ts:233) never passes them.
  4. Serializer drops at small budgets (audit item 05 leftover, prompt.ts). After the 1.4.11 overhead reserve, on a labelled fixture at default settings the serializer still dropped 13 selected chunks at a 256-token budget and 3 at 512 (0 at 4096). It never exceeds the budget.

Steps to reproduce

  1. POST /api/long-term-memory/search with only queryText and a chat scope, then send the same text as the last messages of a chat turn with debug logging on. Compare the selected memories and the semanticOutcome.
  2. In Debug, open a recall with more candidates than the memory cap and compare relevance values of injected and lower_rank candidates.
  3. Set the recall prompt budget to 256 tokens with debug logging on and compare retrieval's selected count with the injected count.

Environment

  • Marinara Engine version: 2.5.0 line (staging)
  • Package version: long-term-memory 1.4.15 (upstream/staging 7fc3b91c2)
  • Install type: source (code audit plus local evaluation with the package's real retrieval code)
  • OS + version: not platform-specific
  • Browser or app shell: any

Logs, screenshots, or video

Not applicable; references above are against 7fc3b91c2.

Additional context

Suggested approach:

  1. /search: resolve settings with resolveLongTermMemoryRecallSettings for the requested mode, reserve estimateLongTermMemoryPromptOverhead, pass promptNormalizedEstimate, and let explicit body fields override. Optionally return the serializer result so a preview equals the injected block. Regression test: /search with only queryText matches the generation-injection selection for the same text and scope.
  2. Debug list: show fused rank beside relevance, and label lower_rank as "cut by the memory limit (lower fused rank)".
  3. Remove the cooldowns option, LtmRankCooldown and cooldownPenalty.
  4. Serializer: refill from the remaining ranked candidates when a selected chunk does not fit after framing, or report the drop in the recall explanation.

Independent of the recall scoring fix and can land before or after it.

Template check

  • 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/1265 Originally assigned to: @Promansis on GitHub. ## Summary Recall clean-up left over from the #1250 / #1258 scoring audit (scoring follow-up: #1264). `/search` does not reproduce a real recall turn, the Debug recall list shows relevance in an order that relevance does not explain, cooldown plumbing in ranking is dead, and the prompt serializer still drops selected memories at very small budgets. None of these change recall scoring. ## Affected package `long-term-memory` 1.4.15: - `routes.ts`, `retrieval.ts`, `ranking.ts`, `budget.ts`, `prompt.ts` under `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/` - `ActivityView.tsx` under `packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/` ## Expected behavior - `POST /search` without explicit settings returns what a chat turn would recall: the resolved recall settings (style weights, threshold, max memories, include-resolved), the prompt-overhead reserve and prompt-normalized token estimates. Explicit body fields still override. This makes it usable for an in-app "test recall" panel. - The Debug recall list makes clear why a memory with higher relevance can be cut by the memory cap while a lower one is injected. - Ranking has no unused cooldown parameters. - At small prompt budgets, memories retrieval selected are not silently dropped by the serializer, or the drop is reported. ## Actual behavior 1. **`/search` defaults differ from a turn** (`routes.ts:1426`, `retrieval.ts:161-236`). With no weights in the body, the semantic lane is disabled (`semanticWeight ?? 0`), lexical, keyword and graph run at weight 1, `maxChunks` is 20, there is no threshold, no overhead reserve and no prompt-normalized estimate. A query sent to `/search` can return a very different set from the same text in a chat turn. The client does not call `/search`. 2. **Debug list order vs relevance** (`ActivityView.tsx:556`). Candidates are listed in fused (RRF) order with their relevance score, but no rank. The memory cap cuts in fused order, so a candidate rejected as `lower_rank` can show higher relevance than one that was injected (for example 0.45 cut beside 0.35 injected), which reads as a bug. 3. **Dead cooldowns** (`ranking.ts:36`, `:82-89`; `cooldownPenalty` in `budget.ts`). `reciprocalRankFuse` accepts `cooldowns`, but its only caller (`retrieval.ts:233`) never passes them. 4. **Serializer drops at small budgets** (audit item 05 leftover, `prompt.ts`). After the 1.4.11 overhead reserve, on a labelled fixture at default settings the serializer still dropped 13 selected chunks at a 256-token budget and 3 at 512 (0 at 4096). It never exceeds the budget. ## Steps to reproduce 1. `POST /api/long-term-memory/search` with only `queryText` and a chat scope, then send the same text as the last messages of a chat turn with debug logging on. Compare the selected memories and the `semanticOutcome`. 2. In Debug, open a recall with more candidates than the memory cap and compare relevance values of injected and `lower_rank` candidates. 3. Set the recall prompt budget to 256 tokens with debug logging on and compare retrieval's selected count with the injected count. ## Environment - Marinara Engine version: 2.5.0 line (`staging`) - Package version: long-term-memory 1.4.15 (`upstream/staging` 7fc3b91c2) - Install type: source (code audit plus local evaluation with the package's real retrieval code) - OS + version: not platform-specific - Browser or app shell: any ## Logs, screenshots, or video Not applicable; references above are against 7fc3b91c2. ## Additional context Suggested approach: 1. `/search`: resolve settings with `resolveLongTermMemoryRecallSettings` for the requested mode, reserve `estimateLongTermMemoryPromptOverhead`, pass `promptNormalizedEstimate`, and let explicit body fields override. Optionally return the serializer result so a preview equals the injected block. Regression test: `/search` with only `queryText` matches the generation-injection selection for the same text and scope. 2. Debug list: show fused rank beside relevance, and label `lower_rank` as "cut by the memory limit (lower fused rank)". 3. Remove the `cooldowns` option, `LtmRankCooldown` and `cooldownPenalty`. 4. Serializer: refill from the remaining ranked candidates when a selected chunk does not fit after framing, or report the drop in the recall explanation. Independent of the recall scoring fix and can land before or after it. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:29:18 +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#645
No description provided.