[PR #7187] [MERGED] fix(memory): shortlist recall and let the decision model pick scenes, then messages #7616

Closed
opened 2026-10-24 04:05:53 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7187
Author: @SpicyMarinara
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/6/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/memory-recall-two-stage-7182


📝 Commits (6)

  • ab0f5b0 fix(memory): shortlist recall and let the decision model pick scenes, then messages
  • 55ed28d fix(memory): skip the message pass when the Decision model must be deferred
  • 0384796 fix(memory): keep speaker names out of name weighting and flag text-centred excerpts
  • f9487b7 Merge remote-tracking branch 'origin/staging' into fix/memory-recall-two-stage-7182
  • 467bfef Merge branch 'staging' into fix/memory-recall-two-stage-7182
  • 760e4ac Merge remote-tracking branch 'origin/staging' into fix/memory-recall-two-stage-7182

📊 Changes

9 files changed (+535 additions, -118 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 docs/agents/memory.md (+4 -4)
📝 docs/connections/decision-models.md (+1 -1)
📝 packages/client/src/localization/locales/en.json (+2 -2)
📝 packages/server/src/services/advanced-memory-decisions.ts (+9 -6)
📝 packages/server/src/services/advanced-memory-ranking.ts (+28 -2)
📝 packages/server/src/services/advanced-memory.ts (+152 -103)
➕ scripts/regressions/advanced-memory-recall-shortlist.regression.ts (+336 -0)
📝 scripts/run-regressions.mjs (+2 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7182

Why this change

  • With Use Decision model on, recall handed the Decision model (Jev) every eligible scene summary and every 3-message excerpt chunk, in batches of 24, under one shared 10-second limit. On a long chat (about 470 candidates in the reporter's diagnostics), Jev cannot finish in time. One failed batch threw away every score, the per-scene message pass was skipped too, and recall fell back to text matching.
  • That fallback then preferred "the resident cats at the Cat's Tail inn" over the scenes about the persona's cat Shiro. Plain IDF weighting counts the rare word "cat" above a pet name that recurs across many scenes. In a long roleplay turn, the name was also outweighed by many ordinary shared words.
  • In Decision mode the archive has no vectors, so the fallback was text-only.
  • The recall question also told Jev that "shared names or similar wording alone are insufficient", which works against a memory about something the user just named.
  • The maintainer's requested design: shortlist first, let the Decision model pick scenes, then run it again to pick which messages of those scenes to recall.

What changed

  • Stage 0, shortlist (always). Ordinary relevance scores every candidate: lexical, plus semantic whenever saved vectors exist in the active space. The query embedding is no longer skipped when a Decision model is on. A scene scores its summary or its best excerpt chunk, whichever is higher. With the Decision model off, this ranking chooses scenes exactly as before (same 0.12 threshold).
  • Pass 1. The Decision model judges only the top 24 scene summaries (MEMORY_DECISION_BATCH_SIZE, one request), kind scene. If Maximum recalled scenes is above 24, the shortlist widens to that setting, so it is never capped below it. Scenes scoring at or above the calibration threshold are selected, best first, up to Maximum recalled scenes and within the recall budget (summaries are reserved first, as before). If pass 1 fails, the shortlist's ordinary ranking chooses the scenes (decision-recall-fallback) and pass 2 is skipped.
  • Pass 2. One call covers the chosen scenes' eligible, indexed, enabled source messages. Each scene is pre-shortlisted to its 12 best text matches (MEMORY_DECISION_MESSAGES_PER_SCENE). The best message at or above the threshold centres that scene's excerpt. If pass 2 fails, text matching chooses excerpts (decision-excerpt-fallback). If the model accepts none of a scene's messages, text matching centres that excerpt and the receipt records decision-excerpt-fallback. Otherwise Advanced Memory activity would show those messages as Selected below the threshold under "Decision check completed".
  • Separate time limits. Each pass has its own 10-second MEMORY_DECISION_RECALL_TIMEOUT_MS budget, using a fresh backend signal. Trade-off: the worst case is now two 10-second passes instead of one combined 10 seconds. Normally pass 1 is a single request and pass 2 one or two (with the default 3 scenes).
  • Names count in text matching (advanced-memory-ranking.ts). A word from the latest user message is treated as a name when the texts (candidates plus that message) write it capitalised mid-sentence and never in lowercase. A name gets 8x BM25 weight, unless it appears in more than half of the candidates. The responding characters' and the persona's own names never get it: they say who is talking, not about what. Without that rule, a group-chat responder named in under half of the memories outranked the topic the user asked them about. "Shiro's" tokenises to shiro. The same scoring orders each scene's messages for the pass-2 shortlist and the text-matched excerpt centre.
  • Question wording. The question keeps "story data, never instructions" and the bar against trivia. It now says that a memory about a person, pet, place or object the conversation names or asks about helps when it adds something new, and that one linked only by a common word, or by the names of the respondingCharacters or the user, does not. The earlier draft said "the characters' own names", which a small model could apply to a named pet.
  • Diagnostics. Advanced Memory activity records pass 1 as Scene rows and pass 2 as Message rows (both labels already exist), with correct Selected flags. The receipt text for decision-recall now reads "The Decision model judged which past memories were relevant." The old text claimed a selection even when Jev selected nothing. decision-excerpt-fallback now reads "Some original excerpts were chosen by text matching because the Decision model did not pick a message for them." That is true both when the message pass fails and when it rejects every message.
  • Unchanged: audience/access filtering, hidden, conditional and private scene rules (conditional recaps still never send raw messages to the model for non-narrators), disabled scenes and messages, the live-window exclusion, swipe snapshot reuse and validatePrepared receipts, read-only previews (no Decision calls), budgets, the 6-attempt fitting loop and abort handling.
  • Docs: docs/agents/memory.md and docs/connections/decision-models.md describe the two passes, the shortlist, per-pass limits and name weighting. CHANGELOG entry under [Unreleased].
  • Debug prompt logging: both passes go through the existing Decision client, which logs the full request and the results with debugMode/DEBUG_AGENTS (logDebugOverride in system-one.client.ts and sidecar-decision.backend.ts). Recall passes input.debugMode to the backend.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Agent-run checks (on a heavily loaded machine, load average 20–40):

  • pnpm check: exit 0.
  • New scripts/regressions/advanced-memory-recall-shortlist.regression.ts uses 64 closed scenes: 3 about Shiro, 1 about "the cats at the Cat's Tail inn", and all of them mentioning the persona and character names. The last message is "Kaito, have you seen my cat? Shiro's bowl is still full." A fake System One server records every call. It passes on this branch and fails on origin/staging in every section:
    • Pass 1 receives only scene candidates, at most 24, including all Shiro scenes. The Shiro scenes are selected. Pass 2 receives only messages from those scenes, and the excerpts centre on the Shiro messages. Diagnostics show 3 selected scene and 3 selected message rows, with fallback: false. validatePrepared accepts the receipt. On staging, recall made 9 requests instead of 2.
    • When the backend returns 500: exactly one request, decision-recall-fallback, and the Shiro scenes are chosen without the cat-inn scene. Staging chose [cat-inn, shiro, shiro].
    • The model accepts the scenes but rejects every message: text matching still centres the excerpts on the Shiro messages, and the receipt records decision-excerpt-fallback with diagnostics fallback: true.
    • Maximum recalled scenes set to 30: the scene pass judges 30 summaries (two requests), not 24.
    • A second chat with Decision off, where the responder Kaito is named in 4 of 10 scenes and the user asks "Kaito, do you still have the lighthouse key?": the lighthouse scene is recalled. Without the speaker-name exclusion, the four Kaito scenes take all three slots.
    • Each pass delayed 5.5 s: both finish (decision-recall), proving separate budgets. Staging fell back at 10 s. The runner timeout for this file is raised to 60 s in scripts/run-regressions.mjs. There is no test seam for the 10 s constant, so this check waits about 11 real seconds.
    • Decision model off, with "Where did Shiro go? The cat flap is open.": the Shiro scenes are chosen and no Decision calls are made.
  • All other Advanced Memory regressions pass: audience, context, core, decisions, generation, history-start, inspector, post-generation, recall, recovery and summary. memory-recall-exclusivity, memory-recall-revectorize, roleplay-user-private-memory, native-export-memory, regression-timeout-policy and pnpm regression:prompt pass too. Under the machine load, core, history-start, post-generation, native-export-memory and inspector first hit the runner's 30 s limit or the inspector's 5 s timing check. Rerun directly or once the load dropped, they all passed; the inspector's 1000-message prepare took 318 ms and 606 ms.
  • pnpm localization:check passes. prettier --check passes on the changed TS, MD and JSON files. scripts/run-regressions.mjs and docs/connections/decision-models.md were already unformatted on staging and were left as they are.

Adversarial verification (second agent, head 038479669):

  • Privacy and access. The scene pass sends only access-filtered, audience-rendered recaps. It now sends no excerpt chunks, so it exposes less than staging did. The message pass sends only sceneSource messages, which are eligible for the audience, indexed and not disabled, from scenes that passed canRecallExcerpt. The existing decisions regression still proves hidden (PRIVATE_SECRET) and conditional (CONDITION_SECRET) text never reaches a request or the diagnostics. Read-only previews make no calls, compatible swipes reuse the snapshot, and abort still throws.
  • Fixed (commit 038479669): the speaker-name exclusion, the honest decision-excerpt-fallback when the model rejects every message, the shortlist widening for Maximum recalled scenes above 24, and the question wording. Each new assertion was checked to fail with only its own fix neutralised.
  • Ranking without the Decision model, old against new (the lexical investigator's end-to-end probe, 9 scenes, 3 about Shiro, lexical and 500-fallback modes): the short message improved from [0S,3S,8] to [0S,3S,6S], and the 300-word message from [2,3S,7] to [0S,3S,6S]. Lowercase "shiro's", the no-name, persona-name and side-name controls are unchanged.
  • After the fixes, pnpm check exits 0. All 12 Advanced Memory regressions pass, as do memory-recall-exclusivity, memory-recall-revectorize, roleplay-user-private-memory, native-export-memory, regression-timeout-policy and pnpm regression:prompt, at a load average of about 5. pnpm localization:check and prettier on the changed files also pass.
  • Local CodeRabbit on the final head: not run. The CLI was rate limited (3 included reviews used, next in about 39 minutes). The GitHub CodeRabbit review still has to run on 038479669.

Local CodeRabbit review by the builder (CLI 0.7.6, committed changes against the staging merge base, head 55ed28d5b):

  • First run: 2 minor findings.
    • Fixed: the message pass now also skips a backend that must be deferred (deferPreGeneration). A reasoning chat-model connection can learn that it reasons during the scene pass, and the message pass then uses text matching with decision-excerpt-fallback.
    • Rejected: "filter the shortlist to scores of at least 0.12". The shortlist fills one 24-question batch, best first, even with low-scoring scenes. Filling it costs no extra request, and the model can still pick a scene that shares no words with the message. Decision mode saves no vectors, so text matching is often the only ordinary signal. Before this change the model judged every scene. The 0.12 floor still applies whenever ordinary ranking decides alone (Decision off or failed).
  • Second run after the fix: 0 findings.

Manual verification notes

  • Manually verify with Use Decision model on, in a long Roleplay chat with many closed scenes: mention a pet or side character by name that appears in a few older scenes. The reply's memory should include those scenes. In Peek Prompt → Decision diagnostics → Advanced Memory activity, check for at most 24 Scene rows, then Message rows from the chosen scenes only, with the recalled ones marked Selected and "Decision check completed."
  • Manually verify that the same turn finishes recall within about 20 seconds at worst, and normally much faster, with no decision-recall-fallback reason in the memory receipt (Chat Settings → Advanced Memory) when the Decision connection is healthy.
  • Manually verify the fallback: point the memory Decision connection at an unreachable host, then mention the name again. The receipt should show the fallback reason, and the named scenes should still be recalled ahead of scenes that only share a common word.
  • Manually verify with Use Decision model off that a message naming the pet still recalls those scenes, and that a message using only the main characters' names does not pull in unrelated scenes.
  • Manually verify that Peek Prompt (read-only) still makes no Decision calls and shows "This preview uses ordinary recall…".
  • Manually verify in a group chat that addressing a character by name about a topic, such as "Yuna, do you remember the lighthouse?", recalls the lighthouse scene rather than only scenes in which Yuna speaks.
  • Manually verify that when the Decision model accepts a scene but none of its messages, the receipt lists "Some original excerpts were chosen by text matching…" and the activity panel reports the fallback.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

Changed English docs: docs/agents/memory.md and docs/connections/decision-models.md. The translated packs on docs-i18n still need matching updates or a [docs-i18n] follow-up issue.

UI evidence (if applicable)

No layout change. Diagnostics rows reuse the existing Scene and Message labels, and one receipt string in en.json was reworded.

Summary by CodeRabbit

  • New Features
    • Advanced Memory recall now uses a two-step process: it shortlists relevant scenes, then selects relevant messages within them. The shortlist can exceed 24 scenes when the configured maximum is higher.
    • Recall gives more weight to distinctive names in the latest message and can consider related memories about people, pets, places, and objects.
    • Each selection step has its own time limit, with relevance-based fallbacks when a step fails or times out.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7187 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/memory-recall-two-stage-7182` --- ### 📝 Commits (6) - [`ab0f5b0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ab0f5b0030c68d1f6aeef2054d58d7abdfe3a6c3) fix(memory): shortlist recall and let the decision model pick scenes, then messages - [`55ed28d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/55ed28d5b35db4fbebb3444e9a1cad3cd9e80c25) fix(memory): skip the message pass when the Decision model must be deferred - [`0384796`](https://github.com/Pasta-Devs/Marinara-Engine/commit/038479669c2c267cca74910c9b5dd9d579e7c492) fix(memory): keep speaker names out of name weighting and flag text-centred excerpts - [`f9487b7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f9487b7c037742c7c86677d7d8ca78c7ac741fd6) Merge remote-tracking branch 'origin/staging' into fix/memory-recall-two-stage-7182 - [`467bfef`](https://github.com/Pasta-Devs/Marinara-Engine/commit/467bfefde83b7fabef9f4f365eadfceb6593c103) Merge branch 'staging' into fix/memory-recall-two-stage-7182 - [`760e4ac`](https://github.com/Pasta-Devs/Marinara-Engine/commit/760e4acd09cc50e8ca2ff968f7397f471f9c3495) Merge remote-tracking branch 'origin/staging' into fix/memory-recall-two-stage-7182 ### 📊 Changes **9 files changed** (+535 additions, -118 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `docs/agents/memory.md` (+4 -4) 📝 `docs/connections/decision-models.md` (+1 -1) 📝 `packages/client/src/localization/locales/en.json` (+2 -2) 📝 `packages/server/src/services/advanced-memory-decisions.ts` (+9 -6) 📝 `packages/server/src/services/advanced-memory-ranking.ts` (+28 -2) 📝 `packages/server/src/services/advanced-memory.ts` (+152 -103) ➕ `scripts/regressions/advanced-memory-recall-shortlist.regression.ts` (+336 -0) 📝 `scripts/run-regressions.mjs` (+2 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #7182 ## Why this change - With **Use Decision model** on, recall handed the Decision model (Jev) **every** eligible scene summary and every 3-message excerpt chunk, in batches of 24, under one shared 10-second limit. On a long chat (about 470 candidates in the reporter's diagnostics), Jev cannot finish in time. One failed batch threw away every score, the per-scene message pass was skipped too, and recall fell back to text matching. - That fallback then preferred "the resident cats at the Cat's Tail inn" over the scenes about the persona's cat Shiro. Plain IDF weighting counts the rare word "cat" above a pet name that recurs across many scenes. In a long roleplay turn, the name was also outweighed by many ordinary shared words. - In Decision mode the archive has no vectors, so the fallback was text-only. - The recall question also told Jev that "shared names or similar wording alone are insufficient", which works against a memory about something the user just named. - The maintainer's requested design: shortlist first, let the Decision model pick scenes, then run it again to pick which messages of those scenes to recall. ## What changed - **Stage 0, shortlist (always).** Ordinary relevance scores every candidate: lexical, plus semantic whenever saved vectors exist in the active space. The query embedding is no longer skipped when a Decision model is on. A scene scores its summary or its best excerpt chunk, whichever is higher. With the Decision model off, this ranking chooses scenes exactly as before (same 0.12 threshold). - **Pass 1.** The Decision model judges only the top 24 scene summaries (`MEMORY_DECISION_BATCH_SIZE`, one request), kind `scene`. If **Maximum recalled scenes** is above 24, the shortlist widens to that setting, so it is never capped below it. Scenes scoring at or above the calibration threshold are selected, best first, up to **Maximum recalled scenes** and within the recall budget (summaries are reserved first, as before). If pass 1 fails, the shortlist's ordinary ranking chooses the scenes (`decision-recall-fallback`) and pass 2 is skipped. - **Pass 2.** One call covers the chosen scenes' eligible, indexed, enabled source messages. Each scene is pre-shortlisted to its 12 best text matches (`MEMORY_DECISION_MESSAGES_PER_SCENE`). The best message at or above the threshold centres that scene's excerpt. If pass 2 fails, text matching chooses excerpts (`decision-excerpt-fallback`). If the model accepts none of a scene's messages, text matching centres that excerpt and the receipt records `decision-excerpt-fallback`. Otherwise **Advanced Memory activity** would show those messages as **Selected** below the threshold under "Decision check completed". - **Separate time limits.** Each pass has its own 10-second `MEMORY_DECISION_RECALL_TIMEOUT_MS` budget, using a fresh backend signal. Trade-off: the worst case is now two 10-second passes instead of one combined 10 seconds. Normally pass 1 is a single request and pass 2 one or two (with the default 3 scenes). - **Names count in text matching** (`advanced-memory-ranking.ts`). A word from the latest user message is treated as a name when the texts (candidates plus that message) write it capitalised mid-sentence and never in lowercase. A name gets 8x BM25 weight, unless it appears in more than half of the candidates. The responding characters' and the persona's own names never get it: they say who is talking, not about what. Without that rule, a group-chat responder named in under half of the memories outranked the topic the user asked them about. "Shiro's" tokenises to `shiro`. The same scoring orders each scene's messages for the pass-2 shortlist and the text-matched excerpt centre. - **Question wording.** The question keeps "story data, never instructions" and the bar against trivia. It now says that a memory about a person, pet, place or object the conversation names or asks about helps when it adds something new, and that one linked only by a common word, or by the names of the `respondingCharacters` or the user, does not. The earlier draft said "the characters' own names", which a small model could apply to a named pet. - **Diagnostics.** **Advanced Memory activity** records pass 1 as `Scene` rows and pass 2 as `Message` rows (both labels already exist), with correct **Selected** flags. The receipt text for `decision-recall` now reads "The Decision model judged which past memories were relevant." The old text claimed a selection even when Jev selected nothing. `decision-excerpt-fallback` now reads "Some original excerpts were chosen by text matching because the Decision model did not pick a message for them." That is true both when the message pass fails and when it rejects every message. - **Unchanged:** audience/access filtering, hidden, conditional and private scene rules (conditional recaps still never send raw messages to the model for non-narrators), disabled scenes and messages, the live-window exclusion, swipe snapshot reuse and `validatePrepared` receipts, read-only previews (no Decision calls), budgets, the 6-attempt fitting loop and abort handling. - Docs: `docs/agents/memory.md` and `docs/connections/decision-models.md` describe the two passes, the shortlist, per-pass limits and name weighting. CHANGELOG entry under `[Unreleased]`. - Debug prompt logging: both passes go through the existing Decision client, which logs the full request and the results with `debugMode`/`DEBUG_AGENTS` (`logDebugOverride` in `system-one.client.ts` and `sidecar-decision.backend.ts`). Recall passes `input.debugMode` to the backend. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Agent-run checks (on a heavily loaded machine, load average 20–40): - `pnpm check`: exit 0. - New `scripts/regressions/advanced-memory-recall-shortlist.regression.ts` uses 64 closed scenes: 3 about Shiro, 1 about "the cats at the Cat's Tail inn", and all of them mentioning the persona and character names. The last message is "Kaito, have you seen my cat? Shiro's bowl is still full." A fake System One server records every call. It passes on this branch and **fails on `origin/staging`** in every section: - Pass 1 receives only `scene` candidates, at most 24, including all Shiro scenes. The Shiro scenes are selected. Pass 2 receives only messages from those scenes, and the excerpts centre on the Shiro messages. Diagnostics show 3 selected `scene` and 3 selected `message` rows, with `fallback: false`. `validatePrepared` accepts the receipt. On staging, recall made 9 requests instead of 2. - When the backend returns 500: exactly one request, `decision-recall-fallback`, and the Shiro scenes are chosen without the cat-inn scene. Staging chose `[cat-inn, shiro, shiro]`. - The model accepts the scenes but rejects every message: text matching still centres the excerpts on the Shiro messages, and the receipt records `decision-excerpt-fallback` with diagnostics `fallback: true`. - **Maximum recalled scenes** set to 30: the scene pass judges 30 summaries (two requests), not 24. - A second chat with Decision off, where the responder Kaito is named in 4 of 10 scenes and the user asks "Kaito, do you still have the lighthouse key?": the lighthouse scene is recalled. Without the speaker-name exclusion, the four Kaito scenes take all three slots. - Each pass delayed 5.5 s: both finish (`decision-recall`), proving separate budgets. Staging fell back at 10 s. The runner timeout for this file is raised to 60 s in `scripts/run-regressions.mjs`. There is no test seam for the 10 s constant, so this check waits about 11 real seconds. - Decision model off, with "Where did Shiro go? The cat flap is open.": the Shiro scenes are chosen and no Decision calls are made. - All other Advanced Memory regressions pass: audience, context, core, decisions, generation, history-start, inspector, post-generation, recall, recovery and summary. `memory-recall-exclusivity`, `memory-recall-revectorize`, `roleplay-user-private-memory`, `native-export-memory`, `regression-timeout-policy` and `pnpm regression:prompt` pass too. Under the machine load, core, history-start, post-generation, native-export-memory and inspector first hit the runner's 30 s limit or the inspector's 5 s timing check. Rerun directly or once the load dropped, they all passed; the inspector's 1000-message prepare took 318 ms and 606 ms. - `pnpm localization:check` passes. `prettier --check` passes on the changed TS, MD and JSON files. `scripts/run-regressions.mjs` and `docs/connections/decision-models.md` were already unformatted on staging and were left as they are. Adversarial verification (second agent, head `038479669`): - **Privacy and access.** The scene pass sends only access-filtered, audience-rendered recaps. It now sends no excerpt chunks, so it exposes less than staging did. The message pass sends only `sceneSource` messages, which are eligible for the audience, indexed and not disabled, from scenes that passed `canRecallExcerpt`. The existing decisions regression still proves hidden (`PRIVATE_SECRET`) and conditional (`CONDITION_SECRET`) text never reaches a request or the diagnostics. Read-only previews make no calls, compatible swipes reuse the snapshot, and abort still throws. - **Fixed (commit `038479669`):** the speaker-name exclusion, the honest `decision-excerpt-fallback` when the model rejects every message, the shortlist widening for **Maximum recalled scenes** above 24, and the question wording. Each new assertion was checked to fail with only its own fix neutralised. - **Ranking without the Decision model, old against new** (the lexical investigator's end-to-end probe, 9 scenes, 3 about Shiro, lexical and 500-fallback modes): the short message improved from `[0S,3S,8]` to `[0S,3S,6S]`, and the 300-word message from `[2,3S,7]` to `[0S,3S,6S]`. Lowercase "shiro's", the no-name, persona-name and side-name controls are unchanged. - After the fixes, `pnpm check` exits 0. All 12 Advanced Memory regressions pass, as do `memory-recall-exclusivity`, `memory-recall-revectorize`, `roleplay-user-private-memory`, `native-export-memory`, `regression-timeout-policy` and `pnpm regression:prompt`, at a load average of about 5. `pnpm localization:check` and prettier on the changed files also pass. - **Local CodeRabbit on the final head: not run.** The CLI was rate limited (3 included reviews used, next in about 39 minutes). The GitHub CodeRabbit review still has to run on `038479669`. Local CodeRabbit review by the builder (CLI 0.7.6, committed changes against the staging merge base, head `55ed28d5b`): - First run: 2 minor findings. - **Fixed:** the message pass now also skips a backend that must be deferred (`deferPreGeneration`). A reasoning chat-model connection can learn that it reasons during the scene pass, and the message pass then uses text matching with `decision-excerpt-fallback`. - **Rejected:** "filter the shortlist to scores of at least 0.12". The shortlist fills one 24-question batch, best first, even with low-scoring scenes. Filling it costs no extra request, and the model can still pick a scene that shares no words with the message. Decision mode saves no vectors, so text matching is often the only ordinary signal. Before this change the model judged every scene. The 0.12 floor still applies whenever ordinary ranking decides alone (Decision off or failed). - Second run after the fix: 0 findings. ### Manual verification notes - Manually verify with **Use Decision model** on, in a long Roleplay chat with many closed scenes: mention a pet or side character by name that appears in a few older scenes. The reply's memory should include those scenes. In **Peek Prompt → Decision diagnostics → Advanced Memory activity**, check for at most 24 `Scene` rows, then `Message` rows from the chosen scenes only, with the recalled ones marked **Selected** and "Decision check completed." - Manually verify that the same turn finishes recall within about 20 seconds at worst, and normally much faster, with no `decision-recall-fallback` reason in the memory receipt (Chat Settings → Advanced Memory) when the Decision connection is healthy. - Manually verify the fallback: point the memory Decision connection at an unreachable host, then mention the name again. The receipt should show the fallback reason, and the named scenes should still be recalled ahead of scenes that only share a common word. - Manually verify with **Use Decision model** off that a message naming the pet still recalls those scenes, and that a message using only the main characters' names does not pull in unrelated scenes. - Manually verify that Peek Prompt (read-only) still makes no Decision calls and shows "This preview uses ordinary recall…". - Manually verify in a group chat that addressing a character by name about a topic, such as "Yuna, do you remember the lighthouse?", recalls the lighthouse scene rather than only scenes in which Yuna speaks. - Manually verify that when the Decision model accepts a scene but none of its messages, the receipt lists "Some original excerpts were chosen by text matching…" and the activity panel reports the fallback. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) Changed English docs: `docs/agents/memory.md` and `docs/connections/decision-models.md`. The translated packs on `docs-i18n` still need matching updates or a `[docs-i18n]` follow-up issue. ## UI evidence (if applicable) No layout change. Diagnostics rows reuse the existing `Scene` and `Message` labels, and one receipt string in `en.json` was reworded. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Advanced Memory recall now uses a two-step process: it shortlists relevant scenes, then selects relevant messages within them. The shortlist can exceed 24 scenes when the configured maximum is higher. * Recall gives more weight to distinctive names in the latest message and can consider related memories about people, pets, places, and objects. * Each selection step has its own time limit, with relevance-based fallbacks when a step fails or times out. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:05:53 +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#7616
No description provided.