[GH-ISSUE #1567] [Feature]: Long-Term Memory: let other Agents recall memories about the characters they write as, with a switch in Memory Settings #1547

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

Originally created by @Promansis on GitHub (Oct 22, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1567

Originally assigned to: @Promansis on GitHub.

What problem does this solve?

Other Agents that write as a character want what Long-Term Memory knows about that character. Slurp already does this for its feed posts ("What your other Agents know"), and a Noodle update is planned. The only way in is the long-term-memory:storage service, which after #1565 lists whole memories available to a character everywhere. Every package then has to choose and trim memories itself, with nothing that ranks them against what it is about to write. The user can't see which Agents read memories, or stop them from Long-Term Memory's side.

Proposed package or change

A recall service for other Agents, a Memory Settings switch that stops every read by another Agent, and a line that names the Agents that read memories lately. One PR in long-term-memory, patch bump, on top of #1565. Nothing changes in the Engine, Slurp or Noodle.

Minimal fix

S = packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory, H = packages/long-term-memory/src/engine/packages/shared/src/features/agents/long-term-memory, C = packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory.

 activate
   registerService("long-term-memory:storage", createLtmStorageReadService(storage))
+  registerService("long-term-memory:recall", createLtmRecallService(storage))
+    recall({ caller?, queryText, characterIds?, personaId?, mode?, maxTokens?, signal? })
+      null unless "Other Agents can read memories" is on
+      notes = listNotes(characterIds, persona)      # no chat or group, so chat-limited memories never match
+        minus archived, game-only, tone and source memories
+        minus character and relationship memories that don't name an account as a subject
+      retrieveLongTermMemory(queryText, noteIds = notes, resolved included, the user's weights, maxTokens)
+      one section per memory: thread, timeline_event, relationship, character, world, scene, by relevance within a type
+      debug log: package_recall (caller, count)
+      -> { version: 1, sections: [{ noteId, type, title?, text }] }
 storage.listNotes(filter)
+  [] unless the switch is on; debug log: package_list (caller, count)
+GET /api/long-term-memory/settings/package-readers -> { readers: [{ caller, lastReadAt }] }   # from the debug log
  • Recall service. New S/services/recall.ts. Input checked with zod: caller (a name, up to 64 letters, digits and . _ : -; a malformed name is dropped, not the read), queryText (1-8,000 characters), characterIds (up to 20), personaId (only when the persona's own account writes), mode (roleplay or conversation), maxTokens (50-4,000, default 800) and an AbortSignal. It returns null for invalid input (no query, or no character or persona), an aborted call or reads turned off, and { version: 1, sections: [] } when nothing matches. It reuses the recall ranking through one new option in S/recall/retrieval.ts, noteIds, which limits the candidates to the listed memories. Malformed vault files are skipped, as in chat recall. Recall receipts and usage are not touched. A thrown error other than an abort reaches the caller.
  • Switch. longTermMemoryShareWithPackages in H/schema/settings.ts (optional in the settings, required in the resolved settings, default true). Off, the recall service returns null and the storage read [], which Slurp's flavour brief already treats as no memories.
  • Who reads. caller is the name a package gives itself; the Engine does not say who looks a service up. Each read writes one debug-log line (phase retrieval, action package_list or package_recall, the name as source, the count). GET /settings/package-readers lists the ten names that read most lately, each with its latest read, with null for a package that gave none. The list covers what the debug log holds (it keeps 1.5 to 2 MB), so Clear log empties it and refreshes the line.
  • Memory Settings. At the end of the Recall tab in C/settings/MemorySettings.tsx, a Toggle and one line under it. Activity labels both actions "Read by another Agent" (C/settings/ActivityView.tsx). Strings in C/locales/en.json:
    • label: "Other Agents can read memories"
    • help: "Lets other Agents, such as Slurp, use memories about the character they write as. They get only memories available to that character everywhere: never memories limited to a chat or group, archived memories or suggestions, and they can't change anything."
    • "Read lately by {{names}}." / "No other Agent has read memories lately." / "an Agent that gave no name"
    • Activity: "Read by another Agent"
  • Contract. docs/ARCHITECTURE.md gets "Services for Other Packages": the call, the result, the rules above and the versioning rule (a new section field can be added without a version change; removing or renaming one raises version).
  • CHANGELOG under ## Unreleased: other Agents can ask for memories about the characters they write as, with only memories available everywhere and no changes; the new setting (on by default) turns it off, also for Slurp's "What your other Agents know", and names the Agents that read memories lately; each read shows in Activity as "Read by another Agent".
 <MemorySettings> Recall tab
   …
   <Toggle "Filter generated stop words">
+  <Toggle "Other Agents can read memories">
+  <p>Read lately by slurp, an Agent that gave no name.</p>     # or "No other Agent has read memories lately."

Regression proof

tests/long-term-memory-runtime.regression.ts, in its own vault, with memories for character char-a:

  • the service is registered with version 1 and removed on deactivate;
  • a recall for char-a returns exactly a thread, a resolved timeline event, a relationship about char-a and char-b, char-a's character memory and a world memory, in that order, each with title and text. It leaves out a tone memory, a memory limited to a chat, an archived one, a game-only one, a character memory available to char-a but about char-z, and a character memory with no subjects;
  • naming a persona adds its persona-only memory; an unknown character gives { version: 1, sections: [] }, and so does mode: "conversation" against roleplay-only memories;
  • no query, no account and an aborted signal each give null;
  • a malformed caller name still reads; the reader list holds the recall's caller, the storage read's caller and the unnamed reads;
  • with the switch off, recall gives null and the storage read [].

tests/long-term-memory-routes.regression.ts lists the new route. Each of these one-line mutations fails the matching assertion: recall without the subject rule, a subject rule that lets subject-less memories through, tone added to the recalled types, and a switch that ignores the new setting.

Why should this be optional?

It stays inside Long-Term Memory, which is already optional, and adds no Engine code. Consent to use memories belongs to each reading Agent: Slurp's "What your other Agents know" today, and an off-by-default setting with a first-time confirmation in Noodle or Slurp when they move to this service. The new switch is the stop on Long-Term Memory's side. It is on by default so Slurp's current flavour brief keeps working after the update.

Alternatives considered

  • Keep the storage list only: each Agent re-implements ranking and the privacy rules, and Long-Term Memory can't change them later.
  • Check the caller's identity: the Engine's service lookup doesn't say who asks, and package server code runs inside the Engine with file access, so a check would stop no package that wants to read anyway. A self-given name is enough for the reader list.
  • Off by default: Slurp's flavour brief would stop reading memories after the update until the user found the switch.
  • Use the subject filter recall already has (exclusiveCharacterIds): it checks availability, not subjects, and only character and relationship memories have subjects. The service checks subjects on those and availability on the rest.

Additional context

Follows #1565. Noodle and Slurp would call runtime.services.get("long-term-memory:recall"), check version and keep their current behaviour when the service is missing or returns null; their changes are separate.

Template check

Please uncheck (untick) 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 @Promansis on GitHub (Oct 22, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1567 Originally assigned to: @Promansis on GitHub. ## What problem does this solve? Other Agents that write as a character want what Long-Term Memory knows about that character. Slurp already does this for its feed posts ("What your other Agents know"), and a Noodle update is planned. The only way in is the `long-term-memory:storage` service, which after #1565 lists whole memories available to a character everywhere. Every package then has to choose and trim memories itself, with nothing that ranks them against what it is about to write. The user can't see which Agents read memories, or stop them from Long-Term Memory's side. ## Proposed package or change A recall service for other Agents, a Memory Settings switch that stops every read by another Agent, and a line that names the Agents that read memories lately. One PR in `long-term-memory`, patch bump, on top of #1565. Nothing changes in the Engine, Slurp or Noodle. ### Minimal fix S = `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory`, H = `packages/long-term-memory/src/engine/packages/shared/src/features/agents/long-term-memory`, C = `packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory`. ```diff activate registerService("long-term-memory:storage", createLtmStorageReadService(storage)) + registerService("long-term-memory:recall", createLtmRecallService(storage)) + recall({ caller?, queryText, characterIds?, personaId?, mode?, maxTokens?, signal? }) + null unless "Other Agents can read memories" is on + notes = listNotes(characterIds, persona) # no chat or group, so chat-limited memories never match + minus archived, game-only, tone and source memories + minus character and relationship memories that don't name an account as a subject + retrieveLongTermMemory(queryText, noteIds = notes, resolved included, the user's weights, maxTokens) + one section per memory: thread, timeline_event, relationship, character, world, scene, by relevance within a type + debug log: package_recall (caller, count) + -> { version: 1, sections: [{ noteId, type, title?, text }] } storage.listNotes(filter) + [] unless the switch is on; debug log: package_list (caller, count) +GET /api/long-term-memory/settings/package-readers -> { readers: [{ caller, lastReadAt }] } # from the debug log ``` - **Recall service.** New `S/services/recall.ts`. Input checked with zod: `caller` (a name, up to 64 letters, digits and `. _ : -`; a malformed name is dropped, not the read), `queryText` (1-8,000 characters), `characterIds` (up to 20), `personaId` (only when the persona's own account writes), `mode` (`roleplay` or `conversation`), `maxTokens` (50-4,000, default 800) and an `AbortSignal`. It returns `null` for invalid input (no query, or no character or persona), an aborted call or reads turned off, and `{ version: 1, sections: [] }` when nothing matches. It reuses the recall ranking through one new option in `S/recall/retrieval.ts`, `noteIds`, which limits the candidates to the listed memories. Malformed vault files are skipped, as in chat recall. Recall receipts and usage are not touched. A thrown error other than an abort reaches the caller. - **Switch.** `longTermMemoryShareWithPackages` in `H/schema/settings.ts` (optional in the settings, required in the resolved settings, default `true`). Off, the recall service returns `null` and the storage read `[]`, which Slurp's flavour brief already treats as no memories. - **Who reads.** `caller` is the name a package gives itself; the Engine does not say who looks a service up. Each read writes one debug-log line (phase `retrieval`, action `package_list` or `package_recall`, the name as `source`, the count). `GET /settings/package-readers` lists the ten names that read most lately, each with its latest read, with `null` for a package that gave none. The list covers what the debug log holds (it keeps 1.5 to 2 MB), so Clear log empties it and refreshes the line. - **Memory Settings.** At the end of the Recall tab in `C/settings/MemorySettings.tsx`, a `Toggle` and one line under it. Activity labels both actions "Read by another Agent" (`C/settings/ActivityView.tsx`). Strings in `C/locales/en.json`: - label: "Other Agents can read memories" - help: "Lets other Agents, such as Slurp, use memories about the character they write as. They get only memories available to that character everywhere: never memories limited to a chat or group, archived memories or suggestions, and they can't change anything." - "Read lately by {{names}}." / "No other Agent has read memories lately." / "an Agent that gave no name" - Activity: "Read by another Agent" - **Contract.** `docs/ARCHITECTURE.md` gets "Services for Other Packages": the call, the result, the rules above and the versioning rule (a new section field can be added without a version change; removing or renaming one raises `version`). - **CHANGELOG under `## Unreleased`**: other Agents can ask for memories about the characters they write as, with only memories available everywhere and no changes; the new setting (on by default) turns it off, also for Slurp's "What your other Agents know", and names the Agents that read memories lately; each read shows in Activity as "Read by another Agent". ```diff <MemorySettings> Recall tab … <Toggle "Filter generated stop words"> + <Toggle "Other Agents can read memories"> + <p>Read lately by slurp, an Agent that gave no name.</p> # or "No other Agent has read memories lately." ``` ### Regression proof `tests/long-term-memory-runtime.regression.ts`, in its own vault, with memories for character `char-a`: - the service is registered with `version` 1 and removed on deactivate; - a recall for `char-a` returns exactly a thread, a resolved timeline event, a relationship about `char-a` and `char-b`, `char-a`'s character memory and a world memory, in that order, each with title and text. It leaves out a tone memory, a memory limited to a chat, an archived one, a game-only one, a character memory available to `char-a` but about `char-z`, and a character memory with no subjects; - naming a persona adds its persona-only memory; an unknown character gives `{ version: 1, sections: [] }`, and so does `mode: "conversation"` against roleplay-only memories; - no query, no account and an aborted signal each give `null`; - a malformed caller name still reads; the reader list holds the recall's caller, the storage read's caller and the unnamed reads; - with the switch off, recall gives `null` and the storage read `[]`. `tests/long-term-memory-routes.regression.ts` lists the new route. Each of these one-line mutations fails the matching assertion: recall without the subject rule, a subject rule that lets subject-less memories through, tone added to the recalled types, and a switch that ignores the new setting. ## Why should this be optional? It stays inside Long-Term Memory, which is already optional, and adds no Engine code. Consent to use memories belongs to each reading Agent: Slurp's "What your other Agents know" today, and an off-by-default setting with a first-time confirmation in Noodle or Slurp when they move to this service. The new switch is the stop on Long-Term Memory's side. It is on by default so Slurp's current flavour brief keeps working after the update. ## Alternatives considered - Keep the storage list only: each Agent re-implements ranking and the privacy rules, and Long-Term Memory can't change them later. - Check the caller's identity: the Engine's service lookup doesn't say who asks, and package server code runs inside the Engine with file access, so a check would stop no package that wants to read anyway. A self-given name is enough for the reader list. - Off by default: Slurp's flavour brief would stop reading memories after the update until the user found the switch. - Use the subject filter recall already has (`exclusiveCharacterIds`): it checks availability, not subjects, and only character and relationship memories have subjects. The service checks subjects on those and availability on the rest. ## Additional context Follows #1565. Noodle and Slurp would call `runtime.services.get("long-term-memory:recall")`, check `version` and keep their current behaviour when the service is missing or returns `null`; their changes are separate. ## Template check Please **uncheck (untick)** 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.
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#1547
No description provided.