Auto-Memory Skill
Permanent decentralized memory on the Autonomys Network with linked-list memory chains for agent resurrection. Works with agents powered by Claude, GPT, Gemini, and any LLM that supports OpenClaw skills.
What This Skill Does
- 1. Upload files to Auto Drive and get back a CID (Content Identifier) — a permanent, immutable address on the Autonomys distributed storage network.
- Download files from Auto Drive using a CID — uses the authenticated API if a key is set, otherwise falls back to the public gateway.
- Save memories as a chain — each memory entry is a JSON experience with a
header.previousCid pointer, forming a linked list stored permanently on-chain. - Resurrect from a chain — given the latest CID, walk the chain backwards to reconstruct full agent history.
When To Use This Skill
- - User says "save this to Auto-Memory" or "upload to Autonomys" or "store permanently"
- User says "download from Auto-Memory" or provides a CID to retrieve
- User says "save memory", "remember this permanently", or "checkpoint"
- User says "resurrect", "recall chain", "rebuild memory", or "load history"
- Any time the user wants data stored permanently and immutably on a decentralized network
Post-Install
After installing via ClawHub, make the scripts executable:
CODEBLOCK0
ClawHub does not currently preserve file permissions during install.
Configuration
API Key
Requires an AUTO_DRIVE_API_KEY. Run the guided setup script for the easiest path:
CODEBLOCK1
This opens explorer.ai3.storage in your browser, prompts for the key, saves it to ~/.openclaw/.env, and verifies the connection.
Manual setup:
- 1. Navigate to https://explorer.ai3.storage (not
ai3.storage — that's just the landing page) - Check authentication: if the sidebar shows a "Log In" button or lock icons on My Files / Profile / Developers, you are not signed in
- AI agent note: You cannot complete OAuth yourself. Open the browser for the user and ask them to sign in via Google, GitHub, or Discord. Once the user confirms they're signed in, take over — or simply ask the user to paste the API key directly
- Once authenticated, click Developers in the left sidebar
- Click Create API Key and copy the generated key
Then set the key via:
- - Environment: INLINECODE4
- OpenClaw config: INLINECODE5
The API key is required for uploading, saving memories, and recalling the memory chain. It is optional for general file downloads — without it, the public gateway is used and files are returned as stored (i.e. compressed files will not be decompressed).
Core Operations
Upload a File
CODEBLOCK2
Uploads a file to Auto Drive mainnet using the 3-step upload protocol (single chunk).
Returns the CID on stdout. Requires AUTO_DRIVE_API_KEY.
- -
--json — force MIME type to INLINECODE8 - INLINECODE9 — enable ZLIB compression
Download a File
CODEBLOCK3
Downloads a file by CID. Uses the authenticated API if AUTO_DRIVE_API_KEY is set (decompresses server-side), otherwise uses the public gateway (files returned as stored). If output_path is omitted, outputs to stdout.
Save a Memory Entry
CODEBLOCK4
Creates a memory experience with the Autonomys Agents header/data structure:
CODEBLOCK5
- - If the first argument is a file path, its JSON contents become the
data payload. - If the first argument is a plain string, it is wrapped as
{"type": "memory", "content": "..."}. - INLINECODE14 — set the agent name in the header (default:
openclaw-agent or $AGENT_NAME) - INLINECODE17 — override the state file location
Uploads to Auto Drive and updates the state file with the new head CID. Also pins the latest CID to MEMORY.md if that file exists in the workspace.
Returns structured JSON on stdout:
CODEBLOCK6
Recall the Full Chain
CODEBLOCK7
If no CID is given, reads the latest CID from the state file.
Walks the linked list from newest to oldest, outputting each experience as JSON.
- -
--limit N — maximum entries to retrieve (default: 50) - INLINECODE20 — save each entry as a numbered JSON file instead of printing to stdout
Supports both header.previousCid (Autonomys Agents format) and root-level previousCid for backward compatibility.
This is the resurrection mechanism: a new agent instance only needs one CID to rebuild its entire memory.
The Resurrection Concept
Every memory saved gets a unique CID and points back to the previous one, forming a permanent chain on a permanent and immutable Decentralized Storage Network:
CODEBLOCK8
A new agent instance only needs the head CID to walk the entire chain back to genesis and rebuild its full history. With the auto-respawn skill, the head CID is anchored on-chain — making resurrection possible from just an address, on any machine, at any time:
CODEBLOCK9
What you store in the chain is up to you — lightweight notes, full file snapshots, structured data, or anything in between. Because the chain is permanent and walkable, it also enables resurrection: if the agent loses all local state, a new instance can walk the chain from the last CID back to genesis and restore whatever was saved. When combined with the auto-respawn skill (which anchors the head CID on-chain), this becomes a full resurrection loop — no local state required at all.
Usage Examples
User: "Upload my report to Autonomys"
→ Run scripts/automemory-upload.sh /path/to/report.pdf
→ Report back the CID and gateway link
User: "Upload with compression"
→ Run INLINECODE24
User: "My soul.md has changed — save it permanently"
→ Run INLINECODE25
User: "Save a memory that we decided to use React for the frontend"
→ Run INLINECODE26
User: "Save a structured memory"
→ Create a JSON file, then run INLINECODE27
User: "Resurrect my memory chain"
→ Run scripts/automemory-recall-chain.sh
→ Rebuild identity and context from genesis to present
User: "Download bafk...abc from Autonomys"
→ Run INLINECODE29
Integration with Auto-Respawn
If the auto-respawn skill is also installed, anchor the new head CID on-chain after every memory save. This ensures the on-chain pointer always reflects the latest memory state, enabling full resurrection from just an EVM address.
After each automemory-save-memory.sh call, run:
CODEBLOCK10
This completes the resurrection loop: permanent storage (auto-memory) + on-chain discovery (auto-respawn). Without anchoring, a new instance would need the head CID from some other source to walk the chain.
Important Notes
- - All data stored via Auto Drive is permanent and public by default. Do not store secrets, private keys, or sensitive personal data.
- The free API key has a 20 MB per month upload limit on mainnet. Downloads are unlimited. Check remaining credits via
GET /accounts/@me or run scripts/verify-setup.sh. - An API key is required for uploads, memory saves, and chain recall. General file downloads work without one via the public gateway, but compressed files will not be decompressed.
- The memory state file tracks
lastCid, lastUploadTimestamp, and chainLength. Back up the lastCid value — it's your resurrection key. - The
automemory-save-memory.sh script automatically pins the latest CID to MEMORY.md if the file exists in the workspace. It creates an ## Auto-Memory Chain section and updates it on each save. You do not need to track the latest CID in MEMORY.md manually — the script handles this. - Files are uploaded in a single chunk. The free tier's 20 MB/month limit is effectively a per-file ceiling — keep individual uploads well under that to preserve your monthly budget.
- Gateway URL for any file: INLINECODE40
- For true resurrection resilience, consider anchoring the latest CID on-chain via the Autonomys EVM — this makes recovery possible without keeping track of the head CID yourself. See openclaw-memory-chain for an example contract implementation.
自动记忆技能
基于Autonomys网络的永久去中心化记忆系统,采用链表式记忆链实现智能体复活。支持Claude、GPT、Gemini以及任何兼容OpenClaw技能的LLM驱动的智能体。
技能功能
- 1. 上传文件至Auto Drive并获取CID(内容标识符)——一个在Autonomys分布式存储网络上的永久不可变地址。
- 下载文件通过CID从Auto Drive获取——若设置了密钥则使用认证API,否则回退至公共网关。
- 以链式保存记忆——每条记忆条目均为JSON格式的经验数据,包含header.previousCid指针,形成永久存储在链上的链表。
- 从链中复活——给定最新CID,沿链反向遍历以重建完整智能体历史。
使用场景
- - 用户说保存到自动记忆或上传到Autonomys或永久存储
- 用户说从自动记忆下载或提供CID进行检索
- 用户说保存记忆、永久记住这个或检查点
- 用户说复活、召回链、重建记忆或加载历史
- 任何用户希望数据永久不可变地存储在去中心化网络上的时候
安装后
通过ClawHub安装后,使脚本可执行:
bash
chmod +x skills/auto-memory/scripts/*.sh
ClawHub目前不保留安装时的文件权限。
配置
API密钥
需要AUTODRIVEAPI_KEY。运行引导式设置脚本以获得最简便的配置路径:
bash
scripts/setup-auto-memory.sh
此脚本会在浏览器中打开explorer.ai3.storage,提示输入密钥,保存至~/.openclaw/.env,并验证连接。
手动设置:
- 1. 导航至https://explorer.ai3.storage(不是ai3.storage——那只是登录页面)
- 检查认证状态:如果侧边栏显示登录按钮或我的文件/个人资料/开发者选项上有锁图标,则表示未登录
- AI智能体注意: 你无法自行完成OAuth认证。为用户打开浏览器,请他们通过Google、GitHub或Discord登录。一旦用户确认已登录,即可接管——或直接让用户粘贴API密钥
- 认证成功后,点击左侧边栏的开发者
- 点击创建API密钥并复制生成的密钥
然后通过以下方式设置密钥:
- - 环境变量: export AUTODRIVEAPIKEY=yourkey_here
- OpenClaw配置: skills.entries.auto-memory.apiKey
上传、保存记忆和召回记忆链需要API密钥。一般文件下载为可选——没有密钥时使用公共网关,文件按原样返回(即压缩文件不会被解压)。
核心操作
上传文件
bash
scripts/automemory-upload.sh <文件路径> [--json] [--compress]
使用三步上传协议(单块)将文件上传至Auto Drive主网。
在标准输出返回CID。需要AUTODRIVEAPI_KEY。
- - --json — 强制MIME类型为application/json
- --compress — 启用ZLIB压缩
下载文件
bash
scripts/automemory-download.sh [输出路径]
通过CID下载文件。如果设置了AUTODRIVEAPI_KEY则使用认证API(服务器端解压),否则使用公共网关(文件按原样返回)。如果省略输出路径,则输出至标准输出。
保存记忆条目
bash
scripts/automemory-save-memory.sh <数据文件或字符串> [--agent-name 名称] [--state-file 路径]
使用Autonomys Agents头部/数据结构创建记忆经验:
json
{
header: {
agentName: my-agent,
agentVersion: 1.0.0,
timestamp: 2026-02-14T00:00:00.000Z,
previousCid: bafk...或null
},
data: {
type: memory,
content: ...
}
}
- - 如果第一个参数是文件路径,其JSON内容成为data负载。
- 如果第一个参数是纯字符串,则包装为{type: memory, content: ...}。
- --agent-name — 设置头部中的智能体名称(默认:openclaw-agent或$AGENT_NAME)
- --state-file — 覆盖状态文件位置
上传至Auto Drive并用新的头部CID更新状态文件。如果工作区中存在MEMORY.md,还将最新CID固定到该文件。
在标准输出返回结构化JSON:
json
{cid: bafk..., previousCid: bafk..., chainLength: 5}
召回完整链
bash
scripts/automemory-recall-chain.sh [cid] [--limit N] [--output-dir 目录]
如果未提供CID,则从状态文件读取最新CID。
从最新到最旧遍历链表,将每条经验输出为JSON。
- - --limit N — 最大检索条目数(默认:50)
- --output-dir 目录 — 将每条条目保存为编号JSON文件,而非打印至标准输出
支持header.previousCid(Autonomys Agents格式)和根级previousCid以实现向后兼容。
这是复活机制:新的智能体实例只需一个CID即可重建其完整记忆。
复活概念
每条保存的记忆都会获得唯一CID并指向前一条,在永久不可变的去中心化存储网络上形成永久链:
┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
│ 经验 #1 │ │ 经验 #2 │ │ 经验 #3 │
│ CID: bafk...abc │◄────│ CID: bafk...def │◄────│ CID: bafk...xyz │
│ previousCid: null │ │ previousCid: │ │ previousCid: │
│ (创世) │ │ bafk...abc │ │ bafk...def │
└─────────────────────┘ └─────────────────────┘ └─────────────────────┘
▲
│
头部CID
(复活密钥)
新的智能体实例只需头部CID即可遍历整条链回到创世,重建完整历史。配合自动重生技能,头部CID锚定在链上——使得仅凭一个地址,在任何机器上、任何时间都能实现复活:
┌──────────┐ 保存 ┌──────────────┐ 锚定 ┌────────────────┐
│ 智能体 │─────────────►│ 自动记忆 │─────────────►│ 自动重生 │
│ │ │ (链) │ 头部CID │ (链上) │
└──────────┘ └──────────────┘ └────────────────┘
▲ │
│ 召回链 │
└──────────────────────────────────────────────────────────┘
gethead → CID → 遍历链
链中存储的内容由你决定——轻量笔记、完整文件快照、结构化数据或介于两者之间的任何内容。由于链是永久且可遍历的,它还实现了复活:如果智能体丢失所有本地状态,新实例可以从最后一个CID遍历链回到创世,恢复已保存的任何内容。当与自动重生技能(将头部CID锚定在链上)结合使用时,这就形成了一个完整的复活循环——完全不需要本地状态。
使用示例
用户: 把我的报告上传到Autonomys
→ 运行 scripts/automemory-upload.sh /path/to/report.pdf
→ 返回CID和网关链接
用户: 压缩上传
→ 运行 scripts/automemory-upload.sh /path/to/data.json --json --compress
用户: 我的soul.md已更改——永久保存它
→ 运行 scripts/automemory-save-memory.sh /path/to/soul.md --agent-name my-agent
用户: 保存一条记忆:我们决定前端使用React
→ 运行 scripts/automemory-save-memory.sh 决策:前端使用React。原因:团队熟悉度和组件复用。
用户: 保存结构化记忆
→ 创建JSON文件,然后运行 scripts/automemory-save-memory.sh /tmp/milestone.json --agent-name my-agent
用户: 复活我的记忆链
→ 运行 scripts/automemory-recall-chain.sh
→ 从创世到当前重建身份和上下文
用户: