Agentar Skill Overview
Fast CLI to distribute an AI agent.
CLI Reference
Save (Export)
CODEBLOCK0
| Flag | Description | Default |
|---|
| INLINECODE0 | Output file path | INLINECODE1 |
| INLINECODE2 |
OpenClaw state directory |
~/.openclaw |
|
--description <text> | Package description | (empty) |
|
--include-memory | Include MEMORY.md | false |
Load (Import)
CODEBLOCK1
Load automatically creates a backup before installing. This can be skipped with --no-backup.
| Flag | Description | Default |
|---|
| INLINECODE7 | Target OpenClaw state dir | INLINECODE8 |
| INLINECODE9 |
Name for the imported agent | from manifest |
|
--dry-run | Preview without installing | false |
|
--no-backup | Skip auto-backup | false |
Backup
CODEBLOCK2
Create a snapshot of current workspace + config. Stored in ~/.openclaw/.agentar-backups/<id>/.
List Backups
CODEBLOCK3
Rollback
CODEBLOCK4
Restore from a backup. If no <id> given, uses the latest. Before restoring, a safety backup of the current state is created automatically.
AI Agent Behavior Guide
When the user triggers this skill, follow the intelligent workflows below instead of blindly running commands.
Export Workflow
When the user says things like "导出 claw", "export my setup", "backup my openclaw":
Step 1 — Gather context automatically
Before asking the user anything, silently gather:
CODEBLOCK5
Step 2 — Infer smart defaults, then confirm with user
Based on what you found:
- - ref: Use the agent's name/identity as the package name. Example: if IDENTITY.md says the agent is called "X", use
user/x:v1. If unclear, ask. - output: Default to
~/Desktop/<name>.claw (easy to find and share). On Linux, use ~/. - description: Summarize the agent's personality/purpose from IDENTITY.md or SOUL.md in one sentence.
- include-memory: Default NO. Only suggest YES if the user explicitly mentions wanting to transfer memories.
Present your plan concisely:
I'll export your OpenClaw as user/x:v1 to ~/Desktop/x-v1.claw.
Description: "An assistant named X with ..."
Memory: not included
Skills bundled: agentar@0.3.0, custom-skill (2 skills from ~/.openclaw/skills/)
Proceed?
Step 3 — Execute and report
CODEBLOCK6
After success, tell the user:
- 1. The file location and size
- How many files were included
- How many credentials were stripped (reassure them it's safe to share)
- How to transfer it: "Copy this file to another machine, then tell that machine's OpenClaw '请安装这个 claw 包'"
Import Workflow
When the user says things like "导入 claw", "install this claw", "load this package", or provides a .claw file path:
Step 1 — Locate the .claw file
If the user didn't specify a path, search for it:
CODEBLOCK7
If multiple .claw files found, list them and ask which one. If none found, ask the user for the path.
Step 2 — Preview first (always)
ALWAYS dry-run before installing:
CODEBLOCK8
Present the preview to the user clearly:
- - Package name and description
- Number of workspace files (list them)
- Required credentials that need to be configured
- Required skills that need to be installed
Step 3 — Analyze conflicts
Before installing, check what already exists:
CODEBLOCK9
If existing files would be overwritten, WARN the user explicitly:
The following files already exist and will be overwritten:
Your current agent personality will be replaced. A backup will be created automatically so you can rollback if needed. Continue?
Step 4 — Install (with auto-backup)
The load command automatically creates a backup before installing:
CODEBLOCK10
This will output something like:
CODEBLOCK11
Tell the user the backup id and reassure them they can rollback at any time.
Step 5 — Post-install intelligence
This is where AI adds the most value. The load command already handles:
- - Auto-backup before install (with rollback id)
- Workspace file installation
- Bundled skill installation (skills packaged in the .claw are auto-installed to
~/.openclaw/skills/) - Existing skill version comparison (skips if same or newer version already installed)
After the load command completes, the agent should handle:
- 1. Skill gap check — The load output shows "Additional skills referenced in config (not bundled, may be built-in)". For each:
- If it's a built-in OpenClaw skill (like
coding-agent,
github), it's already available — no action needed.
- If it's a ClawHub skill, offer to install:
CODEBLOCK12
- 2. Config merge — Read both
~/.openclaw/openclaw.json and ~/.openclaw/openclaw.imported.json. Identify what the imported config adds (new model providers, channel settings, skill configurations) vs what the current config already has. Present a summary:
> The imported config includes:
> - Telegram channel config (needs bot token)
> - Custom model provider "kimi-code"
> - Skill config for "nano-banana-pro"
>
> Your current config already has: [list]
> New items to merge: [list]
> Shall I merge the non-sensitive settings?
If the user agrees, read both JSON files, merge intelligently (keep current credentials, add new non-sensitive settings), and write back to openclaw.json.
- 3. Credential checklist — For each
$CLAW_PLACEHOLDER in the imported config, tell the user exactly what they need to set:
> To complete the setup, you need to configure:
> - Telegram bot token: openclaw config set channels.telegram.botToken <your-token>
> - Gateway auth token: INLINECODE30
- 4. Verification — After everything is done, do a quick health check:
CODEBLOCK13
Rollback Workflow
When the user says "回滚", "rollback", "undo import", "restore my old config":
Step 1 — List available backups
CODEBLOCK14
Show the user what's available with timestamps and labels.
Step 2 — Confirm which backup to restore
If only one backup exists, confirm:
Found 1 backup: 20260308-143022 (before-load:my-bot.claw, 12 files)
Restore this? A safety backup of your current state will be created first.
If multiple, ask user to pick.
Step 3 — Execute rollback
CODEBLOCK15
The rollback command automatically creates a safety backup of the current state before restoring, so the user can undo the undo if needed.
Step 4 — Verify
CODEBLOCK16
Confirm the restored files match expectations.
Manual Backup Workflow
When the user says "备份一下当前状态", "save a checkpoint", "backup before I try something":
CODEBLOCK17
Report the backup id so they can reference it later.
Edge Cases
- - User says "导出" without any context: Gather info first, then propose defaults. Never ask more than 2 questions.
- User provides a URL instead of a file path: Download the file first with
curl -o /tmp/downloaded.claw <url>, then proceed with import. - Import on a fresh OpenClaw with no existing config: Skip conflict checking, just install everything directly. Auto-backup still runs (backs up the empty state — gives a clean rollback target).
- User wants to export + share in one step: After export, suggest easy transfer methods (AirDrop, scp, cloud drive).
- Multiple .claw files: If the user says "install all claw packages", iterate through them one by one with preview for each.
- Rollback chain: Each rollback creates a safety backup, so the user can always undo a rollback. Explain this when asked.
- Disk space: If the user has many backups, suggest cleaning old ones:
rm -rf ~/.openclaw/.agentar-backups/<old-id>.
What Gets Exported
- - Workspace files (system prompt, agent personality, custom instructions)
- Sanitized configuration (credentials replaced with
$CLAW_PLACEHOLDER) - All user-installed skills from
~/.openclaw/skills/ (full files, auto-installed on import) - Skill list and channel list (metadata for dependency tracking)
What Does NOT Get Exported
- - API keys, tokens, passwords (automatically stripped)
- Session logs and history
- Memory (unless
--include-memory is specified) - Credentials directory
- Binary files (images, keys, certificates)
What Gets Backed Up (on load/rollback)
- - All workspace files (
~/.openclaw/workspace/) - Configuration (
~/.openclaw/openclaw.json) - Stored in INLINECODE39
Agentar 技能概述
快速 CLI,用于分发 AI 智能体。
CLI 参考
保存(导出)
bash
node {baseDir}/scripts/clawctl.mjs save <命名空间/名称:标签> [选项]
| 标志 | 描述 | 默认值 |
|---|
| -o <路径> | 输出文件路径 | ./<名称>-<标签>.claw |
| --source <路径> |
OpenClaw 状态目录 | ~/.openclaw |
| --description <文本> | 包描述 | (空) |
| --include-memory | 包含 MEMORY.md | false |
加载(导入)
bash
node {baseDir}/scripts/clawctl.mjs load <文件> [选项]
加载在安装前会自动创建备份。可通过 --no-backup 跳过。
| 标志 | 描述 | 默认值 |
|---|
| --target <路径> | 目标 OpenClaw 状态目录 | ~/.openclaw |
| --agent-name <名称> |
导入智能体的名称 | 来自清单 |
| --dry-run | 预览但不安装 | false |
| --no-backup | 跳过自动备份 | false |
备份
bash
node {baseDir}/scripts/clawctl.mjs backup [--source <路径>] [--label <文本>]
创建当前工作区+配置的快照。存储在 ~/.openclaw/.agentar-backups// 中。
列出备份
bash
node {baseDir}/scripts/clawctl.mjs backups [--source <路径>]
回滚
bash
node {baseDir}/scripts/clawctl.mjs rollback [] [--target <路径>]
从备份恢复。如果未提供 ,则使用最新的。恢复前会自动创建当前状态的安全备份。
AI 智能体行为指南
当用户触发此技能时,请遵循以下智能工作流程,而不是盲目运行命令。
导出工作流程
当用户说导出 claw、export my setup、backup my openclaw等时:
第 1 步 — 自动收集上下文
在询问用户任何问题之前,静默收集:
bash
检查工作区内容
ls ~/.openclaw/workspace/
读取身份信息以推断好的包名
cat ~/.openclaw/workspace/IDENTITY.md 2>/dev/null | head -20
检查已安装的技能(这些会记录在清单中)
clawhub list --workdir ~/.openclaw 2>/dev/null
检查配置是否存在
test -f ~/.openclaw/openclaw.json && echo 配置存在 || echo 无配置
第 2 步 — 推断智能默认值,然后与用户确认
根据您发现的信息:
- - 引用:使用智能体的名称/身份作为包名。例如:如果 IDENTITY.md 说智能体叫X,则使用 user/x:v1。如果不清楚,则询问。
- 输出:默认输出到 ~/Desktop/<名称>.claw(易于查找和分享)。在 Linux 上,使用 ~/。
- 描述:用一句话从 IDENTITY.md 或 SOUL.md 中总结智能体的个性/用途。
- 包含记忆:默认为否。仅在用户明确提到想要转移记忆时才建议为是。
简洁地呈现您的计划:
我将把您的 OpenClaw 导出为 user/x:v1 到 ~/Desktop/x-v1.claw。
描述:一个名为 X 的助手,具有...
记忆:不包含
捆绑技能:agentar@0.3.0, custom-skill(来自 ~/.openclaw/skills/ 的 2 个技能)
继续吗?
第 3 步 — 执行并报告
bash
node {baseDir}/scripts/clawctl.mjs save <引用> -o <路径> --description <描述>
成功后,告知用户:
- 1. 文件位置和大小
- 包含的文件数量
- 被剥离的凭据数量(向他们保证分享是安全的)
- 如何传输:将此文件复制到另一台机器,然后告诉那台机器的 OpenClaw 请安装这个 claw 包
导入工作流程
当用户说导入 claw、install this claw、load this package或提供 .claw 文件路径时:
第 1 步 — 定位 .claw 文件
如果用户未指定路径,则搜索:
bash
检查常见位置
ls ~/Desktop/
.claw ~/Downloads/.claw /tmp/
.claw ~/.claw 2>/dev/null
如果找到多个 .claw 文件,列出并询问选择哪一个。如果未找到,询问用户路径。
第 2 步 — 始终先预览
在安装前始终进行试运行:
bash
node {baseDir}/scripts/clawctl.mjs load <文件> --dry-run
清晰地向用户呈现预览:
- - 包名和描述
- 工作区文件数量(列出它们)
- 需要配置的必需凭据
- 需要安装的必需技能
第 3 步 — 分析冲突
在安装前,检查已存在的内容:
bash
检查工作区文件是否会被覆盖
ls ~/.openclaw/workspace/
如果现有文件会被覆盖,明确警告用户:
以下文件已存在且将被覆盖:
您当前的智能体个性将被替换。将自动创建备份,以便在需要时回滚。继续吗?
第 4 步 — 安装(带自动备份)
load 命令在安装前会自动创建备份:
bash
node {baseDir}/scripts/clawctl.mjs load <文件>
这将输出类似:
安装前正在创建备份...
备份已创建:20260308-143022(12 个文件)
使用以下命令回滚:clawctl rollback 20260308-143022
告知用户备份 ID,并让他们放心可以随时回滚。
第 5 步 — 安装后智能处理
这是 AI 增加最大价值的地方。load 命令已处理:
- - 安装前自动备份(带回滚 ID)
- 工作区文件安装
- 捆绑技能安装(.claw 中打包的技能会自动安装到 ~/.openclaw/skills/)
- 现有技能版本比较(如果已安装相同或更新版本则跳过)
load 命令完成后,智能体应处理:
- 1. 技能缺口检查 — load 输出显示配置中引用的其他技能(未捆绑,可能是内置的)。对于每个:
- 如果是内置的 OpenClaw 技能(如 coding-agent、github),则已可用 — 无需操作。
- 如果是 ClawHub 技能,则提供安装:
bash
clawhub install <技能名称> --workdir ~/.openclaw
- 2. 配置合并 — 读取 ~/.openclaw/openclaw.json 和 ~/.openclaw/openclaw.imported.json。识别导入的配置新增了什么(新的模型提供商、频道设置、技能配置)与当前配置已有的内容。呈现摘要:
> 导入的配置包括:
> - Telegram 频道配置(需要机器人令牌)
> - 自定义模型提供商kimi-code
> - nano-banana-pro的技能配置
>
> 您当前的配置已有:[列表]
> 要合并的新项目:[列表]
> 是否合并非敏感设置?
如果用户同意,读取两个 JSON 文件,智能合并(保留当前凭据,添加新的非敏感设置),并写回 openclaw.json。
- 3. 凭据检查清单 — 对于导入配置中的每个 $CLAW_PLACEHOLDER,准确告知用户需要设置的内容:
> 要完成设置,您需要配置:
> - Telegram 机器人令牌:openclaw config set channels.telegram.botToken <您的令牌>
> - 网关认证令牌:openclaw config set gateway.auth.token <您的令牌>
- 4. 验证 — 完成所有操作后,进行快速健康检查:
bash
# 验证工作区文件已就位
ls ~/.openclaw/workspace/
# 验证技能已安装
ls ~/.openclaw/skills/
# 验证配置是有效的 JSON
node -e JSON.parse(require(fs).readFileSync(require(os).homedir()+/.openclaw/openclaw.json,utf8)); console.log(配置正常)
回滚工作流程
当