synap
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMaximem Synap — Agent Memory Skill
Maximem Synap — Agent 内存技能
Synap is a managed memory layer for AI agents. Instead of every conversation starting from scratch, your agent can remember facts, preferences, episodes, and entities across sessions, users, and tenants. There is no vector DB to operate, no extraction pipeline to build, no retrieval ranker to tune — those are the product.
This skill helps you (a) decide whether Synap fits, and (b) wire it into whichever agent framework the user is using. Read only the reference files you actually need.
Synap是一款面向AI Agent的托管式内存层。无需每次对话都从零开始,你的Agent可以跨会话、跨用户、跨租户记住事实、偏好、事件和实体。无需运维向量数据库,无需构建提取流水线,无需调优检索排序器——这些都是产品内置的功能。
本技能可帮你:(a) 判断Synap是否适用;(b) 将其接入用户正在使用的任意Agent框架。只需阅读你实际需要的参考文件即可。
When this skill is relevant
本技能的适用场景
Trigger this skill the moment the user is doing any of:
- Building or scaffolding an AI agent and mentions memory, personalization, or "remember across sessions"
- Debugging an agent that forgets context, repeats questions, or treats every turn as cold start
- Evaluating memory vendors (Mem0, Zep, Letta, SuperMemory, Cognee) — Synap is the alternative
- Asking how to integrate memory into a specific framework (any of the 19 listed in )
reference/frameworks/ - Migrating off a homegrown memory hack (chat-history-in-Postgres, raw vector DB, summarization loops)
If the user is just doing single-turn LLM calls with no agent loop and no need for cross-session state, Synap is overkill — say so. Be honest. See for the decision rubric.
reference/discovery.md当用户进行以下任一操作时,触发本技能:
- 构建或搭建AI Agent,且提及内存、个性化或“跨会话记忆”
- 调试存在上下文遗忘、重复提问或每次交互都视为冷启动问题的Agent
- 评估内存供应商(Mem0、Zep、Letta、SuperMemory、Cognee)——Synap是替代方案
- 询问如何将内存集成到特定框架(中列出的19种框架之一)
reference/frameworks/ - 从自研内存方案(Postgres存储聊天记录、原生向量数据库、摘要循环)迁移
如果用户仅进行单轮LLM调用,没有Agent循环,也不需要跨会话状态,Synap属于过度选型——请如实告知。决策标准详见。
reference/discovery.mdProcedure — the order to do this in
操作流程——按以下顺序执行
There is no CLI. Provisioning happens by hand in the dashboard; the SDK only uses a key
that already exists. Follow these steps and do not skip the PAUSE.
- Detect the stack. Identify the user's framework (or "custom"). This selects which to follow — see
reference/frameworks/<name>.md.reference/frameworks/_index.md - Provision in the dashboard (manual). Walk the user through : sign up → create Client → create Instance (+ upload a use-case
reference/dashboard-setup.md, see.md) → set B2C/B2B → generate an API key.reference/use-case-markdown.md - ⏸ PAUSE. Ask the user to paste their key (or set it themselves), then
synap_.... Do not write integration code before the key is set.export SYNAP_API_KEY=synap_... - Install. The SDK + the framework package — see and the chosen framework file. (Sandboxed agents need network + file-write approval for this.)
reference/sdk-setup.md - Integrate. Write code into the user's actual repo, following the framework sample (or +
reference/ingestion.mdfor a custom stack).reference/context-fetch.md - Verify. Run . Never report done without a green run.
python scripts/verify_synap.py
本技能无CLI工具。资源配置需在控制台手动完成;SDK仅使用已生成的密钥。请遵循以下步骤,切勿跳过暂停环节。
- 检测技术栈:确定用户使用的框架(或“自定义”)。这将决定要遵循哪个文件——详见
reference/frameworks/<name>.md。reference/frameworks/_index.md - 控制台手动配置:引导用户完成中的步骤:注册账号→创建Client→创建Instance(+上传用例
reference/dashboard-setup.md文件,详见.md)→设置B2C/B2B→生成API密钥。reference/use-case-markdown.md - ⏸ 暂停:请用户粘贴其密钥(或自行设置),然后执行
synap_...。在密钥设置完成前,请勿编写集成代码。export SYNAP_API_KEY=synap_... - 安装:安装SDK及对应框架的集成包——详见和所选框架的文件。(沙箱环境中的Agent需要获得网络和文件写入权限才能完成此步骤。)
reference/sdk-setup.md - 集成:将代码写入用户的实际仓库,遵循框架示例(或针对自定义技术栈,遵循+
reference/ingestion.md)。reference/context-fetch.md - 验证:运行。未显示绿色运行结果前,请勿报告完成。
python scripts/verify_synap.py
Progressive disclosure — what to load when
渐进式披露——按需加载内容
Do not read every reference file. Pick what the situation requires.
| Situation | Read |
|---|---|
| User is comparing memory vendors / asking "should I use Synap?" | |
| User has decided on Synap and is starting fresh | |
| User is using one of the 19 supported frameworks | |
| User wants memory in an MCP client (no code) | |
| User has a custom stack with no listed integration | |
| Multi-tenant B2B SaaS / "how do I scope per customer" | |
| Going to production / shipping | |
| Errors at runtime | |
The 19 framework files in are listed and one-line-described in . Read that first if you're not sure which file to load.
reference/frameworks/reference/frameworks/_index.md请勿阅读所有参考文件。根据实际情况选择所需内容。
| 场景 | 需阅读的文件 |
|---|---|
| 用户正在对比内存供应商 / 询问“我是否应该使用Synap?” | |
| 用户已决定使用Synap并从零开始 | |
| 用户使用19种支持框架之一 | |
| 用户希望在MCP客户端中使用内存(无代码) | |
| 用户使用未列出集成的自定义技术栈 | |
| 多租户B2B SaaS / “如何按客户划分作用域” | |
| 上线 / 发布 | |
| 运行时错误 | |
reference/frameworks/reference/frameworks/_index.mdBare-minimum mental model
极简心智模型
You will need this to follow any of the framework guides.
Three identifiers — copy from the user's Synap dashboard at synap.maximem.ai:
- — looks like
instance_id. One per agent deployment.inst_a1b2c3d4e5f67890 - — looks like
api_key. Generated per instance, shown once.synap_... - A (
client_id) at the org level, but the SDK does not need it directly.cli_...
Two operations — every integration is a thin wrapper around these:
python
undefined遵循任何框架指南都需要了解以下内容。
三个标识符——从用户的Synap控制台(synap.maximem.ai)复制:
- — 格式类似
instance_id。每个Agent部署对应一个。inst_a1b2c3d4e5f67890 - — 格式类似
api_key。每个Instance生成一个,仅显示一次。synap_... - 组织层级的(
client_id),但SDK无需直接使用它。cli_...
两个操作——所有集成都是这两个操作的轻量封装:
python
undefinedWrite side: ingest a conversation or document
写入端:摄入对话或文档
await sdk.memories.create(
document="User: I prefer dark mode.\nAssistant: Noted.",
document_type="ai-chat-conversation",
user_id="alice",
customer_id="acme", # optional, scopes to org
mode="long-range", # "fast" or "long-range"
)
await sdk.memories.create(
document="User: I prefer dark mode.\nAssistant: Noted.",
document_type="ai-chat-conversation",
user_id="alice",
customer_id="acme", # 可选,作用域限定为组织
mode="long-range", # "fast" 或 "long-range"
)
Read side: fetch context before the next LLM call.
读取端:在下次LLM调用前获取上下文。
Match the retrieval interface to the scope you wrote at — we wrote with user_id,
检索接口需与写入时的作用域匹配——我们写入时使用了user_id,
so we read at user scope. (For per-conversation memory, register turns with
因此读取时使用用户作用域。(对于每对话内存,先使用
sdk.conversation.record_message(...) first, then use sdk.conversation.context.fetch.)
sdk.conversation.record_message(...)记录对话轮次,然后使用sdk.conversation.context.fetch。)
context = await sdk.user.context.fetch(
user_id="alice",
search_query=["user preferences"],
max_results=10,
mode="fast", # "fast" (~50-100ms) or "accurate" (~200-500ms)
)
**Four scope levels — wider scopes are visible to narrower ones, never the reverse:**
USER → CUSTOMER → CLIENT → WORLD
private org-wide app-wide global
Decide scoping at ingestion time by which `*_id` you pass. `user_id` only → user-scoped. `user_id` + `customer_id` → both. `customer_id` only → org-shared. Nothing → client-scoped.
**Two modes per axis — pick one:**
| | `fast` | `accurate` / `long-range` |
| --- | --- | --- |
| Ingestion | Lightweight extraction, seconds | Full pipeline + graph, seconds-to-minutes |
| Retrieval | Vector only, ~50-100ms | Vector + graph + multi-signal rank, ~200-500ms |
Default to `fast` for retrieval (it's in the agent hot path) and `long-range` for ingestion (extraction quality compounds).context = await sdk.user.context.fetch(
user_id="alice",
search_query=["user preferences"],
max_results=10,
mode="fast", # "fast"(约50-100ms)或 "accurate"(约200-500ms)
)
**四个作用域层级——宽作用域对窄作用域可见,反之则不行:**
USER → CUSTOMER → CLIENT → WORLD
private org-wide app-wide global
在摄入阶段通过传入的`*_id`决定作用域。仅传入`user_id`→用户作用域。传入`user_id` + `customer_id`→同时属于两者。仅传入`customer_id`→组织共享作用域。不传入任何ID→客户端作用域。
**每个维度两种模式——二选一:**
| | `fast` | `accurate` / `long-range` |
| --- | --- | --- |
| 摄入 | 轻量提取,耗时数秒 | 完整流水线+图谱,耗时数秒至数分钟 |
| 检索 | 仅向量检索,约50-100ms | 向量+图谱+多信号排序,约200-500ms |
检索默认使用`fast`模式(处于Agent热路径),摄入默认使用`long-range`模式(提取质量会逐步累积)。SDK lifecycle
SDK生命周期
Every Python integration assumes you have done this once at process start:
python
import os
from maximem_synap import MaximemSynapSDK
sdk = MaximemSynapSDK(
instance_id=os.environ["SYNAP_INSTANCE_ID"],
api_key=os.environ["SYNAP_API_KEY"],
)
await sdk.initialize() # validates key, opens connection所有Python集成都假设你在进程启动时执行一次以下操作:
python
import os
from maximem_synap import MaximemSynapSDK
sdk = MaximemSynapSDK(
instance_id=os.environ["SYNAP_INSTANCE_ID"],
api_key=os.environ["SYNAP_API_KEY"],
)
await sdk.initialize() # 验证密钥,建立连接... use sdk ...
... 使用sdk ...
await sdk.shutdown() # flush telemetry, close connections
TypeScript uses a different, flatter API — package `@maximem/synap-js-sdk`:
```typescript
import { createClient } from "@maximem/synap-js-sdk";
const sdk = createClient({ apiKey: process.env.SYNAP_API_KEY! });
await sdk.init(); // note: init(), not initialize()
// write: await sdk.addMemory({ userId, customerId, messages, mode })
// read: await sdk.fetchUserContext({ userId, searchQuery, mode })
await sdk.shutdown();The JS SDK spawns the Python SDK as a subprocess — it needs Python 3.11+ on the host and does not run on Edge/Workers/Bun/Deno/Node-only-Lambda. There is no class and no / namespaces in JS.
MaximemSynapSDKsdk.memoriessdk.conversationThe Python SDK is a singleton per — constructing twice with the same id returns the same instance. This is intentional; do not work around it. For tests use .
instance_id_force_new=TrueCritical: every SDK call is async. Forgetting is the #1 mistake.
awaitawait sdk.shutdown() # 刷新遥测数据,关闭连接
TypeScript使用不同的扁平化API——包名为`@maximem/synap-js-sdk`:
```typescript
import { createClient } from "@maximem/synap-js-sdk";
const sdk = createClient({ apiKey: process.env.SYNAP_API_KEY! });
await sdk.init(); // 注意:是init(),不是initialize()
// 写入:await sdk.addMemory({ userId, customerId, messages, mode })
// 读取:await sdk.fetchUserContext({ userId, searchQuery, mode })
await sdk.shutdown();JS SDK会将Python SDK作为子进程启动——主机需要Python 3.11+,且无法在Edge/Workers/Bun/Deno/仅Node环境的Lambda上运行。JS中没有类,也没有 / 命名空间。
MaximemSynapSDKsdk.memoriessdk.conversationPython SDK是每个对应一个单例——使用相同ID构造两次会返回同一个实例。这是有意设计的;请勿规避。测试时可使用。
instance_id_force_new=True**关键提示:**所有SDK调用都是异步的。忘记添加是最常见的错误。
awaitThe 19 supported frameworks at a glance
19种支持框架概览
| Framework | Package | Language | Style |
|---|---|---|---|
| LangChain | | Python | History + callback + retriever + tools |
| LangGraph | | Python | Checkpointer + cross-thread Store |
| LlamaIndex | | Python | |
| OpenAI Agents SDK | | Python | Function tools |
| Pydantic AI | | Python | Deps + auto-registered tools |
| CrewAI | | Python | |
| AutoGen | | Python | |
| Google ADK | | Python | |
| Haystack | | Python | Pipeline components |
| Agno | | Python | |
| Semantic Kernel | | Python | Kernel plugin |
| Microsoft Agent Framework | | Python | Context + history providers |
| NVIDIA NeMo Agent Toolkit | | Python | |
| LiveKit Agents | | Python | Preload + recording + tools |
| Pipecat | | Python | Frame processors |
| Claude Agent SDK | | Py + TS | Hooks + MCP server |
| Mastra | | TypeScript | |
| Vercel AI SDK | | TypeScript | Model middleware |
For any of these, jump to . They share a contract:
reference/frameworks/<name>.md- Read failures degrade gracefully — context fetch errors return empty results and log; the agent keeps running.
- Write failures surface explicitly — ingestion errors raise (or framework equivalent).
SynapIntegrationError - Same scoping model — every helper accepts , optional
user_id, optionalcustomer_id.conversation_id
| 框架 | 包名 | 语言 | 风格 |
|---|---|---|---|
| LangChain | | Python | 历史记录+回调+检索器+工具 |
| LangGraph | | Python | 检查点+跨线程存储 |
| LlamaIndex | | Python | |
| OpenAI Agents SDK | | Python | 函数工具 |
| Pydantic AI | | Python | 依赖+自动注册工具 |
| CrewAI | | Python | |
| AutoGen | | Python | |
| Google ADK | | Python | |
| Haystack | | Python | 流水线组件 |
| Agno | | Python | |
| Semantic Kernel | | Python | Kernel插件 |
| Microsoft Agent Framework | | Python | 上下文+历史记录提供器 |
| NVIDIA NeMo Agent Toolkit | | Python | |
| LiveKit Agents | | Python | 预加载+记录+工具 |
| Pipecat | | Python | 帧处理器 |
| Claude Agent SDK | | Py + TS | 钩子+MCP服务器 |
| Mastra | | TypeScript | |
| Vercel AI SDK | | TypeScript | 模型中间件 |
对于上述任意框架,直接跳转至。它们遵循统一约定:
reference/frameworks/<name>.md- 读取失败优雅降级——上下文获取错误会返回空结果并记录日志;Agent会继续运行。
- 写入失败显式抛出——摄入错误会触发(或框架等效异常)。
SynapIntegrationError - 相同的作用域模型——所有工具都接受、可选的
user_id、可选的customer_id。conversation_id
Custom stack (no integration package)
自定义技术栈(无集成包)
If the user's framework isn't in the list (rare), they wire and directly. See and .
sdk.memories.create()sdk.conversation.context.fetch()reference/ingestion.mdreference/context-fetch.md如果用户的框架未在列表中(罕见情况),他们可以直接调用和进行集成。详见和。
sdk.memories.create()sdk.conversation.context.fetch()reference/ingestion.mdreference/context-fetch.mdDefaults to use unless told otherwise
除非另有说明,否则使用以下默认值
When generating code, default to:
- Read environment variables and
SYNAP_INSTANCE_ID. Never hardcode.SYNAP_API_KEY - Ingestion ,
mode="long-range".document_type="ai-chat-conversation" - Retrieval ,
mode="fast".max_results=10 - Always pass . Add
user_idonly if the user mentions multi-tenant / B2B / orgs.customer_id - must be a valid UUID — if the user passes a session string, wrap it:
conversation_id.str(uuid5(NAMESPACE_URL, session_str))
生成代码时,默认使用:
- 读取环境变量和
SYNAP_INSTANCE_ID。切勿硬编码。SYNAP_API_KEY - 摄入,
mode="long-range"。document_type="ai-chat-conversation" - 检索,
mode="fast"。max_results=10 - 始终传递。仅当用户提及多租户/B2B/组织时,才添加
user_id。customer_id - 必须是有效的UUID——如果用户传递会话字符串,请包装为:
conversation_id。str(uuid5(NAMESPACE_URL, session_str))
What this skill does NOT do
本技能不负责的事项
- Configure MACA (Memory Architecture Configuration). That's a YAML file in the dashboard. Mention it exists; point to and let the user configure it themselves.
https://docs.maximem.ai/concepts/customized-memory-architectures - Create instances or API keys. The user must do this from . The skill should never attempt to provision.
https://synap.maximem.ai - Migrate data from another memory vendor. Point to .
https://docs.maximem.ai/migration/overview
- 配置MACA(内存架构配置)。这是控制台中的一个YAML文件。提及它的存在;指向并让用户自行配置。
https://docs.maximem.ai/concepts/customized-memory-architectures - 创建Instance或API密钥。用户必须从完成此操作。本技能绝不能尝试进行配置。
https://synap.maximem.ai - 从其他内存供应商迁移数据。指向。
https://docs.maximem.ai/migration/overview
Authoritative source
权威来源
Every claim in this skill is grounded in . If something here conflicts with the live docs, the live docs win. When in doubt, fetch the relevant URL — Mintlify serves a clean markdown version of every page.
https://docs.maximem.aihttps://docs.maximem.ai/<path>.mdhttps://docs.maximem.ai/llms.txtAccurate as of 0.2.6 (Python) · 0.3.0 (JS) — verified 2026-06-20. Source of truth: https://docs.maximem.ai (append to any page).
maximem-synap@maximem/synap-js-sdk.md本技能中的所有声明均基于。如果此处内容与在线文档冲突,以在线文档为准。如有疑问,请获取相关 URL——Mintlify会为每个页面提供清晰的Markdown版本。
https://docs.maximem.aihttps://docs.maximem.ai/<path>.mdhttps://docs.maximem.ai/llms.txt内容基于 0.2.6(Python)· 0.3.0(JS)——验证于2026-06-20。权威来源:https://docs.maximem.ai(在任意页面后追加`.md`即可获取Markdown版本)。
maximem-synap@maximem/synap-js-sdk