feat(skill): 新增从 OpenClaw 迁移技能 / Add migrate-from-openclaw skill (#431)

## 概要 / Summary

新增官方技能 `migrate-from-openclaw`:把本机 OpenClaw
数据目录(`~/.openclaw/`)里的智能体与技能迁移到 DesireCore。DesireCore 客户端将移除内置的 OpenClaw
专用导入器(desirecore/desirecore#6563),迁移能力改由本技能以操作知识的形式提供,Agent 用既有的
`ManageAgent`、文件工具与 `FileDigest` 完成。

Adds the official `migrate-from-openclaw` Skill, which migrates agents
and skills from the local OpenClaw data directory (`~/.openclaw/`) into
DesireCore. The DesireCore client is removing its built-in OpenClaw
importer (desirecore/desirecore#6563); this Skill carries the migration
as operating knowledge, and the Agent performs it with the existing
`ManageAgent`, file tools and `FileDigest`.

## 内容 / What it covers

- 来源结构:`openclaw.json` 的 `agents.list[]` 与
`agents.defaults.workspace`,`~` 展开规则,`IDENTITY.md` 名称与表情解析,全局技能目录只认含
`SKILL.md` 的子目录。
-
固定映射:`SOUL.md→persona.md`、`AGENTS.md→principles.md`、`USER.md`/`MEMORY.md→memory/`、workspace
`skills/`→智能体私有技能;描述取 `SOUL.md` 首个非空行(≤200 字符)。与客户端原导入器一致。
- 重名:智能体交给 `ManageAgent` 的既有原子分配(`-2`、`-3`);全局技能沿用
`<名>-openclaw[-N]`;缺版本号补 `1.0.0`。
- 流程:扫描 → 预览并由用户选择 → 创建 → 复制 → 逐文件 `FileDigest` 核对 → 回执。只读来源,不覆盖已有内容,不碰
MCP、权限、模型与凭据。
- Source layout, the fixed file mapping (same as the client's former
importer), conflict naming, and a scan → preview/choose → create → copy
→ per-file `FileDigest` verification → receipt procedure. The source is
read-only; existing content is never overwritten.

## 外部依赖披露 / External dependency disclosure

需要本机已有 OpenClaw 数据目录;本技能只读取它,不安装、不授权、不运行
OpenClaw,也不访问其网络服务(`description`、`compatibility`、本地化文案与正文均已写明)。

Requires an existing local OpenClaw data directory; the Skill only reads
it and does not install, license or operate OpenClaw (stated in
`description`, `compatibility`, localized text and the body).

## 目录 / Catalog

- 不加入 `builtin-skills.json`:只对 OpenClaw 用户有意义,按需从市场安装(客户端加号菜单入口会按需安装并预填
`/skill:migrate-from-openclaw`)。
- `requiredClientVersion` 10.0.180(`ManageAgent` 的 `avatarGeneration`
参数从该版起存在);`manifest.json` 技能计数 164 → 165。
- Not added to `builtin-skills.json`; installed on demand.
`requiredClientVersion` 10.0.180; skill count 164 → 165.

## 校验 / Checks

- `validate-i18n.py`:0 error(新条目只有与其他内置技能相同的 license/review evidence 警告)
- `validate_catalog_metadata.py --require-complete`:0 error
- `translate.py --check`:通过(中英正文均为人工撰写,`source_hash` 一致)
- 公共信息边界自检:无客户或私有信息;示例为通用名称。

运行时验收(隔离 DesireCore 实例用合成 OpenClaw 夹具按本技能迁移,与原导入器产出逐项对比)完成后补充在下方评论。

Runtime acceptance (migrating a synthetic OpenClaw fixture in an
isolated DesireCore instance and comparing with the former importer's
output) will be added as a comment.

---------

Co-authored-by: mashagua <993498039@qq.com>
This commit is contained in:
yigeandmashagua authored and GitHub committed 2026-12-03 21:32:17 +08:00
1 parent 6c16c794cc
commit 4245947c4c
4 files changed
+354 -2

No files matched your search

+164
View File
@@ -0,0 +1,164 @@
---
license: "MIT"
name: migrate-from-openclaw
description: >-
把本机 OpenClaw 数据目录(~/.openclaw/)中的智能体与技能迁移到 DesireCore:按固定映射(SOUL.md→persona.md、AGENTS.md→principles.md、USER.md/MEMORY.md→memory/、workspace skills→智能体私有技能)经 ManageAgent 创建智能体并复制技能,迁移后逐项核对。Use when 用户要求从 OpenClaw 导入、迁移或搬家智能体与技能(migrate / import from OpenClaw)。需要本机已有 OpenClaw 数据目录;不安装、不运行 OpenClaw。
version: 1.0.0
compatibility: "Requires an existing local OpenClaw data directory (~/.openclaw); this Skill only reads it and does not install, license or operate OpenClaw. Uses DesireCore ManageAgent, file tools and FileDigest; reading outside the DesireCore data directory follows the current approval mode."
type: meta
risk_level: medium
status: enabled
disable-model-invocation: true
tags:
- agent
- migration
- import
- openclaw
metadata:
author: desirecore
updated_at: '2026-12-03'
i18n:
default_locale: en-US
source_locale: zh-CN
locales:
- zh-CN
- en-US
zh-CN:
name: 从 OpenClaw 迁移
short_desc: 把本机 OpenClaw 的智能体与技能迁移到 DesireCore
description: >-
把本机 OpenClaw 数据目录(~/.openclaw/)中的智能体与技能迁移到 DesireCore:按固定映射(SOUL.md→persona.md、AGENTS.md→principles.md、USER.md/MEMORY.md→memory/、workspace skills→智能体私有技能)经 ManageAgent 创建智能体并复制技能,迁移后逐项核对。Use when 用户要求从 OpenClaw 导入、迁移或搬家智能体与技能(migrate / import from OpenClaw)。需要本机已有 OpenClaw 数据目录;不安装、不运行 OpenClaw。
body: ./SKILL.zh-CN.md
source_hash: sha256:1afa5bf5e6016987
translated_by: human
en-US:
name: Migrate from OpenClaw
short_desc: Move local OpenClaw agents and skills into DesireCore
description: >-
Migrate agents and skills from the local OpenClaw data directory (~/.openclaw/) into DesireCore using a fixed mapping (SOUL.md→persona.md, AGENTS.md→principles.md, USER.md/MEMORY.md→memory/, workspace skills→agent-private skills): create agents with ManageAgent, copy skills, then verify every item. Use when the user asks to import or migrate agents or skills from OpenClaw. Requires an existing local OpenClaw data directory; does not install or run OpenClaw.
body: ./SKILL.md
source_hash: sha256:1afa5bf5e6016987
translated_by: human
market:
icon: >-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><defs><linearGradient id="mo-a" x1="2" y1="4" x2="22" y2="20" gradientUnits="userSpaceOnUse"><stop stop-color="#007AFF"/><stop offset="1" stop-color="#AF52DE"/></linearGradient></defs><rect x="2" y="5" width="8" height="14" rx="2" fill="url(#mo-a)" fill-opacity="0.12" stroke="url(#mo-a)" stroke-width="1.5"/><rect x="14" y="5" width="8" height="14" rx="2" fill="#34C759" fill-opacity="0.12" stroke="#34C759" stroke-width="1.5"/><path d="M8 12h8m-2.5-2.5L16 12l-2.5 2.5" stroke="#34C759" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>
category: productivity
maintainer:
name: DesireCore Official
verified: true
compatible_agents: []
channel: latest
required_client_version: 10.0.180
---
# migrate-from-openclaw Skill
## L0: One-line summary
Migrate the agents and skills in the local OpenClaw data directory (`~/.openclaw/`) into DesireCore: read the source, create agents with a fixed mapping, copy skills, then verify every item.
## L1: Overview
This Skill is operating knowledge only: how to read the source directory, where each file goes, how to handle name conflicts, and how to verify the result. Always create agents with `ManageAgent(action="create")`, and read or copy files with the file tools available in the current session. The platform handles permissions and approvals for every step according to the current approval mode; never try to bypass them or switch to HTTP endpoints.
Migration is a **copy**: never modify or delete anything under `~/.openclaw/`, and never overwrite existing DesireCore agents or skills.
Prerequisite: an existing OpenClaw data directory on this machine. This Skill does not install or run OpenClaw and does not contact any OpenClaw network service. If the directory is missing, tell the user and stop.
## L2: Detailed specification
### 1. Locate the source
- Source root: `.openclaw/` in the user's home directory (`~/.openclaw/` on macOS/Linux, `%USERPROFILE%\.openclaw\` on Windows). It lies outside the DesireCore data directory, so reading it may show an approval card or require authorizing the directory with `ManageWorkDirs(action="add")` first. Follow the prompt; do not retry with a different path.
- Configuration file: `.openclaw/openclaw.json`. Structure (only these fields are used):
```json
{
"agents": {
"defaults": { "workspace": "~/.openclaw/workspace" },
"list": [
{ "id": "main" },
{ "id": "writer", "name": "Writer", "workspace": "~/.openclaw/workspace-writer" }
]
}
}
```
- Global skills directory: `.openclaw/skills/<directory>/SKILL.md`. Subdirectories without `SKILL.md` are not skills; skip them.
- Missing source root: tell the user "No OpenClaw data directory was found" and stop without creating anything. Missing or invalid `openclaw.json`: report 0 agents with the reason and still scan skills.
### 2. Parse each agent
For every entry in `agents.list[]`:
| Item | Rule |
| --- | --- |
| Workspace | `workspace` → otherwise `agents.defaults.workspace` → if neither exists the entry cannot be migrated. A leading `~` or `~/` means the user's home directory; `~otheruser/...` is not expanded and is treated as missing |
| Display name | The value on the `- **Name:** <value>` line of the workspace `IDENTITY.md` → entry `name` → entry `id` |
| Emoji | The value on the `- **Emoji:** <value>` line of `IDENTITY.md`; empty if absent |
| Description | The first non-empty line of `SOUL.md`, trimmed, at most 200 characters; empty if there is no `SOUL.md` |
Example of the two `IDENTITY.md` lines:
```markdown
- **Name:** Night Owl
- **Emoji:** 🦉
```
If the workspace directory does not exist, record the agent as "cannot migrate: workspace not found <path>" and continue with the others.
### 3. File mapping
| OpenClaw (inside the workspace) | DesireCore (inside the new agent directory) | Method |
| --- | --- | --- |
| `IDENTITY.md` | `name` (and optional `avatar.char`) in `agent.json` | Parsed and passed as `ManageAgent` parameters |
| First line of `SOUL.md` | `description` in `agent.json` | `ManageAgent` `description` |
| `SOUL.md` | `persona.md` | Full text, unchanged, as the `ManageAgent` `persona` string |
| `AGENTS.md` | `principles.md` | Full text, unchanged, as the `ManageAgent` `principles` string |
| `USER.md` | `memory/USER.md` | Byte-for-byte copy after creation |
| `MEMORY.md` | `memory/MEMORY.md` | Byte-for-byte copy after creation |
| `skills/` (whole directory) | `skills/` (the agent's private skills) | Whole-directory copy after creation |
- Skip a target when its source file does not exist; never invent content. When `SOUL.md` or `AGENTS.md` is missing, omit the `persona` / `principles` parameter so the platform generates its default template, and mention it in the receipt.
- Pass `persona` / `principles` as Markdown strings whose content is **exactly** the source file: do not rewrite, summarize, translate, or add an L0/L1/L2 structure.
- Global skill `.openclaw/skills/<directory>/` → DesireCore global skills directory `<DesireCore data directory>/skills/<target directory>/`, copied as a whole directory (including scripts and resources).
- **Global skills only**: when the `SKILL.md` frontmatter has no version (neither top-level `version` nor `metadata.version`), add `1.0.0`: write `metadata.version` if the frontmatter has a `metadata` object, otherwise a top-level `version`. Change nothing else. Agent-private skills are copied as they are, with no version added.
Determine the DesireCore data directory from the current environment (for example from the agent directory returned by `ManageAgent(action="get")`); do not assume it is `~/.desirecore`.
### 4. Name conflicts
- **Agents**: do not pass `id`. `ManageAgent` derives the directory ID from the name and appends `-2`, `-3` when it is taken; use the ID in the result. The display name stays the OpenClaw name.
- **Global skills**: the target directory name defaults to the source directory name; if it exists, try `<name>-openclaw`, `<name>-openclaw-2`, `<name>-openclaw-3`, … until one is free. Never overwrite or merge an existing directory.
### 5. Procedure
1. **Scan**: read `openclaw.json`, each workspace's `IDENTITY.md` / `SOUL.md`, and list the global skills directory.
2. **Preview and confirm**: show a table of migratable agents (name, emoji, description, which mapped files the workspace has, number of private skills) and global skills (name, description, target directory name, whether renamed). Use `ManageAgent(action="list")` and a listing of the global skills directory to detect and mark conflicts. Let the user choose what to migrate; create nothing before the user has chosen explicitly.
3. **Create agents** (one at a time):
```
ManageAgent({
"action": "create",
"name": "<display name>",
"description": "<description>",
"persona": "<full text of SOUL.md>",
"principles": "<full text of AGENTS.md>",
"avatarGeneration": { "enabled": false }
})
```
- `avatarGeneration.enabled:false` keeps parity with the source (OpenClaw has no image avatar); drop it only when the user explicitly asks for a generated avatar.
- When there is an emoji you may add `"config": { "avatar": { "char": "<emoji>" } }`; if the parameter is rejected, retry without it and say so in the receipt.
- Record the returned agent ID. If one agent fails, record the reason and continue with the next.
4. **Copy memory and private skills**: copy `USER.md` and `MEMORY.md` into the new agent's `memory/`, and copy the workspace `skills/` directory as a whole into the new agent's `skills/`. Prefer a whole-directory shell copy (macOS/Linux: `cp -R <source> <target>`; Windows PowerShell: `Copy-Item -Recurse -LiteralPath <source> -Destination <target>`); without a shell, copy file by file with Read + Write. If a target file already exists, stop and ask; never overwrite. Leave copied private skills unchanged (no version added).
5. **Copy global skills**: pick the target directory name per section 4, copy the whole directory, then add the version per section 3.
6. **Verify**: for every copied or written file, compare the source and target SHA-256 with `FileDigest` (except a `SKILL.md` that received a version; read it instead and confirm the version is the only addition), and use `ManageAgent(action="get")` to confirm each new agent exists with the right name and description. On any mismatch, name the file; never claim success.
7. **Receipt**: list each item's result in a table (migrated / renamed to … / skipped with reason / failed with reason) together with where it was written, and remind the user that the new agents are ready to chat and that the original OpenClaw directory is untouched; whether to clean it up is the user's decision.
### 6. Boundaries
- Only read `~/.openclaw/`; never write, move, or delete anything in it.
- Migrate only the files in the mapping above. Do not copy other workspace files (for example `HEARTBEAT.md`, `TOOLS.md`, session logs, credential or token files); if the user asks for them, explain where each would go and confirm item by item. If a file looks like a credential, only mention that it exists; do not read it.
- Do not create or change MCP servers, tool permissions, model providers, or credentials; the user configures those separately in the interface.
- Always create agents with `ManageAgent`; never use curl / HTTP endpoints, and never create an agent directory or `agent.json` by hand.