agent-teams
A generic Rust Agent Teams framework replicating the Claude Code Agent Teams architecture (lead, teammates, task list, mailbox), with pluggable backends for Claude Code, Codex, and Gemini CLI.
Overview
agent-teams provides the building blocks for orchestrating multi-agent workflows:
- Team Management — Create teams, add/remove members (leads + teammates), file-based persistence compatible with
~/.claude/teams/ - Task Management — CRUD tasks with status transitions, dependency tracking (DAG), cycle detection, critical path analysis
- Messaging — Inbox-based inter-agent messaging with structured message types (shutdown, plan approval, idle notifications)
- Pluggable Backends — Claude Code (via
cc-sdk), Codex (JSON-RPC 2.0 subprocess), Gemini CLI — all behind a unifiedAgentBackendtrait - Smart Routing — Route prompts to the best backend based on keywords, capabilities, or prompt complexity
- CLI Delegation — Agents can shell out to Codex/Gemini/custom tools via Bash for hybrid execution
- Consensus — Multi-agent voting: majority, weighted, unanimous, human-in-the-loop
- Conversation Memory — Per-agent context management with configurable budgets
- Checkpoints — Git notes-based audit trail attaching agent session context to commits
- TUI Dashboard — Terminal UI for browsing team status, checkpoints, and token costs
Architecture
┌─────────────────────────────────────────────────────┐
│ TeamOrchestrator │
│ │
│ ┌──────────┐ ┌──────────┐ ┌────────────────┐ │
│ │ TeamMgr │ │ TaskMgr │ │ InboxManager │ │
│ │ (files) │ │ (files) │ │ (files) │ │
│ └──────────┘ └──────────┘ └────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────┐ │
│ │ AgentBackend (trait) │ │
│ │ │ │
│ │ ┌────────────┐ ┌───────┐ ┌──────────────┐ │ │
│ │ │ClaudeCode │ │ Codex │ │ Gemini CLI │ │ │
│ │ │(cc-sdk) │ │(JSONRPC)│ │ (subprocess)│ │ │
│ │ └────────────┘ └───────┘ └──────────────┘ │ │
│ └──────────────────────────────────────────────┘ │
│ │
│ ┌──────────┐ ┌───────────┐ ┌────────────────┐ │
│ │ DAG / │ │ Consensus │ │ Conversation │ │
│ │ Graph │ │ (voting) │ │ Memory │ │
│ └──────────┘ └───────────┘ └────────────────┘ │
│ │
│ ┌──────────────────┐ ┌───────────────────────┐ │
│ │ Checkpoint │ │ TUI Dashboard │ │
│ │ (Git notes) │ │ (ratatui) │ │
│ └──────────────────┘ └───────────────────────┘ │
└─────────────────────────────────────────────────────┘
Installation
As a library
[]
= "0.1"
With optional features:
[]
= { = "0.1", = ["checkpoint"] }
As a CLI tool
# Core CLI (DAG analysis, team management)
# With checkpoints (Git notes audit trail)
# Full features (checkpoints + TUI dashboard)
Features
| Feature | Default | Description |
|---|---|---|
cli |
No | CLI binary with clap — team/task/dag/checkpoint subcommands |
dashboard |
No | Web dashboard with axum REST API + SSE events |
checkpoint |
No | Git notes-based checkpoint system (git2, sha2) |
tui |
No | Terminal UI dashboard (ratatui, crossterm) — implies checkpoint |
Quick Start
Library Usage
use *;
async
CLI Delegation (Hybrid Execution)
use *;
// Claude agent that delegates code generation to Codex
let config = builder
.delegate
.delegate
.build;
Smart Routing
use *;
// Route prompts to the best backend based on complexity
let router = default;
let backend = router.route;
// → Routes simple prompts to faster/cheaper backends
CLI Usage
# Team management
# Task management
# DAG analysis
# Checkpoints (requires --features checkpoint)
# TUI dashboard (requires --features tui)
Claude Code Plugin
This crate includes a Claude Code plugin (plugin/) with slash commands:
/team-delegate <task description> — Free-form multi-agent delegation
/team-review <files> — 5+1 agent code review pipeline
/team-implement <task> — 4-phase implementation pipeline
/teams-dag <team> — DAG visualization and analysis
/checkpoint — Git checkpoint management
/tui — Launch TUI dashboard
Install: claude --plugin-dir /path/to/agent-teams/plugin
File Layout
The framework uses the same file layout as Claude Code:
~/.claude/
teams/{team-name}/
config.json # TeamConfig
inboxes/{agent}.jsonl # Per-agent messages
tasks/{team-name}/
{id}.json # TaskFile
Git checkpoints are stored as notes under refs/notes/agent-checkpoints.
概述
agent-teams 是一个通用的 Rust 智能体团队框架,复刻了 Claude Code Agent Teams 的架构(队长、队友、任务列表、消息邮箱),支持 Claude Code、Codex 和 Gemini CLI 等可插拔后端。
核心功能
- 团队管理 — 创建团队、添加/移除成员(队长 + 队友),基于文件系统持久化,兼容
~/.claude/teams/目录格式 - 任务管理 — 任务 CRUD、状态流转、依赖追踪(DAG 有向无环图)、环路检测、关键路径分析
- 消息通信 — 基于收件箱的智能体间通信,支持结构化消息类型(关闭请求、计划审批、空闲通知)
- 可插拔后端 — Claude Code(通过
cc-sdk)、Codex(JSON-RPC 2.0 子进程)、Gemini CLI,统一在AgentBackendtrait 之下 - 智能路由 — 根据关键词、能力或 prompt 复杂度自动选择最优后端
- CLI 委派 — 智能体可通过 Bash 调用 Codex/Gemini/自定义工具,实现混合执行
- 共识机制 — 多智能体投票:多数、加权、全票、人工介入
- 对话记忆 — 每个智能体独立的上下文管理,可配置 token 预算
- 检查点 — 基于 Git notes 的审计追踪,将智能体会话上下文附加到 commit
- TUI 仪表盘 — 终端 UI,浏览团队状态、检查点和 token 费用
安装
作为库使用
[]
= "0.1"
带可选功能:
[]
= { = "0.1", = ["checkpoint"] }
作为 CLI 工具安装
# 核心 CLI(DAG 分析、团队管理)
# 带检查点(Git notes 审计追踪)
# 全部功能(检查点 + TUI 仪表盘)
Feature Flags
| Feature | 默认 | 说明 |
|---|---|---|
cli |
否 | CLI 二进制,基于 clap — 团队/任务/DAG/检查点子命令 |
dashboard |
否 | Web 仪表盘,axum REST API + SSE 事件流 |
checkpoint |
否 | Git notes 检查点系统(git2、sha2) |
tui |
否 | 终端 UI 仪表盘(ratatui、crossterm)— 隐含 checkpoint |
快速开始
库用法
use *;
async
CLI 委派(混合执行模式)
use *;
// Claude 智能体将代码生成委派给 Codex,分析委派给 Gemini
let config = builder
.delegate
.delegate
.build;
CLI 用法
# 团队管理
# 任务管理
# DAG 分析
# 检查点(需要 --features checkpoint)
# TUI 仪表盘(需要 --features tui)
Claude Code 插件
本项目包含 Claude Code 插件(plugin/ 目录),提供斜杠命令:
/team-delegate <任务描述> — 自由形式的多智能体委派
/team-review <文件> — 5+1 智能体代码审查流水线
/team-implement <任务> — 4 阶段实现流水线
/teams-dag <团队> — DAG 可视化和分析
/checkpoint — Git 检查点管理
/tui — 启动 TUI 仪表盘
安装方式:claude --plugin-dir /path/to/agent-teams/plugin
文件布局
框架使用与 Claude Code 相同的文件布局:
~/.claude/
teams/{team-name}/
config.json # 团队配置
inboxes/{agent}.jsonl # 每个智能体的消息收件箱
tasks/{team-name}/
{id}.json # 任务文件
Git 检查点存储为 refs/notes/agent-checkpoints 下的 notes。
License
MIT