Merge remote-tracking branch 'origin/main'
# Conflicts: # 4 - Resources/Claude-Code/Everything Claude Code 完整指南.md
This commit is contained in:
416
4 - Resources/Claude-Code/Claude Code Agent Teams 官方多Agent编排.md
Normal file
416
4 - Resources/Claude-Code/Claude Code Agent Teams 官方多Agent编排.md
Normal file
@@ -0,0 +1,416 @@
|
||||
---
|
||||
created: "2026-05-16"
|
||||
type: resource
|
||||
tags: [resource, claude-code, agent-teams, orchestration, multi-agent, tmux, subagents, official, workflow]
|
||||
source: "https://code.claude.com/docs/en/agent-teams"
|
||||
---
|
||||
|
||||
# Claude Code Agent Teams 官方多 Agent 编排
|
||||
|
||||
Anthropic 官方嘅多 Claude Code instance 编排方案。同 ECC 嘅 `/orchestrate` 第三方实现唔同,呢个系 **Claude Code v2.1.32+ 内置嘅实验功能**,允许多个完整 session 通过共享 task list + 直接消息传递协同工作。
|
||||
|
||||
> 相关笔记:[[Everything Claude Code 多服务编排详解]]、[[ECC 编排实战手册]]、[[dmux 多Agent并行编排]]、[[Autonomous Agent Harness 自主代理框架]]
|
||||
|
||||
---
|
||||
|
||||
## 0. 三层编排能力速查
|
||||
|
||||
Claude Code 嘅并行编排有三层,由轻到重:
|
||||
|
||||
| 层次 | 工具 | 适用 | 通信方式 |
|
||||
|------|------|------|---------|
|
||||
| **Subagents** | `Agent` tool(单消息多 call) | 任务独立、只要结果、低成本 | 仅向主 agent 报告 |
|
||||
| **Worktrees** | `git worktree` + 多 terminal | 长任务、build/test 隔离 | 无(人工协调) |
|
||||
| **Agent Teams** | `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` | 需讨论、互相 challenge、跨层协调 | Teammates 之间直接 `SendMessage` |
|
||||
|
||||
**判断口诀**:
|
||||
- 任务可切干净、只要结果 → Subagents
|
||||
- 长 horizon、独立分支 → Worktrees
|
||||
- 需要互相对话、对抗审查、你想中途介入某个 worker → **Agent Teams**
|
||||
|
||||
---
|
||||
|
||||
## 1. Subagents vs Agent Teams 关键对比
|
||||
|
||||
| 维度 | Subagents | Agent Teams |
|
||||
|------|-----------|------------|
|
||||
| Context | 独立窗口,结果汇报返主 agent | 独立窗口,**完全独立 session** |
|
||||
| 通信 | 只能向主 agent 报告 | **Teammates 之间直接 message** |
|
||||
| 协调 | 主 agent 集中调度 | **共享 task list,self-coordination** |
|
||||
| Token 成本 | 较低(结果会被压缩回主 context) | **显著更高**(每个 teammate 都系完整 Claude 实例) |
|
||||
| 你能否同 worker 直接对话 | ❌ | ✅ Shift+Down 切换 |
|
||||
| 嵌套 | 主 agent 可派 subagent | ❌ Teammate 不能再开 team |
|
||||
|
||||
---
|
||||
|
||||
## 2. 启用方法
|
||||
|
||||
`~/.claude/settings.json`:
|
||||
```json
|
||||
{
|
||||
"env": {
|
||||
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
|
||||
},
|
||||
"teammateMode": "auto"
|
||||
}
|
||||
```
|
||||
|
||||
`teammateMode` 三种值:
|
||||
- `in-process`:所有 teammate 喺主 terminal,**Shift+Down** 切换,**Ctrl+T** 切 task list
|
||||
- `tmux`:split-pane 模式,需要 tmux 或 iTerm2 + it2 CLI
|
||||
- `auto`(默认):喺 tmux 内就 split,否则 in-process
|
||||
|
||||
要求版本:`claude --version` ≥ v2.1.32。
|
||||
|
||||
---
|
||||
|
||||
## 3. tmux 集成操作要点
|
||||
|
||||
### 3.1 启动 / 重接
|
||||
|
||||
```bash
|
||||
# 首次创建(iTerm2 集成)
|
||||
tmux -CC new -s billo_team
|
||||
|
||||
# 重新接入(推荐用普通 attach,最稳)
|
||||
tmux attach -t billo_team
|
||||
|
||||
# iTerm2 ControlMode 重接(要 iTerm2 + 已开 tmux integration)
|
||||
tmux -CC attach -t billo_team
|
||||
|
||||
# 列出所有 session
|
||||
tmux ls
|
||||
|
||||
# 杀掉旧 session
|
||||
tmux kill-session -t billo_team
|
||||
```
|
||||
|
||||
### 3.2 常见坑
|
||||
|
||||
- **`-CC` 看到 raw `%begin %end %output` 输出 = 集成未生效**
|
||||
原因:用紧 Terminal.app 而唔系 iTerm2,或 iTerm2 集成被关。
|
||||
解决:改用 `tmux attach -t <name>` 普通模式。
|
||||
|
||||
- **duplicate session 错误**
|
||||
Session 已存在,用 attach 而唔系 new。
|
||||
|
||||
- **Claude Code 喺边度起?**
|
||||
喺 tmux session 入面用 `claude` 启动主 session,呢个就系 team lead。Teammate 由 lead 自动 spawn 入新 pane。
|
||||
|
||||
### 3.3 tmux 常用快捷键(attach 后)
|
||||
|
||||
| 快捷键 | 作用 |
|
||||
|--------|------|
|
||||
| `Ctrl+b d` | detach 离开但保留 session |
|
||||
| `Ctrl+b s` | 列出 session 切换 |
|
||||
| `Ctrl+b c` | 开新 window |
|
||||
| `Ctrl+b %` / `"` | 垂直 / 水平 split pane |
|
||||
|
||||
---
|
||||
|
||||
## 4. 架构
|
||||
|
||||
| 组件 | 角色 |
|
||||
|------|------|
|
||||
| **Team lead** | 创建团队嘅主 session,spawn teammate + 协调 |
|
||||
| **Teammates** | 独立 Claude Code 实例,各有 context window |
|
||||
| **Task list** | 共享任务清单(pending / in_progress / completed,支持依赖) |
|
||||
| **Mailbox** | Teammates 之间嘅消息系统,自动投递 |
|
||||
|
||||
**状态文件**(**唔好手编辑**,每次状态变更覆盖):
|
||||
- `~/.claude/teams/{team-name}/config.json`
|
||||
- `~/.claude/tasks/{team-name}/`
|
||||
|
||||
> ⚠️ **冇 project 级 teams 配置**。`.claude/teams/teams.json` 系普通文件,唔识别。
|
||||
|
||||
---
|
||||
|
||||
## 5. Subagent 定义作为可复用 Teammate 角色
|
||||
|
||||
呢个系 Agent Teams 嘅核心可复用性机制。
|
||||
|
||||
### 5.1 写法
|
||||
|
||||
`.claude/agents/dotnet-backend-implementer.md`(project 级,可 commit):
|
||||
```markdown
|
||||
---
|
||||
name: dotnet-backend-implementer
|
||||
description: Implements .NET backend modules following DDD patterns
|
||||
tools: [Read, Write, Edit, Bash, Grep, Glob]
|
||||
model: claude-sonnet-4-6
|
||||
---
|
||||
|
||||
You implement .NET 8 backend modules in the Billo.Platform codebase.
|
||||
|
||||
Conventions you MUST follow:
|
||||
- DDD layering: Domain / Application / Infrastructure / API
|
||||
- Use Result<T> pattern for error returns, no exceptions for control flow
|
||||
- Async methods end in Async, ConfigureAwait(false) on library code
|
||||
- Repository interfaces in Domain, implementations in Infrastructure
|
||||
|
||||
Before implementing:
|
||||
1. Read PLAN.md sections relevant to your assigned files
|
||||
2. Check existing patterns in adjacent modules
|
||||
3. Write xUnit tests first (TDD)
|
||||
|
||||
When done: report files changed + test coverage % to the lead.
|
||||
```
|
||||
|
||||
### 5.2 喺 Agent Teams 入面引用
|
||||
|
||||
```text
|
||||
Spawn a teammate using the dotnet-backend-implementer agent type
|
||||
to handle Subtask 2.1.
|
||||
```
|
||||
|
||||
### 5.3 注意事项
|
||||
|
||||
- Teammate 跟 subagent 定义嘅 `tools` allowlist 同 `model`
|
||||
- 定义嘅 body **append** 到 teammate 嘅 system prompt(**唔系替换**)
|
||||
- `SendMessage` 同 task 管理工具**永远可用**,即使 `tools` 限制咗其他
|
||||
- ⚠️ 定义入面嘅 `skills`、`mcpServers` 喺 team 模式**唔生效**,teammate 从 project / user settings 加载
|
||||
|
||||
---
|
||||
|
||||
## 6. 大型项目完整工作流
|
||||
|
||||
### 6.1 One-time Setup
|
||||
|
||||
1. **写好可复用嘅 subagent 定义**(`.claude/agents/*.md`)
|
||||
建议角色:`backend-implementer`、`frontend-implementer`、`domain-modeler`、`test-writer`、`integration-reviewer`、`db-migration-author`
|
||||
既有嘅可直接用:`code-reviewer`、`security-reviewer`、`tdd-guide`、`architect`
|
||||
|
||||
2. **写 PLAN.md**(放 repo 根目录)
|
||||
关键:**每个 subtask 列明 owned files glob**,呢个系防冲突嘅唯一可靠方法。
|
||||
```markdown
|
||||
# Project Plan
|
||||
|
||||
## Phase 2: Customer Context
|
||||
- 2.1 Customer aggregate
|
||||
- Owner files: src/Customer.Domain/**
|
||||
- 2.2 Customer application layer
|
||||
- Owner files: src/Customer.Application/**
|
||||
- Depends on: 2.1
|
||||
- 2.3 Customer API + integration tests
|
||||
- Owner files: src/Customer.Api/**, tests/Customer.IntegrationTests/**
|
||||
- Depends on: 2.2
|
||||
|
||||
## Cross-cutting Rules
|
||||
- File ownership is exclusive per subtask
|
||||
- Coverage ≥ 80% per module
|
||||
```
|
||||
|
||||
3. **配置 hooks 作为质量门**(详见第 7 节)
|
||||
|
||||
### 6.2 每个阶段嘅 Spawn Prompt 模板
|
||||
|
||||
```text
|
||||
We're starting Phase {N}. Read PLAN.md for context.
|
||||
|
||||
Create an agent team with {3-5} teammates:
|
||||
|
||||
[Teammate A]
|
||||
- Name: "customer-domain"
|
||||
- Subagent type: dotnet-backend-implementer
|
||||
- Task: Subtask 2.1
|
||||
- Owned files: src/Customer.Domain/**
|
||||
- Require plan approval before implementation.
|
||||
|
||||
[Teammate B]
|
||||
- Name: "customer-app"
|
||||
- Subagent type: dotnet-backend-implementer
|
||||
- Task: Subtask 2.2
|
||||
- Owned files: src/Customer.Application/**
|
||||
- Depends on: customer-domain finishing aggregate signatures
|
||||
- Require plan approval.
|
||||
|
||||
[Teammate C]
|
||||
- Name: "customer-api"
|
||||
- Subagent type: dotnet-backend-implementer
|
||||
- Task: Subtask 2.3
|
||||
- Owned files: src/Customer.Api/**, tests/Customer.IntegrationTests/**
|
||||
- Depends on: customer-app
|
||||
|
||||
COORDINATION RULES:
|
||||
1. Create shared task list with dependencies.
|
||||
2. Each teammate reads PLAN.md + cross-cutting rules.
|
||||
3. When customer-domain finishes the aggregate API, message
|
||||
customer-app and customer-api with signatures.
|
||||
4. No teammate edits files outside their owned glob.
|
||||
5. Wait for all to finish before synthesis.
|
||||
|
||||
PLAN APPROVAL CRITERIA (for the lead):
|
||||
- Reject plans that skip writing tests first.
|
||||
- Reject plans touching files outside ownership.
|
||||
- Approve plans with explicit coverage ≥ 80%.
|
||||
|
||||
AFTER ALL FINISH:
|
||||
Spawn code-reviewer teammate for cross-module review.
|
||||
Then security-reviewer for the API surface only.
|
||||
Report: files changed, coverage %, findings.
|
||||
```
|
||||
|
||||
### 6.3 阶段过渡
|
||||
|
||||
**唔好一次 spawn 所有阶段**。原因:
|
||||
- 一次只能开一个 team,必须 cleanup 先开新
|
||||
- 下一阶段 spec 可能因为上一阶段发现要调整
|
||||
- Token 成本
|
||||
|
||||
过渡 prompt:
|
||||
```text
|
||||
Phase 2 is complete. Summarize:
|
||||
- What was delivered vs plan
|
||||
- Open issues / deferred items
|
||||
- Any architectural changes
|
||||
Then clean up the team.
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 7. Hooks 质量门
|
||||
|
||||
| Hook | 触发时机 | exit code 2 作用 |
|
||||
|------|---------|------------------|
|
||||
| `TeammateIdle` | Teammate 准备 idle 之前 | 推回反馈,迫继续做 |
|
||||
| `TaskCreated` | 任务创建时 | 阻止创建,反馈意见 |
|
||||
| `TaskCompleted` | 任务标记完成时 | 阻止完成,反馈意见 |
|
||||
|
||||
例子(`~/.claude/settings.json`):
|
||||
```json
|
||||
{
|
||||
"hooks": {
|
||||
"TaskCompleted": [
|
||||
{
|
||||
"matcher": ".*test.*",
|
||||
"command": "dotnet test --collect:\"XPlat Code Coverage\" | grep -q 'Line coverage.*[8-9][0-9]%\\|100%' || exit 2"
|
||||
}
|
||||
],
|
||||
"TeammateIdle": [
|
||||
{
|
||||
"command": "git status --short | grep -v '^??' | wc -l | awk '$1==0 {exit 0} {print \"Uncommitted work\"; exit 2}'"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 8. 控制操作
|
||||
|
||||
### 8.1 模型选择
|
||||
|
||||
Teammate **唔继承** lead 嘅 `/model`。要喺 `/config` 设置 **Default teammate model**,或选 "Default (leader's model)" 跟随 lead。Spawn prompt 入面也可显式:
|
||||
```text
|
||||
Use Sonnet for each teammate.
|
||||
```
|
||||
|
||||
### 8.2 Plan Approval(高风险任务必用)
|
||||
|
||||
```text
|
||||
Spawn an architect teammate to refactor authentication.
|
||||
Require plan approval before any changes.
|
||||
```
|
||||
Teammate 留喺 read-only plan mode,lead 审核批准或反馈拒绝。
|
||||
|
||||
### 8.3 直接对话 Teammate
|
||||
|
||||
- **in-process**:`Shift+Down` 循环切 → 打字发消息 → `Enter` 进入睇 session → `Esc` 中断
|
||||
- **split-pane**:直接 click 入嗰个 pane
|
||||
|
||||
### 8.4 关闭 Teammate / 清场
|
||||
|
||||
```text
|
||||
Ask the researcher teammate to shut down
|
||||
```
|
||||
|
||||
**清场必须由 lead 执行**:
|
||||
```text
|
||||
Clean up the team
|
||||
```
|
||||
(Teammate cleanup 会留下 inconsistent state)
|
||||
|
||||
---
|
||||
|
||||
## 9. 官方使用场景
|
||||
|
||||
### 9.1 并行 Code Review
|
||||
```text
|
||||
Create an agent team to review PR #142. Spawn three reviewers:
|
||||
- One focused on security implications
|
||||
- One checking performance impact
|
||||
- One validating test coverage
|
||||
Have them each review and report findings.
|
||||
```
|
||||
|
||||
### 9.2 竞争性假设调查(debug 神技)
|
||||
```text
|
||||
Users report the app exits after one message. Spawn 5 teammates
|
||||
to investigate different hypotheses. Have them talk to each other
|
||||
to disprove each other's theories, like a scientific debate.
|
||||
Update findings doc with consensus.
|
||||
```
|
||||
精髓:互相 challenge 打破单 agent 嘅 anchoring bias。
|
||||
|
||||
---
|
||||
|
||||
## 10. Best Practices
|
||||
|
||||
| 项 | 建议 |
|
||||
|----|------|
|
||||
| Team 大小 | **3-5 个 teammate 最稳**,超过协调成本 > 收益 |
|
||||
| 任务大小 | 每个 teammate 5-6 个 task 最高产 |
|
||||
| 文件 ownership | **必须明确分割**,每个 teammate 独占 glob |
|
||||
| Plan approval | 高风险(migration、API contract、auth)一定 require |
|
||||
| 新手入门 | 由 review / research 开始,唔写代码嘅任务先体验 |
|
||||
| Lead 偷跑 | 见 lead 自己动手就提佢 "Wait for your teammates to complete" |
|
||||
| Permission | 预先批准常用操作,减少 prompt 打断 |
|
||||
|
||||
---
|
||||
|
||||
## 11. 实验性限制(实操要小心)
|
||||
|
||||
| 限制 | 影响 |
|
||||
|------|------|
|
||||
| `/resume` `/rewind` 唔恢复 in-process teammate | 恢复后 lead 可能发消息俾已死 teammate → 叫佢 spawn new |
|
||||
| Task status 可能滞后 | Teammate 偶尔忘记 mark complete,阻塞下游 |
|
||||
| Shutdown 慢 | Teammate 完成当前 tool call 先关 |
|
||||
| **一次只能开一个 team** | 创建新 team 必须先 cleanup 旧 |
|
||||
| **唔支持嵌套 team** | Teammate 不能 spawn 自己嘅 team |
|
||||
| **Lead 唔可转让** | 创建 team 嗰个 session 永远系 lead |
|
||||
| Permission 只喺 spawn 时跟 lead | Spawn 完先可单独改个别 teammate |
|
||||
| Split-pane 限制 | VS Code 内置 terminal、Windows Terminal、Ghostty **唔支持** |
|
||||
|
||||
---
|
||||
|
||||
## 12. 思维模型
|
||||
|
||||
把多 Agent 编排映射到人类团队:
|
||||
|
||||
```
|
||||
开发计划 (Plan)
|
||||
└── 阶段 (Phase)
|
||||
├── 独立子任务 → 并行
|
||||
│ ├── 任务可切干净 → Subagents (廉价 fan-out)
|
||||
│ ├── 任务需独立 build/test → Worktrees (隔离)
|
||||
│ └── 任务需互相讨论 → Agent Teams (协同)
|
||||
└── 阶段尾审查
|
||||
└── 并行 reviewer teammates
|
||||
(security / performance / test coverage 各一个)
|
||||
```
|
||||
|
||||
启发:**如果你会同时分配呢两个任务俾两个唔同嘅工程师,并且佢哋唔需要事先沟通,咁就适合并行**。
|
||||
|
||||
---
|
||||
|
||||
## 13. 同既有笔记嘅区别
|
||||
|
||||
| 笔记 | 重点 |
|
||||
|------|------|
|
||||
| 本笔记 | **官方 Agent Teams**(v2.1.32+ 实验功能、tmux 集成、大型项目编排模板) |
|
||||
| [[Everything Claude Code 多服务编排详解]] | **ECC 第三方** `/orchestrate` 命令(feature/bugfix/refactor/security 流水线) |
|
||||
| [[ECC 编排实战手册]] | ECC 6 种正交编排模式总览 |
|
||||
| [[dmux 多Agent并行编排]] | dmux 工具嘅并行 worktree 编排 |
|
||||
| [[Ralphinho RFC-DAG 编排模式]] | RFC-DAG 风格强制隔离编排 |
|
||||
| [[Autonomous Agent Harness 自主代理框架]] | 长时间自主运行嘅 harness 设计 |
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
created: "2026-04-06"
|
||||
updated: "2026-04-14"
|
||||
type: resource
|
||||
tags: [resource, claude-code, AI-tools, orchestrate, migration, feature-dev, GSD, ECC, windows-compatible]
|
||||
tags: [resource, claude-code, AI-tools, orchestrate, migration, feature-dev, GSD, PRP, devfleet, ECC, windows-compatible]
|
||||
source: "https://github.com/affaan-m/everything-claude-code"
|
||||
---
|
||||
|
||||
@@ -9,6 +10,8 @@ source: "https://github.com/affaan-m/everything-claude-code"
|
||||
|
||||
`/ecc:orchestrate` 已标记为 legacy shim。底层委托给 `dmux-workflows`(需 tmux)和 `autonomous-agent-harness`(部分依赖 tmux)。Windows 上基本不可用。本文档记录迁移路径。
|
||||
|
||||
> **先看决策表**:见文末「一张表选编排方式」。
|
||||
|
||||
相关笔记:[[Autonomous Agent Harness 自主代理框架]]、[[Everything Claude Code 完整指南]]
|
||||
|
||||
## orchestrate 做了什么
|
||||
@@ -63,7 +66,102 @@ source: "https://github.com/affaan-m/everything-claude-code"
|
||||
| 安全相关 | 任何组合 + `/ecc:security-review` |
|
||||
| 最终验证 | `/ecc:verify` |
|
||||
|
||||
### 路线 C:全项目多阶段 — GSD
|
||||
### 路线 C:PRP 工作流(PRD → 实施 → 提交 → PR)
|
||||
|
||||
**适合结构化 PRD/migration-plan 等带 Implementation Phases 的文档。** 一条龙自动走完:
|
||||
|
||||
```
|
||||
/prp-plan <feature 描述 | path/to/prd.md> # 解析 PRD 找到下一个 pending phase,产出完整实施计划
|
||||
/prp-implement <上一步生成的 plan 路径> # 按计划严格实施 + 验证循环
|
||||
/prp-commit # 分析变更,起草 conventional commit
|
||||
/prp-pr # 汇总提交生成 PR
|
||||
```
|
||||
|
||||
特点:
|
||||
- `/prp-plan` 自动检测输入:PRD 文件 → 选下一个 pending phase;自由描述 → 直接规划
|
||||
- 黄金原则:把实施时可能要搜的所有模式/惯例**提前抓进 plan**,实施阶段不再回去搜
|
||||
- Windows 原生可用
|
||||
|
||||
### 路线 D:多模型协同 — `/multi-workflow`
|
||||
|
||||
**Claude 编排 + Codex 后端 + Gemini 前端 的 6 阶段流水线。** 适合全栈功能。
|
||||
|
||||
```
|
||||
/multi-workflow "add real-time notifications when market resolves"
|
||||
```
|
||||
|
||||
6 阶段:Research → Ideation → Plan → Execute → Optimize → Review。每阶段通过 `~/.claude/bin/codeagent-wrapper` 并行调用 Codex/Gemini(`run_in_background: true`),用 `TaskOutput` 等结果。外部模型**无文件写权限**,所有修改由 Claude 落盘。
|
||||
|
||||
变体:`/multi-plan`(只规划)、`/multi-backend`、`/multi-frontend`、`/multi-execute`。
|
||||
|
||||
### 路线 E:DAG 式并行多 agent — `claude-devfleet`
|
||||
|
||||
**用独立 git worktree 跑多个 Claude Code agent,按 DAG 依赖自动调度,Windows 原生可用。** 需本地启 DevFleet 服务并通过 MCP 接入:
|
||||
|
||||
```bash
|
||||
claude mcp add devfleet --transport http http://localhost:18801/mcp
|
||||
```
|
||||
|
||||
核心调用(通过 MCP tool):
|
||||
|
||||
```
|
||||
plan_project(prompt="Build a REST API with auth and tests")
|
||||
→ 返回 project_id + 一系列 missions(含 depends_on 链、auto_dispatch=true)
|
||||
dispatch_mission(mission_id=<root>)
|
||||
→ 根 mission 启动,后续 mission 在依赖满足时自动派发
|
||||
get_mission_status / get_dashboard / get_report
|
||||
→ 监控与汇报
|
||||
```
|
||||
|
||||
特点:
|
||||
- 每个 mission 在独立 worktree 中运行,完成后自动 merge
|
||||
- 默认最多 3 个并发 agent(`DEVFLEET_MAX_AGENTS` 可配)
|
||||
- 合并冲突时留在 worker 分支手动处理
|
||||
- 长任务建议用 `get_mission_status` 轮询(30-60 秒间隔),避免用 `wait_for_mission` 阻塞会话
|
||||
|
||||
### 路线 F:会话内并行 — Agent 工具 + worktree 隔离
|
||||
|
||||
**当前会话里直接 spawn 多个子代理,`isolation: "worktree"` 参数自动建临时 worktree,Windows 原生可用。** 不需要 tmux、不需要外部服务。
|
||||
|
||||
主代理调用示例(Claude 自身能用):
|
||||
|
||||
```
|
||||
并行 3 个子 agent:
|
||||
- subagent_type: general-purpose, isolation: worktree, prompt: "迁移 module X"
|
||||
- subagent_type: general-purpose, isolation: worktree, prompt: "迁移 module Y"
|
||||
- subagent_type: csharp-reviewer, prompt: "审查 module X/Y 结果"
|
||||
```
|
||||
|
||||
适合:互相独立的迁移任务、并行审查、互不冲突的多模块改造。不适合:跨模块强耦合、需要相互看到中间状态的任务。
|
||||
|
||||
### 路线 G:外部 tmux + worktree 脚本 — `scripts/orchestrate-worktrees.js`
|
||||
|
||||
**ECC 自带的长周期/跨 harness 编排助手。需要 tmux(Linux/macOS/WSL)。**
|
||||
|
||||
```bash
|
||||
node scripts/orchestrate-worktrees.js plan.json --execute
|
||||
```
|
||||
|
||||
`plan.json` 结构:
|
||||
|
||||
```json
|
||||
{
|
||||
"sessionName": "skill-audit",
|
||||
"baseRef": "HEAD",
|
||||
"seedPaths": ["scripts/helper.js", ".claude/plan/spec.md"],
|
||||
"launcherCommand": "codex exec --cwd {worktree_path} --task-file {task_file}",
|
||||
"workers": [
|
||||
{"name": "docs-a", "task": "Fix skills 1-4."},
|
||||
{"name": "docs-b", "task": "Fix skills 5-8."}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
自动完成:每 worker 一个分支+worktree、覆盖 `seedPaths` 中的本地脏文件、写 `.orchestration/<session>/` 下的 task/handoff/status 文件、启动 tmux 会话挂 panes。
|
||||
|
||||
状态快照:`node scripts/orchestration-status.js <plan.json>`。
|
||||
|
||||
### 路线 H:全项目多阶段 — GSD
|
||||
|
||||
GSD(Get Shit Done)是 ECC 集成的项目级编排系统,Windows 原生可用。
|
||||
|
||||
@@ -103,14 +201,16 @@ npx get-shit-done-cc@latest
|
||||
|
||||
## 迁移对照表
|
||||
|
||||
| 旧命令 | 新命令 | 说明 |
|
||||
|--------|--------|------|
|
||||
| `/ecc:orchestrate feature "desc"` | `/ecc:feature-dev "desc"` | 单功能全流程 |
|
||||
| `/ecc:orchestrate bugfix "desc"` | `/ecc:tdd` + `/ecc:code-review` | 先写失败测试再修 |
|
||||
| `/ecc:orchestrate refactor "desc"` | `/ecc:plan` + `/ecc:tdd` + `/ecc:code-review` | 先规划再重构 |
|
||||
| `/ecc:orchestrate security "desc"` | 任何路线 + `/ecc:security-review` | 加安全审查 |
|
||||
| 多阶段自动执行 | `/gsd:autonomous` | GSD 接管 |
|
||||
| 并行编排 | 不可用(Windows) | 用 Agent/Task tool 做进程内并行 |
|
||||
| 旧命令 | 新命令 | 说明 |
|
||||
| ---------------------------------- | --------------------------------------------- | ------------------------ |
|
||||
| `/ecc:orchestrate feature "desc"` | `/ecc:feature-dev "desc"` 或 `/prp-plan`+`/prp-implement` | 单功能全流程 |
|
||||
| `/ecc:orchestrate bugfix "desc"` | `/ecc:tdd` + `/ecc:code-review` | 先写失败测试再修 |
|
||||
| `/ecc:orchestrate refactor "desc"` | `/ecc:plan` + `/ecc:tdd` + `/ecc:code-review` | 先规划再重构 |
|
||||
| `/ecc:orchestrate security "desc"` | 任何路线 + `/ecc:security-review` | 加安全审查 |
|
||||
| 多阶段自动执行 | `/gsd:autonomous` | GSD 接管 |
|
||||
| 并行编排(tmux) | `claude-devfleet` MCP 或 Agent+worktree | Windows 原生替代 |
|
||||
| PRD → 实施 | `/prp-plan <prd.md>` → `/prp-implement` | 自动解析 phases |
|
||||
| 多模型协同 | `/multi-workflow` | Codex+Gemini+Claude |
|
||||
|
||||
## CLAUDE.md 更新
|
||||
|
||||
@@ -138,13 +238,35 @@ npx get-shit-done-cc@latest
|
||||
|------|---------|------|
|
||||
| `/ecc:feature-dev` | 可用 | Claude Code 内部,不依赖外部工具 |
|
||||
| `/ecc:plan` + `/ecc:tdd` + ... | 可用 | 同上 |
|
||||
| `/prp-plan` / `/prp-implement` / `/prp-commit` / `/prp-pr` | 可用 | 全部 Claude Code 内部 |
|
||||
| `/multi-workflow` (含 Codex/Gemini) | 可用 | 需装 codeagent-wrapper,不依赖 tmux |
|
||||
| `/gsd:autonomous` | 可用 | 用 Claude Code Task tool 做并行 |
|
||||
| Agent 工具 + `isolation: "worktree"` | 可用 | 原生 git worktree,不依赖 tmux |
|
||||
| `claude-devfleet` (MCP) | 可用 | HTTP MCP 接入,worker 在独立 worktree |
|
||||
| `/ecc:orchestrate` | **不可用** | Legacy,底层依赖 tmux |
|
||||
| `dmux-workflows` | **不可用** | 需要 tmux |
|
||||
| `dmux-workflows` | **不可用** | 需要 tmux(除非 WSL) |
|
||||
| `scripts/orchestrate-worktrees.js` | **WSL 可用** | 建 tmux session 挂 panes |
|
||||
| `auto-pilot.sh` 脚本 | 可用 | Git Bash,每阶段独立 `claude -p` |
|
||||
|
||||
---
|
||||
|
||||
## 一张表选编排方式
|
||||
|
||||
| 我要... | 选 | 入口 |
|
||||
|---------|-----|------|
|
||||
| 规划单个功能,确认后再写 | `/plan` | 命令 |
|
||||
| 单功能全流程(含 TDD+审查) | `/ecc:feature-dev` | 命令 |
|
||||
| 已有 PRD/migration-plan 带 phases | `/prp-plan <path>` → `/prp-implement` | 命令 |
|
||||
| 前后端都动(Codex/Gemini 辅助) | `/multi-workflow` | 命令 |
|
||||
| 会话内并行几个独立任务 | Agent 工具 + `isolation: worktree` | 主代理直接 spawn |
|
||||
| DAG 调度多 worker 自动合并 | `claude-devfleet` | MCP |
|
||||
| 整个项目/多 milestone 生命周期 | `/gsd:new-project` → `/gsd:autonomous` | 命令 |
|
||||
| 无人值守长时间跑 | `autonomous-agent-harness` + crons | MCP scheduled-tasks |
|
||||
| 定时重复同一个任务 | `/loop-start <interval> <prompt>` | 命令 |
|
||||
| 跨 harness 长周期编排(Linux/WSL) | `scripts/orchestrate-worktrees.js` | 脚本 |
|
||||
|
||||
---
|
||||
|
||||
## 什么时候需要外部脚本
|
||||
|
||||
大部分情况下 Claude Code 自己编排(`/ecc:feature-dev` 或 GSD)就够了。外部脚本(`auto-pilot.sh`)只在以下场景有价值:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
created: "2026-03-08 21:30"
|
||||
updated: "2026-04-14"
|
||||
type: resource
|
||||
tags: [resource, claude-code, AI-tools, development-workflow, reference]
|
||||
source: "https://github.com/affaan-m/everything-claude-code"
|
||||
@@ -7,24 +8,35 @@ source: "https://github.com/affaan-m/everything-claude-code"
|
||||
|
||||
# Everything Claude Code 完整指南
|
||||
|
||||
生产级 Claude Code 插件系统。v1.10.0 (2026-04-06 更新),包含 215 skills、112 agents、82 commands、hooks 和 rules (608 files total)。方法论与最佳实践见 [[Everything Claude Code 方法论与最佳实践]],按场景速查见 [[Everything Claude Code 用法速查]]。
|
||||
生产级 Claude Code 插件系统。v1.10.0(本地仓库实测 183 skills / 48 agents / 79 commands;marketplace 版可能更多——以本地 `ls` 结果为准)。方法论与最佳实践见 [[Everything Claude Code 方法论与最佳实践]],按场景速查见 [[Everything Claude Code 用法速查]]。
|
||||
|
||||
> **仓库关键参考文档**(实测路径 `C:\Users\yaoji\git\OpenSource\everything-claude-code\`):
|
||||
> - `docs/COMMAND-AGENT-MAP.md` — 命令↔agent↔skill 的官方对照表
|
||||
> - `COMMANDS-QUICK-REF.md` — 59 命令速查(按作者口径)
|
||||
> - `the-longform-guide.md` / `the-shortform-guide.md` — 官方长/短指南
|
||||
> - `skills/dmux-workflows/SKILL.md`、`skills/autonomous-agent-harness/SKILL.md`、`skills/claude-devfleet/SKILL.md` — 三类编排机制
|
||||
> - `scripts/orchestrate-worktrees.js` — 外部 tmux+worktree 编排脚本
|
||||
|
||||
自主循环和并行编排详见:[[Autonomous Loops 自主循环模式]]、[[dmux 多Agent并行编排]]、[[Ralphinho RFC-DAG 编排模式]]、[[Autonomous Agent Harness 自主代理框架]]、[[ECC 编排替代方案 (orchestrate 迁移)]]
|
||||
|
||||
## 项目架构
|
||||
|
||||
```
|
||||
everything-claude-code/ (v1.10.0, 608 files)
|
||||
├── agents/ (112个) - 专用子代理 (.agents/ + agents/)
|
||||
├── skills/ (215个) - 工作流定义和领域知识
|
||||
├── commands/ (82个) - slash 命令
|
||||
├── hooks/ - 基于事件的自动化
|
||||
├── rules/ - 始终遵循的规则(15种语言 + common)
|
||||
├── scripts/ (93个) - 跨平台 Node.js 工具脚本
|
||||
everything-claude-code/ (v1.10.0)
|
||||
├── agents/ (~48) - 专用子代理(code-reviewer、planner、tdd-guide、...)
|
||||
├── skills/ (~183) - 工作流定义和领域知识
|
||||
├── commands/ (~79) - slash 命令
|
||||
├── hooks/ - 基于事件的自动化(hooks.json + scripts/hooks/*)
|
||||
├── rules/ - 始终遵循的规则(python/typescript/golang/... + common + zh)
|
||||
├── scripts/ - 跨平台 Node.js 工具脚本(orchestrate-worktrees、harness-audit、...)
|
||||
├── mcp-configs/- MCP 服务器配置模板
|
||||
└── contexts/ - 动态注入的上下文文件
|
||||
├── contexts/ - 动态注入的上下文文件
|
||||
├── docs/ - COMMAND-AGENT-MAP、SKILL-PLACEMENT-POLICY 等
|
||||
└── plugins/ - 独立子插件(gsd、obsidian、planning-with-files、...)
|
||||
```
|
||||
|
||||
> 数字随版本浮动,以 `ls commands/*.md | wc -l` 等实测为准。
|
||||
|
||||
## 安装
|
||||
|
||||
```bash
|
||||
@@ -123,7 +135,21 @@ Rules 新增:java, kotlin, dart, csharp, cpp, rust, perl, php, web, zh (中文
|
||||
|
||||
---
|
||||
|
||||
## 全部 65 Skills
|
||||
## 精选 Skills(curated subset,非全量)
|
||||
|
||||
> 实际 skills 总数 ~183(v1.10.0)。以下只列最常用的按领域分组。完整清单:`ls skills/` 或看 `docs/COMMAND-AGENT-MAP.md`。
|
||||
|
||||
### 编排三件套(本文档重点)
|
||||
|
||||
| Skill | 用途 | Windows 可用 |
|
||||
|-------|------|--------------|
|
||||
| `dmux-workflows` | tmux pane 多 agent 并行 | ❌(需 WSL) |
|
||||
| `autonomous-agent-harness` | 自主循环 / 定时 / 持久记忆 | ✅ |
|
||||
| `claude-devfleet` | DAG 式多 worker + 独立 worktree + 自动 merge | ✅(需本地 DevFleet MCP) |
|
||||
|
||||
其它相关:`autonomous-loops`、`continuous-agent-loop`、`ralphinho-rfc-pipeline`、`council`、`gan-style-harness`。
|
||||
|
||||
|
||||
|
||||
### 核心基础设施 (9)
|
||||
|
||||
@@ -267,7 +293,11 @@ Rules 新增:java, kotlin, dart, csharp, cpp, rust, perl, php, web, zh (中文
|
||||
|
||||
---
|
||||
|
||||
## 16 Agents
|
||||
## 精选 Agents(非全量)
|
||||
|
||||
> 实际 agents 总数 ~48。以下是最常被命令调用或主代理手动 spawn 的核心子代理。完整清单:`ls agents/` 或看 `docs/COMMAND-AGENT-MAP.md`。
|
||||
|
||||
|
||||
|
||||
| Agent | 职责 |
|
||||
| ---------------------- | ----------------- |
|
||||
@@ -293,16 +323,22 @@ Rules 新增:java, kotlin, dart, csharp, cpp, rust, perl, php, web, zh (中文
|
||||
## 常用 Commands
|
||||
|
||||
### 开发核心
|
||||
`/plan` `/tdd` `/e2e` `/code-review` `/build-fix` `/verify` `/test-coverage` `/refactor-clean`
|
||||
`/plan` `/tdd` `/e2e` `/code-review` `/build-fix` `/verify` `/test-coverage` `/refactor-clean` `/feature-dev`
|
||||
|
||||
### PRP 工作流(PRD→实施→PR 一条龙)
|
||||
`/prp-prd` `/prp-plan` `/prp-implement` `/prp-commit` `/prp-pr`
|
||||
|
||||
### 多 Agent 编排
|
||||
`/multi-plan` `/multi-execute` `/multi-frontend` `/multi-backend` `/orchestrate`
|
||||
`/multi-plan` `/multi-workflow` `/multi-execute` `/multi-frontend` `/multi-backend` `/devfleet` `/orchestrate`(legacy shim)
|
||||
|
||||
### GSD 项目生命周期(独立子插件)
|
||||
`/gsd:new-project` `/gsd:plan-phase` `/gsd:execute-phase` `/gsd:verify-work` `/gsd:next` `/gsd:autonomous` `/gsd:ship` `/gsd:complete-milestone`
|
||||
|
||||
### 学习演化
|
||||
`/learn` `/learn-eval` `/evolve` `/instinct-status` `/instinct-export` `/instinct-import`
|
||||
`/learn` `/learn-eval` `/evolve` `/instinct-status` `/instinct-export` `/instinct-import` `/skill-create` `/skill-health` `/rules-distill`
|
||||
|
||||
### v1.8.0 新增
|
||||
`/loop-start` `/loop-status` `/model-route` `/quality-gate` `/harness-audit` `/promote`
|
||||
### 循环/自动化
|
||||
`/loop-start` `/loop-status` `/model-route` `/quality-gate` `/harness-audit` `/promote` `/claw`
|
||||
|
||||
### 验证 & 会话
|
||||
`/checkpoint`(verification-loop 检查点)`/verify`(完整验证管道)`/sessions`(会话历史)`/security-scan`(AgentShield 扫描)
|
||||
@@ -349,10 +385,16 @@ ECC_DISABLED_HOOKS="pre:bash:tmux-reminder,post:edit:typecheck"
|
||||
### Resources
|
||||
- [[Everything Claude Code 方法论与最佳实践]]
|
||||
- [[Everything Claude Code 用法速查]]
|
||||
<<<<<<< HEAD
|
||||
- [[ECC 编排实战手册]] — 6 种编排模式真实命令 + 实战搭配 + 来源标注
|
||||
=======
|
||||
- [[ECC 编排替代方案 (orchestrate 迁移)]] ← **编排机制全景表**
|
||||
>>>>>>> origin/main
|
||||
- [[Autonomous Loops 自主循环模式]]
|
||||
- [[Autonomous Agent Harness 自主代理框架]]
|
||||
- [[dmux 多Agent并行编排]]
|
||||
- [[Ralphinho RFC-DAG 编排模式]]
|
||||
- [[GSD 方法论与最佳实践]]
|
||||
|
||||
### Zettelkasten
|
||||
- [[Everything Claude Code 最佳实践]]
|
||||
|
||||
Reference in New Issue
Block a user