Skip to content

feat: add store memory builtin tool#2233

Open
nkanf-dev wants to merge 1 commit into
the-open-agent:masterfrom
nkanf-dev:feat/save-memory-runtime
Open

feat: add store memory builtin tool#2233
nkanf-dev wants to merge 1 commit into
the-open-agent:masterfrom
nkanf-dev:feat/save-memory-runtime

Conversation

@nkanf-dev
Copy link
Copy Markdown
Contributor

Summary

Add a built-in store_memory tool that lets the model save durable store-scoped memories as vectors with a Store memory: prefix. Retrieval stays on the existing RAG path via GetNearestKnowledge(...), and the prompt now nudges the model to use the tool for long-term user preferences and standing instructions.

Copilot AI review requested due to automatic review settings May 7, 2026 06:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new built-in store_memory tool intended to persist “durable” store-scoped memories as vectors (with a Store memory: prefix) so they can be retrieved via the existing RAG knowledge path.

Changes:

  • Introduces object/store_memory.go to create and save “store memory” vectors and expose them as a builtin tool (store_memory).
  • Registers store_memory into the merged builtin registry for stores.
  • Extends the per-store prompt to instruct the model to call store_memory when the user shares durable preferences/standing instructions.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
object/store_memory.go Implements vector-backed “store memory” persistence + builtin tool surface.
object/merge_agent_tools.go Registers the new builtin in the merged registry.
controllers/message_answer.go Nudges the model via prompt to use store_memory for durable preferences/instructions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +30 to +31
if bt := NewStoreMemoryBuiltin(store, lang); bt != nil {
reg.RegisterTool(bt)
Comment thread object/store_memory.go

func AddStoreMemory(store *Store, content string, lang string) (*Vector, error) {
if store == nil {
return nil, fmt.Errorf(i18n.Translate(lang, "object:The store should not be empty"))
Comment thread object/store_memory.go

text := normalizeStoreMemoryText(content)
if text == "" {
return nil, fmt.Errorf(i18n.Translate(lang, "object:The memory content should not be empty"))
Comment thread object/store_memory.go
Comment on lines +92 to +96
Store: store.Name,
Provider: embeddingProvider.Name,
File: "__store_memory__",
Index: 0,
Text: text,
Comment thread object/store_memory.go
Comment on lines +51 to +60
embeddingProviderName := store.EmbeddingProvider
if embeddingProviderName == "" {
embeddingProvider, _, err := GetEmbeddingProviderFromContext(store.Owner, "", lang)
if err != nil {
return nil, err
}
if embeddingProvider == nil {
return nil, fmt.Errorf(i18n.Translate(lang, "object:Please add an embedding provider first"))
}
embeddingProviderName = embeddingProvider.Name
Comment on lines +30 to +33
if bt := NewStoreMemoryBuiltin(store, lang); bt != nil {
reg.RegisterTool(bt)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants