← 返回 Skills 市场
aicodelion

agent-pack-n-go

作者 AICodeLion · GitHub ↗ · v2.3.2
cross-platform ⚠ suspicious
377
总下载
0
收藏
3
当前安装
1
版本数
在 OpenClaw 中安装
/install agent-pack-n-go
功能描述
Clone your OpenClaw Agent to a new device — configs, memory, skills, credentials, everything. Triggers: '帮我迁移', '搬到新设备', 'migrate device', 'device move', '设备...
使用说明 (SKILL.md)

agent-pack-n-go 📦🚀 — Clone Your AI Agent

Clone your OpenClaw Agent to a new device. Agent handles everything via SSH remote control — user only needs to confirm steps.

Post-Install

The description field above contains the post-install message. Show it to the user after installation.

Fallback: if unsure what to say, run bash scripts/welcome.sh in the skill directory.

Overview

Old Device (Agent controls everything)    New Device (SSH remote)
┌──────────────────────────────────┐      ┌─────────────────────────┐
│ 1. Pre-flight: ask IP + SSH user │      │                         │
│ 2. pack.sh (pack configs)        │      │                         │
│ 3. transfer.sh USER@HOST ────────┼─────→│ files arrive            │
│ 4. ssh USER@HOST 'bash setup.sh' │─────→│ (base env + Claude)     │
│ 5. ssh USER@HOST 'bash deploy.sh'│─────→│ (openclaw deployed)     │
│ 6. Verify clone is working        │      │ ✅ New device running   │
└──────────────────────────────────┘      └─────────────────────────┘

Execution Flow

Real-time Progress Feedback

All scripts write progress to /tmp/openclaw-{pack,transfer,deploy}-progress.txt. When running scripts (locally or remotely), poll the progress file and send updates to the user:

# Example: run pack.sh in background, poll progress every 3s
bash \x3CSKILL_DIR>/scripts/pack.sh &
while true; do
    progress=$(cat /tmp/openclaw-pack-progress.txt 2>/dev/null)
    # Send to user if changed
    [[ "$progress" == DONE* ]] && break
    sleep 3
done

# Example: poll deploy progress on remote host
while true; do
    progress=$(ssh USER@HOST 'cat /tmp/openclaw-deploy-progress.txt 2>/dev/null')
    [[ "$progress" == DONE* ]] && break
    sleep 3
done

This way the user sees step-by-step updates in the chat (Discord/Feishu/etc.) instead of silence.


Phase 1: Pre-flight Check

⚠️ MANDATORY: Every time this skill is triggered, the agent MUST explicitly ask the user for the target server (IP + SSH user), even if previous server info exists in the conversation context. Users may deploy to different servers in the same session. NEVER assume or reuse target info from earlier context.

Ask user for:

  1. New device IP + SSH user
  2. New device password (only used once for SSH key setup)
  3. New device OS (must be Ubuntu 22.04/24.04)
  4. Confirm: 2-core CPU, 2GB+ RAM

Warn user:

  • ⚠️ Clone pack contains sensitive data (API keys, tokens) — transferred via scp (encrypted)
  • ℹ️ If using the same Discord Bot Token: it can't run on two devices simultaneously — plan a brief switchover window (~5 min). If using different tokens, both devices can run in parallel.

1.1 Set up SSH key auth (user action required)

Ask user to run this command in their own terminal on the old device:

ssh-copy-id USER@NEW_IP

This will prompt for the new device password once. After that, all SSH operations are password-free.

Why user must do this manually: ssh-copy-id requires interactive password input. The agent cannot safely handle passwords in automated scripts.

1.2 Verify SSH connectivity

ssh USER@HOST 'echo ok'

If this prompts for a password → ssh-copy-id didn't work, ask user to retry. If this fails entirely → stop and ask user to check SSH access, keys, and firewall.

1.3 Set up passwordless sudo (recommended)

