Skip to content

feat: add /swarm slash command for agent swarm / multi-agent mode #61

Description

@Daiyimo

问题场景(这是为了解决什么问题?)

复杂任务需要并行执行多个子代理(subagent)时,当前 CLI
没有原生机制让模型自动分发工作。模型只能串行处理,无法利用多子代理并行能力提升效率。Kimi Code 已有 swarm 模式实现,但
Step-Realtime-CLI 尚未支持。

期望行为(你希望的方案)

新增 /swarm 斜杠命令,支持三种模式:

  • /swarm 或 /swarm on — 手动开启 swarm 模式,此后模型可使用 AgentSwarm 工具并行派发子代理,直到用户执行
    /swarm off 关闭
  • /swarm off — 关闭 swarm 模式
  • /swarm <任务描述> — 以任务模式执行一次 swarm:自动进入 swarm 模式 → 将任务提交为对话 → 完成后自动退出

核心机制:

  • Swarm mode 状态机(manual / task / tool 三种 trigger),由 swarm-plugin 管理
  • beforeModelRequest hook 在 swarm 模式激活时注入系统提示,告知模型使用 AgentSwarm 工具
  • AgentSwarm 工具接收 prompt_template(含 {{item}} 占位符)+ items 数组,为每个 item 派生一个子代理任务

已经考虑过的替代方案

  1. 仅作为工具暴露,不用斜杠命令 — 体验不直观,用户需要记住 AgentSwarm 工具名及其参数格式,门槛过高
  2. 复用 /teammates 的 team 机制 — teammates 是持久化团队,swarm 是一次性按需派生,语义不同
  3. 环境变量开关 — 斜杠命令更符合 CLI 交互习惯,支持临时任务模式

相关 issue / PR(可选)

#30 — 实现 /swarm 命令、swarm-plugin 状态机、AgentSwarm 工具集成
#30

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions