[PR #8361] [MERGED] feat(generation): skip built-in recall when Long-Term Memory is on #8316

Closed
opened 2026-10-27 06:07:38 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8361
Author: @Promansis
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @Promansis

Base: staging ← Head: feature(generation)/8359-ltm-builtin-recall


📝 Commits (4)

  • ef4cd02 feat(generation): skip built-in recall when Long-Term Memory is on (#8359)
  • 3d57e35 Merge remote-tracking branch 'upstream/staging' into feature(generation)/8359-ltm-builtin-recall
  • 0d80563 fix(generation): return complete game session summaries from listChatSummaries (#8359)
  • 16a410d Merge remote-tracking branch 'upstream/staging' into feature(generation)/8359-ltm-builtin-recall

📊 Changes

10 files changed (+348 additions, -16 deletions)

View changed files

📝 docs/development/optional-agent-packages.md (+22 -0)
📝 packages/server/src/routes/generate.routes.ts (+56 -9)
➕ packages/server/src/routes/generate/memory-recall-policy.ts (+28 -0)
📝 packages/server/src/services/capability-packages/capability-persistence.service.ts (+69 -0)
📝 packages/server/src/services/generation/long-term-memory-runtime.ts (+5 -0)
📝 packages/shared/src/schemas/capability-package.schema.ts (+3 -1)
📝 packages/shared/src/types/capability-runtime.ts (+27 -1)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+6 -5)
📝 scripts/regressions/capability-persistence-permissions.regression.ts (+83 -0)
➕ scripts/regressions/long-term-memory-recall-policy.regression.ts (+49 -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 #8359

Why this change

  • With a Long-Term Memory package active, the main prompt still ran the built-in memory_chunks recall, so a turn could get two sets of memories. This makes the package replace the built-in recall, and gives its text the conversation memories slot when the preset has one.
  • Packages had no way to read a chat's stored summaries. persistence.listChatSummaries adds that (the optional second part of the issue).

What changed

  • Recall policy (routes/generate/memory-recall-policy.ts, used from generate.routes.ts): when the package is listed, enabled and its runtime service is registered, built-in prompt recall is off. In a conversation chat whose preset has a memories slot, the package's notes go in that slot, after the important block. Otherwise its agent placement is unchanged. If the runtime service is unregistered, built-in recall stays on.
  • Regenerate reuses the original turn's cached Long-Term Memory notes and runs no fresh recall, so a regenerated reply gets the same notes as the original. In slot mode those notes fill the slot and are kept out of the runtime-section replay, so they appear once.
  • persistence.listChatSummaries (chat-read): returns day, week, rolling and game-session summaries. A legacy single summary is dated with the chat's last update time, not the read time. Capability API 1.386 → 1.387, with a docs section.
  • Unchanged: roleplay exclusivity with Advanced Memory, the access_vectors agent-only recall, dry-run (which never ran this recall), and retry-agents (which runs built-in recall only for access_vectors agents).

Known cases where a regenerate gets no memories

Built-in recall stays off on every regenerate in a Long-Term Memory chat, and the slot text comes only from the cached notes. A regenerate therefore gets no memories when the original turn cached none:

  • the original recall timed out, failed or came back empty;
  • the regenerate target is a user message;
  • the turn predates installing the package.

A fresh recall here would run recall without prompt accounting, which is the behavior this change avoids, so it is left out on purpose.

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

Manual verification notes

Not done. Boxes are left for the human verifier.

Local commands run by the author's agent on the merged head (the boxes above stay unticked): pnpm check, pnpm version:check, and the regressions long-term-memory-recall-policy (new), capability-persistence-permissions (extended), capability-package-lifecycle (pins moved to 1.387), prompt, regeneration-context, roleplay-regeneration-context, memory-recall-exclusivity, agents-see-whispers, capability-prompt-preview, manual-agent-retry-resolution, prompt-attachments, context-fit and connection-model-list through node scripts/run-regressions.mjs --filter <name>.

Each new test was checked to fail without its fix: removing the replay filter fails long-term-memory-recall-policy, and removing the updatedAt dating fails capability-persistence-permissions.

Not proven:

  • A live turn with a real Long-Term Memory package. No end-to-end generation was run.
  • The route's own call sites of the new helpers. The helpers and the runtime-section code are tested; the route around them is not.

Risk: another Engine PR that bumps the capability API to 1.387 first would collide with this one.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) 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)

docs/development/optional-agent-packages.md documents listChatSummaries. No app version bump; the capability API moves to 1.387.

UI evidence (if applicable)

None. No UI change.

🤖 Generated with Claude Code


🔄 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/8361 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `staging` ← **Head:** `feature(generation)/8359-ltm-builtin-recall` --- ### 📝 Commits (4) - [`ef4cd02`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ef4cd021ab33f64964e0ab912a972ab86b7eba78) feat(generation): skip built-in recall when Long-Term Memory is on (#8359) - [`3d57e35`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3d57e35ce6a1fb37cab269fc086694e3a0e43e00) Merge remote-tracking branch 'upstream/staging' into feature(generation)/8359-ltm-builtin-recall - [`0d80563`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0d805639af7a819c053d32f12069c0c84ce67fa5) fix(generation): return complete game session summaries from listChatSummaries (#8359) - [`16a410d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/16a410d3225c77cf2fd309167341dbc7ccdb9e9f) Merge remote-tracking branch 'upstream/staging' into feature(generation)/8359-ltm-builtin-recall ### 📊 Changes **10 files changed** (+348 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `docs/development/optional-agent-packages.md` (+22 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+56 -9) ➕ `packages/server/src/routes/generate/memory-recall-policy.ts` (+28 -0) 📝 `packages/server/src/services/capability-packages/capability-persistence.service.ts` (+69 -0) 📝 `packages/server/src/services/generation/long-term-memory-runtime.ts` (+5 -0) 📝 `packages/shared/src/schemas/capability-package.schema.ts` (+3 -1) 📝 `packages/shared/src/types/capability-runtime.ts` (+27 -1) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+6 -5) 📝 `scripts/regressions/capability-persistence-permissions.regression.ts` (+83 -0) ➕ `scripts/regressions/long-term-memory-recall-policy.regression.ts` (+49 -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 #8359 ## Why this change - With a Long-Term Memory package active, the main prompt still ran the built-in `memory_chunks` recall, so a turn could get two sets of memories. This makes the package replace the built-in recall, and gives its text the conversation `memories` slot when the preset has one. - Packages had no way to read a chat's stored summaries. `persistence.listChatSummaries` adds that (the optional second part of the issue). ## What changed - **Recall policy** (`routes/generate/memory-recall-policy.ts`, used from `generate.routes.ts`): when the package is listed, enabled and its runtime service is registered, built-in prompt recall is off. In a conversation chat whose preset has a `memories` slot, the package's notes go in that slot, after the important block. Otherwise its agent placement is unchanged. If the runtime service is unregistered, built-in recall stays on. - **Regenerate** reuses the original turn's cached Long-Term Memory notes and runs no fresh recall, so a regenerated reply gets the same notes as the original. In slot mode those notes fill the slot and are kept out of the runtime-section replay, so they appear once. - **`persistence.listChatSummaries`** (`chat-read`): returns day, week, rolling and game-session summaries. A legacy single summary is dated with the chat's last update time, not the read time. Capability API 1.386 → 1.387, with a docs section. - Unchanged: roleplay exclusivity with Advanced Memory, the `access_vectors` agent-only recall, `dry-run` (which never ran this recall), and `retry-agents` (which runs built-in recall only for `access_vectors` agents). ### Known cases where a regenerate gets no memories Built-in recall stays off on every regenerate in a Long-Term Memory chat, and the slot text comes only from the cached notes. A regenerate therefore gets no memories when the original turn cached none: - the original recall timed out, failed or came back empty; - the regenerate target is a user message; - the turn predates installing the package. A fresh recall here would run recall without prompt accounting, which is the behavior this change avoids, so it is left out on purpose. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [ ] `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` ### Manual verification notes Not done. Boxes are left for the human verifier. Local commands run by the author's agent on the merged head (the boxes above stay unticked): `pnpm check`, `pnpm version:check`, and the regressions `long-term-memory-recall-policy` (new), `capability-persistence-permissions` (extended), `capability-package-lifecycle` (pins moved to 1.387), `prompt`, `regeneration-context`, `roleplay-regeneration-context`, `memory-recall-exclusivity`, `agents-see-whispers`, `capability-prompt-preview`, `manual-agent-retry-resolution`, `prompt-attachments`, `context-fit` and `connection-model-list` through `node scripts/run-regressions.mjs --filter <name>`. Each new test was checked to fail without its fix: removing the replay filter fails `long-term-memory-recall-policy`, and removing the `updatedAt` dating fails `capability-persistence-permissions`. Not proven: - A live turn with a real Long-Term Memory package. No end-to-end generation was run. - The route's own call sites of the new helpers. The helpers and the runtime-section code are tested; the route around them is not. Risk: another Engine PR that bumps the capability API to 1.387 first would collide with this one. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) 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) `docs/development/optional-agent-packages.md` documents `listChatSummaries`. No app version bump; the capability API moves to 1.387. ## UI evidence (if applicable) None. No UI change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-27 06:07:38 +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#8316
No description provided.