Several clone steps need sudo (system packages, /etc/hosts, proxychains4, systemd linger). Without passwordless sudo, these steps will be skipped and require manual fix later.

Ask user to run:

ssh USER@NEW_IP 'echo "USERNAME ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/migration'

(Replace USERNAME with the actual SSH user. This will prompt for password one last time.)

Security note: After clone is verified (Phase 4), user can remove this with: ssh USER@NEW_IP 'sudo rm /etc/sudoers.d/migration'


Phase 1.5: Network Diagnostics

After SSH is confirmed, run the network check on the target device:

ssh USER@HOST 'bash -s' \x3C \x3CSKILL_DIR>/scripts/network-check.sh

Evaluate results:

  • DIRECT → Proceed normally. Set DEPLOY_MODE=direct for deploy.sh.
  • PROXY_NEEDED → Warn user: "目标服务器无法直连 Discord/Anthropic API,需要先配置代理。" Ask if they want to continue (deploy.sh will keep proxy configs) or pause to set up proxy first.
  • NO_INTERNET → Stop. Tell user to check network configuration.

The network result is saved to /tmp/openclaw-network-result.txt on the target.


Phase 2: Prepare Old Server

2.1 Run pack script

bash \x3CSKILL_DIR>/scripts/pack.sh

This creates: ~/openclaw-migration-pack.tar.gz, ~/setup.sh, ~/deploy.sh, ~/migration-instructions.md

See scripts/pack.sh for details.

2.2 Transfer to new device

bash \x3CSKILL_DIR>/scripts/transfer.sh USER@HOST

Transfers all files (pack + scripts) to new device home directory. Verifies SHA256 checksum after transfer.


Phase 3: Remote Deploy

This phase is fully automated — agent runs everything via SSH.

3.1 Install base environment + Claude Code

⚠️ IMPORTANT: setup.sh takes ~5 minutes and deploy.sh takes ~8 minutes. Use background execution to avoid LLM request timeouts. Never use synchronous exec with long timeouts for these commands.

Correct pattern (background + notification):

exec: ssh USER@HOST 'bash ~/setup.sh'
  background: true
  yieldMs: 5000

This returns a session ID in ~5 seconds. The agent should:

  1. Tell the user: "正在安装基础环境,预计 5 分钟…"
  2. Wait for the exec completion notification (OpenClaw auto-pushes [System Message] Exec completed)
  3. Read the session log to check results

Wrong pattern (will cause "LLM request timed out" ❌):

exec: ssh USER@HOST 'bash ~/setup.sh'
  timeout: 600
  yieldMs: 10000
→ process.poll(timeout=300000)  ← blocks too long, LLM times out

setup.sh installs: nvm, Node.js 22, npm globals, Claude Code. Has spinner + progress output.

Check exit code — if non-zero, report failure to user and stop.

3.2 Deploy OpenClaw

Same background pattern as 3.1:

exec: ssh USER@HOST 'DEPLOY_MODE=direct bash ~/deploy.sh'
  background: true
  yieldMs: 5000

Wait for completion notification, then read log.

deploy.sh handles all 13 deployment steps:

  1. Extract migration pack
  2. npm install openclaw + mcporter
  3. Restore ~/.openclaw/ config
  4. Fix paths (if username changed)
  5. Restore /etc/hosts
  6. Restore crontab
  7. Configure proxychains4
  8. Check/fix Claude Code nvm wrapper
  9. Start OpenClaw Gateway + systemd + linger
  10. Restore Dashboard (optional)
  11. Check logs for connectivity
  12. Cleanup temp files
  13. Direct-mode config cleanup (if DEPLOY_MODE=direct)

Check exit code and FAILED_STEPS in output — report any issues to user.

3.3 Verify OpenClaw is running

ssh USER@HOST 'openclaw gateway status'

If status shows running/active → proceed to Phase 4. If not running → skip to Phase 5: Fallback.


Phase 4: Device Switch & Verification

