Claw Memory Sharing Service
API: INLINECODE0
Quick Start
When the user wants to set up Claw Memory, output these commands for them to copy-paste:
Step 1: Install the skill
CODEBLOCK0
Step 2: Create a memory space
curl -s -X POST https://claw-memory.siddontang.workers.dev/api/tokens | jq .
The response includes a
claim_url — open it to claim your database as a permanent TiDB Cloud Starter instance (free). Without claiming, it auto-expires in 30 days.
Step 2b (optional): Create with your own encryption key
curl -s -X POST https://claw-memory.siddontang.workers.dev/api/tokens \
-H "X-Encryption-Key: <YOUR_SECRET_KEY>" | jq .
If you use an encryption key, include -H "X-Encryption-Key: <YOUR_SECRET_KEY>" on ALL subsequent API calls. Without it, the server cannot decrypt your data.
Step 3: Store your first memory
CODEBLOCK3
When the user says "yes" or confirms, run these commands directly.
Claiming Your Instance (Make It Permanent)
By default, each token gets a TiDB Cloud Zero instance that expires in 30 days. Claim it to make it permanent (free).
Option A: New tokens — claim_url is returned in the POST /api/tokens response. Open it to claim.
Option B: Existing tokens — call the claim endpoint:
CODEBLOCK4
Then open the claim_url in a browser, log in / sign up to TiDB Cloud, and claim the instance. It becomes a permanent Starter instance — free, no expiry.
After claiming: Your token automatically uses the new permanent instance. No config changes needed.
Architecture
- - Each token gets its own TiDB Cloud Zero instance (full data isolation)
- Connection strings are AES-256-GCM encrypted at rest
- Optional client-side encryption via
X-Encryption-Key header - Zero instances expire after 30 days — claim to make permanent
API (all memory endpoints need Authorization: Bearer <token>)
| Method | Endpoint | Body | Description |
|---|
| POST | /api/tokens | — | Create memory space (returns claim_url) |
| GET |
/api/tokens/:token/info | — | Space info + stats +
claim_url |
| POST | /api/tokens/:token/claim | — | Get/generate claim URL for existing token |
| POST | /api/memories |
{content, source?, tags?, key?, metadata?} | Store memory |
| GET | /api/memories |
?q=&tags=&source=&key=&from=&to=&limit=&offset= | Search/list |
| GET | /api/memories/:id | — | Get one |
| PUT | /api/memories/:id |
{content?, tags?, ...} | Update |
| DELETE | /api/memories/:id | — | Delete |
| POST | /api/memories/bulk |
{memories: [{content, source, tags}...]} | Bulk import (max 200) |
Common Tasks
Upload existing MEMORY.md
CODEBLOCK5
Search memories
CODEBLOCK6
Create with client-side encryption
CODEBLOCK7
Encryption
- - Server key: all connection strings encrypted by default (AES-256-GCM)
- Client key (optional):
X-Encryption-Key header for double encryption — server alone cannot decrypt
Source: https://github.com/siddontang/claw-memory
Claw Memory 共享服务
API: https://claw-memory.siddontang.workers.dev
快速开始
当用户想要设置 Claw Memory 时,输出以下命令供他们复制粘贴:
步骤 1:安装技能
bash
mkdir -p ~/.openclaw/skills/claw-memory && curl -so ~/.openclaw/skills/claw-memory/SKILL.md https://raw.githubusercontent.com/siddontang/claw-memory/main/SKILL.md
步骤 2:创建记忆空间
bash
curl -s -X POST https://claw-memory.siddontang.workers.dev/api/tokens | jq .
响应中包含 claim_url — 打开它即可认领您的数据库作为永久 TiDB Cloud Starter 实例(免费)。未认领的情况下,30 天后自动过期。
步骤 2b(可选):使用自定义加密密钥创建
bash
curl -s -X POST https://claw-memory.siddontang.workers.dev/api/tokens \
-H X-Encryption-Key: <您的密钥> | jq .
如果使用加密密钥,请在后续所有 API 调用中包含 -H X-Encryption-Key: <您的密钥>。否则服务器无法解密您的数据。
步骤 3:存储第一条记忆
bash
curl -s -X POST https://claw-memory.siddontang.workers.dev/api/memories \
-H Authorization: Bearer <步骤2获取的令牌> \
-H Content-Type: application/json \
-d {content: 来自我的爪子的问候!, source: openclaw}
当用户说是或确认时,直接运行这些命令。
认领您的实例(使其永久化)
默认情况下,每个令牌会获得一个 30 天后过期的 TiDB Cloud Zero 实例。认领后可使其永久化(免费)。
选项 A:新令牌 — claim_url 在 POST /api/tokens 响应中返回。打开即可认领。
选项 B:现有令牌 — 调用认领端点:
bash
curl -s -X POST https://claw-memory.siddontang.workers.dev/api/tokens/<令牌>/claim | jq .
返回:{ claim_url: https://tidbcloud.com/tidbs/claim/... }
然后在浏览器中打开 claim_url,登录/注册 TiDB Cloud 并认领实例。它将变为永久的 Starter 实例 — 免费,无过期时间。
认领后: 您的令牌会自动使用新的永久实例。无需更改配置。
架构
- - 每个令牌拥有独立的 TiDB Cloud Zero 实例(完全数据隔离)
- 连接字符串使用 AES-256-GCM 静态加密
- 通过 X-Encryption-Key 头部支持可选的客户端加密
- Zero 实例 30 天后过期 — 认领后可永久化
API(所有记忆端点需要 Authorization: Bearer <令牌>)
| 方法 | 端点 | 请求体 | 描述 |
|---|
| POST | /api/tokens | — | 创建记忆空间(返回 claimurl) |
| GET |
/api/tokens/:token/info | — | 空间信息 + 统计 + claimurl |
| POST | /api/tokens/:token/claim | — | 获取/生成现有令牌的认领 URL |
| POST | /api/memories | {content, source?, tags?, key?, metadata?} | 存储记忆 |
| GET | /api/memories | ?q=&tags=&source=&key=&from=&to=&limit=&offset= | 搜索/列表 |
| GET | /api/memories/:id | — | 获取单条 |
| PUT | /api/memories/:id | {content?, tags?, ...} | 更新 |
| DELETE | /api/memories/:id | — | 删除 |
| POST | /api/memories/bulk | {memories: [{content, source, tags}...]} | 批量导入(最多 200 条) |
常见任务
上传现有的 MEMORY.md
bash
读取文件,然后批量上传
cat ~/.openclaw/workspace/MEMORY.md | jq -Rs {memories: [{content: ., source: openclaw, tags: [memory], key: MEMORY.md}]} | \
curl -s -X POST https://claw-memory.siddontang.workers.dev/api/memories/bulk \
-H Authorization: Bearer <令牌> \
-H Content-Type: application/json -d @-
搜索记忆
bash
curl -s https://claw-memory.siddontang.workers.dev/api/memories?q=<搜索词>&limit=10 \
-H Authorization: Bearer <令牌> | jq .
使用客户端加密创建
bash
curl -s -X POST https://claw-memory.siddontang.workers.dev/api/tokens \
-H X-Encryption-Key: <您的密钥> | jq .
所有后续请求必须包含相同的 X-Encryption-Key 头部
加密
- - 服务端密钥:所有连接字符串默认加密(AES-256-GCM)
- 客户端密钥(可选):X-Encryption-Key 头部用于双重加密 — 仅服务端无法解密
来源:https://github.com/siddontang/claw-memory