Mastra memory: strong primitives, your infrastructure
Mastra thinks about memory in layers: an observation log, working memory that persists facts about a user, and semantic recall over past messages using embeddings.
Mastra. Sources checked 2026-09-25.
How Mastra handles memory today
The docs describe observational memory as a long-term observation log maintained by background agents to keep the context window small, working memory that persists facts across conversations, and semantic recall that embeds messages and queries a vector store for similar ones.
Semantic recall means you choose and operate a vector store, tune embeddings, and keep a migration path when you change either. That is a real ongoing cost at production scale.
What Mastra forgets
Embeddings are easy. Changing them is not.
- Relevance beyond similarity. A decision phrased differently from the question will not surface on embeddings alone.
- Embedding migrations. Swap the model and every stored vector has to be reprocessed.
- Per-tenant isolation, which is a store-per-customer problem rather than a query filter.
- Cross-product recall, so agent memory and chat memory stay in separate worlds.
The fix with MemoryRouter
MemoryRouter takes the storage and ranking layer off your plate: per-user vaults, semantic and time-based recall, and an API your Mastra agent calls like any other tool.
- 1
Register the vault key per user
One vault per end user in your product, keyed per request. The isolation model matches how you bill and how you delete data.
- 2
Expose memory as agent tools
Wrap the search and store endpoints as Mastra tools, and let the agent call them alongside its other tools. Working memory stays in Mastra for session facts.
Tool surface
# Tools: memory_search, memory_store, memory_date_search # docs.memoryrouter.ai/api-reference - 3
Keep semantic recall for conversation
Where Mastra’s recall serves the live conversation, the vault serves the record that outlives it. Both layers can coexist.
Per-user vaults and a memory API for your agents. 14-day free trial.
Related
Mastra memory FAQ
Sources
Sources checked 2026-09-25. Tool behavior changes; check the vendor docs before relying on a detail.