Install
What’s included
| Export | Purpose |
|---|---|
SynapMemory | Extends MastraMemory to persist agent memory in Synap |
synapSearchTool | Factory that returns a Mastra-compatible search tool |
synapStoreTool | Factory that returns a Mastra-compatible store tool |
Quick start
SynapMemory
SynapMemory extends MastraMemory and overrides the storage layer:
remember(message)— ingests a message into Synaprecall(query, options)— semantic search over the user’s memories, returnsMemoryMessage[]getMessages(threadId)— retrieves the message thread from Synap
Tools
Use tools as an alternative or complement toSynapMemory. Tools give the model explicit control over when to search or store:
synapSearchTool — schema:
synapStoreTool — schema:
Memory vs. tools
SynapMemory | Tools | |
|---|---|---|
| Context injection | Automatic on every generate call | On-demand when model calls the tool |
| Memory storage | Automatic after every response | On-demand when model calls the tool |
| Best for | Always-on memory for every interaction | Agents that decide when memory is relevant |
SynapMemory handles automatic recall and synapStore lets the model bookmark new information explicitly.
Next steps
Vercel AI SDK
Model middleware for the Vercel AI SDK.
Claude Agent SDK
Hooks and MCP server for the Claude Agent SDK.