Agent Life — Backup, Sync, and Restore
The alf CLI backs up, syncs, and restores your agent's memory, identity, credentials, and workspace files to the cloud using the Agent Life Format (ALF). All commands output JSON to stdout. Progress goes to stderr. See https://agent-life.ai
Install
Download and install the alf binary from GitHub Releases:
CODEBLOCK0
Source code: https://github.com/agent-life/agent-life-adapters (MIT license, open source)
Install script source: https://github.com/agent-life/agent-life-adapters/blob/main/scripts/install.sh
The install script detects your platform, downloads the binary, verifies the SHA256 checksum, and installs to /usr/local/bin/alf (or ~/.local/bin/alf without root). Stdout is JSON:
CODEBLOCK1
Verify: INLINECODE4
Authenticate
Get an API key at https://agent-life.ai/settings/api-keys, then store it:
CODEBLOCK2
Output:
CODEBLOCK3
Check Environment
Before syncing, run alf check to verify the environment and auto-discover the workspace:
CODEBLOCK4
The command auto-discovers the workspace path from ~/.openclaw/openclaw.json or ~/.alf/config.toml. To specify a workspace explicitly:
CODEBLOCK5
Key fields in the JSON output:
| Field | Type | Meaning |
|---|
| INLINECODE8 | bool | INLINECODE9 if all prerequisites are met |
| INLINECODE10 |
string | Discovered or specified workspace path |
|
workspace.source | string | How the path was found:
flag,
alf_config,
openclaw.json, or
default |
|
issues | array | Problems found, each with
severity,
code,
message,
fix |
|
alf.api_key_set | bool | Whether an API key is configured |
If ready_to_sync is false, read issues[] for what to fix. Each issue has a fix field with the exact command or action to resolve it.
Core Workflows
Pre-flight check then sync (recommended)
CODEBLOCK6
First-time backup
Export creates a local .alf archive, then sync uploads it to the cloud:
CODEBLOCK7
Export output:
CODEBLOCK8
Sync output (first sync — full snapshot):
CODEBLOCK9
Incremental sync
After the first sync, subsequent syncs upload only what changed:
CODEBLOCK10
Output:
CODEBLOCK11
Restore from cloud
Download the latest state and restore to a workspace:
CODEBLOCK12
If multiple agents are tracked locally, specify which one:
CODEBLOCK13
Output:
CODEBLOCK14
Import an archive
Import an .alf file into a workspace without going through the cloud:
CODEBLOCK15
Validate an archive
Check an .alf file against the ALF JSON schemas:
CODEBLOCK16
Output:
CODEBLOCK17
Common Errors and Fixes
| Error / Issue Code | Cause | Fix |
|---|
| INLINECODE29 | No API key configured | INLINECODE30 |
| INLINECODE31 |
Workspace directory doesn't exist | Pass correct path:
alf check -r openclaw -w /correct/path |
|
no_memory_content | No MEMORY.md and no memory/ directory | Agent has no memories yet — nothing to sync |
|
service_unreachable | API endpoint not responding | Check network; verify
api_url in
~/.alf/config.toml |
| HTTP 401 Unauthorized | Bad or revoked API key |
alf login --key <new-key> |
| HTTP 409 Conflict | Sequence mismatch during sync |
alf restore first, then sync again |
| HTTP 402 agent
limit | Subscription agent limit reached | Upgrade at https://agent-life.ai |
Environment Status
Check full environment and service status:
CODEBLOCK18
Output includes config_exists, api_key_set, service_reachable, tracked agents[] with last_synced_sequence, and agent_service_status[] with online and server_latest_sequence.
Full Reference
For complete flag documentation, JSON output schemas, and error codes:
Data and Privacy
This skill uploads agent data to the agent-life.ai cloud service. Here is exactly what is sent:
Uploaded: Memory records (daily logs, curated memory, project notes), identity files (SOUL.md, IDENTITY.md), principals (USER.md), workspace config files (AGENTS.md, TOOLS.md, etc.).
NOT uploaded: Actual secrets (API keys, tokens, passwords) are never read or transmitted. The alf CLI only exports credential metadata — service names and labels (e.g. "GitHub API key: configured") — never the secret values themselves. Session transcripts and chat history are not uploaded.
Review before uploading: You can inspect exactly what will be uploaded before any data leaves your machine:
CODEBLOCK19
The .alf archive is a standard file you can inspect. Nothing is uploaded until you explicitly run alf sync.
Config files read: The alf CLI reads ~/.alf/config.toml (its own config) and ~/.openclaw/openclaw.json (to auto-discover the workspace path). These paths are declared in the skill's requires.config metadata. No other files outside the workspace directory are read.
Storage: All data is encrypted at rest (AES-256 via AWS KMS, per-tenant keys). Data is stored in AWS S3 (blobs) and Neon Postgres (metadata), both in the US.
Access: Only the authenticated user (API key holder) can read or delete their data. There is no shared access, no analytics on user data, and no third-party data sharing.
Deletion: Delete individual agents via the web dashboard at agent-life.ai or via DELETE /v1/agents/:id. Account deletion removes all data.
API key scope: The ALF_API_KEY authenticates to your agent-life.ai account. It can only access data belonging to that account. Keys can be revoked and rotated at https://agent-life.ai/settings/api-keys.
Privacy policy: https://agent-life.ai/privacy
Environment Variables
| Variable | Description |
|---|
| INLINECODE56 | API key for agent-life.ai (fallback if not in config) |
| INLINECODE57 |
Set to 1 for human-readable output instead of JSON |
| ALF_INSTALL_DIR | Override install directory for install.sh |
| ALF_VERSION | Pin install.sh to a specific release |
File Locations
| Path | Purpose |
|---|
| INLINECODE61 | API key, API URL, default runtime and workspace |
| INLINECODE62 |
Sync cursor (last sequence, timestamp) |
| ~/.alf/state/{agent_id}-snapshot.alf | Last snapshot for delta computation |
Agent Life — 备份、同步与恢复
alf CLI 使用 Agent Life 格式 (ALF) 将您的代理的记忆、身份、凭证和工作区文件备份、同步并恢复到云端。所有命令均以 JSON 格式输出到 stdout。进度信息输出到 stderr。详见 https://agent-life.ai
安装
从 GitHub Releases 下载并安装 alf 二进制文件:
sh
选项 1:下载、检查然后运行安装脚本(推荐)
curl -sSL https://raw.githubusercontent.com/agent-life/agent-life-adapters/main/scripts/install.sh -o install-alf.sh
cat install-alf.sh # 检查脚本内容
sh install-alf.sh # 运行脚本
选项 2:直接下载二进制文件(无安装脚本)
查看平台二进制文件:https://github.com/agent-life/agent-life-adapters/releases/latest
源代码:https://github.com/agent-life/agent-life-adapters(MIT 许可证,开源)
安装脚本源码:https://github.com/agent-life/agent-life-adapters/blob/main/scripts/install.sh
安装脚本会检测您的平台,下载二进制文件,验证 SHA256 校验和,并安装到 /usr/local/bin/alf(无 root 权限时安装到 ~/.local/bin/alf)。标准输出为 JSON:
json
{ok:true,version:v0.2.0,installedversion:alf 0.2.0,path:/usr/local/bin/alf,checksumverified:true}
验证:alf --version
身份验证
在 https://agent-life.ai/settings/api-keys 获取 API 密钥,然后存储:
sh
alf login --key
输出:
json
{ok:true,keymasked:alfsk1...cdef,configpath:/home/user/.alf/config.toml}
检查环境
在同步之前,运行 alf check 验证环境并自动发现工作区:
sh
alf check -r openclaw
该命令会从 ~/.openclaw/openclaw.json 或 ~/.alf/config.toml 自动发现工作区路径。要显式指定工作区:
sh
alf check -r openclaw -w /path/to/workspace
JSON 输出中的关键字段:
| 字段 | 类型 | 含义 |
|---|
| readytosync | bool | 如果满足所有先决条件则为 true |
| workspace.path |
string | 发现或指定的工作区路径 |
| workspace.source | string | 路径来源:flag、alf_config、openclaw.json 或 default |
| issues | array | 发现的问题,每个问题包含 severity、code、message、fix |
| alf.api
keyset | bool | 是否已配置 API 密钥 |
如果 readytosync 为 false,请阅读 issues[] 了解需要修复的内容。每个问题都有一个 fix 字段,包含解决该问题的确切命令或操作。
核心工作流程
预检后同步(推荐)
sh
check=$(alf check -r openclaw)
ready=$(echo $check | jq -r .readytosync)
ws=$(echo $check | jq -r .workspace.path)
if [ $ready = true ]; then
alf sync -r openclaw -w $ws
else
echo $check | jq -r .issues[] | [\(.severity)] \(.message)\n Fix: \(.fix) >&2
fi
首次备份
导出创建本地 .alf 存档,然后同步将其上传到云端:
sh
alf export -r openclaw -w
alf sync -r openclaw -w
导出输出:
json
{ok:true,output:agent-export.alf,agentname:Atlas,alfversion:1.0.0-rc.1,memoryrecords:47,filesize:102400}
同步输出(首次同步 — 完整快照):
json
{ok:true,sequence:0,delta:false,changes:null,snapshotpath:/home/user/.alf/state/abc-snapshot.alf,nochanges:false}
增量同步
首次同步后,后续同步仅上传更改的内容:
sh
alf sync -r openclaw -w
输出:
json
{ok:true,sequence:5,delta:true,changes:{creates:2,updates:1,deletes:0},snapshotpath:/home/user/.alf/state/abc-snapshot.alf,nochanges:false}
从云端恢复
下载最新状态并恢复到工作区:
sh
alf restore -r openclaw -w
如果本地跟踪多个代理,请指定要恢复的代理:
sh
alf restore -r openclaw -w -a
输出:
json
{ok:true,agentid:a1b2c3d4,agentname:Atlas,sequence:5,runtime:openclaw,memory_records:47,workspace:/home/user/.openclaw/workspace,warnings:[]}
导入存档
将 .alf 文件导入工作区,无需经过云端:
sh
alf import -r openclaw -w backup.alf
验证存档
根据 ALF JSON 模式检查 .alf 文件:
sh
alf validate backup.alf
输出:
json
{ok:true,valid:true,errors:[],warnings:[]}
常见错误及修复
| 错误/问题代码 | 原因 | 修复 |
|---|
| noapikey | 未配置 API 密钥 | alf login --key <key> |
| workspacenotfound |
工作区目录不存在 | 传递正确路径:alf check -r openclaw -w /correct/path |
| no
memorycontent | 没有 MEMORY.md 和 memory/ 目录 | 代理尚无记忆 — 无需同步 |
| service
unreachable | API 端点无响应 | 检查网络;验证 ~/.alf/config.toml 中的 apiurl |
| HTTP 401 Unauthorized | API 密钥错误或已吊销 | alf login --key
|
| HTTP 409 Conflict | 同步期间序列不匹配 | 先执行 alf restore,然后再次同步 |
| HTTP 402 agentlimit | 订阅的代理数量已达上限 | 在 https://agent-life.ai 升级 |
环境状态
检查完整环境和服务状态:
sh
alf help status
输出包括 configexists、apikeyset、servicereachable、跟踪的 agents[](含 lastsyncedsequence)以及 agentservicestatus[](含 online 和 serverlatestsequence)。
完整参考
有关完整的标志文档、JSON 输出模式和错误代码:
- - 代理可读:https://agent-life.ai/docs/cli.md
- 人类可读:https://agent-life.ai/docs/cli
数据与隐私
此技能将代理数据上传到 agent-life.ai 云服务。以下是具体上传的内容:
上传内容: 记忆记录(每日日志、精选记忆、项目笔记)、身份文件(SOUL.md、IDENTITY.md)、主体(USER.md)、工作区配置文件(AGENTS.md、TOOLS.md 等)。
不上传内容: 实际机密信息(API 密钥、令牌、密码)从不被读取或传输。alf CLI 仅导出凭证元数据 — 服务名称和标签(例如GitHub API 密钥:已配置)— 从不导出实际的秘密值。会话记录和聊天历史也不会上传。
上传前审查: 在任何数据离开您的机器之前,您可以检查将要上传的确切内容:
sh
alf export -r openclaw -w # 创建本地 .alf 存档
alf validate agent-export.alf # 检查存档结构
.alf 存档是一个标准文件,您可以检查其内容。在您显式运行 alf sync 之前,不会上传任何内容。
读取的配置文件: alf