第 02 期 | 多 Agent 并行开发架构详解
💡 进群学习加 wx: agentupdate
(申请发送: agentupdate)
(申请发送: agentupdate)
2.1 架构与流程图
2.1.1 整体开发流程
flowchart TD
A[Phase 0: 项目初始化] --> B[Phase A: 并行开发]
B --> B1[ui-dev: HTML/CSS 骨架]
B --> B2[logic-dev: 计算引擎纯函数]
B1 --> C[Phase B: 集成构建]
B2 --> C
C --> C1[ui-dev: UI 交互 + a11y 样式]
C --> C2[logic-dev: DOM 事件 + 键盘 + localStorage]
C1 --> D[Phase C: 测试]
C2 --> D
D --> D1[qa-engineer: 单元 + 集成测试]
D1 --> E[Phase D: 验收]
E --> E1[qa-engineer: E2E + 无障碍 + 对照需求验收]
style A fill:#e1f5fe
style B fill:#c8e6c9
style C fill:#fff9c4
style D fill:#ffe0b2
style E fill:#f8bbd02.1.2 Teams 通信架构
flowchart LR
subgraph "tmux session: calc-dev"
TL[team-lead
Pane 0]
UD[ui-dev
Pane 1]
LD[logic-dev
Pane 2]
end
subgraph "tmux session: (auto-created)"
QA[qa-engineer
Auto Pane]
end
TL -->|"SendMessage
task assignment"| UD
TL -->|"SendMessage
task assignment"| LD
UD -->|"SendMessage
completion notify"| TL
LD -->|"SendMessage
completion notify"| TL
QA -->|"SendMessage
test results"| TL
TASKS["~/.claude/tasks/calc-dev/
共享 Task 列表"]
INBOX["~/.claude/teams/calc-dev/
inboxes/*.json"]
UD -.->|TaskUpdate| TASKS
LD -.->|TaskUpdate| TASKS
QA -.->|TaskUpdate| TASKS
QA -.->|write message| INBOX
TL -.->|read inbox| INBOX2.1.3 Agent 执行生命周期
stateDiagram-v2
[*] --> Spawned: Agent() spawn
Spawned --> ReadingContext: 读 CLAUDE.md + requirement.md
ReadingContext --> ClaimingTask: TaskGet + TaskUpdate(in_progress)
ClaimingTask --> Working: 写代码 / 写测试
Working --> Testing: 运行测试
Testing --> Working: 测试失败 → 修复
Testing --> CompletingTask: 测试通过
CompletingTask --> NotifyingLead: TaskUpdate(completed)
NotifyingLead --> CheckingNext: SendMessage(team-lead)
CheckingNext --> ClaimingTask: 有更多 task
CheckingNext --> Idle: 无更多 task
Idle --> [*]: shutdown
note right of NotifyingLead: 消息写入 inbox 文件
但 UI 通知不保证实时显示