mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #356] [Feature]: Agent Vector Store #152
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#152
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @adunato on GitHub (May 2, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/356
Originally assigned to: @SpicyMarinara on GitHub.
What problem does this solve?
Agents can call tools during generation, but they do not have a clean way to persist and retrieve arbitrary text as semantic memory.
The existing Memory Recall feature is not suitable for this. It stores automatic five-message chat chunks in
memory_chunks, with message-specific fields such asmessageCount,firstMessageAt, andlastMessageAt. It is designed for generated recall fragments from a chat, not custom tool-provided content.The hidden
[memory: ...]command is also not a suitable foundation. It writes ad hoc entries into character cardextensions.characterMemories, with no dedicated table, stable IDs, vector search, or tool API.Proposed solution
Add a tool-only agent vector store backed by a new
agent_vector_chunkstable. The feature should let agents write, search, list, and delete custom text chunks without changing the Memory Recall UI or automatically injecting results into prompts.Proposed built-in tools:
vector_writevector_searchvector_listvector_deletevector_writeshould accept customcontent, optionalnamespace, optional structuredmetadata, and an optional model-facing scope such aschat,character,agent, or a combined scope. The model should not pass raw internal IDs.vector_searchshould accept a semanticquery, optionalnamespace, optionalscope, and retrieval controls such astopK,similarityThreshold, and optional recency weighting. It should return matched chunks with ID, content, metadata, and similarity score.vector_listshould support non-semantic browsing by namespace and scope, with limit/cursor pagination, without exposing raw embeddings.vector_deleteshould remove or disable a stored chunk by ID.The server should resolve concrete scope IDs during tool execution. Current code already has the required values before tool execution:
AgentContext.chatIdis set frominput.chatId.AgentContext.characterscontains active character IDs and names.ResolvedAgenthas the executing agent config ID asagent.id.However,
ToolExecutionContextcurrently does not expose these values. This change should extend it withchatId, active character IDs/names, and executingagentConfigId, so the tool executor can translate model-facing scopes into stored IDs. For character-scoped writes in multi-character chats, the tool input should include a character selector such ascharacterName, validated against the active character list.Possible table direction:
Retrieval should reuse the existing local embedding path and cosine-similarity approach used by Memory Recall: embed the query with
localEmbed(), load bounded candidates by namespace/scope, score with cosine similarity, apply threshold/topK, and return scored matches.Example agent policy:
Alternatives considered
memory_chunks. Rejected because that table and service are specifically shaped around automatic aggregated chat-message chunks.extensions.characterMemories. Rejected because it is stored inside character card JSON, has no stable IDs, no search, no dedicated DB table, and no clean tool API.Additional context
Relevant current implementation points:
memory_chunks.ToolExecutionContextcurrently includes game state, chat metadata, custom tools, lorebook search, Spotify credentials, and metadata patching, but not chat/character/agent identity.Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:
@SpicyMarinara commented on GitHub (May 3, 2026):
Changing some things in how we store data, so I have to refuse this for now.
@adunato commented on GitHub (May 4, 2026):
@SpicyMarinara thanks for the follow up! Makes sense, and the reason why I didn't start a PR on this. When planning data store next steps, it would be great to keep in mind agent custom data storage. The current storage solutions are all quite specific (lorebook semantic search, chat memories, memory recall), hence this ticket. But if there was an underlying way to store arbitrary data as part of the core engine, then you could build custom store management more easily without reinventing the wheel.
@SpicyMarinara commented on GitHub (May 4, 2026):
Okay, so we removed the SQL Lite with the newest update; we no longer use DB to store things, so if you're up to doing some improvements to our memory systems and vectors, the floor is yours! Thanks!
@adunato commented on GitHub (May 4, 2026):
Thanks! I'll have a look and come up with some thoughts.
@adunato commented on GitHub (May 9, 2026):
@SpicyMarinara I had some thoughts. I like the way the new storage system is simpler and consistent across use cases. I have proposed #589 as a general purpose way to save data with exposed tools and built-in embedding options for semantic search. Let me know what you think.