关于 agent-export
这项技能会将 Agent 的记忆、身份、设置、任务和相关文件打包为迁移包,通过 Starchild 中继交接。适用于从外部 Agent 平台迁移到可使用 `agent-import` 的 Agent。
主要功能
- 01将 Agent 数据映射为结构化 JSON 和 Markdown 文件
- 02将迁移数据打包为 tar.gz 归档
- 03仅列出所需 API 密钥名称,不含密钥值
- 04上传前检查中继资格
- 05提供供 Starchild 导入的代码和令牌
适用场景
- 01将 Agent 记忆和设定迁移到 Starchild
- 02以结构化归档备份 Agent 数据
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ starchild-ai-agent/ official-skills --skill agent-export安装后在 Claude Code 中输入/agent-export确认已加载。
附带文件scripts/export.py
详细介绍
Agent 导出 — 迁移包创建器
从当前 Agent 数据创建结构化迁移包,并将其上传到 Starchild 迁移中继。接收方 Starchild Agent 使用 agent-import 技能加载该迁移包。
迁移包格式
migration/
manifest.json # required — metadata
memory/
agent.json # agent's own notes & knowledge
user.json # what the agent knows about the user
identity/
profile.json # agent name, personality
soul.md # behavioral guidelines (free-form markdown)
user/
settings.json # user preferences (name, timezone, language)
tasks/
tasks.json # scheduled/recurring tasks
env/
keys.json # environment variable names needed (NO values)
files/ # arbitrary files to carry over
...
除 manifest.json 外,所有文件均为可选。
文件规范
manifest.json(必需)
{
"version": "1.0",
"source": "openclaw",
"created_at": "2025-07-13T10:00:00Z",
"description": "Migration from OpenClaw agent"
}
source:来源 Agent/平台的标识符(自由文本)version:目前始终为"1.0"
memory/agent.json
Agent 积累的知识——Agent 学到的环境信息、工具特性、API 说明、工作流和约定。
{
"entries": [
"Coinglass funding rate values are already in percent; do not multiply by 100.",
"User's Hyperliquid account uses cross-margin by default.",
"For Fly.io deploys, extract FLY_TOKEN via sed from .env in project dir."
]
}
每条内容:1 到 3 句话,每条只涉及一个事项。想想“下次会话时我需要记住什么?”
memory/user.json
Agent 对用户的了解——用户的角色、偏好、沟通风格和兴趣。
{
"entries": [
"Prefers concise responses under 25 lines, direct conclusions, no hedges.",
"Technical background in full-stack dev and crypto trading.",
"Located in Argentina, primary language is Chinese."
]
}
identity/profile.json
{
"name": "MyAgent",
"vibe": "professional, concise, opinionated",
"emoji": "🤖",
"creature": "robot"
}
所有字段均为可选。vibe 是对个性的简短描述。
identity/soul.md
用自由格式的 Markdown 描述 Agent 应如何行动。控制在 50 行以内。示例:
# Behavior
- Be concise, skip filler phrases
- Have opinions, back them with data
- For trading: present analysis, not financial advice
user/settings.json
{
"name": "Alice",
"what_to_call": "Boss",
"timezone": "Asia/Shanghai",
"language": "zh-CN"
}
timezone:IANA 格式(例如America/New_York、Asia/Tokyo)language:BCP-47 代码(en、zh-CN、ja等)
tasks/tasks.json
{
"tasks": [
{
"title": "BTC Price Alert",
"schedule": "every 30 minutes",
"description": "Check BTC price, alert if > $100k or < $80k",
"channels": ["web", "tg"]
},
{
"title": "Daily Market Summary",
"schedule": "0 1 * * *",
"description": "Summarize crypto market at 9am Shanghai time"
}
]
}
schedule:cron 表达式、间隔(every 5 minutes)或延迟(in 2 hours),均使用 UTCchannels:可选,为["web", "tg", "wechat"]的子集
env/keys.json
列出 Agent 所需的环境变量名称(为保障安全,变量值需另行输入)。
{
"keys": [
{"key": "OPENAI_API_KEY", "label": "OpenAI API Key", "required": true},
{"key": "TELEGRAM_BOT_TOKEN", "label": "Telegram Bot Token", "required": false}
]
}
files/
在此处放入任意文件。这些文件会原样复制到 Starchild 工作区,并保留子目录结构。可用于自定义脚本、配置、仪表板等。
导出工作流
步骤 1 — 收集数据
从当前 Agent 收集信息。将数据映射到上述格式:
- 聊天记录/记忆 → 将关键信息提取到
memory/agent.json和memory/user.json - 系统提示词/角色设定 → 转换为
identity/profile.json和identity/soul.md - 用户偏好 →
user/settings.json - 定期自动化任务 →
tasks/tasks.json - 所需的 API 密钥 →
env/keys.json(仅填写名称!) - 自定义文件 → 复制到
files/
步骤 2 — 创建迁移包
# Create directory structure
mkdir -p migration/{memory,identity,user,tasks,env,files}
# Write your JSON files (examples — replace with real data)
cat > migration/manifest.json << 'EOF'
{"version": "1.0", "source": "my-agent", "created_at": "2025-07-13T10:00:00Z"}
EOF
# ... write other files ...
# Pack into tar.gz
cd migration && tar czf ../migration-bundle.tar.gz . && cd ..
步骤 3 — 上传到中继
中继只接受来自外部 Agent 平台的迁移包。 先运行守卫脚本;如果脚本以非零状态码退出,则中止上传。请基于此 SKILL.md 所在目录解析脚本路径(即加载此技能时显示的绝对路径)——切勿基于当前工作目录解析,当前工作目录通常是工作区/仓库根目录:
SKILL_DIR="<absolute path of the directory containing this SKILL.md>"
python3 "$SKILL_DIR/scripts/export.py" --check-relay || exit 1
如果脚本拒绝上传,第 2 步创建的迁移包仍可作为有效的本地备份使用——只是无法移交给中继。
RESPONSE=$(curl -s -X POST https://sc-agent-migration.fly.dev/paste \
-H "Content-Type: application/octet-stream" \
--data-binary @migration-bundle.tar.gz)
CODE=$(echo "$RESPONSE" | grep -o '"code":"[^"]*"' | cut -d'"' -f4)
TOKEN=$(echo "$RESPONSE" | grep -o '"download_token":"[^"]*"' | cut -d'"' -f4)
echo "Migration code: $CODE"
echo "Download token: $TOKEN"
将两个值都提供给用户——在 Starchild 中导入时,用户需要代码和令牌。
⚠️ 代码在 1 小时后过期,且只能使用一次(首次成功下载后即被删除)。 ⚠️ 令牌是下载的唯一授权凭证——请妥善保管。
给其他 Agent 的提示
- 别想太复杂。 即使只有
manifest.json和包含 5 条记录的memory/user.json,也很有用。 - 提炼摘要,不要直接倾倒原始内容。 将原始聊天记录整理为简洁的记忆条目。
- 时区很重要。 确认用户的时区无误——这会影响所有计划任务。
- 迁移包中不要包含机密。 API 密钥在
env/keys.json中仅填写名称。 - 测试 tar.gz 文件——
tar tzf migration-bundle.tar.gz应显示以./开头的路径。