[PR #6750] [MERGED] feat(memory): add optional Decision model for Advanced Memory #7313

Closed
opened 2026-10-23 04:18:33 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6750
Author: @SpicyMarinara
Created: 9/27/2026
Status: ✅ Merged
Merged: 9/27/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/advanced-memory-decisions


📝 Commits (3)

  • 494eb5e docs: start Advanced Memory decision integration (#6749)
  • ffb1e39 feat(memory): use optional Decision connection for scenes and recall (#6749)
  • a561995 fix(memory): retain fallback vectors during Decision reindex

📊 Changes

16 files changed (+812 additions, -67 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/FAQ.md (+1 -1)
📝 docs/agents/memory.md (+18 -6)
📝 docs/connections/decision-models.md (+4 -0)
📝 e2e/advanced-memory-wizard.e2e.ts (+2 -2)
📝 e2e/advanced-memory.e2e.ts (+72 -3)
📝 packages/client/src/components/chat/AdvancedMemoryInspector.tsx (+9 -1)
📝 packages/client/src/components/chat/AdvancedMemorySettings.tsx (+54 -0)
📝 packages/client/src/localization/locales/en.json (+15 -4)
📝 packages/server/src/routes/advanced-memory.routes.ts (+1 -0)
📝 packages/server/src/routes/generate.routes.ts (+1 -0)
➕ packages/server/src/services/advanced-memory-decisions.ts (+102 -0)
📝 packages/server/src/services/advanced-memory.ts (+201 -50)
📝 packages/shared/src/types/advanced-memory.ts (+2 -0)
📝 scripts/regressions/advanced-memory-context.regression.ts (+2 -0)
➕ scripts/regressions/advanced-memory-decisions.regression.ts (+326 -0)

📄 Description

Linked issue

Closes #6749. Owner: @SpicyMarinara (Codex-assisted).

Why this change

Roleplay Advanced Memory can use a Decision model such as Jev to choose useful past scenes and original dialogue, including when wording differs from the latest message. The same connection can detect scene boundaries while the existing Helper model continues to write summaries.

What changed

  • Add an off-by-default, per-chat Use Decision model (Jev) toggle and saved Decision connection picker in the existing drawer and setup wizard. Remove Advanced Memory's Alpha labels.
  • Reuse the existing Decision backend for historical and ongoing scene checks, scene ranking and excerpt selection. Require complete, bounded answers; uncertain boundaries remain open. No new dependencies or provider transport.
  • Filter character access and private recap conditions before recall requests. Preserve existing context budgets, excerpt limits, read-only previews and compatible swipe snapshots. Skip new archive embeddings while enabled; missing connections, errors, incomplete answers and a combined 10-second recall deadline use existing fallbacks.
  • Update the memory guide, Decision guide, FAQ and changelog. Translations merged in #6753 (10 documentation packs and 11 UI packs).

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

Completed automated checks (checkboxes above remain the human contributor's checklist):

  • pnpm check, including localization, formatting, types and production build; final browser-test type and formatting checks also passed.
  • All 11 Advanced Memory Node regression files passed. The new HTTP fixture proves routing, character-hidden and conditional-private data exclusion, rejected/partial answers, the real 10-second timeout, cancellation, exact boundary IDs, preserved summary routing, disabled/missing connections, bounded batches and swipe reuse.
  • Prompt, attachment, context-fit and agent scene-check regressions passed.
  • All 14 desktop Advanced Memory and wizard browser cases passed; the new settings case also passed on mobile Chromium and mobile WebKit, in both themes. pnpm smoke:ui: 7 passed.
  • Production Docker image built and started on ARM64; health, settings persistence and invalid-connection HTTP 400 checks passed in its isolated data volume.
  • Local CodeRabbit completed. One minor suggestion was rejected: using only retrieveMinMessages for probability-ranked excerpts would suppress relevant excerpts when the minimum is zero. Math.ceil turns a passing probability into one message, then the existing minimum/maximum limits apply. The reindex correction below received a further local review with no findings. No substantive local findings remain.

Manual verification notes

Automated real-browser interactions enabled the toggle, checked the unselected-connection warning, selected a connection, reloaded to verify persistence, deleted the connection to verify fallback warnings, and disabled the option. Captures were inspected for the existing layout and light/dark themes.

  • Manually verify live TypeSafe/OpenRouter Jev recall quality and scene endings on representative roleplays. Provider routing and failure behavior use synthetic HTTP fixtures; no paid hosted-model calls were made.
  • Manually verify translated controls and guides after #6753 is available.

GitHub review follow-up

Fixed the reported reindex edge case: Decision mode now retains existing valid fallback vectors instead of clearing them. The new regression builds vectors in ordinary mode, enables decisions, reindexes, and verifies the same vectorized records survive without any model calls. All 11 memory regression files and pnpm check passed again, and the final container rebuilt and started successfully. New embeddings remain intentionally disabled in Decision mode; documented text matching remains the fallback for records without vectors.

The two translated-documentation comments are covered by merged #6753.

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
  • Version/release files updated (only if this PR includes a version bump)

English documentation and changelog are included. No version or storage-format change is needed. Existing chats keep ordinary memory behavior until the new option is enabled.

UI evidence (if applicable)

Desktop and mobile, toggle off/on, light and dark captures. All captures use disposable synthetic chats.

Summary by CodeRabbit

  • New Features
    • Advanced Memory can optionally use a saved Decision connection to detect scene boundaries and select relevant memories and excerpts. Summaries continue to use the Helper model.
    • Configure Decision-model use per chat in Advanced Memory settings. If a decision is unavailable or fails, existing scene checks and recall remain available.
    • Settings identify unavailable connections and prompt you to select a valid one.
  • Updates
    • Advanced Memory Recall is now labeled without the “Alpha” designation across the app and documentation.

🔄 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/6750 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/27/2026 **Status:** ✅ Merged **Merged:** 9/27/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/advanced-memory-decisions` --- ### 📝 Commits (3) - [`494eb5e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/494eb5e2c1efe741e6369954740de1fec909ce08) docs: start Advanced Memory decision integration (#6749) - [`ffb1e39`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ffb1e399ccf412f11b4931d8ad752cc0b1624d2c) feat(memory): use optional Decision connection for scenes and recall (#6749) - [`a561995`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a5619956bab7250d1d404f8bad7e076650785faf) fix(memory): retain fallback vectors during Decision reindex ### 📊 Changes **16 files changed** (+812 additions, -67 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/FAQ.md` (+1 -1) 📝 `docs/agents/memory.md` (+18 -6) 📝 `docs/connections/decision-models.md` (+4 -0) 📝 `e2e/advanced-memory-wizard.e2e.ts` (+2 -2) 📝 `e2e/advanced-memory.e2e.ts` (+72 -3) 📝 `packages/client/src/components/chat/AdvancedMemoryInspector.tsx` (+9 -1) 📝 `packages/client/src/components/chat/AdvancedMemorySettings.tsx` (+54 -0) 📝 `packages/client/src/localization/locales/en.json` (+15 -4) 📝 `packages/server/src/routes/advanced-memory.routes.ts` (+1 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+1 -0) ➕ `packages/server/src/services/advanced-memory-decisions.ts` (+102 -0) 📝 `packages/server/src/services/advanced-memory.ts` (+201 -50) 📝 `packages/shared/src/types/advanced-memory.ts` (+2 -0) 📝 `scripts/regressions/advanced-memory-context.regression.ts` (+2 -0) ➕ `scripts/regressions/advanced-memory-decisions.regression.ts` (+326 -0) </details> ### 📄 Description ## Linked issue Closes #6749. Owner: @SpicyMarinara (Codex-assisted). ## Why this change Roleplay Advanced Memory can use a Decision model such as Jev to choose useful past scenes and original dialogue, including when wording differs from the latest message. The same connection can detect scene boundaries while the existing Helper model continues to write summaries. ## What changed - Add an off-by-default, per-chat **Use Decision model (Jev)** toggle and saved Decision connection picker in the existing drawer and setup wizard. Remove Advanced Memory's Alpha labels. - Reuse the existing Decision backend for historical and ongoing scene checks, scene ranking and excerpt selection. Require complete, bounded answers; uncertain boundaries remain open. No new dependencies or provider transport. - Filter character access and private recap conditions before recall requests. Preserve existing context budgets, excerpt limits, read-only previews and compatible swipe snapshots. Skip new archive embeddings while enabled; missing connections, errors, incomplete answers and a combined 10-second recall deadline use existing fallbacks. - Update the memory guide, Decision guide, FAQ and changelog. Translations merged in #6753 (10 documentation packs and 11 UI packs). ## 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` Completed automated checks (checkboxes above remain the human contributor's checklist): - `pnpm check`, including localization, formatting, types and production build; final browser-test type and formatting checks also passed. - All 11 Advanced Memory Node regression files passed. The new HTTP fixture proves routing, character-hidden and conditional-private data exclusion, rejected/partial answers, the real 10-second timeout, cancellation, exact boundary IDs, preserved summary routing, disabled/missing connections, bounded batches and swipe reuse. - Prompt, attachment, context-fit and agent scene-check regressions passed. - All 14 desktop Advanced Memory and wizard browser cases passed; the new settings case also passed on mobile Chromium and mobile WebKit, in both themes. `pnpm smoke:ui`: 7 passed. - Production Docker image built and started on ARM64; health, settings persistence and invalid-connection HTTP 400 checks passed in its isolated data volume. - Local CodeRabbit completed. One minor suggestion was rejected: using only `retrieveMinMessages` for probability-ranked excerpts would suppress relevant excerpts when the minimum is zero. `Math.ceil` turns a passing probability into one message, then the existing minimum/maximum limits apply. The reindex correction below received a further local review with no findings. No substantive local findings remain. ### Manual verification notes Automated real-browser interactions enabled the toggle, checked the unselected-connection warning, selected a connection, reloaded to verify persistence, deleted the connection to verify fallback warnings, and disabled the option. Captures were inspected for the existing layout and light/dark themes. - [ ] Manually verify live TypeSafe/OpenRouter Jev recall quality and scene endings on representative roleplays. Provider routing and failure behavior use synthetic HTTP fixtures; no paid hosted-model calls were made. - [ ] Manually verify translated controls and guides after #6753 is available. ### GitHub review follow-up Fixed the reported reindex edge case: Decision mode now retains existing valid fallback vectors instead of clearing them. The new regression builds vectors in ordinary mode, enables decisions, reindexes, and verifies the same vectorized records survive without any model calls. All 11 memory regression files and `pnpm check` passed again, and the final container rebuilt and started successfully. New embeddings remain intentionally disabled in Decision mode; documented text matching remains the fallback for records without vectors. The two translated-documentation comments are covered by merged #6753. ## 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 - [ ] Version/release files updated (only if this PR includes a version bump) English documentation and changelog are included. No version or storage-format change is needed. Existing chats keep ordinary memory behavior until the new option is enabled. ## UI evidence (if applicable) [Desktop and mobile, toggle off/on, light and dark captures](https://gist.github.com/SpicyMarinara/90870102ea31b5f589f3df9dbff22323). All captures use disposable synthetic chats. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Advanced Memory can optionally use a saved Decision connection to detect scene boundaries and select relevant memories and excerpts. Summaries continue to use the Helper model. * Configure Decision-model use per chat in Advanced Memory settings. If a decision is unavailable or fails, existing scene checks and recall remain available. * Settings identify unavailable connections and prompt you to select a valid one. * **Updates** * Advanced Memory Recall is now labeled without the “Alpha” designation across the app and documentation. <!-- 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-23 04:18:33 +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#7313
No description provided.