memory_write
Capture long-term facts, decisions and procedures as scoped, versioned memory entries with evidence chains so multiple AI agents stay aligned. Search first, then update existing entries.
Instructions
写入一条记忆(默认项目级;scope 可选用户级/设备级/工具级)。HTTP 模式:scope=user 可省 project,其他 scope 必填。写入前先用 memory_search 查找同主题记忆,优先更新而不是新建。只记录有长期价值的内容。
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"title": "<title>",
"content": "<content>",
"kind": "<kind>"
},
"name": "memory_write"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | ||
| tags | No | 标签列表 | |
| scope | No | 写入作用域:user=用户级(跨项目,project 参数可省)/ project=项目级(默认)/ device=本设备 / agent=本工具。设备与工具名取自请求上下文,勿手输 | |
| title | Yes | 简短标题,一句话概括 | |
| pinned | No | 置顶(进入项目简报) | |
| content | Yes | 记忆正文,markdown。决策要带理由 | |
| project | No | 项目名或 id。省略时从当前工作目录自动解析 | |
| evidence | No | 证据链:这条结论从哪来的(最多 12 条)。有外部事实依据时务必填写,日后别人能据此复核 | |
| ttl_days | No | 有效期(天),到期自动归档;episodic 类建议设置 | |
| topic_key | No | 主题键(如 "architecture/auth-model")。同项目内同 key 的写入会原地修订既有记忆(revision_count +1),适合演化中的主题;与 supersedes 二选一 | |
| importance | No | 重要性 0~1,默认 0.5 | |
| session_id | No | 来源会话 id | |
| supersedes | No | 被本条取代的旧记忆 id;旧记忆自动标记为 superseded,保留历史链 | |
| expected_version | No | 乐观并发(仅 topic_key 修订时生效):传你读到的 version(上次读取/写入返回的 memory.version),若期间已被其他写入者修订则报 REVISION_CONFLICT 而不是覆盖 |