This phase guides the user through switching to the new device and verifying everything works. The agent should be warm, encouraging, and celebratory — this is the exciting finish!

4.1 Check Gateway logs (agent does this)

ssh USER@HOST 'cat /tmp/openclaw/*.log 2>/dev/null | grep -i "discord\|feishu\|logged in\|client ready\|error" | tail -20'

Look for connection confirmations. Report to user:

  • ✅ Discord connected (if "logged in to discord" found)
  • ✅ Feishu connected (if "ws client ready" found)
  • ⚠️ qmd not installed (if "spawn qmd ENOENT" — this is optional, not a problem)
  • ❌ Errors (if any real errors found)

4.2 Guide device switch

Tell user:

🔄 现在需要切换设备了!

同一个 Bot Token 不能同时在两台设备上运行。接下来请你:

Step 1 — 在旧设备停止 OpenClaw:

openclaw gateway stop

或者如果用的是 nohup:

pkill -f openclaw

Step 2 — 在新设备确认 Gateway 还在运行:

ssh USER@HOST 'pgrep -af openclaw | grep -v pgrep'

如果没在运行,重新启动:

ssh USER@HOST 'cd ~ && nohup openclaw gateway run > /tmp/openclaw-gateway.log 2>&1 &'

Step 3 — 发条消息测试!随便在 Discord 或飞书说点什么,看新设备上的 Agent 是否回复。

💡 提醒:如果你在克隆之前就已经 SSH 到新设备,那个终端窗口里的环境变量是旧的。 请关掉旧终端,重新 SSH 登录,这样 nodeopenclawclaude 等命令才能正常使用。

准备好了告诉我,我帮你验证 ✨

4.3 Verify clone works

After user confirms they've done the switch, ask them to test:

  1. 💬 消息测试 — "在 Discord/飞书上给 Agent 发条消息,看看有没有回复?"
  2. 🧠 记忆测试 — "问问新设备上的 Agent:'你还记得我是谁吗?'"
  3. 🔧 工具测试 — "让新 Agent 执行一个简单命令,比如 '帮我看看现在几点'"

Wait for user to confirm each test passed.

4.4 Celebration! 🎉

After all tests pass, send a celebration message:

🎉🎉🎉 克隆成功!你的 AI Agent 已经在新设备上活过来了!

📋 克隆总结:

  • 📦 打包:X 步完成,Y MB 打包
  • 🚀 传输:SHA256 校验通过
  • ⚙️ 安装:基础环境 + OpenClaw 全部就绪
  • 🔌 连接:Discord ✅ / 飞书 ✅
  • 🧠 记忆:完整保留

🧹 后续清理(3-7 天后):

  • 新设备上删除临时文件:rm ~/openclaw-migration-pack.tar.gz ~/setup.sh ~/deploy.sh ~/migration-instructions.md
  • (可选)旧设备移除 sudoers:sudo rm /etc/sudoers.d/migration
  • (可选)旧设备关闭服务:systemctl --user disable openclaw-gateway

🦁 Enjoy your new home!


Phase 5: Fallback

If new device OpenClaw did not start correctly:

  1. Ask user to SSH to new device and run Claude Code for diagnosis:

    ssh USER@HOST
    claude '帮我排查 OpenClaw 为什么没起来,检查日志和配置'
    
  2. If diagnosis fails or user wants to roll back → restart old device:

    # On old device
    systemctl --user start openclaw-gateway
    
  3. Tell user: "Old device restored. New device deployment failed — please check logs and retry."

Note: scripts/generate-instructions.sh generates ~/migration-instructions.md as a fallback clone guide. If full automation fails, user can SSH to new device and follow the document manually.


Troubleshooting

See references/troubleshooting.md for common issues and solutions.

