
关于
使用 dmux(AI 代理的 tmux 面板管理器)进行多代理编排。跨 Claude Code、Codex、OpenCode 和其他工具的并行代理工作流模式。适用于并行运行多个代理会话或协调多代理开发工作流。
name: dmux-workflows description: 使用 dmux(AI 代理的 tmux 面板管理器)进行多代理编排。涵盖 Claude Code、Codex、OpenCode 及其他工具的并行代理工作流模式。适用于并行运行多个代理会话或协调多代理开发工作流。 origin: ECC
dmux 工作流
使用 dmux(一个面向代理工具的 tmux 面板管理器)编排并行 AI 代理会话。
何时激活
- 并行运行多个代理会话
- 跨 Claude Code、Codex 及其他工具协调工作
- 受益于分治并行的复杂任务
- 用户说"并行运行"、"拆分工作"、"使用 dmux"或"多代理"
什么是 dmux
dmux 是一个基于 tmux 的编排工具,用于管理 AI 代理面板:
- 按 `n` 创建带提示的新面板
- 按 `m` 将面板输出合并回主会话
- 支持:Claude Code、Codex、OpenCode、Cline、Gemini、Qwen
安装: 审查包后从其仓库安装 dmux。参见 github.com/standardagents/dmux
快速开始
# Start dmux session
dmux
# Create agent panes (press 'n' in dmux, then type prompt)
# Pane 1: "Implement the auth middleware in src/auth/"
# Pane 2: "Write tests for the user service"
# Pane 3: "Update API documentation"
# Each pane runs its own agent session
# Press 'm' to merge results back
工作流模式
模式 1:研究 + 实现
将研究和实现拆分为并行轨道:
Pane 1 (Research): "Research best practices for rate limiting in Node.js.
Check current libraries, compare approaches, and write findings to
/tmp/rate-limit-research.md"
Pane 2 (Implement): "Implement rate limiting middleware for our Express API.
Start with a basic token bucket, we'll refine after research completes."
# After Pane 1 completes, merge findings into Pane 2's context
模式 2:多文件功能
跨独立文件并行化工作:
Pane 1: "Create the database schema and migrations for the billing feature"
Pane 2: "Build the billing API endpoints in src/api/billing/"
Pane 3: "Create the billing dashboard UI components"
# Merge all, then do integration in main pane
模式 3:测试 + 修复循环
在一个面板运行测试,在另一个面板修复:
Pane 1 (Watcher): "Run the test suite in watch mode. When tests fail,
summarize the failures."
Pane 2 (Fixer): "Fix failing tests based on the error output from pane 1"
模式 4:跨工具
为不同任务使用不同的 AI 工具:
Pane 1 (Claude Code): "Review the security of the auth module"
Pane 2 (Codex): "Refactor the utility functions for performance"
Pane 3 (Claude Code): "Write E2E tests for the checkout flow"
模式 5:代码审查流水线
并行审查视角:
Pane 1: "Review src/api/ for security vulnerabilities"
Pane 2: "Review src/api/ for performance issues"
Pane 3: "Review src/api/ for test coverage gaps"
# Merge all reviews into a single report
最佳实践
- 仅限独立任务。 不要并行化相互依赖输出的任务。
- 明确边界。 每个面板应处理不同的文件或关注点。
- 策略性合并。 合并前审查面板输出以避免冲突。
- 使用 git worktree。 对于容易产生文件冲突的工作,每个面板使用单独的 worktree。
- 资源意识。 每个面板消耗 API token——总面板数保持在 5-6 个以下。
Git Worktree 集成
对于涉及重叠文件的任务:
# Create worktrees for isolation
git worktree add -b feat/auth ../feature-auth HEAD
git worktree add -b feat/billing ../feature-billing HEAD
# Run agents in separate worktrees
# Pane 1: cd ../feature-auth && claude
# Pane 2: cd ../feature-billing && claude
# Merge branches when done
git merge feat/auth
git merge feat/billing
互补工具
| 工具 | 功能 | 使用场景 | |------|------|----------| | dmux | 代理的 tmux 面板管理 | 并行代理会话 | | Superset | 支持 10+ 并行代理的终端 IDE | 大规模编排 | | Claude Code Task tool | 进程内子代理生成 | 会话内的编程式并行 | | Codex multi-agent | 内置代理角色 | Codex 特定的并行工作 |
ECC 辅助工具
ECC 现在包含一个用于外部 tmux 面板编排(带独立 git worktree)的辅助工具:
node scripts/orchestrate-worktrees.js plan.json --execute
示例 `plan.json`:
{
"sessionName": "skill-audit",
"baseRef": "HEAD",
"launcherCommand": "codex exec --cwd {worktree_path} --task-file {task_file}",
"workers": [
{ "name": "docs-a", "task": "Fix skills 1-4 and write handoff notes." },
{ "name": "docs-b", "task": "Fix skills 5-8 and write handoff notes." }
]
}
该辅助工具:
- 为每个 worker 创建一个基于分支的 git worktree
- 可选覆盖设置
兼容工具
Claude CodeCursor
标签
后端开发

