AI · Convex component
convex-supermemory
Give your Convex app long-term, semantically searchable memory with Supermemory. Reactive local memory and document state, direct REST integration.
npm install convex-supermemory18downloads last week
685downloads last 12 months
v0.0.5latest, Sep 18, 2026
5releases since Sep 13, 2026
Downloads
Download history
Loading download history…
Build this
Build with convex-supermemory
The install and setup steps from the package documentation.
- 1
Install
bashnpm install convex-supermemoryRequirements: Convex v1.33.1 or later, Node.js 18+, a API key
- 2
Quick Start
Three steps to add memory to your Convex app.
1. Add the component
In
convex/convex.config.ts:tsimport { defineApp } from "convex/server"; import convexSupermemory from "convex-supermemory/convex.config"; const app = defineApp(); app.use(convexSupermemory); export default app;2. Set environment variables
bashnpx convex env set SUPERMEMORY_API_KEY sm_xxxxxxxxxxxx3. Initialize the client
In
convex/memory.ts:tsimport { components } from "./_generated/api"; import { Supermemory } from "convex-supermemory"; export const supermemory = new Supermemory(components.convexSupermemory, { apiKey: process.env.SUPERMEMORY_API_KEY!, });Import
supermemoryfrom this file in any Convex action that needs to read or write memory. - 3
Usage
Remember a fact
tsexport const remember = action({ args: { userId: v.string(), fact: v.string() }, handler: async (ctx, args) => { return await supermemory.addMemory(ctx, { containerTag: args.userId, content: args.fact, isStatic: true, // long-term fact, not a fading conversational detail }); }, }); // Returns: { memoryId }Recall with semantic search
tsexport const recall = action({ args: { userId: v.string(), query: v.string() }, handler: async (ctx, args) => { return await supermemory.search({ containerTag: args.userId, query: args.query, limit: 5, }); }, }); // Returns: { results: [{ documentId, score, summary, chunks, ... }], total }Forget a memory
containerTagis required here too — Supermemory scopes the delete by it, not just bymemoryId.tsexport const forget = action({ args: { userId: v.string(), memoryId: v.string() }, handler: async (ctx, args) => { return await supermemory.forgetMemory(ctx, { containerTag: args.userId, memoryId: args.memoryId, }); }, }); // Returns: { forgotten: boolean }List a user's memories reactively
tsexport const getMemories = query({ args: { userId: v.string() }, handler: async (ctx, args) => { return await supermemory.listMemories(ctx, { containerTag: args.userId }); }, });