supermemoryai/supermemory
Memory and context engine + app that is extremely fast, scalable, and can be run fully locally. The Memory API for the AI era.
supermemoryai/supermemory
Memory and context engine + app that is extremely fast, scalable, and can be run fully locally. The Memory API for the AI era.
Supermemory 是面向 AI 产品的记忆与上下文引擎(Memory API):从对话中抽取事实,处理知识更新与矛盾,自动遗忘过期信息,并维护约 50ms 可取的用户画像。它把 Memory 与 RAG 放进同一次检索,还覆盖连接器与多模态文件处理,避免自建向量库、分块与嵌入流水线。官方宣称在 LongMemEval、LoCoMo、ConvoMem 三项主流记忆基准上均为第一;可走托管 API,也可用一条命令在本机跑完全相同的接口(可接 Ollama 离线)。
编程助手和 Agent 每次开新会话都会「失忆」,重复对齐偏好、项目背景和做过的决策。Supermemory 在后台抽取并维护这些事实,下次对话按需召回,而不是把整段历史塞进上下文——官方在 LongMemEval 上给出 95% Recall@15、约 99.4% 的上下文压缩。产品侧不必再拼向量数据库、嵌入流水线和分块策略;一条 API 同时拿到记忆、画像与文档检索。数据敏感时,本机二进制默认用本地嵌入,LLM 可指向 Ollama,数据落在 ./.supermemory。
项目有三条入口:给现有 AI 工具装插件/MCP、用 SDK 接入自己的应用、或在本机跑与云端同 API 的二进制。下面以本机部署和 SDK 为主;插件路径见各宿主仓库。
Xenova/bge-base-en-v1.5,无需密钥。sm_... 密钥。Claude Code 插件需要 Node.js ≥ 18。本机(官方推荐)
curl -fsSL https://supermemory.ai/install | bash# 或npx supermemory localSDK(接入自己的应用)
npm install supermemory # 或: pip install supermemoryexport SUPERMEMORY_API_KEY="sm_..."Claude Code 插件
/plugin marketplace add supermemoryai/claude-supermemory/plugin install supermemoryexport SUPERMEMORY_CC_API_KEY="sm_..."MCP(托管)
{ "mcpServers": { "supermemory": { "url": "https://mcp.supermemory.ai/mcp" } }}其他宿主插件:Cursor、Codex、OpenCode、OpenClaw。
本机启动:
supermemory-server首次启动会初始化嵌入式图引擎、本地嵌入,并打印 API Key;服务默认监听 http://localhost:6767,数据目录为 ./.supermemory。把 SDK 指向本机即可(其余 API 与云端相同):
import Supermemory from "supermemory";
const client = new Supermemory({ apiKey: "sm_...", // 首次启动打印的密钥 baseURL: "http://localhost:6767",});
await client.add({ content: "User loves TypeScript and prefers functional patterns", containerTag: "user_123",});
const { profile } = await client.profile({ containerTag: "user_123", q: "What programming style does the user prefer?",});完全离线可接 Ollama(需先拉好模型):
OPENAI_BASE_URL=http://localhost:11434/v1 \OPENAI_API_KEY=ollama \OPENAI_MODEL=gpt-oss:20b \supermemory-server编码插件指向本机时设置 SUPERMEMORY_API_URL=http://localhost:6767。
supermemory-server 启动后终端出现 url http://localhost:6767 与 api key sm_...。containerTag 执行 add 后调用 profile,profile.static 应出现刚写入的长期事实(add 默认异步,需等到文档 status === "done";演示可设 dreaming: "instant")。/supermemory:status 查看鉴权。add 是异步的:返回 queued 不等于记忆已可搜;立刻查 profile 可能为空。Quickstart 需要马上检索时用 dreaming: "instant"(会多计一次操作);默认 "dynamic" 会批量处理,更省但更慢。SUPERMEMORY_EMBEDDING_* 后需新数据目录或全量重新入库,否则维度对不上。claude-supermemory,已更名为 supermemory,不会原地升级,需按插件 README 迁移。curl | bash)请先阅读脚本内容;生产环境建议固定版本并备份 ./.supermemory。