← 返回 Skills 市场
yangyangupday

Agent Del

作者 yangyangupday · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ⚠ suspicious
49
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install agent-del
功能描述
按照 OpenClaw 官方规范删除一个或多个 agent(代理),自动完成列表展示、确认、执行删除、移到回收站及历史记录。
使用说明 (SKILL.md)

Agent Del — 删除 OpenClaw Agent

按照 OpenClaw 官方规范删除一个或多个 agent,使用 openclaw agents delete CLI 命令,自动将数据移到技能目录下的回收站({skillDir}/.trash/),并在 history.md 中记录删除详情和回收站路径。

流程

第一步:列出当前所有 agent

exec 执行:

openclaw agents list --json

解析 JSON 输出,给用户展示列表。main agent 也要列出,但标注为不可删除

📋 当前已配置的 Agent:

1. 📜 main(管仲)— ⭐ 默认 agent — 🔒 不可删除
   - 模型: r740-llama/qwen-aggr-nothink-normal
   - Workspace: /data1/.openclaw/workspace

2. 🎓 xiaolaoshi(小老师)
   - 模型: r740-llama/qwen-aggr-nothink-normal
   - Workspace: /data1/.openclaw/workspace-xiaolaoshi

回复编号来选择要删除的 agent,可多个(如 "2,3" 或 "2 3")。

展示信息包括:编号、emoji、agent ID、显示名称(如有)、模型、workspace 路径。isDefault: true 的标注为默认 agent 且不可删除。

第二步:用户选择要删除的 agent

等用户回复编号,解析出对应的 agent ID 列表。

注意: 如果用户选了 main,提示 "main 是默认 agent,通常保留。确认要删除吗?"

第三步:展示待删除 agent 的基本信息并确认

根据用户选择的编号,从 JSON 数据中提取这些 agent 的关键信息,展示给用户:

🗑️ 即将删除以下 Agent:

1. xiaolaoshi(小老师)🎓
   - Workspace: /data1/.openclaw/workspace-xiaolaoshi
   - Agent 目录: ~/.openclaw/agents/xiaolaoshi/
   - 模型: r740-llama/qwen-aggr-nothink-normal

⚠️ 删除后将:
- 从 openclaw.json 移除 agent 配置
- 将 workspace 和 agent 目录移到技能目录下的回收站 `{skillDir}/.trash/`
- 在 history.md 中记录删除时间和回收站路径

确认删除?回复"确认"即可。

等用户回复确认后,再进入下一步。

第四步:执行删除脚本

用户确认后,执行脚本:

{baseDir}/scripts/agent-del.sh \x3CagentId1> \x3CagentId2> ...

脚本会自动完成:

  1. 再次用 openclaw agents list --json 确认这些 agent 是否存在,并获取 workspace/agentDir 路径
  2. 对每个 agent 执行 openclaw agents delete \x3Cid> --force
  3. 移到回收站(已知 bug workaround):
    • 将 workspace 目录 mv{skillDir}/.trash/agent-{id}-{timestamp}-workspace/
    • 将 agent 目录 mv{skillDir}/.trash/agent-{id}-{timestamp}-agentdir/
  4. 记录到 {baseDir}/history/history.md
    • 删除时间(精确到秒)
    • agent ID、显示名称
    • 原 workspace 和 agent 目录路径
    • 回收站中的实际路径
  5. 最终用 openclaw agents list 验证删除结果

第五步:完成提示

脚本执行完成后,告诉用户:

✅ 以下 Agent 已删除:

  • {agentId1}({name1})→ 回收站: {skillDir}/.trash/agent-{id}-{timestamp}-*
  • {agentId2}({name2})→ 回收站: {skillDir}/.trash/agent-{id}-{timestamp}-*

注意事项:

  • 原数据已移到回收站,如需恢复可手动从 {skillDir}/.trash/ 移回
  • 如果这些 agent 之前绑定了 channel,请检查 openclaw.json 中的 bindings 配置
  • 如需立即生效,运行 openclaw gateway restart

history.md 记录格式

# Agent 删除记录

## xiaolaoshi (🎓)

- **删除时间:** 2026-06-06 01:43:00 CST
- **Agent ID:** xiaolaoshi
- **显示名称:** 小老师
- **原 Workspace:** /data1/.openclaw/workspace-xiaolaoshi
- **原 Agent 目录:** ~/.openclaw/agents/xiaolaoshi
- **回收站 workspace:** {skillDir}/.trash/agent-xiaolaoshi-20260606-014300-workspace
- **回收站 agent dir:** {skillDir}/.trash/agent-xiaolaoshi-20260606-014300-agentdir

已知 Bug

openclaw agents delete 通过 gateway 执行时有一个 bug:gateway 删除了 openclaw.json 中的 agent 配置,但 CLI 提前 return,导致 moveToTrash(workspaceDir)moveToTrash(agentDir)moveToTrash(sessionsDir) 未执行。

脚本中用 mv 手动将目录移到技能目录下的 {skillDir}/.trash/ 作为 workaround,避免 ~/.Trash/ 可能的权限问题。

注意事项

  • main agent 可以出现在列表中,但通常保留不删
  • 删除后数据在回收站中,不是永久删除,可恢复
  • 如果 agent 绑定了 channel,需手动清理 bindings 配置
安全使用建议
Install only if you trust the publisher and are comfortable with repo-maintenance skills that can run privileged local review automation and authenticated staff/GitHub actions. Consider using the autoreview helper with `--no-yolo` or disabling fallback reviewers when reviewing private code.
能力评估
Purpose & Capability
The skills are coherent for ClawHub moderation, PR review, UI proof, Convex setup, migrations, and performance work, but several capabilities are high-impact, including staff moderation actions and code-review automation.
Instruction Scope
The autoreview helper is disclosed but defaults to `--dangerously-bypass-approvals-and-sandbox --sandbox danger-full-access`, and can fall back to external reviewer CLIs with generated diff prompts; that is broader authority than ordinary review instructions need.
Install Mechanism
The inspected skill folders do not show hidden install-time execution or persistence setup; the executable helper runs only when invoked.
Credentials
Full local sandbox bypass for a nested review agent is an overbroad environment grant, even though it is purpose-related and has a documented opt-out.
Persistence & Privilege
No unbounded persistence, cron, or daemon behavior was found, but the skills do rely on privileged local tools and authenticated ClawHub/GitHub workflows when the user runs those commands.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install agent-del
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /agent-del 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.0
回收站从 ~/.Trash/ 改到技能目录下的 .trash/,避免权限问题;.trash 和 history/history.md 加入 .clawignore 防止更新覆盖
v1.0.0
初始版本:按照 OpenClaw 官方规范删除 agent,自动移到回收站并记录 history;新增 .clawignore 排除本地记录文件防止更新覆盖
元数据
Slug agent-del
版本 1.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Agent Del 是什么?

按照 OpenClaw 官方规范删除一个或多个 agent(代理),自动完成列表展示、确认、执行删除、移到回收站及历史记录。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 49 次。

如何安装 Agent Del?

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

Agent Del 是免费的吗?

是的,Agent Del 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Agent Del 支持哪些平台?

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

谁开发了 Agent Del?

由 yangyangupday(@yangyangupday)开发并维护,当前版本 v1.1.0。

💬 留言讨论