Migrating to v2 from 1.4.x? Check the migration guide.
@supermemory/tools on npm
Check out the NPM page for more details
Installation
Quick Comparison
| Approach | Use Case | Setup |
|---|---|---|
| User Profiles | Personalized LLM responses with automatic user context | Simple middleware |
| Memory Tools | AI agents that need explicit memory control | Tool definitions |
User Profiles with Middleware
Automatically inject user profiles into every LLM call for instant personalization.Required fields
BothcontainerTag and customId are required.
containerTag— who the memories belong to. Use a stable identifier per user, workspace, or tenant (e.g."user-123","acme-workspace"). Memory search and writes are scoped to this tag.customId— which conversation this turn belongs to. Use it to group messages from the same chat session into a single document (e.g."chat-2026-04-25", a thread ID, or a UUID per session).
Memory saving is enabled by default (
addMemory: "always"). New conversations are persisted automatically. To opt out, set addMemory: "never":Memory Search Modes
Profile Mode (Default) - Retrieves the user’s complete profile:Custom Prompt Templates
Customize how memories are formatted. The template receivesuserMemories, generalSearchMemories, and searchResults (raw array for filtering by metadata):
Verbose Logging
When Supermemory errors (default: continue without memories)
If the Supermemory API returns an error, is unreachable, or retrieval hits the internal time limit, memory injection is skipped.skipMemoryOnError defaults to true, so the LLM call still runs with the original prompt (no injected memories). Use verbose: true if you want console output when that happens.
To fail the call when memory retrieval fails instead, set skipMemoryOnError: false: