@NFTCPS: 多个 AI agent 一起干活这事,终于有人用最土的办法做出来了。 squad,一个 Rust 写的命令行工具,让 Claude Code、Gemini CLI、Codex、OpenCode 这几个 CLI agent 直接坐一桌协作。…
摘要
squad 是一个用 Rust 编写的命令行工具,通过 shell 命令和 SQLite 数据库实现多个 AI CLI 代理(如 Claude Code、Gemini CLI 等)的协作,无需后台守护进程。
查看缓存全文
缓存时间: 2026/06/29 06:24
多个 AI agent 一起干活这事,终于有人用最土的办法做出来了。
squad,一个 Rust 写的命令行工具,让 Claude Code、Gemini CLI、Codex、OpenCode 这几个 CLI agent 直接坐一桌协作。
它的思路特别朴素,没有后台守护进程,全靠 shell 命令加一个 SQLite 数据库传话,每条命令都是一锤子买卖。
玩法也简单,三个终端各开一个:
manager 负责拆任务、派活 worker 负责接活、干活、回报 inspector 在旁边盯着
一句 /squad 就能拉起一整队 AI 帮你打工,多开同角色还会自动编号,worker、worker-2 排好队。
https://github.com/mco-org/squad
mco-org/squad
Source: https://github.com/mco-org/squad
squad
Multi-AI-agent terminal collaboration via simple CLI commands.
squad lets multiple AI CLI agents communicate through shell commands + SQLite.
No daemon, no background processes — every command is a one-shot operation.
English | 简体中文
| Claude Code | Gemini CLI | Codex CLI | OpenCode |
claude |
gemini |
codex |
opencode |
One slash command. Multiple agents collaborating in real-time.
Assign a manager, spin up workers, add an inspector — each in its own terminal, communicating through SQLite.
Install
# Homebrew (macOS)
brew install mco-org/tap/squad
# Windows (GitHub Releases)
# 1. Download squad-x86_64-pc-windows-msvc.zip
# 2. Extract squad.exe to a folder like C:\Tools\squad
# 3. Add that folder to PATH
# Or download another prebuilt binary from GitHub Releases
# https://github.com/mco-org/squad/releases
# Or build from source
cargo install --git https://github.com/mco-org/squad.git
Quick Start
# Install /squad slash command for your AI tools
squad setup
# Initialize workspace in your project
squad init
# In any AI CLI terminal — just use the slash command
/squad manager # terminal 1
/squad worker # terminal 2
/squad inspector # terminal 3
That’s it. Each agent joins, reads its role instructions, and enters a work loop that checks for messages. The manager breaks down your goal and assigns tasks to workers.
Optional tmux Launcher
For Unix-like environments that already use Claude Code, this repo also ships an optional helper script:
scripts/squad-tmux-launch.sh /path/to/project --dry-run
It can:
- read project-local launcher config from
.squad/launcher.yaml - read a task brief from
.squad/run-task.md - generate manager / inspector prompt files under
.squad/quickstart/ - start a tiled
tmuxsession and inject/squadcommands into Claude panes - optionally create an isolated git worktree before launching agents
Requirements:
tmuxruby(used to parselauncher.yaml)claude
This launcher is intentionally separate from the core Rust CLI. Treat it as optional automation for people who want a repeatable multi-terminal workflow.
Usage Flow
You (human)
│
├── Terminal 1: /squad manager
│ Manager joins, asks you for the goal,
│ breaks it into tasks, assigns to workers.
│
├── Terminal 2: /squad worker
│ Worker joins, checks for tasks via squad receive,
│ executes assigned work, reports back.
│
└── Terminal 3: /squad worker
Auto-assigned as worker-2 (ID conflict resolved automatically).
Same behavior — checks, executes, reports.
Multiple agents with the same role get unique IDs automatically (worker, worker-2, worker-3).
Commands
| Command | Description |
|---|---|
squad init [--refresh-roles] | Initialize workspace, create .squad/, add .squad/ to .gitignore, and append squad guidance to CLAUDE.md, AGENTS.md, and GEMINI.md if missing. --refresh-roles rewrites only builtin manager/worker/inspector files under .squad/roles/. |
squad join <id> [--role <role>] [--client <claude|gemini|codex|opencode>] [--protocol-version <n>] | Join as agent (auto-suffixes if ID is taken; omitted capability metadata stays NULL) |
squad leave <id> | Archive agent and preserve unread work |
squad agents [--all] [--json] | List online agents (--json emits one JSON object per line including raw/effective capability fields and protocol-derived support booleans) |
squad send [--task-id <id>] [--reply-to <message-id>] <from> <to> <message> | Send a note (@all to broadcast, or squad send [flags] --file <path-or-> <from> <to> to read from file/stdin) |
squad receive <id> [--wait] [--timeout N] [--json] | Check inbox (--wait blocks until a message arrives; --json emits one JSON object per line) |
squad task create <from> <to> --title <title> [--body <body>] | Create a structured task assignment |
squad task ack <agent> <task-id> | Claim a queued task |
squad task complete <agent> <task-id> --summary <text> | Mark an acked task complete with a summary |
squad task requeue <task-id> [--to <agent>] | Put a task back into the queue, optionally to a new assignee |
squad task list [--agent <id>] [--status <status>] | List tasks with optional filters |
squad pending | Show all unread messages |
squad history [agent] [--from <id>] [--to <id>] [--since <RFC3339|unix-seconds>] | Show timestamped message history with optional filters |
squad roles | List available roles |
squad teams | List available teams |
squad team <name> | Show team template |
squad setup [platform] | Install /squad slash command for AI tools |
squad setup --list | List supported platforms and status |
squad clean | Clear all state |
Setup
Install the /squad slash command for your AI tools:
squad setup # auto-detect and install for all found tools
squad setup claude # install only for Claude Code
squad setup --list # show supported platforms
Supported platforms:
| Platform | Binary | Command location |
|---|---|---|
| Claude Code | claude | ~/.claude/commands/squad.md |
| Gemini CLI | gemini | ~/.gemini/commands/squad.toml |
| Codex CLI | codex | ~/.codex/skills/squad/SKILL.md |
| OpenCode | opencode | ~/.config/opencode/commands/squad.md |
Once installed, use /squad <role> (or $squad <role> in Codex) in any project where squad init has been run. Generated slash templates automatically join with their platform client type and the current supported protocol version.
squad init does more than create .squad/: it also appends .squad/ to .gitignore and adds a short squad collaboration section to CLAUDE.md, AGENTS.md, and GEMINI.md when those files do not already contain one. Existing builtin role files stay untouched unless you run squad init --refresh-roles.
How It Works
Agents communicate through a shared SQLite database (.squad/messages.db). Each agent runs in its own terminal and uses CLI commands to send and receive messages.
Terminal 1 (manager) Terminal 2 (worker) Terminal 3 (worker-2)
┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
│ /squad manager │ │ /squad worker │ │ /squad worker │
│ │ │ (auto-ID: worker) │ │ (auto-ID: worker-2) │
│ │ │ │ │ │
│ squad task create │─────>│ squad receive worker │ │ │
│ manager worker │ │ │ │ │
│ "task-a" "details" │ │ │ │ │
│ │ │ │ │ │
│ squad task create │──────────────────────────────────>│ squad receive │
│ manager worker-2 │ │ │ │ worker-2 │
│ "task-b" "details" │ │ │ │ │
│ │ │ │ │ │
│ squad receive manager│<─────│ squad task complete │ │ │
│ │ │ worker <task-id> │ │ │
│ │ │ "done A" │ │ │
│ │ │ │ │ │
│ │<──────────────────────────────────│ squad task complete │
│ │ │ │ │ worker-2 <task-id> │
│ │ │ │ │ "done B" │
└─────────────────────┘ └─────────────────────┘ └─────────────────────┘
All messages flow through SQLite — no daemon, no sockets, no background processes.
Message Flow
Agents should prefer squad task ... when assignment state matters, and keep squad send / squad receive as the fallback path for freeform coordination. Agents use squad receive --wait to block until messages arrive:
Agent joins
→ squad receive <id> --wait ← blocks until a message arrives
→ receives task from manager
→ squad task ack <id> <task-id>
→ executes the task
→ squad task complete <id> <task-id> --summary "done: summary..."
→ squad receive <id> --wait ← blocks again for next message
squad receive <id> (without --wait) checks once and returns immediately, useful for scripting or manual checks.
ID Auto-Suffix
When multiple agents join with the same ID, squad automatically assigns unique IDs:
squad join worker --role worker --client codex --protocol-version 2
# → Joined as worker
squad join worker --role worker --client opencode --protocol-version 2
# → ID 'worker' was taken. Joined as worker-2
This is handled server-side (atomic INSERT OR IGNORE), so even simultaneous joins from different terminals are safe.
Agent Capability Metadata
squad join can optionally record agent capability metadata:
squad join worker --role worker --client codex --protocol-version 2
- If
--clientor--protocol-versionis omitted, the database storesNULL. squad agentsshows client/protocol details in human-readable output using the effective fallback view, so legacy rows appear asclient: unknown, protocol: 1.squad agents --jsonexposesclient_type_raw,protocol_version_raw,effective_client_type,effective_protocol_version,supports_task_commands, andsupports_json_receive.- In the current phase,
supports_task_commandsandsupports_json_receiveare both derived from the effective protocol version, with support enabled at protocol>= 2.
Role Templates
Roles are .md files in .squad/roles/ that define agent behavior. Three are built in:
- manager — breaks down goals, assigns tasks, coordinates review
- worker — executes tasks, reports results
- inspector — reviews code, sends PASS/FAIL verdicts
Create custom roles by adding .md files to .squad/roles/:
echo "You are a database specialist..." > .squad/roles/dba.md
squad join db-expert --role dba
If the builtin role templates in .squad/roles/ drift from the bundled defaults, run squad init --refresh-roles to refresh only manager.md, worker.md, and inspector.md. Custom role files are left untouched.
Team Templates
Teams are YAML files in .squad/teams/ that define which roles are needed:
# .squad/teams/dev.yaml
name: dev
roles:
manager:
prompt_file: manager
worker:
prompt_file: worker
inspector:
prompt_file: inspector
View a team’s setup instructions:
squad team dev
Broadcast
Send a message to all agents at once:
squad task create manager worker --title "auth-module" --body "implement auth module with JWT"
squad task ack worker <task-id>
squad task complete worker <task-id> --summary "JWT auth shipped"
squad send --task-id <task-id> inspector worker "please handle follow-up edge cases"
squad receive worker --json
squad send manager @all "API contract changed, update your implementations"
Requirements
- Rust 1.77+ (for building)
- macOS or Linux
License
MIT
鸟哥 | 蓝鸟会🕊️ (@NFTCPS): 不会画架构图,但又得给老板/同事讲清楚系统长啥样?这事现在真不用愁了。
Archify 这个东西,你拿大白话把系统描述一遍,它直接给你生成一张好看的架构图,还支持工作流、时序、数据流、状态机这几种。
我觉得最香的几点: 1️⃣ 一键切深色浅色,不用来回导两张图 2️⃣ PNG 能直接复制,粘到
相似文章
@vintcessun: 原来多个 AI agent 组队干活,比单个通用 agent 高明在这:每个角色绑自己最擅长的模型,记忆和技能跨聊天累积。不是轮流调用,而是通过 handover 传一句简报就把任务交出去。本地跑,文件状态全在 ~/.crew44 里,免…
Crew44 is a local-first orchestrator that turns coding agents like Claude Code and Codex into a coordinated team of specialists, each bound to its best model, with persistent memory and skill accumulation across sessions. It runs entirely on your machine with no cloud dependence and is free under MIT license.
@justloveabit: 用这个开源工具,我让一群AI替我上班了 事情是这样的,最近一直在折腾各种AI agent。Claude Code开一堆窗口,Codex也在跑,偶尔还要用Cursor。结果呢,乱成一锅粥——哪个agent在干啥,花了多少钱,完全搞不清楚。重…
本文介绍了一款名为Paperclip的开源工具,用于统一管理和调度多个AI Agent。它通过模拟公司组织架构、任务分配与预算控制等功能,解决了多Agent协作时上下文丢失、成本不可控和调度混乱的痛点。
@sitinme: AI 编程工具终于开始互通了。 以前 Claude Code、Codex、Cursor、Gemini CLI 各玩各的,用哪个工具基本就被锁在哪个客户端里。 现在有了 ACP(Agent Client Protocol),它有点像 AI …
ACP(Agent Client Protocol)协议统一了编辑器和AI Agent的通信方式,使Claude Code、Codex、Cursor、Gemini CLI等AI编程工具可以互通协作,标志着AI编程从单点工具进入互联工作流阶段。
@daweifs: AI Agent 必备神器:CLI-Anything Hub 一句话:任何 GUI/SaaS/桌面软件,都能一键变成 AI 原生 CLI! Agent 再也不用“帮我点按钮”了,直接一条命令搞定! 核心亮点: • 76+ 现成 CLI,覆…
CLI-Anything Hub 是一个开源工具,能将任意 GUI 或 SaaS 软件一键转化为 AI 原生 CLI,让 AI Agent 直接通过命令行操作,无需人工点击。目前已提供 76+ 现成 CLI,覆盖 31 类软件,并兼容 Claude Code、Cursor 等主流 Agent 框架。
@itsharmanjot: 四个AI CLI现在通过一个SQLite文件互相通信:Claude Code、Gemini CLI、Codex CLI、OpenCode……
Squad是一个开源的Rust工具,让四大AI CLI(Claude Code、Gemini CLI、Codex CLI、OpenCode)通过一个单一的SQLite文件在同一个代码库上协作,无需守护进程或服务器。