@supermemory/tools on npm
Check out the NPM page for more details
Installation
Quick Start
Supermemory provides awithSupermemory wrapper that enhances any VoltAgent agent config with automatic memory retrieval and storage:
Memory saving is enabled by default in the VoltAgent integration. To disable it:
How It Works
When integrated with VoltAgent, Supermemory hooks into two lifecycle events:1. Memory Retrieval (onPrepareMessages)
Before each LLM call, Supermemory automatically:- Extracts the user’s latest message
- Searches for relevant memories scoped to the
containerTag - Injects retrieved memories into the system prompt
2. Conversation Saving (onEnd)
After each agent response, the conversation is saved to Supermemory for future retrieval. This requires either athreadId or customId to be set.
Memory Modes
| Mode | Description | Use Case |
|---|---|---|
"profile" | Retrieves the user’s complete profile | Personalization without search |
"query" | Searches memories based on the user’s message | Finding relevant past context |
"full" | Combines profile AND query-based search | Complete memory (recommended) |
Configuration Options
| Parameter | Type | Default | Description |
|---|---|---|---|
containerTag | string | required | User/project ID for scoping memories |
mode | string | "profile" | Memory retrieval mode |
addMemory | string | "always" | Whether to save conversations after each response |
threadId | string | — | Conversation ID to group messages |
searchMode | string | — | "memories", "documents", or "hybrid" |
threshold | number | 0.1 | Similarity threshold (0 = more results, 1 = more accurate) |
limit | number | 10 | Maximum number of memory results |
rerank | boolean | false | Rerank results for relevance |
rewriteQuery | boolean | false | AI-rewrite query for better results (+400ms) |
entityContext | string | — | Context for memory extraction (max 1500 chars) |
metadata | object | — | Custom metadata attached to saved conversations |
promptTemplate | function | — | Custom function to format memory data into prompt |
Search Modes
ThesearchMode option controls what type of results are searched:
| Mode | Description |
|---|---|
"memories" | Search only memory entries (atomic facts about the user) |
"documents" | Search only document chunks |
"hybrid" | Search both memories AND document chunks (recommended) |