Communitygithub.com

dmux 工作流程

使用 dmux(適用於 AI 代理的 tmux 窗格管理器)進行多代理協調。提供跨 Claude Code、Codex、OpenCode 及其他工具的平行代理工作流程模式。在平行執行多個代理工作階段或協調多代理開發工作流程時使用。

dmux 工作流程 是什麼?

dmux 工作流程技能是一個強大的多代理協調框架,利用 dmux(一種基於 tmux 的窗格管理器)來平行執行 AI 代理工作階段。此技能可協助開發者將複雜任務拆分為獨立的工作項目,並將其分配給 Claude Code、Codex、OpenCode、Cline、Gemini 或 Qwen 等不同代理工具。它支援多種工作流程模式,包括研究與實作、多檔案功能開發、測試與修復循環、跨工具協作以及程式碼審查管道。最佳實踐強調任務獨立性、清晰的界限、策略性合併、使用 git worktrees 避免檔案衝突,以及控制平行窗格數量以管理 API 權杖使用量。ECC 也提供了輔助腳本來簡化程序化協調,支援建立分支備份的工作樹、種子路徑覆蓋,以及自動化 tmux 工作階段管理。此技能可顯著加快開發工作流程,適合需要分工處理的大型專案。

相容平台✓Claude Code✓Codex CLI~Cursor✓Gemini CLI✓OpenCode
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/dmux-workflows

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

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

快速入門

# 啟動 dmux 工作階段
dmux

# 建立代理窗格(在 dmux 中按 'n',然後輸入提示)
# 窗格 1:「在 src/auth/ 中實作認證中介軟體」
# 窗格 2:「為使用者服務撰寫測試」
# 窗格 3:「更新 API 文件」

# 每個窗格執行自己的代理工作階段
# 按 'm' 將結果合併回來

工作流程模式

模式 1:研究 + 實作

將研究和實作拆分為平行軌道:

窗格 1(研究):「研究 Node.js 中速率限制的最佳實務。
  檢查現有函式庫,比較方法,並將結果寫入
  /tmp/rate-limit-research.md」

窗格 2(實作):「為我們的 Express API 實作速率限制中介軟體。
  先從基本的令牌桶開始,研究完成後再進行最佳化。」

# 窗格 1 完成後,將結果合併到窗格 2 的上下文中

模式 2:多檔案功能

跨獨立檔案平行化工作:

窗格 1:「為計費功能建立資料庫結構和遷移腳本」
窗格 2:「在 src/api/billing/ 中建立計費 API 端點」
窗格 3:「建立計費儀表板 UI 元件」

# 全部合併,然後在主窗格中進行整合

模式 3:測試 + 修復循環

在一個窗格中執行測試,在另一個窗格中修復:

窗格 1(監視器):「以監視模式執行測試套件。當測試失敗時,
  摘要說明失敗原因。」

窗格 2(修復者):「根據窗格 1 的錯誤輸出修復失敗測試」

模式 4:跨工具協作

對不同任務使用不同的 AI 工具:

窗格 1(Claude Code):「審查認證模組的安全性」
窗格 2(Codex):「重構效能相關的工具函式」
窗格 3(Claude Code):「為結帳流程編寫 E2E 測試」

模式 5:程式碼審查管道

平行審查觀點:

窗格 1:「審查 src/api/ 的安全性漏洞」
窗格 2:「審查 src/api/ 的效能問題」
窗格 3:「審查 src/api/ 的測試覆蓋率缺口」

# 將所有審查結果合併成一份報告

最佳實務

  1. 僅限獨立任務。 不要平行化彼此輸出相依的任務。
  2. 明確界限。 每個窗格應處理不同的檔案或關注點。
  3. 策略性合併。 在合併之前先審查窗格輸出,以避免衝突。
  4. 使用 git worktrees。 對於容易發生檔案衝突的工作,為每個窗格使用獨立的工作樹。
  5. 資源感知。 每個窗格都會使用 API 權杖 — 將總窗格數保持在 5-6 個以下。

Git Worktree 整合

對於涉及重疊檔案的任務:

# 建立工作樹以隔離
git worktree add -b feat/auth ../feature-auth HEAD
git worktree add -b feat/billing ../feature-billing HEAD

# 在獨立的工作樹中執行代理
# 窗格 1:cd ../feature-auth && claude
# 窗格 2:cd ../feature-billing && claude

# 完成後合併分支
git merge feat/auth
git merge feat/billing

互補工具

工具功能使用時機
dmux代理適用的 tmux 窗格管理平行代理工作階段
Superset支援 10+ 平行代理的終端機 IDE大規模協調
Claude Code Task 工具程序內子代理產生器工作階段內的程式化平行處理
Codex 多代理內建代理角色Codex 特定的平行工作

ECC 輔助工具

ECC 現在包含一個用於外部 tmux 窗格協調的輔助工具,可搭配獨立的 git worktrees:

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": "修復技能 1-4 並撰寫交接筆記。" },
    { "name": "docs-b", "task": "修復技能 5-8 並撰寫交接筆記。" }
  ]
}

該輔助工具:

  • 為每個工作者建立一個分支備份的 git worktree
  • 可選擇性地將主要工作目錄中的選定 seedPaths 覆蓋到每個工作者工作樹中
  • 在 .orchestration/<session>/ 下為每個工作者寫入 task.md、handoff.md 和 status.md 檔案
  • 啟動一個 tmux 工作階段,每個工作者佔用一個窗格
  • 在其自己的窗格中啟動每個工作者的命令
  • 保持主窗格空閒供協調者使用

當工作者需要存取尚未包含在 HEAD 中的髒檔案或未追蹤的本機檔案(例如本機協調腳本、草稿計畫或文件)時,請使用 seedPaths:

{
  "sessionName": "workflow-e2e",
  "seedPaths": [
    "scripts/orchestrate-worktrees.js",
    "scripts/lib/tmux-worktree-orchestrator.js",
    ".claude/plan/workflow-e2e-test.json"
  ],
  "launcherCommand": "bash {repo_root}/scripts/orchestrate-codex-worker.sh {task_file} {handoff_file} {status_file}",
  "workers": [
    { "name": "seed-check", "task": "在開始工作前確認已播種的檔案是否存在。" }
  ]
}

故障排除

  • 窗格無回應: 直接切換到該窗格,或使用 tmux capture-pane -pt <session>:0.<pane-index> 檢查。
  • 合併衝突: 使用 git worktrees 隔離每個窗格的檔案變更。
  • 高權杖使用量: 減少平行窗格數量。每個窗格都是一個完整的代理工作階段。
  • 找不到 tmux: 使用 brew install tmux(macOS)或 apt install tmux(Linux)安裝。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

相關技能