返回顶部
a

agent-life代理生命周期

Backup, sync, and restore agent memory and state to the cloud using the Agent Life Format (ALF). Use when asked to back up agent data, sync memory to the cloud, restore from a backup, or migrate between agent frameworks. Requires the alf CLI binary and an API key from agent-life.ai.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.2.0
安全检测
已通过
219
下载量
免费
免费
1
收藏
概述
安装方式
版本历史

agent-life

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 输出中的关键字段:

字段类型含义
readytosyncbool如果满足所有先决条件则为 true
workspace.path
string | 发现或指定的工作区路径 |
| workspace.source | string | 路径来源:flag、alf_config、openclaw.json 或 default |
| issues | array | 发现的问题,每个问题包含 severity、code、message、fix |
| alf.apikeyset | 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 | | nomemorycontent | 没有 MEMORY.md 和 memory/ 目录 | 代理尚无记忆 — 无需同步 | | serviceunreachable | 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

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 agent-life-1776084202 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 agent-life-1776084202 技能

通过命令行安装

skillhub install agent-life-1776084202

下载

⬇ 下载 agent-life v1.2.0(免费)

文件大小: 5.28 KB | 发布时间: 2026-4-14 15:55

v1.2.0 最新 2026-4-14 15:55
Declare config paths in requires.config metadata. Remove curl|sh one-liner. Expand Data and Privacy section with credential handling details, pre-sync review workflow, and API key scope info.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large