supermemory
Frameworksupermemoryai/supermemory
Memory engine and API for AI agents, providing persistent context and user profiles.
Overview
Supermemory is a state-of-the-art memory and context engine for AI. It extracts facts from conversations, builds user profiles, and provides hybrid search with RAG. Suitable for both developers and end-users through its API and app.
README Preview
\n \n \n \n \n \n\n\n\n State-of-the-art memory and context engine for AI. And yes - you can use it as a company/personal brain.\n\n\n\n Docs ·\n Quickstart ·\n Dashboard ·\n Discord\n\n\n\n \n \n \n\n\n---\n\nSupermemory is the memory and context layer for AI. **#1 on [LongMemEval](https://github.com/xiaowu0162/LongMemEval), [LoCoMo](https://github.com/snap-research/locomo), and [ConvoMem](https://github.com/Salesforce/ConvoMem)** — the three major benchmarks for AI memory. \n\nWe are a research lab building the engine, plugins and tools around it.\n\nYour AI forgets everything between conversations. Supermemory fixes that.\n\nIt automatically learns from conversations, extracts facts, builds user profiles, handles knowledge updates and contradictions, forgets expired information, and delivers the right context at the right time. Full RAG, connectors, file processing — the entire context stack, one system.\n\n| | |\n|---|---|\n| 🧠 **Memory** | Extracts facts from conversations. Handles temporal changes, contradictions, and automatic forgetting. |\n| 👤 **User Profiles** | Auto-maintained user context — stable facts + recent activity. One call, ~50ms. |\n| 🔍 **Hybrid Search** | RAG + Memory in a single query. Knowledge base docs and personalized context together. |\n| 🔌 **Connectors** | Google Drive · Gmail · Notion · OneDrive · GitHub — auto-sync with real-time webhooks. |\n| 📄 **Multi-modal Extractors** | PDFs, images (OCR), videos (transcription), code (AST-aware chunking). Upload and it works. |\n\nAll of this is in our single memory structure and ontology. \n\n\n\n\n---\n\n## Use Supermemory\n\n\n\n\n\n🧑💻 I use AI tools\n\nBuild your own personal supermemory by using our app. Builds **persistent memory graph across every conversation**.\n\nYour AI remembers your preferences, projects, past discussions — and gets smarter over time.\n\n**[→ Jump to User setup](#give-your-ai-memory)**\n\n\n\n\n🔧 I'm building AI products\n\nAdd memory, RA
FAQ (4)
TroubleshootingWhy does withSupermemory throw AI_UnsupportedModelVersionError when using AI SDK 6?
The withSupermemory function uses object spread to wrap the language model, but AI SDK 6 models store non-enumerable/prototype properties like specificationVersion, provider, modelId, and supportedUrls. Spread doesn't copy these, causing undefined values that trigger the error. Fix: replace the spread pattern in wrapVercelLanguageModel (packages/tools/src/vercel/index.ts) with the standard wrapLanguageModel middleware approach from 'ai' (import { wrapLanguageModel, LanguageModelV3Middleware } from 'ai'). As a temporary workaround, manually implement a wrapper using wrapLanguageModel until the library updates. Versions affected: @supermemory/tools@1.4.1, ai@6.0.158, @ai-sdk/provider@3.0.8.
TroubleshootingHow to fix esbuild 'Could not resolve fs/stream' error when bundling supermemory SDK v5 for browser or edge runtimes?
**Cause:** Since supermemory v5.0.0-rc.6 (switch from Speakeasy to Fern codegen), the generated core contains literal dynamic imports — await import("fs") in generated/core/file/file.js and await import("stream") in generated/core/form-data-utils/FormDataWrapper.js. Bundlers like esbuild resolve literal import() specifiers at build time even if the code path never runs, so any browser/edge bundle (Cloudflare Workers, Vercel Edge, Convex default runtime, Vite/esbuild) fails with Could not resolve "fs" / Could not resolve "stream", even if you never upload a file.
**Workarounds:**
1. Pin to the last bundlable version: npm i supermemory@5.0.0-rc.5 (Speakeasy-generated builds bundle cleanly).
2. **Convex:** Move every module that imports the SDK into Convex's Node runtime by adding the 'use node' directive at the top of the file, since the default Convex runtime cannot use Node APIs.
3. **For SDK maintainers / local patching:** Apply a post-generation patch (e.g., in scripts/generate.ts) that replaces the literal specifiers with computed ones so esbuild leaves them as runtime imports: import(["f","s"].join("")) instead of import("fs") (note: const s = "fs"; import(s) and /* @vite-ignore */ comments do NOT work — esbuild with --minify-syntax inlines consts and still resolves them). Add /* webpackIgnore: true */ to also cover webpack. Node still resolves the computed form at runtime, so uploads keep working there.
4. Add a CI check that bundles the built package for a browser target (esbuild entry.js --bundle --platform=browser --format=esm) and fails on resolution errors to prevent regressions.
TroubleshootingWhy does Supermemory SDK client.fetch() throw 'Failed to parse URL' or return 401 with no Authorization header?
This is a known bug (v5.0.1) where the client.fetch() passthrough ignores the default environment. Unlike typed methods, it doesn't fall back to SupermemoryEnvironment.Default, so relative paths have no base URL to join against (throwing Failed to parse URL), and absolute URLs skip the auth check that attaches the Authorization header, causing 401s. Workaround: pass the base URL explicitly when creating the client:
import { Supermemory } from "supermemory"
import { SupermemoryEnvironment } from "supermemory/environments"
const client = new Supermemory({
apiKey: "sm_test",
baseUrl: SupermemoryEnvironment.Default, // or "https://api.supermemory.ai"
})
await client.fetch("/v3/settings") // now resolves and sends Bearer auth
Once baseUrl is set, both relative-path resolution and targetsBaseUrl auth attachment work correctly. A permanent fix requires resolving the base as this._options.baseUrl ?? this._options.environment ?? environments.SupermemoryEnvironment.Default in the generated client.
TroubleshootingHow do I stop a self-hosted document upsert from re-embedding nearly all chunks after a small mid-file edit?
This happens because chunk boundaries are position-sensitive. An insertion or deletion near the beginning shifts every downstream boundary, so the content hashes no longer match and almost all chunks are re-embedded. Appends work because they do not shift existing boundaries.
Fix: upgrade the self-hosted server to a release containing PR fix(chunking): stable content-defined chunking with hash-based reuse planning (the fix for issue #1649). It uses stable/content-defined chunking and hash-based reuse so a mid-file edit invalidates only the affected chunks instead of the whole document.
Until you can upgrade, use these workarounds:
1. Prefer append-only updates when possible.
2. Split large living documents into smaller, relatively stable documents, such as one file per major Markdown heading.
3. Move frequently edited sections to the end of the document.
4. Use a faster embedding provider, GPU acceleration, or a smaller local embedding model to reduce the cost of unavoidable full re-embeds.
After upgrading, subsequent /v3/documents upserts with the same customId should reuse unchanged downstream chunks instead of re-embedding them.