360 Secure SkillHub
360 安全技能中心

Agent Migration

用于在 OpenClaw 中安全重命名或迁移 agent:更新配置与命名、迁移既有会话内容、修复会话显示元数据、重启并验证新 agent;删除旧 agent 需另行确认。附带检查清单、清理说明与三个 Bash 脚本,工作区路径按示例写死。

kid0114
kid0114
热度 47.67
最近更新 2026-05-11 17:36:59
分类:自动化依赖:代码执行 / 读写文件应用场景:工作流 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add agent-migration
Metadata
name
agent-migration
description
Safely rename or migrate an OpenClaw agent by updating config and naming, migrating session content, fixing session metadata, restarting, verifying, and asking separately before deleting the old agent.
input
old agent id, new agent id, new workspace, optional model change
output
new agent active; prior session content migrated unless explicitly skipped; old agent deletion handled only after separate confirmation

Agent Migration

Use this skill when the user wants to rename or migrate an OpenClaw agent safely.

Scope

This skill handles:

  • agent id rename
  • workspace rename
  • config/path updates
  • prior session content migration
  • session display metadata updates
  • restart and verification
  • separate deletion confirmation for the old agent

Defaults and boundaries

  • Confirm old id, new id, new workspace, and whether model also changes.
  • Migrate prior session content by default unless the user explicitly says not to.
  • Do not skip migration just because a session does not look active.
  • Do not hard-edit active lock files or force-rewrite a live session shell.
  • Restart is required after migration.
  • Never delete the old agent without a separate user confirmation.

Files involved

  • config: ~/.openclaw/openclaw.json
  • agent dirs: ~/.openclaw/agents/<id>/...
  • workspace: /home/yln/claw-workspace/<name>
  • session metadata such as sessions.json

Use the included files

  • references/checklist.md
  • references/cleanup.md
  • scripts/inspect_agent_migration.sh
  • scripts/copy_session_content.sh
  • scripts/verify_agent_migration.sh

Recommended commands

bash skills/agent-migration/scripts/inspect_agent_migration.sh <old-id> <new-id>
bash skills/agent-migration/scripts/copy_session_content.sh <old-id> <new-id>
bash skills/agent-migration/scripts/verify_agent_migration.sh <old-id> <new-id>

Guardrails

  • Keep config, workspace, and naming changes consistent.
  • Update session display-layer metadata as part of the migration.
  • Verify the new agent before offering deletion of the old one.
  • Use references/cleanup.md only after the user separately confirms deletion.