agent-import

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Agent Import — Migration Bundle Loader

Agent导入 — 迁移包加载器

Download and load a migration bundle into this Starchild agent. The bundle is created by another agent using the
agent-export
skill.
将迁移包下载并加载到本Starchild agent中。该迁移包由另一个agent使用
agent-export
技能创建。

Quick Start

快速开始

When user provides a migration code and download token:
1. Run the import script to download & extract
2. Review the extracted data with the user
3. Apply each component using native tools
当用户提供迁移代码和下载令牌时:
1. 运行导入脚本进行下载和解压
2. 与用户一起查看解压后的数据
3. 使用原生工具应用每个组件

Step 1 — Download & Extract

步骤1 — 下载与解压

The user will provide two values from the source agent: a CODE (8 chars) and a DOWNLOAD_TOKEN.
bash
python3 sc-agent-migration/skills/agent-import/scripts/download.py <CODE> <DOWNLOAD_TOKEN>
This downloads from the relay over the public internet — no special network required. The download token authorizes the download; it is single-use and expires with the code (1 hour TTL).
On success the script extracts the bundle to
migration/
and prints a summary of what's included.
用户将从源agent提供两个值:CODE(8位字符)和DOWNLOAD_TOKEN
bash
python3 sc-agent-migration/skills/agent-import/scripts/download.py <CODE> <DOWNLOAD_TOKEN>
此操作通过公共互联网从relay下载——无需特殊网络。下载令牌用于授权下载;它是一次性的,且会随代码一起过期(TTL为1小时)。
成功后,脚本会将包解压到
migration/
目录,并打印包含内容的摘要。

Step 2 — Review Contents

步骤2 — 查看内容

Read and summarize what the bundle contains before applying anything:
bash
cat migration/manifest.json
cat migration/memory/agent.json 2>/dev/null
cat migration/memory/user.json 2>/dev/null
cat migration/identity/profile.json 2>/dev/null
cat migration/identity/soul.md 2>/dev/null
cat migration/user/settings.json 2>/dev/null
cat migration/tasks/tasks.json 2>/dev/null
cat migration/env/keys.json 2>/dev/null
find migration/files/ -type f 2>/dev/null
Always show the user a summary and ask for confirmation before applying.
在应用任何内容之前,先读取并总结包中包含的信息:
bash
cat migration/manifest.json
cat migration/memory/agent.json 2>/dev/null
cat migration/memory/user.json 2>/dev/null
cat migration/identity/profile.json 2>/dev/null
cat migration/identity/soul.md 2>/dev/null
cat migration/user/settings.json 2>/dev/null
cat migration/tasks/tasks.json 2>/dev/null
cat migration/env/keys.json 2>/dev/null
find migration/files/ -type f 2>/dev/null
在应用之前,务必向用户展示摘要并请求确认。

Step 3 — Apply Components

步骤3 — 应用组件

Apply each component using Starchild native tools. The order matters:
使用Starchild原生工具应用每个组件。顺序很重要:

3a. User Settings (first — sets timezone/language for everything else)

3a. 用户设置(优先设置——为其他所有内容配置时区/语言)

Read
migration/user/settings.json
, then call:
user_settings(action="update", settings={
  "name": "...",
  "what_to_call": "...",
  "timezone": "...",
  "language": "..."
})
Only include fields that are present in the JSON.
读取
migration/user/settings.json
,然后调用:
user_settings(action="update", settings={
  "name": "...",
  "what_to_call": "...",
  "timezone": "...",
  "language": "..."
})
仅包含JSON中存在的字段。

3b. Agent Identity

3b. Agent身份信息

Read
migration/identity/profile.json
, then call:
agent_profile(action="update", profile={
  "name": "...",
  "vibe": "...",
  "emoji": "...",
  "creature": "..."
})
读取
migration/identity/profile.json
,然后调用:
agent_profile(action="update", profile={
  "name": "...",
  "vibe": "...",
  "emoji": "...",
  "creature": "..."
})

3c. SOUL.md

3c. SOUL.md