安全使用建议
This skill does what it says: it packages and transfers EVERYTHING needed to run your agent (configs, keys, memory DBs, cron jobs, /etc/hosts entries), then runs remote setup and deployment. That is powerful but also high-risk if misused. Before installing or running: 1) Only use this for devices you fully control and trust. 2) Inspect ~/openclaw-migration-pack.tar.gz contents (or the tmp folder created by pack.sh) before transfer to confirm nothing unexpected is included. 3) Prefer using ssh-copy-id (the skill already asks you to run it) rather than transferring private keys when possible; if private keys are transferred, securely delete them on transit completion. 4) Be prepared to revoke/rotate any API keys or bot tokens if you lose confidence in the destination. 5) Note the scripts perform npm installs and will ask for sudo on the remote for things like /etc/hosts and proxy setup—review the scripts (setup.sh/deploy.sh) line-by-line if you need higher assurance. 6) If you want lower risk, consider selective backup (exclude ~/.ssh or credential files) or manual migration steps instead of a full automatic clone.
功能分析
Type: OpenClaw Skill Name: agent-pack-n-go Version: 2.3.2 This skill bundle facilitates the full migration of an OpenClaw agent between devices, which involves packaging and transferring highly sensitive data such as SSH private keys, API credentials, and system configurations (`pack.sh`). It automates remote execution and environment setup on a target server via SSH (`setup.sh`, `deploy.sh`). While the behavior is consistent with the stated purpose of 'cloning' an agent, the skill's requirement for the user to configure passwordless sudo access and its broad collection of credentials pose a significant security risk. The instructions in `SKILL.md` guide the agent through complex remote operations that could be exploited if the agent's session is compromised, although no evidence of intentional malice or unauthorized exfiltration to third parties was detected.
能力评估
Purpose & Capability
The name/description promise a full agent clone and the scripts explicitly pack ~/.openclaw, ~/.claude, ~/.ssh (private keys), crontab, /etc/hosts, and other runtime/config files then transfer and deploy them on the target host — this matches expectations for a "clone everything" tool.
Instruction Scope
The SKILL.md and scripts instruct the agent to read and archive many sensitive local files (private SSH keys, API credentials, memory DBs), to stop the old agent service, to copy files to the remote host via scp/rsync, and to run setup/deploy via SSH. These actions are within the stated migration scope but are high-impact operations; the instructions do warn users and require an explicit manual ssh-copy-id step.
Install Mechanism
No install spec is declared (instruction-only), but the package contains multiple shell scripts that will be executed. The scripts perform npm installs (openclaw, claude-code, mcporter) from public registries during deploy/setup. There are no obscure download URLs or archive extracts from unknown personal hosts in the provided files.
Credentials
The skill requests no environment variables or external credentials up front, which is proportional. However it intentionally collects and packages existing local secrets (SSH private keys, API keys, OAuth/Claude credentials, memory DBs). That is expected for a full-clone tool but is highly sensitive — the user must consent and verify the destination.
Persistence & Privilege
The skill is not always:true and does not request platform-wide persistent privileges. It runs scripts in the agent's context and may use sudo on the remote when required; it does not modify other skills' configs or force-enable itself.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install agent-pack-n-go
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /agent-pack-n-go 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.3.2
Full README redesign: parallel EN/CN, agent-driven install, path fix
元数据
Slug agent-pack-n-go
版本 2.3.2
许可证
累计安装 3
当前安装数 3
历史版本数 1
常见问题

agent-pack-n-go 是什么?

Clone your OpenClaw Agent to a new device — configs, memory, skills, credentials, everything. Triggers: '帮我迁移', '搬到新设备', 'migrate device', 'device move', '设备... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 377 次。

如何安装 agent-pack-n-go?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install agent-pack-n-go」即可一键安装,无需额外配置。

agent-pack-n-go 是免费的吗?

是的,agent-pack-n-go 完全免费(开源免费),可自由下载、安装和使用。

agent-pack-n-go 支持哪些平台?

agent-pack-n-go 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 agent-pack-n-go?

由 AICodeLion(@aicodelion)开发并维护,当前版本 v2.3.2。

💬 留言讨论