Skip to main content

Documentation Index

Fetch the complete documentation index at: https://openclaw.zhcndoc.com/llms.txt

Use this file to discover all available pages before exploring further.

OpenClaw 通过随附的 Claude 迁移提供程序导入本地 Claude 状态。该提供程序会在更改状态前预览每一项,在计划和报告中对密钥进行脱敏,并在应用前创建经过验证的备份。
入职导入需要全新的 OpenClaw 设置。如果你已经有本地 OpenClaw 状态,请先重置 config、credentials、sessions 和 workspace,或者在查看计划后直接使用带有 --overwriteopenclaw migrate

两种导入方式

当向导检测到本地 Claude 状态时,会提供 Claude 选项。
openclaw onboard --flow import
或者指定特定来源:
openclaw onboard --import-from claude --import-source ~/.claude

会导入哪些内容

  • 项目 CLAUDE.md.claude/CLAUDE.md 的内容会被复制或追加到 OpenClaw agent workspace 的 AGENTS.md 中。
  • 用户 ~/.claude/CLAUDE.md 的内容会追加到 workspace 的 USER.md 中。
当存在时,会从项目 .mcp.json、Claude Code ~/.claude.json 和 Claude Desktop claude_desktop_config.json 中导入 MCP 服务器定义。
  • 带有 SKILL.md 文件的 Claude skills 会被复制到 OpenClaw workspace 的 skills 目录中。
  • .claude/commands/~/.claude/commands/ 下的 Claude 命令 Markdown 文件会被转换为 OpenClaw skills,并设置 disable-model-invocation: true

仅归档的内容

提供程序会将这些内容复制到迁移报告中供人工审查,但不会将它们加载到实时 OpenClaw config 中:
  • Claude hooks
  • Claude permissions 和宽泛的工具 allowlists
  • Claude environment defaults
  • CLAUDE.local.md
  • .claude/rules/
  • .claude/agents/~/.claude/agents/ 下的 Claude subagents
  • Claude Code caches、plans 和 project history directories
  • Claude Desktop extensions 和 OS 存储的 credentials
OpenClaw 拒绝自动执行 hooks、信任 permission allowlists,或解码不透明的 OAuth 和 Desktop credential state。请在审查归档后,手动迁移你需要的内容。

来源选择

如果没有 --from,OpenClaw 会检查默认的 Claude Code home:~/.claude、采样到的 Claude Code ~/.claude.json 状态文件,以及 macOS 上的 Claude Desktop MCP config。 --from 指向项目根目录时,OpenClaw 只会导入该项目的 Claude 文件,例如 CLAUDE.md.claude/settings.json.claude/commands/.claude/skills/.mcp.json。在项目根目录导入时,它不会读取你的全局 Claude home。

推荐流程

1

预览计划

openclaw migrate claude --dry-run
计划会列出所有将要变更的内容,包括冲突、跳过的项目,以及从嵌套 MCP envheaders 字段中脱敏后的敏感值。
2

应用并备份

openclaw migrate apply claude --yes
OpenClaw 会在应用前创建并验证备份。
3

运行 doctor

openclaw doctor
Doctor 会在导入后检查 config 或 state 问题。
4

重启并验证

openclaw gateway restart
openclaw status
确认 gateway 运行正常,并且你导入的指令、MCP 服务器和技能都已加载。

冲突处理

当计划报告冲突时,apply 会拒绝继续(即某个文件或 config 值已存在于目标位置)。
仅当明确要替换现有目标时,才重新运行并使用 --overwrite。提供程序仍可能会在 migration report 目录中为被覆盖的文件写入逐项备份。
对于全新的 OpenClaw 安装,冲突并不常见。它们通常出现在你在已经有用户编辑的设置上重新运行导入时。

用于自动化的 JSON 输出

openclaw migrate claude --dry-run --json
openclaw migrate apply claude --json --yes
在使用 --json 且不带 --yes 时,apply 会打印计划而不会修改状态。这是 CI 和共享脚本中最安全的模式。

故障排除

传入 --from /actual/path(CLI)或 --import-source /actual/path(onboarding)。
入职导入需要全新设置。你可以重置状态后重新进行 onboarding,或者直接使用 openclaw migrate apply claude,它支持 --overwrite 和显式的备份控制。
Claude Desktop 会从平台相关路径读取 claude_desktop_config.json。如果 OpenClaw 没有自动检测到,请将 --from 指向该文件所在目录。
这是设计如此。Claude 命令由用户触发,因此 OpenClaw 会将它们作为带有 disable-model-invocation: true 的 skills 导入。如果你希望 agent 自动调用它们,请编辑每个 skill 的 frontmatter。

相关内容