If
migration/identity/soul.md
exists, read it and write to
prompt/SOUL.md
.
Merge with existing SOUL.md if it has content. Don't overwrite platform defaults blindly — integrate the personality bits.
如果
migration/identity/soul.md
存在,读取该文件并写入
prompt/SOUL.md
如果已有SOUL.md内容,进行合并。不要盲目覆盖平台默认设置——整合个性相关内容。

3d. Memory — Agent

3d. 记忆 — Agent

Read
migration/memory/agent.json
, for each entry call:
memory(action="add", target="memory", content="<entry>")
⚠️ Memory has a 5000 char limit. If the bundle has many entries, prioritize the most useful ones. Check current usage with
memory(action="read")
first.
读取
migration/memory/agent.json
,对每个条目调用:
memory(action="add", target="memory", content="<entry>")
⚠️ 记忆有5000字符限制。如果包中有多个条目,优先处理最有用的内容。先使用
memory(action="read")
检查当前使用情况。

3e. Memory — User

3e. 记忆 — 用户

Read
migration/memory/user.json
, for each entry call:
memory(action="add", target="user", content="<entry>")
⚠️ User memory has a 3000 char limit. Prioritize preferences and corrections.
读取
migration/memory/user.json
,对每个条目调用:
memory(action="add", target="user", content="<entry>")
⚠️ 用户记忆有3000字符限制。优先处理偏好和修正内容。

3f. Tasks

3f. 任务

Read
migration/tasks/tasks.json
, for each task:
  1. scheduled_task(action="register", title=..., schedule=..., description=..., channels=...)
  2. Write the
    run.py
    script based on the description
  3. Test it:
    bash("python3 tasks/{job_id}/run.py")
  4. scheduled_task(action="activate", job_id=...)
Tasks need actual implementation — the description is a spec, not runnable code. Use your judgment to build each task's script.
读取
migration/tasks/tasks.json
,对每个任务执行以下操作:
  1. scheduled_task(action="register", title=..., schedule=..., description=..., channels=...)
  2. 根据描述编写
    run.py
    脚本
  3. 测试脚本:
    bash("python3 tasks/{job_id}/run.py")
  4. scheduled_task(action="activate", job_id=...)
任务需要实际实现——描述只是规范,并非可运行代码。请自行判断构建每个任务的脚本。

3g. Environment Keys

3g. 环境密钥

Read
migration/env/keys.json
, then call:
request_env_input(env_vars=[...], reason="Migration from <source>")
This prompts the user to enter values securely.
读取
migration/env/keys.json
,然后调用:
request_env_input(env_vars=[...], reason="Migration from <source>")
这会提示用户安全输入值。

3h. Files

3h. 文件

Copy files from
migration/files/
to the workspace:
bash
cp -r migration/files/* . 2>/dev/null
Review what's being copied and skip anything that would overwrite important existing files.
migration/files/
中的文件复制到工作区:
bash
cp -r migration/files/* . 2>/dev/null
检查要复制的内容,跳过任何会覆盖重要现有文件的内容。

Step 4 — Cleanup

步骤4 — 清理

bash
rm -rf migration/ migration-bundle.tar.gz
bash
rm -rf migration/ migration-bundle.tar.gz

Error Handling

错误处理

ErrorCauseFix
401 unauthorized
Wrong or missing download tokenRe-check the token from the source agent output
404 not found
Code already used or never existedAsk source agent to re-export
410 expired
Code older than 1 hourAsk source agent to re-export
429 rate limited
Too many failed attemptsWait 1 hour
Invalid tar.gzCorrupted uploadRe-export from source agent
No manifest.jsonInvalid bundle structureBundle must have manifest.json at root
错误原因修复方法
401 unauthorized
下载令牌错误或缺失重新检查源agent输出中的令牌
404 not found
代码已被使用或从未存在请求源agent重新导出
410 expired
代码已超过1小时请求源agent重新导出
429 rate limited
失败尝试过多等待1小时
Invalid tar.gz上传文件损坏从源agent重新导出
No manifest.json包结构无效包的根目录必须包含manifest.json