[PR #1268] [CLOSED] feat: Agent Memory Enhancement #5015

Closed
opened 2026-10-22 04:12:29 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1268
Author: @adunato
Created: 5/26/2026
Status: ❌ Closed

Base: staging ← Head: upstream-main


📝 Commits (3)

  • 19411f3 Fix mobile composer text input collapse (#1136)
  • 77a30fa Fix tracker aliases, avatars, HUD temps, and changelog (#1137)
  • 0649255 feat: add scoped agent memory tools

📊 Changes

17 files changed (+1178 additions, -160 deletions)

View changed files

📝 CHANGELOG.md (+16 -0)
📝 packages/client/src/components/chat/ConversationInput.tsx (+5 -5)
📝 packages/client/src/components/chat/RoleplayHUD.tsx (+19 -37)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+1 -1)
📝 packages/client/src/components/panels/settings/TrackerCardColorSettings.tsx (+17 -11)
📝 packages/client/src/features/tracker-panel/hooks/use-tracker-sprite-lookup.ts (+11 -6)
📝 packages/client/src/features/tracker-panel/lib/tracker-metadata.ts (+31 -0)
📝 packages/client/src/lib/character-display.ts (+40 -0)
📝 packages/server/src/db/migrate.ts (+66 -1)
📝 packages/server/src/db/schema/agents.ts (+10 -0)
📝 packages/server/src/routes/generate.routes.ts (+79 -54)
📝 packages/server/src/routes/generate/generate-route-utils.ts (+40 -4)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+16 -37)
➕ packages/server/src/routes/generate/secret-plot-memory.ts (+64 -0)
📝 packages/server/src/services/storage/agents.storage.ts (+355 -4)
📝 packages/server/src/services/tools/tool-executor.ts (+318 -0)
📝 packages/shared/src/types/agent.ts (+90 -0)

📄 Description

Linked issue

Closes #589

Why this change

Agents currently have only narrow per-agent key/value memory, which works for internal state like the secret plot driver but does not give built-in or custom agents a clear way to save, search, list, and delete durable memory records. This change adds an owner-aware agent memory surface that keeps current secret plot behavior working while making explicit agent-authored memory available through built-in tools.

Examples of how this expanded memory agent functionality can be used are: custom memories saving and retrieval, persistent custom trackers, etc

What changed

Key Changes

  • Expanded agent_memory storage to support typed records with title, content, metadata, optional embeddings, ownership fields, timestamps, and soft deletion.
  • Added built-in tools for save_agent_memory, search_agent_memory, list_agent_memory, and delete_agent_memory.

Secondary Changes

  • Added server-side ownership resolution from the current chat, executing agent config, and active character list, without accepting raw internal IDs from tool callers.
  • Added literal, fuzzy, and optional semantic search behavior; semantic search returns a clear unavailable result when embeddings are not available.
  • Updated existing agent memory compatibility so current key/value use, including secret plot state, continues through the enhanced storage model.
  • Added settings.memoryScope as an explicit opt-in for multi-agent cooperation, so writer/retriever custom agents can share records without making all agent memory chat-global.

Validation

  • pnpm check
  • Manual verification completed (describe below)
  • playwright testing to cover regression and new test (playtest files not included in the PR)

Manual verification notes

  • UI verification was performed ensuring that agent activity was logged correctly.
  • A Playwright suite exercised save, search, list, delete, and semantic-unavailable behavior through deterministic API/tool execution (playwright files not included as not part of repo testing strategy).
  • Follow-up local session verification confirmed the writer/retriever custom agents can be configured with the same memoryScope and that existing writer-owned character_memory records can be tagged with metadata.memoryScope for shared retrieval. The patch preserves per-agent isolation when memoryScope is absent.
  • No regression testing was performed on agent memory functionality used by Secret Plot agent confirming both writing and reading ot its generations.

Docs and release impact

  • No docs changes needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Not applicable. This change adds server/storage/tool behavior and does not introduce a user-facing UI surface.


🔄 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/1268 **Author:** [@adunato](https://github.com/adunato) **Created:** 5/26/2026 **Status:** ❌ Closed **Base:** `staging` ← **Head:** `upstream-main` --- ### 📝 Commits (3) - [`19411f3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/19411f3675ea22a60b5803feecfd0e8b17a6ab06) Fix mobile composer text input collapse (#1136) - [`77a30fa`](https://github.com/Pasta-Devs/Marinara-Engine/commit/77a30fa4ee43b368f4ba4709b0161705e7c05881) Fix tracker aliases, avatars, HUD temps, and changelog (#1137) - [`0649255`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0649255097e5699581e9f9b35b4599c68074170e) feat: add scoped agent memory tools ### 📊 Changes **17 files changed** (+1178 additions, -160 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+16 -0) 📝 `packages/client/src/components/chat/ConversationInput.tsx` (+5 -5) 📝 `packages/client/src/components/chat/RoleplayHUD.tsx` (+19 -37) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+1 -1) 📝 `packages/client/src/components/panels/settings/TrackerCardColorSettings.tsx` (+17 -11) 📝 `packages/client/src/features/tracker-panel/hooks/use-tracker-sprite-lookup.ts` (+11 -6) 📝 `packages/client/src/features/tracker-panel/lib/tracker-metadata.ts` (+31 -0) 📝 `packages/client/src/lib/character-display.ts` (+40 -0) 📝 `packages/server/src/db/migrate.ts` (+66 -1) 📝 `packages/server/src/db/schema/agents.ts` (+10 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+79 -54) 📝 `packages/server/src/routes/generate/generate-route-utils.ts` (+40 -4) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+16 -37) ➕ `packages/server/src/routes/generate/secret-plot-memory.ts` (+64 -0) 📝 `packages/server/src/services/storage/agents.storage.ts` (+355 -4) 📝 `packages/server/src/services/tools/tool-executor.ts` (+318 -0) 📝 `packages/shared/src/types/agent.ts` (+90 -0) </details> ### 📄 Description ## Linked issue Closes #589 ## Why this change Agents currently have only narrow per-agent key/value memory, which works for internal state like the secret plot driver but does not give built-in or custom agents a clear way to save, search, list, and delete durable memory records. This change adds an owner-aware agent memory surface that keeps current secret plot behavior working while making explicit agent-authored memory available through built-in tools. Examples of how this expanded memory agent functionality can be used are: custom memories saving and retrieval, persistent custom trackers, etc ## What changed *Key Changes* - Expanded `agent_memory` storage to support typed records with title, content, metadata, optional embeddings, ownership fields, timestamps, and soft deletion. - Added built-in tools for `save_agent_memory`, `search_agent_memory`, `list_agent_memory`, and `delete_agent_memory`. *Secondary Changes* - Added server-side ownership resolution from the current chat, executing agent config, and active character list, without accepting raw internal IDs from tool callers. - Added literal, fuzzy, and optional semantic search behavior; semantic search returns a clear unavailable result when embeddings are not available. - Updated existing agent memory compatibility so current key/value use, including secret plot state, continues through the enhanced storage model. - Added `settings.memoryScope` as an explicit opt-in for multi-agent cooperation, so writer/retriever custom agents can share records without making all agent memory chat-global. ## Validation - [x] `pnpm check` - [x] Manual verification completed (describe below) - [x] playwright testing to cover regression and new test (playtest files not included in the PR) ### Manual verification notes - UI verification was performed ensuring that agent activity was logged correctly. - A Playwright suite exercised save, search, list, delete, and semantic-unavailable behavior through deterministic API/tool execution (playwright files not included as not part of repo testing strategy). - Follow-up local session verification confirmed the writer/retriever custom agents can be configured with the same `memoryScope` and that existing writer-owned `character_memory` records can be tagged with `metadata.memoryScope` for shared retrieval. The patch preserves per-agent isolation when `memoryScope` is absent. - No regression testing was performed on agent memory functionality used by Secret Plot agent confirming both writing and reading ot its generations. ## Docs and release impact - [ ] No docs changes needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) Not applicable. This change adds server/storage/tool behavior and does not introduce a user-facing UI surface. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:12:29 +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#5015
No description provided.