使用说明
特警
自主多智能体任务执行引擎。特警队将任务分派给专业小组——每个小组都作为独立的人工智能编码代理会话运行。
🚀 安装
Linux/macOS
curl -fsSL https://raw.githubusercontent.com/LangSensei/swat/main/install.sh | bash
视窗
irm https://raw.githubusercontent.com/LangSensei/swat/main/install.ps1 | iex
这将:
- 下载适用于您平台的最新版本
- 将SWAT二进制文件安装到
~/.swat/bin/并将其添加到您的PATH(Linux/macOS:附加到.bashrc/.zshrc;Windows:更新注册表中的用户PATH) - 安装框架蓝图
~/.swat/blueprints/
OpenClaw集成(可选)
如果你使用 开爪,单独安装桥接插件:
# See https://github.com/LangSensei/swat-openclaw
🗑️ 卸载
Linux/macOS
curl -fsSL https://raw.githubusercontent.com/LangSensei/swat/main/uninstall.sh | bash
视窗
irm https://raw.githubusercontent.com/LangSensei/swat/main/uninstall.ps1 | iex
添加 --purge 还可以删除运行时数据(操作历史)。
🎮 用法
特警队公开了12个MCP工具。配置您的代理以进行连接:
MCP配置
{
"mcpServers": {
"swat": {
"command": "swat",
"args": []
}
}
}
工具
运营
swat_dispatch--分派任务(自动分类到正确的小队)swat_ops--使用筛选器列出操作(状态/自/限制/偏移)swat_cancel--取消正在运行的操作
小队
swat_squads--列出已安装的小队swat_squad_browse--浏览市场swat_squad_install--从市场上安装一个小队swat_squad_uninstall--卸载小队swat_squad_update--将小队更新到最新的市场版本
摄入
swat_intake_create--创建定期任务(零LLM成本)swat_intake_list--列出所有进气队列条目swat_intake_delete--删除摄入条目
通知
swat_notify--向用户发送通知
CLI标志
| 标志 | 描述 |
|---|---|
--version |
打印已安装的版本并退出 |
--mcp-only |
仅启动MCP服务器——跳过后台命令循环 |
--runtime <name> |
设置AI编码代理运行时(默认值: copilot) |
--notify <target> |
设置通知目标: desktop, openclaw (默认值: desktop) |
🧠 建筑
Agent → MCP → SWAT Commander (Go) → Squads (AI coding agent sessions)
特警队 运行时无关指挥官在可插拔的状态下协调行动 运行时适配器 处理特定于运行时的细节(点目录、代理文件、MCP配置路径、钩子)。
| 组件 | 角色 |
|---|---|
| 指挥官 | 转到MCP服务器。处理调度、工作区组合、依赖关系解析、调度和完成扫描。 |
| 小队 | 专业代理。每个都作为一个独立的编码代理会话运行,具有自己的技能、MCP工具和协议。 |
| 运行时适配器 | 抽象运行时差异。每个适配器都知道它的点目录、代理文件名、MCP配置路径以及如何启动代理。 |
支持的运行库
| 运行时 | 点目录 | 代理文件 | MCP配置 | 启动命令 |
|---|---|---|---|---|
copilot (默认) |
.github/ |
AGENTS.md |
.mcp.json |
copilot |
gemini |
.gemini/ |
GEMINI.md |
.gemini/settings.json |
gemini |
使用以下参数设置运行时 --runtime <name> (例如。 swat --runtime gemini).
运作原理
- 你分派一个任务(指挥官自动分类到正确的小队)
- 指挥官配置工作区——将小队快照复制到
.squad/,技能挂钩<dotdir>/hooks/,技能内容<dotdir>/skills/,解析MCP依赖关系,写入代理文件(特定于运行时) - 在操作目录中启动编码代理会话,读取代理文件+operation.md
- 指挥官的后台循环扫描完成(OPERATION.md状态+report.html)
- 结果通过您的代理浮出水面
技能vs钩子: 技能与运行时无关(在所有运行时共享)。Hooks是特定于运行时的,并且存在于
hooks/copilot/,hooks/gemini/等等。
进气队列
统一的任务入口点——所有任务(即时调度和定期计划)都通过 ~/.swat/intake/:
- 即时任务:由创建
swat_dispatch,由后台循环处理,完成后删除 - 重复任务:支持时区的标准5字段cron表达式
immediate首次运行行为标志- 每个文件锁定以实现并发安全
📂 目录结构
~/.swat/
├── blueprints/ # Templates & installed content
│ ├── OPERATION.md # Operation template
│ ├── squads/
│ │ ├── _framework/ # Core protocol (versioned with binary)
│ │ │ ├── PROTOCOL.md
│ │ │ └── TEMPLATE.md
│ │ └── <squad>/ # Squad blueprints
│ │ └── MANIFEST.md
│ ├── skills/ # Shared skills (runtime-agnostic)
│ └── mcps/ # MCP server configs
│
├── squads/ # Runtime data
│ ├── _unclassified/ # Operations before squad assignment
│ └── <squad>/
│ └── operations/
│ └── <id>/ # Operation workspace
│ ├── OPERATION.md
│ ├── <agent-file> # Runtime-specific (AGENTS.md or GEMINI.md)
│ ├── <mcp-config> # Runtime-specific (.mcp.json or .gemini/settings.json)
│ ├── report.html
│ ├── .squad/ # Squad blueprint snapshot (read-only)
│ └── <dotdir>/ # Runtime-specific (.github/ or .gemini/)
│ ├── hooks/ # Skill hooks (runtime-specific)
│ └── skills/ # Skill content
│
└── intake/ # Intake queue (JSON)
└── <id>.json
🛠️ 先决条件
- Linux、macOS或Windows
- GitHub命令行界面 (已认证)
- 至少一个受支持的AI编码代理运行时:
| 运行时 | 要求 |
|---|---|
| 副驾驶 (默认) | GitHub Copilot 命令行工具 (npm install -g @github/copilot),Node.js 18+ |
| 双子座 | Gemini CLI 已安装并可用 gemini 关于PATH |
🔨 从源代码构建
go build -o swat . # Go 1.24+
# With version injection:
go build -ldflags "-X main.version=v1.0.0" -o swat .
📦 相关项目
- swat市场 --小队、技能和MCP
- swat openclaw --OpenClaw集成(插件+技能)
📄 许可证
麻省理工学院
