agentbox

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<!-- agentbox-managed:v1 -->
Fork the current Claude Code session into a fresh AgentBox box.
  1. Resolve the provider flag from
    $ARGUMENTS
    :
    • empty → no flag (uses the default docker provider)
    • docker
      |
      daytona
      |
      hetzner
      |
      vercel
      |
      e2b
      → pass
      --provider $ARGUMENTS
    • anything else → stop and tell the user the valid values are
      docker
      ,
      daytona
      ,
      hetzner
      ,
      vercel
      ,
      e2b
  2. Detect an active plan (optional
    --plan
    ).
    If this session was just working on a Claude Code plan, carry it into the box so the fork resumes in plan mode.
    • If you know the plan file path for this session (plan mode writes it to
      ~/.claude/plans/<slug>.md
      , and you have it from the plan you just produced in this conversation), use that path.
    • Otherwise, find the most recent plan only if it was touched in the last 15 minutes (a stale plan from another task should not be resurrected). Run via the Bash tool:
      find "$HOME/.claude/plans" -name '*.md' -mmin -15 -type f 2>/dev/null \
        | xargs -r ls -t 2>/dev/null | head -1
      If it prints a path, that's the current plan; if it prints nothing, there is no active plan — skip
      --plan
      .
  3. Fork. If you are in plan mode, exit it, then run, via the Bash tool, exactly one command (add
    --plan "<path>"
    only if step 2 found a plan). Do NOT pass
    --session
    :
    agentbox fork
    autodetects the current Claude session itself (and safely falls back to the newest session for this workspace), which is correct even when this skill runs in a subagent where
    $CLAUDE_CODE_SESSION_ID
    would be the subagent's id, not the conversation you want to fork:
    agentbox fork [--provider $ARGUMENTS] [--plan "<plan path>"]
  4. Report. In one line, give the user the new box name (parse it from the command output) and confirm their host session is unaffected. If you passed
    --plan
    , mention the box opens in plan mode ready to resume. Do not summarize the conversation — the fork already carries it.
For Hetzner cloud boxes only, when in Codex App or Claude Desktop, use can add a ssh connection to the box. To do this first add an alias to their ssh config, then instruct them how to add the connection:
agentbox shell <box> --ssh-config          # writes ~/.ssh/config + prints details
to add a ssh alias that the user can use to connect to the box
When in Codex App return a clickable link in the response for an easy way:
[Add <ssh-alias> to Codex SSH](codex://settings/connections/ssh/add?name=<ssh-alias>)
<!-- agentbox-managed:v1 -->
将当前Claude Code会话复刻到全新的AgentBox容器(box)中。
  1. $ARGUMENTS
    解析提供商标识:
    • 为空 → 不添加标识(使用默认的docker提供商)
    • docker
      |
      daytona
      |
      hetzner
      |
      vercel
      |
      e2b
      → 传入
      --provider $ARGUMENTS
    • 其他值 → 终止操作并告知用户有效值为
      docker
      daytona
      hetzner
      vercel
      e2b
  2. 检测活跃计划(可选
    --plan
    参数)
    。如果当前会话正在使用Claude Code计划,需将其带入新容器,使复刻后的会话能在计划模式下继续。
    • 若已知当前会话的计划文件路径(计划模式会将其写入
      ~/.claude/plans/<slug>.md
      ,且你可从本次对话中生成的计划获取该路径),直接使用该路径。
    • 否则,仅查找过去15分钟内被修改过的最新计划(避免复用其他任务的过期计划)。通过Bash工具运行以下命令:
      find "$HOME/.claude/plans" -name '*.md' -mmin -15 -type f 2>/dev/null \
        | xargs -r ls -t 2>/dev/null | head -1
      若命令输出路径,则为当前计划;若无输出,则无活跃计划 —— 跳过
      --plan
      参数。
  3. 执行复刻操作。若当前处于计划模式,先退出该模式,然后通过Bash工具运行以下命令(仅当步骤2找到计划时才添加
    --plan "<path>"
    )。请勿传入
    --session
    参数:
    agentbox fork
    会自动检测当前Claude会话(若检测失败,会安全 fallback 到当前工作区的最新会话),即使该技能在子Agent中运行时
    $CLAUDE_CODE_SESSION_ID
    为子Agent的ID而非目标会话ID,此逻辑依然有效:
    agentbox fork [--provider $ARGUMENTS] [--plan "<plan path>"]
  4. 结果反馈。用一句话告知用户新容器的名称(从命令输出中解析),并确认原主机会话不受影响。若传入了
    --plan
    参数,需说明新容器将以计划模式启动,可直接继续任务。无需总结对话内容 —— 复刻操作已同步所有会话数据。
仅针对Hetzner云容器,当在Codex App或Claude Desktop中使用时,可添加SSH连接。操作步骤为:先在SSH配置中添加别名,再指导用户添加连接:
agentbox shell <box> --ssh-config          # 写入~/.ssh/config并打印详情
添加一个用户可用于连接容器的SSH别名
若在Codex App中,返回可点击链接以简化操作:
[Add <ssh-alias> to Codex SSH](codex://settings/connections/ssh/add?name=<ssh-alias>)

Troubleshooting

故障排查

  • If agentbox command fails, tell the user to install AgentBox by writing
    ! npm -g install @madarco/agentbox
    in the chat.
  • If
    AGENTBOX_RELAY_URL
    is set in the environment, you are running inside a box. This command is host-only in v1; tell the user box→box fork is not supported yet.
  • If you need to know more about Agentbox, check the /agentbox-info skill that containes the full documentation.
  • 若agentbox命令执行失败,告知用户在聊天框中输入
    ! npm -g install @madarco/agentbox
    以安装AgentBox。
  • 若环境中设置了
    AGENTBOX_RELAY_URL
    ,说明当前正运行在容器内部。v1版本仅支持主机端操作;告知用户暂不支持容器到容器的复刻。
  • 如需了解更多AgentBox相关信息,请查看包含完整文档的/agentbox-info技能。