ccg-ros2-workflow 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -140
- package/dist/cli.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/{ccg-ros2-workflow.CpLJvcLP.mjs → ccg-ros2-workflow.B6DeI0On.mjs} +1 -1
- package/package.json +4 -33
- package/templates/commands/analyze.md +11 -2
- package/templates/commands/backend.md +3 -3
- package/templates/commands/debug.md +11 -2
- package/templates/commands/execute.md +15 -6
- package/templates/commands/feat.md +12 -3
- package/templates/commands/frontend.md +3 -3
- package/templates/commands/optimize.md +11 -2
- package/templates/commands/plan.md +14 -5
- package/templates/commands/review.md +11 -2
- package/templates/commands/spec-impl.md +3 -3
- package/templates/commands/spec-init.md +42 -26
- package/templates/commands/spec-plan.md +2 -2
- package/templates/commands/spec-research.md +3 -3
- package/templates/commands/spec-review.md +2 -2
- package/templates/commands/team-exec.md +109 -0
- package/templates/commands/team-plan.md +118 -0
- package/templates/commands/team-research.md +123 -0
- package/templates/commands/team-review.md +96 -0
- package/templates/commands/test.md +10 -1
- package/templates/commands/workflow.md +12 -3
- package/templates/output-styles/abyss-cultivator.md +302 -0
- package/templates/output-styles/engineer-professional.md +89 -0
- package/templates/output-styles/laowang-engineer.md +127 -0
- package/templates/output-styles/nekomata-engineer.md +120 -0
- package/templates/output-styles/ojousama-engineer.md +121 -0
|
@@ -25,7 +25,7 @@ $ARGUMENTS
|
|
|
25
25
|
|
|
26
26
|
```
|
|
27
27
|
Bash({
|
|
28
|
-
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--backend <codex|gemini> - \"
|
|
28
|
+
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--backend <codex|gemini> - \"{{WORKDIR}}\" <<'EOF'
|
|
29
29
|
ROLE_FILE: <角色提示词路径>
|
|
30
30
|
<TASK>
|
|
31
31
|
需求:<增强后的需求>
|
|
@@ -46,6 +46,15 @@ EOF",
|
|
|
46
46
|
| 分析 | `~/.claude/.ccg/prompts/codex/analyzer.md` | `~/.claude/.ccg/prompts/gemini/analyzer.md` |
|
|
47
47
|
| 规划 | `~/.claude/.ccg/prompts/codex/architect.md` | `~/.claude/.ccg/prompts/gemini/architect.md` |
|
|
48
48
|
|
|
49
|
+
**工作目录**:
|
|
50
|
+
- `{{WORKDIR}}`:替换为目标工作目录的**绝对路径**
|
|
51
|
+
- 如果用户通过 `/add-dir` 添加了多个工作区,先用 Glob/Grep 确定任务相关的工作区
|
|
52
|
+
- 如果无法确定,用 `AskUserQuestion` 询问用户选择目标工作区
|
|
53
|
+
- 默认使用当前工作目录
|
|
54
|
+
|
|
55
|
+
**模型参数说明**:
|
|
56
|
+
- `{{GEMINI_MODEL_FLAG}}`:当使用 `--backend gemini` 时,替换为 `--gemini-model gemini-3.1-pro-preview `(注意末尾空格);使用 codex 时替换为空字符串
|
|
57
|
+
|
|
49
58
|
**会话复用**:每次调用返回 `SESSION_ID: xxx`(通常由 wrapper 输出),**必须保存**以供后续 `/ccg:execute` 使用。
|
|
50
59
|
|
|
51
60
|
**等待后台任务**(最大超时 600000ms = 10 分钟):
|
|
@@ -77,7 +86,7 @@ TaskOutput({ task_id: "<task_id>", block: true, timeout: 600000 })
|
|
|
77
86
|
mcp__ace-tool__enhance_prompt({
|
|
78
87
|
prompt: "$ARGUMENTS",
|
|
79
88
|
conversation_history: "<最近5-10轮对话历史>",
|
|
80
|
-
project_root_path: "
|
|
89
|
+
project_root_path: "{{WORKDIR}}"
|
|
81
90
|
})
|
|
82
91
|
```
|
|
83
92
|
|
|
@@ -85,12 +94,12 @@ mcp__ace-tool__enhance_prompt({
|
|
|
85
94
|
|
|
86
95
|
#### 1.2 上下文检索
|
|
87
96
|
|
|
88
|
-
**调用 `
|
|
97
|
+
**调用 `{{MCP_SEARCH_TOOL}}` 工具**:
|
|
89
98
|
|
|
90
99
|
```
|
|
91
|
-
|
|
100
|
+
{{MCP_SEARCH_TOOL}}({
|
|
92
101
|
query: "<基于增强后需求构建的语义查询>",
|
|
93
|
-
project_root_path: "
|
|
102
|
+
project_root_path: "{{WORKDIR}}"
|
|
94
103
|
})
|
|
95
104
|
```
|
|
96
105
|
|
|
@@ -23,7 +23,7 @@ description: 'ROS2 多模型代码审查:无参数时自动审查 git diff,
|
|
|
23
23
|
|
|
24
24
|
```
|
|
25
25
|
Bash({
|
|
26
|
-
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--backend <codex|gemini> - \"
|
|
26
|
+
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--backend <codex|gemini> - \"{{WORKDIR}}\" <<'EOF'
|
|
27
27
|
ROLE_FILE: <角色提示词路径>
|
|
28
28
|
<TASK>
|
|
29
29
|
审查以下代码变更:
|
|
@@ -44,6 +44,15 @@ EOF",
|
|
|
44
44
|
| Codex | `~/.claude/.ccg/prompts/codex/reviewer.md` |
|
|
45
45
|
| Gemini | `~/.claude/.ccg/prompts/gemini/reviewer.md` |
|
|
46
46
|
|
|
47
|
+
**工作目录**:
|
|
48
|
+
- `{{WORKDIR}}`:替换为目标工作目录的**绝对路径**
|
|
49
|
+
- 如果用户通过 `/add-dir` 添加了多个工作区,先用 Glob/Grep 确定任务相关的工作区
|
|
50
|
+
- 如果无法确定,用 `AskUserQuestion` 询问用户选择目标工作区
|
|
51
|
+
- 默认使用当前工作目录
|
|
52
|
+
|
|
53
|
+
**模型参数说明**:
|
|
54
|
+
- `{{GEMINI_MODEL_FLAG}}`:当使用 `--backend gemini` 时,替换为 `--gemini-model gemini-3.1-pro-preview `(注意末尾空格);使用 codex 时替换为空字符串
|
|
55
|
+
|
|
47
56
|
**并行调用**:使用 `run_in_background: true` 启动,用 `TaskOutput` 等待结果。**必须等所有模型返回后才能进入下一阶段**。
|
|
48
57
|
|
|
49
58
|
**等待后台任务**(使用最大超时 600000ms = 10 分钟):
|
|
@@ -69,7 +78,7 @@ TaskOutput({ task_id: "<task_id>", block: true, timeout: 600000 })
|
|
|
69
78
|
|
|
70
79
|
**有参数时**:使用指定的代码/描述
|
|
71
80
|
|
|
72
|
-
调用 `
|
|
81
|
+
调用 `{{MCP_SEARCH_TOOL}}` 获取相关上下文。
|
|
73
82
|
|
|
74
83
|
### 🔬 阶段 2:并行审查
|
|
75
84
|
|
|
@@ -35,7 +35,7 @@ description: '按规范执行 + 多模型协作 + 归档'
|
|
|
35
35
|
|
|
36
36
|
For each task:
|
|
37
37
|
```
|
|
38
|
-
codeagent-wrapper --backend <codex|gemini> - "
|
|
38
|
+
codeagent-wrapper --backend <codex|gemini> - "{{WORKDIR}}" <<'EOF'
|
|
39
39
|
TASK: <task description from tasks.md>
|
|
40
40
|
CONTEXT: <relevant code context>
|
|
41
41
|
CONSTRAINTS: <constraints from spec>
|
|
@@ -69,7 +69,7 @@ description: '按规范执行 + 多模型协作 + 归档'
|
|
|
69
69
|
**FIRST Bash call (Codex)**:
|
|
70
70
|
```
|
|
71
71
|
Bash({
|
|
72
|
-
command: "~/.claude/bin/codeagent-wrapper --backend codex - \"
|
|
72
|
+
command: "~/.claude/bin/codeagent-wrapper --backend codex - \"{{WORKDIR}}\" <<'EOF'\nReview the implementation changes:\n- Correctness: logic errors, edge cases\n- Security: injection, auth issues\n- Spec compliance: constraints satisfied\nOUTPUT: JSON with findings\nEOF",
|
|
73
73
|
run_in_background: true,
|
|
74
74
|
timeout: 300000,
|
|
75
75
|
description: "Codex: correctness/security review"
|
|
@@ -79,7 +79,7 @@ description: '按规范执行 + 多模型协作 + 归档'
|
|
|
79
79
|
**SECOND Bash call (Gemini) - IN THE SAME MESSAGE**:
|
|
80
80
|
```
|
|
81
81
|
Bash({
|
|
82
|
-
command: "~/.claude/bin/codeagent-wrapper --backend gemini - \"
|
|
82
|
+
command: "~/.claude/bin/codeagent-wrapper --backend gemini {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nReview the implementation changes:\n- Maintainability: readability, complexity\n- Patterns: consistency with project style\n- Integration: cross-module impacts\nOUTPUT: JSON with findings\nEOF",
|
|
83
83
|
run_in_background: true,
|
|
84
84
|
timeout: 300000,
|
|
85
85
|
description: "Gemini: maintainability/patterns review"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: '初始化 OpenSpec (OPSX) 环境 + 验证多模型 MCP
|
|
2
|
+
description: '初始化 OpenSpec (OPSX) 环境 + 验证多模型 MCP 工具(ROS2 版本)'
|
|
3
3
|
---
|
|
4
4
|
<!-- CCG:SPEC:INIT:START -->
|
|
5
5
|
**Core Philosophy**
|
|
@@ -19,47 +19,61 @@ description: '初始化 OpenSpec (OPSX) 环境 + 验证多模型 MCP 工具'
|
|
|
19
19
|
- Inform user which OS was detected.
|
|
20
20
|
|
|
21
21
|
2. **Check and Install OpenSpec (OPSX)**
|
|
22
|
-
-
|
|
23
|
-
-
|
|
22
|
+
- **IMPORTANT**: OpenSpec CLI command is `openspec`, NOT `opsx`
|
|
23
|
+
- Verify if OpenSpec is available:
|
|
24
|
+
```bash
|
|
25
|
+
npx @fission-ai/openspec --version
|
|
26
|
+
```
|
|
27
|
+
- If not found, install globally:
|
|
24
28
|
```bash
|
|
25
29
|
npm install -g @fission-ai/openspec@latest
|
|
26
30
|
```
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
- After installation, verify again:
|
|
32
|
+
```bash
|
|
33
|
+
openspec --version
|
|
34
|
+
```
|
|
35
|
+
- If `openspec` command not found after global install, use `npx`:
|
|
36
|
+
```bash
|
|
37
|
+
npx @fission-ai/openspec --version
|
|
38
|
+
```
|
|
39
|
+
- **Note**: Always use `openspec` (not `opsx`) for CLI commands.
|
|
33
40
|
|
|
34
|
-
3. **Initialize OPSX for Current Project**
|
|
35
|
-
-
|
|
41
|
+
3. **Initialize OPSX for Current ROS2 Project**
|
|
42
|
+
- Check if already initialized:
|
|
43
|
+
```bash
|
|
44
|
+
ls -la openspec/ .claude/skills/openspec-* 2>/dev/null || echo "Not initialized"
|
|
45
|
+
```
|
|
46
|
+
- If not initialized, run:
|
|
36
47
|
```bash
|
|
37
|
-
/
|
|
48
|
+
npx @fission-ai/openspec init --tools claude
|
|
38
49
|
```
|
|
39
|
-
- Verify
|
|
40
|
-
|
|
50
|
+
- Verify initialization:
|
|
51
|
+
- Check `openspec/` directory exists
|
|
52
|
+
- Check `.claude/skills/` contains `openspec-*` skills
|
|
53
|
+
- Check `.claude/commands/opsx/` contains OPSX commands
|
|
41
54
|
- Report any errors with remediation steps.
|
|
42
55
|
|
|
43
56
|
4. **Validate Multi-Model MCP Tools**
|
|
44
57
|
- Check `codeagent-wrapper` availability: `~/.claude/bin/codeagent-wrapper --version`
|
|
45
|
-
-
|
|
58
|
+
- **工作目录**:`{{WORKDIR}}` 替换为目标工作目录的绝对路径。如果用户通过 `/add-dir` 添加了多个工作区,先确定任务相关的工作区。
|
|
59
|
+
- Test Codex backend(底层控制):
|
|
46
60
|
```bash
|
|
47
|
-
~/.claude/bin/codeagent-wrapper --backend codex - "
|
|
61
|
+
~/.claude/bin/codeagent-wrapper --backend codex - "{{WORKDIR}}" <<< "echo test"
|
|
48
62
|
```
|
|
49
|
-
- Test Gemini backend
|
|
63
|
+
- Test Gemini backend(上层应用):
|
|
50
64
|
```bash
|
|
51
|
-
~/.claude/bin/codeagent-wrapper --backend gemini - "
|
|
65
|
+
~/.claude/bin/codeagent-wrapper --backend gemini --gemini-model gemini-3.1-pro-preview - "{{WORKDIR}}" <<< "echo test"
|
|
52
66
|
```
|
|
53
67
|
- For each unavailable tool, display warning with installation instructions.
|
|
54
68
|
|
|
55
69
|
5. **Validate Context Retrieval MCP** (Optional)
|
|
56
|
-
- **Check Active Tool**: Is `
|
|
57
|
-
- **Check Configuration**: If tool is missing, check `~/.claude.json`
|
|
70
|
+
- **Check Active Tool**: Is `{{MCP_SEARCH_TOOL}}` available in the current session?
|
|
71
|
+
- **Check Configuration**: If tool is missing, check `~/.claude.json` for `"ace-tool"` or `"ace-tool-rs"` in `mcpServers`.
|
|
58
72
|
- **Diagnosis**:
|
|
59
73
|
- If tool available: Mark as "✓ Active".
|
|
60
74
|
- If config exists but tool missing: Mark as "⚠️ Configured but inactive (Try restarting Claude)".
|
|
61
75
|
- If neither: Mark as "○ Not installed (Optional)".
|
|
62
|
-
- If not installed/configured, suggest: "Run `npx ccg-workflow` and select ace-tool MCP option."
|
|
76
|
+
- If not installed/configured, suggest: "Run `npx ccg-ros2-workflow` and select ace-tool MCP option."
|
|
63
77
|
|
|
64
78
|
6. **Summary Report**
|
|
65
79
|
Display status table:
|
|
@@ -70,8 +84,8 @@ description: '初始化 OpenSpec (OPSX) 环境 + 验证多模型 MCP 工具'
|
|
|
70
84
|
Project initialized ✓/✗
|
|
71
85
|
OPSX Skills ✓/✗
|
|
72
86
|
codeagent-wrapper ✓/✗
|
|
73
|
-
Codex backend
|
|
74
|
-
Gemini backend
|
|
87
|
+
Codex backend(底层控制) ✓/✗
|
|
88
|
+
Gemini backend(上层应用) ✓/✗
|
|
75
89
|
ace-tool MCP ✓/✗ (optional)
|
|
76
90
|
```
|
|
77
91
|
|
|
@@ -84,8 +98,10 @@ description: '初始化 OpenSpec (OPSX) 环境 + 验证多模型 MCP 工具'
|
|
|
84
98
|
- Code Review: `/ccg:spec-review` (Independent dual-model review)
|
|
85
99
|
|
|
86
100
|
**Reference**
|
|
87
|
-
- OpenSpec (OPSX) CLI:
|
|
88
|
-
-
|
|
101
|
+
- OpenSpec (OPSX) CLI: `npx @fission-ai/openspec --help`
|
|
102
|
+
- OPSX Commands: `/opsx:new`, `/opsx:continue`, `/opsx:apply`, etc.
|
|
103
|
+
- CCG ROS2 Workflow: `npx ccg-ros2-workflow`
|
|
89
104
|
- Codex/Gemini MCP: Bundled with codeagent-wrapper
|
|
90
|
-
- Node.js >=
|
|
105
|
+
- Node.js >= 20.x required
|
|
106
|
+
- ROS2 Humble: https://docs.ros.org/en/humble/
|
|
91
107
|
<!-- CCG:SPEC:INIT:END -->
|
|
@@ -29,7 +29,7 @@ description: '多模型分析 → 消除歧义 → 零决策可执行计划'
|
|
|
29
29
|
**FIRST Bash call (Codex)**:
|
|
30
30
|
```
|
|
31
31
|
Bash({
|
|
32
|
-
command: "~/.claude/bin/codeagent-wrapper --backend codex - \"
|
|
32
|
+
command: "~/.claude/bin/codeagent-wrapper --backend codex - \"{{WORKDIR}}\" <<'EOF'\nAnalyze change <change_id> from backend perspective:\n- Implementation approach\n- Technical risks\n- Alternative architectures\n- Edge cases and failure modes\nOUTPUT: JSON with analysis\nEOF",
|
|
33
33
|
run_in_background: true,
|
|
34
34
|
timeout: 300000,
|
|
35
35
|
description: "Codex: backend analysis"
|
|
@@ -39,7 +39,7 @@ description: '多模型分析 → 消除歧义 → 零决策可执行计划'
|
|
|
39
39
|
**SECOND Bash call (Gemini) - IN THE SAME MESSAGE**:
|
|
40
40
|
```
|
|
41
41
|
Bash({
|
|
42
|
-
command: "~/.claude/bin/codeagent-wrapper --backend gemini - \"
|
|
42
|
+
command: "~/.claude/bin/codeagent-wrapper --backend gemini {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nAnalyze change <change_id> from frontend/integration perspective:\n- Maintainability assessment\n- Scalability considerations\n- Integration conflicts\nOUTPUT: JSON with analysis\nEOF",
|
|
43
43
|
run_in_background: true,
|
|
44
44
|
timeout: 300000,
|
|
45
45
|
description: "Gemini: frontend analysis"
|
|
@@ -13,7 +13,7 @@ description: '需求 → 约束集(并行探索 + OPSX 提案)'
|
|
|
13
13
|
- **NEVER** divide subagent tasks by roles (e.g., "架构师agent", "安全专家agent").
|
|
14
14
|
- **ALWAYS** divide by context boundaries (e.g., "user-related code", "authentication logic").
|
|
15
15
|
- Each subagent context must be self-contained with independent output.
|
|
16
|
-
- Use `
|
|
16
|
+
- Use `{{MCP_SEARCH_TOOL}}` to minimize grep/find operations.
|
|
17
17
|
- Do not make architectural decisions—surface constraints that guide decisions.
|
|
18
18
|
|
|
19
19
|
**Steps**
|
|
@@ -24,7 +24,7 @@ description: '需求 → 约束集(并行探索 + OPSX 提案)'
|
|
|
24
24
|
mcp__ace-tool__enhance_prompt({
|
|
25
25
|
prompt: "$ARGUMENTS",
|
|
26
26
|
conversation_history: "<recent conversation>",
|
|
27
|
-
project_root_path: "
|
|
27
|
+
project_root_path: "{{WORKDIR}}"
|
|
28
28
|
})
|
|
29
29
|
```
|
|
30
30
|
- Wait for enhanced prompt result.
|
|
@@ -39,7 +39,7 @@ description: '需求 → 约束集(并行探索 + OPSX 提案)'
|
|
|
39
39
|
- If change already exists, use `/opsx:list` to find it and continue.
|
|
40
40
|
|
|
41
41
|
2. **Initial Codebase Assessment**
|
|
42
|
-
- Use `
|
|
42
|
+
- Use `{{MCP_SEARCH_TOOL}}` to scan codebase.
|
|
43
43
|
- Determine project scale: single vs multi-directory structure.
|
|
44
44
|
- **Decision**: If multi-directory → enable parallel Explore subagents.
|
|
45
45
|
|
|
@@ -33,7 +33,7 @@ description: '双模型交叉审查(独立工具,随时可用)'
|
|
|
33
33
|
**FIRST Bash call (Codex)**:
|
|
34
34
|
```
|
|
35
35
|
Bash({
|
|
36
|
-
command: "~/.claude/bin/codeagent-wrapper --backend codex - \"
|
|
36
|
+
command: "~/.claude/bin/codeagent-wrapper --backend codex - \"{{WORKDIR}}\" <<'EOF'\nReview proposal <proposal_id> implementation:\n\n## Codex Review Dimensions\n1. **Spec Compliance**: Verify ALL constraints from spec are satisfied\n2. **PBT Properties**: Check invariants, idempotency, bounds are correctly implemented\n3. **Logic Correctness**: Edge cases, error handling, algorithm correctness\n4. **Backend Security**: Injection vulnerabilities, auth checks, input validation\n5. **Regression Risk**: Interface compatibility, type safety, breaking changes\n\n## Output Format (JSON)\n{\n \"findings\": [\n {\n \"severity\": \"Critical|Warning|Info\",\n \"dimension\": \"spec_compliance|pbt|logic|security|regression\",\n \"file\": \"path/to/file.ts\",\n \"line\": 42,\n \"description\": \"What is wrong\",\n \"constraint_violated\": \"Constraint ID from spec (if applicable)\",\n \"fix_suggestion\": \"How to fix\"\n }\n ],\n \"passed_checks\": [\"List of verified constraints/properties\"],\n \"summary\": \"Overall assessment\"\n}\nEOF",
|
|
37
37
|
run_in_background: true,
|
|
38
38
|
timeout: 300000,
|
|
39
39
|
description: "Codex: backend/logic review"
|
|
@@ -43,7 +43,7 @@ description: '双模型交叉审查(独立工具,随时可用)'
|
|
|
43
43
|
**SECOND Bash call (Gemini) - IN THE SAME MESSAGE**:
|
|
44
44
|
```
|
|
45
45
|
Bash({
|
|
46
|
-
command: "~/.claude/bin/codeagent-wrapper --backend gemini - \"
|
|
46
|
+
command: "~/.claude/bin/codeagent-wrapper --backend gemini {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nReview proposal <proposal_id> implementation:\n\n## Gemini Review Dimensions\n1. **Pattern Consistency**: Naming conventions, code style, project patterns\n2. **Maintainability**: Readability, complexity, documentation adequacy\n3. **Integration Risk**: Dependency changes, cross-module impacts\n4. **Frontend Security**: XSS, CSRF, sensitive data exposure\n5. **Spec Alignment**: Implementation matches spec intent (not just letter)\n\n## Output Format (JSON)\n{\n \"findings\": [\n {\n \"severity\": \"Critical|Warning|Info\",\n \"dimension\": \"patterns|maintainability|integration|security|alignment\",\n \"file\": \"path/to/file.ts\",\n \"line\": 42,\n \"description\": \"What is wrong\",\n \"spec_reference\": \"Spec section (if applicable)\",\n \"fix_suggestion\": \"How to fix\"\n }\n ],\n \"passed_checks\": [\"List of verified aspects\"],\n \"summary\": \"Overall assessment\"\n}\nEOF",
|
|
47
47
|
run_in_background: true,
|
|
48
48
|
timeout: 300000,
|
|
49
49
|
description: "Gemini: patterns/integration review"
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Agent Teams 并行实施 - 读取计划文件,spawn Builder teammates 并行写代码'
|
|
3
|
+
---
|
|
4
|
+
<!-- CCG:TEAM:EXEC:START -->
|
|
5
|
+
**Core Philosophy**
|
|
6
|
+
- 实施是纯机械执行——所有决策已在 team-plan 阶段完成。
|
|
7
|
+
- Lead 不写代码,只做协调和汇总。
|
|
8
|
+
- Builder teammates 并行实施,文件范围严格隔离。
|
|
9
|
+
|
|
10
|
+
**Guardrails**
|
|
11
|
+
- **前置条件**:`.claude/team-plan/` 下必须有计划文件。没有则终止,提示先运行 `/ccg:team-plan`。
|
|
12
|
+
- **Agent Teams 必须启用**:需要 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`。
|
|
13
|
+
- Lead 绝不直接修改产品代码。
|
|
14
|
+
- 每个 Builder 只能修改分配给它的文件。
|
|
15
|
+
|
|
16
|
+
**Steps**
|
|
17
|
+
1. **前置检查**
|
|
18
|
+
- 检测 Agent Teams 是否可用。
|
|
19
|
+
- 若不可用,输出启用指引后终止:
|
|
20
|
+
```
|
|
21
|
+
⚠️ Agent Teams 未启用。请先配置:
|
|
22
|
+
在 settings.json 中添加:
|
|
23
|
+
{ "env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" } }
|
|
24
|
+
```
|
|
25
|
+
- 读取 `.claude/team-plan/` 下最新的计划文件。
|
|
26
|
+
- 若无计划文件,提示:`请先运行 /ccg:team-plan <任务描述> 生成计划`,终止。
|
|
27
|
+
|
|
28
|
+
2. **解析计划**
|
|
29
|
+
- 解析子任务列表、文件范围、依赖关系、并行分组。
|
|
30
|
+
- 向用户展示摘要并确认:
|
|
31
|
+
```
|
|
32
|
+
📋 即将并行实施:
|
|
33
|
+
- 子任务:N 个
|
|
34
|
+
- 并行分组:Layer 1 (X 个并行) → Layer 2 (Y 个)
|
|
35
|
+
- Builder 数量:N 个(Sonnet)
|
|
36
|
+
确认开始?
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
3. **创建 Team + spawn Builders**
|
|
40
|
+
- 创建 Agent Team。
|
|
41
|
+
- 按 Layer 分组 spawn Builder teammates(Sonnet)。
|
|
42
|
+
- 每个 Builder 的 spawn prompt 必须包含:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
你是 Builder,负责实施一个 ROS2 子任务。严格按照以下指令执行。
|
|
46
|
+
|
|
47
|
+
## 你的任务
|
|
48
|
+
<从计划文件中提取该 Builder 负责的子任务全部内容,包括实施步骤>
|
|
49
|
+
|
|
50
|
+
## 工作目录
|
|
51
|
+
{{WORKDIR}}
|
|
52
|
+
|
|
53
|
+
## 文件范围约束(⛔ 硬性规则)
|
|
54
|
+
你只能创建或修改以下文件:
|
|
55
|
+
<文件列表>
|
|
56
|
+
严禁修改任何其他文件。违反此规则等于任务失败。
|
|
57
|
+
|
|
58
|
+
## 实施要求
|
|
59
|
+
1. 严格按照实施步骤执行
|
|
60
|
+
2. 代码必须符合 ROS2 Humble 规范和项目现有模式
|
|
61
|
+
3. C++ 节点完成后运行 colcon build 验证编译
|
|
62
|
+
4. Python 节点完成后运行 ament_flake8 验证
|
|
63
|
+
5. 代码应自解释,非必要不加注释
|
|
64
|
+
|
|
65
|
+
## 验收标准
|
|
66
|
+
<从计划中提取>
|
|
67
|
+
|
|
68
|
+
完成所有步骤后,标记任务为 completed。
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
- **依赖关系**:Layer 2 的 Builder 任务设为依赖 Layer 1 的对应任务,等 Layer 1 完成后自动解锁。
|
|
72
|
+
- spawn 完成后,进入 **delegate 模式**,只协调不写码。
|
|
73
|
+
|
|
74
|
+
4. **监控进度**
|
|
75
|
+
- 等待所有 Builder 完成。
|
|
76
|
+
- 如果某个 Builder 遇到问题并发消息求助:
|
|
77
|
+
* 分析问题,给出指导建议
|
|
78
|
+
* 不要自己写代码替它完成
|
|
79
|
+
- 如果某个 Builder 失败:
|
|
80
|
+
* 记录失败原因
|
|
81
|
+
* 不影响其他 Builder 继续执行
|
|
82
|
+
|
|
83
|
+
5. **汇总 + 清理**
|
|
84
|
+
- 所有 Builder 完成后,汇总报告:
|
|
85
|
+
|
|
86
|
+
```markdown
|
|
87
|
+
## ✅ Team 并行实施完成
|
|
88
|
+
|
|
89
|
+
### 变更摘要
|
|
90
|
+
| Builder | 子任务 | 状态 | 修改文件 |
|
|
91
|
+
|---------|--------|------|----------|
|
|
92
|
+
| Builder 1 | <名称> | ✅/❌ | file1, file2 |
|
|
93
|
+
| Builder 2 | <名称> | ✅/❌ | file3, file4 |
|
|
94
|
+
| ... | ... | ... | ... |
|
|
95
|
+
|
|
96
|
+
### 后续建议
|
|
97
|
+
1. 运行编译验证:`colcon build --packages-select <pkg>`
|
|
98
|
+
2. 运行测试:`colcon test --packages-select <pkg>`
|
|
99
|
+
3. 检查各节点间 Topic/Service 集成是否正常
|
|
100
|
+
4. 提交代码:`git add -A && git commit`
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
- 关闭所有 teammates,清理 team。
|
|
104
|
+
|
|
105
|
+
**Exit Criteria**
|
|
106
|
+
- [ ] 所有 Builder 任务完成(或明确失败并记录原因)
|
|
107
|
+
- [ ] 变更摘要已输出
|
|
108
|
+
- [ ] Team 已清理
|
|
109
|
+
<!-- CCG:TEAM:EXEC:END -->
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Agent Teams 规划 - Lead 调用 Codex/Gemini 并行分析,产出零决策并行实施计划'
|
|
3
|
+
---
|
|
4
|
+
<!-- CCG:TEAM:PLAN:START -->
|
|
5
|
+
**Core Philosophy**
|
|
6
|
+
- 产出的计划必须让 Builder teammates 能无决策机械执行。
|
|
7
|
+
- 每个子任务的文件范围必须隔离,确保并行不冲突。
|
|
8
|
+
- 多模型协作是强制的:Codex(底层控制权威)+ Gemini(上层应用权威)。
|
|
9
|
+
|
|
10
|
+
**Guardrails**
|
|
11
|
+
- 多模型分析是 **mandatory**:必须同时调用 Codex 和 Gemini。
|
|
12
|
+
- 不写产品代码,只做分析和规划。
|
|
13
|
+
- 计划文件必须包含 Codex/Gemini 的实际分析摘要。
|
|
14
|
+
- 使用 `AskUserQuestion` 解决任何歧义。
|
|
15
|
+
|
|
16
|
+
**Steps**
|
|
17
|
+
1. **上下文收集**
|
|
18
|
+
- 用 Glob/Grep/Read 分析项目结构、ROS2 工作空间、现有节点和消息定义。
|
|
19
|
+
- 如果 `mcp__ace-tool__search_context` 可用,优先语义检索。
|
|
20
|
+
- 整理出:ROS2 版本、包结构、节点拓扑、消息类型、CMakeLists 配置。
|
|
21
|
+
|
|
22
|
+
2. **多模型并行分析(PARALLEL)**
|
|
23
|
+
- **CRITICAL**: 必须在一条消息中同时发起两个 Bash 调用,`run_in_background: true`。
|
|
24
|
+
- **工作目录**:`{{WORKDIR}}` 替换为目标工作目录的绝对路径。
|
|
25
|
+
|
|
26
|
+
**FIRST Bash call (Codex - 底层控制)**:
|
|
27
|
+
```
|
|
28
|
+
Bash({
|
|
29
|
+
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--backend codex - \"{{WORKDIR}}\" <<'EOF'\nROLE_FILE: ~/.claude/.ccg/prompts/codex/analyzer.md\n<TASK>\n需求:$ARGUMENTS\n上下文:<步骤1收集的项目结构和关键代码>\n</TASK>\nOUTPUT:\n1) 技术可行性评估(C++节点/实时性/硬件驱动)\n2) 推荐底层控制架构(精确到文件和函数)\n3) 详细实施步骤(节点、消息、控制算法)\n4) 风险评估(硬件依赖、实时性约束、驱动兼容性)\nEOF",
|
|
30
|
+
run_in_background: true,
|
|
31
|
+
timeout: 3600000,
|
|
32
|
+
description: "Codex 底层控制分析"
|
|
33
|
+
})
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**SECOND Bash call (Gemini - 上层应用) - IN THE SAME MESSAGE**:
|
|
37
|
+
```
|
|
38
|
+
Bash({
|
|
39
|
+
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--backend gemini {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nROLE_FILE: ~/.claude/.ccg/prompts/gemini/analyzer.md\n<TASK>\n需求:$ARGUMENTS\n上下文:<步骤1收集的项目结构和关键代码>\n</TASK>\nOUTPUT:\n1) 上层应用架构方案(Launch文件/Python节点/RViz配置)\n2) 节点拆分建议(精确到文件和函数)\n3) 详细实施步骤(Launch、仿真、可视化)\n4) 系统集成要点(Topic/Service/Action 设计)\nEOF",
|
|
40
|
+
run_in_background: true,
|
|
41
|
+
timeout: 3600000,
|
|
42
|
+
description: "Gemini 上层应用分析"
|
|
43
|
+
})
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**等待结果**:
|
|
47
|
+
```
|
|
48
|
+
TaskOutput({ task_id: "<codex_task_id>", block: true, timeout: 600000 })
|
|
49
|
+
TaskOutput({ task_id: "<gemini_task_id>", block: true, timeout: 600000 })
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- 必须指定 `timeout: 600000`,否则默认 30 秒会提前超时。
|
|
53
|
+
- 若 10 分钟后仍未完成,继续轮询,**绝对不要 Kill 进程**。
|
|
54
|
+
|
|
55
|
+
3. **综合分析 + 任务拆分**
|
|
56
|
+
- 底层控制方案以 Codex 为准,上层应用方案以 Gemini 为准。
|
|
57
|
+
- 拆分为独立子任务,每个子任务:
|
|
58
|
+
* 文件范围不重叠(**强制**)
|
|
59
|
+
* 如果无法避免重叠 → 设为依赖关系(如消息定义必须先于节点实现)
|
|
60
|
+
* 有具体实施步骤和验收标准
|
|
61
|
+
- 按依赖关系分 Layer:同 Layer 可并行,跨 Layer 串行。
|
|
62
|
+
|
|
63
|
+
4. **写入计划文件**
|
|
64
|
+
- 路径:`.claude/team-plan/<任务名>.md`(英文短横线命名)
|
|
65
|
+
- 格式:
|
|
66
|
+
|
|
67
|
+
```markdown
|
|
68
|
+
# Team Plan: <任务名>
|
|
69
|
+
|
|
70
|
+
## 概述
|
|
71
|
+
<一句话描述>
|
|
72
|
+
|
|
73
|
+
## Codex 分析摘要(底层控制)
|
|
74
|
+
<Codex 实际返回的关键内容>
|
|
75
|
+
|
|
76
|
+
## Gemini 分析摘要(上层应用)
|
|
77
|
+
<Gemini 实际返回的关键内容>
|
|
78
|
+
|
|
79
|
+
## 技术方案
|
|
80
|
+
<综合最优方案,含关键技术决策(节点架构/消息设计/QoS配置)>
|
|
81
|
+
|
|
82
|
+
## 子任务列表
|
|
83
|
+
|
|
84
|
+
### Task 1: <名称>
|
|
85
|
+
- **类型**: 底层控制/上层应用
|
|
86
|
+
- **文件范围**: <精确文件路径列表>
|
|
87
|
+
- **依赖**: 无 / Task N
|
|
88
|
+
- **实施步骤**:
|
|
89
|
+
1. <具体步骤>
|
|
90
|
+
2. <具体步骤>
|
|
91
|
+
- **验收标准**: <怎么算完成>
|
|
92
|
+
|
|
93
|
+
### Task 2: <名称>
|
|
94
|
+
...
|
|
95
|
+
|
|
96
|
+
## 文件冲突检查
|
|
97
|
+
✅ 无冲突 / ⚠️ 已通过依赖关系解决
|
|
98
|
+
|
|
99
|
+
## 并行分组
|
|
100
|
+
- Layer 1 (并行): Task 1, Task 2
|
|
101
|
+
- Layer 2 (依赖 Layer 1): Task 3
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
5. **用户确认**
|
|
105
|
+
- 展示计划摘要(子任务数、并行分组、Builder 数量)。
|
|
106
|
+
- 用 `AskUserQuestion` 请求确认。
|
|
107
|
+
- 确认后提示:`计划已就绪,运行 /ccg:team-exec 开始并行实施`
|
|
108
|
+
|
|
109
|
+
6. **上下文检查点**
|
|
110
|
+
- 报告当前上下文使用量。
|
|
111
|
+
- 如果接近 80K:建议 `/clear` 后运行 `/ccg:team-exec`。
|
|
112
|
+
|
|
113
|
+
**Exit Criteria**
|
|
114
|
+
- [ ] Codex + Gemini 分析完成
|
|
115
|
+
- [ ] 子任务文件范围无冲突
|
|
116
|
+
- [ ] 计划文件已写入 `.claude/team-plan/`
|
|
117
|
+
- [ ] 用户已确认计划
|
|
118
|
+
<!-- CCG:TEAM:PLAN:END -->
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Agent Teams 需求研究 - 并行探索代码库,产出约束集 + 可验证成功判据'
|
|
3
|
+
---
|
|
4
|
+
<!-- CCG:TEAM:RESEARCH:START -->
|
|
5
|
+
**Core Philosophy**
|
|
6
|
+
- Research 产出的是**约束集**,不是信息堆砌。每条约束缩小解决方案空间。
|
|
7
|
+
- 约束告诉后续阶段"不要考虑这个方向",使 plan 阶段能产出零决策计划。
|
|
8
|
+
- 输出:约束集合 + 可验证的成功判据,写入 `.claude/team-plan/<任务名>-research.md`。
|
|
9
|
+
|
|
10
|
+
**Guardrails**
|
|
11
|
+
- **STOP! BEFORE ANY OTHER ACTION**: 必须先做 Prompt 增强。
|
|
12
|
+
- 按上下文边界(context boundaries)划分探索范围,不按角色划分。
|
|
13
|
+
- 多模型协作是 **mandatory**:Codex(底层控制边界)+ Gemini(上层应用边界)。
|
|
14
|
+
- 不做架构决策——只发现约束。
|
|
15
|
+
- 使用 `AskUserQuestion` 解决任何歧义,绝不假设。
|
|
16
|
+
|
|
17
|
+
**Steps**
|
|
18
|
+
0. **MANDATORY: Prompt 增强**
|
|
19
|
+
- **立即执行,不可跳过。**
|
|
20
|
+
- 分析 $ARGUMENTS 的意图、缺失信息、隐含假设,补全为结构化需求(明确目标、技术约束、范围边界、验收标准)。
|
|
21
|
+
- 后续所有步骤使用增强后的需求。
|
|
22
|
+
|
|
23
|
+
1. **代码库评估**
|
|
24
|
+
- 用 Glob/Grep/Read 扫描项目结构。
|
|
25
|
+
- 判断项目规模:单包 vs 多包(ament 工作空间)。
|
|
26
|
+
- 识别技术栈:ROS2 版本、节点语言(C++/Python)、依赖包、现有消息定义。
|
|
27
|
+
|
|
28
|
+
2. **定义探索边界(按上下文划分)**
|
|
29
|
+
- 识别自然的上下文边界(不是功能角色):
|
|
30
|
+
* 边界 1:底层控制域(控制节点、硬件驱动、实时算法、消息定义)
|
|
31
|
+
* 边界 2:上层应用域(Launch 文件、Python 节点、RViz 配置、仿真)
|
|
32
|
+
* 边界 3:基础设施(CMakeLists、package.xml、配置文件、部署脚本)
|
|
33
|
+
- 每个边界应自包含,无需跨边界通信。
|
|
34
|
+
|
|
35
|
+
3. **多模型并行探索(PARALLEL)**
|
|
36
|
+
- **CRITICAL**: 必须在一条消息中同时发起两个 Bash 调用。
|
|
37
|
+
- **工作目录**:`{{WORKDIR}}` 替换为目标工作目录的绝对路径。
|
|
38
|
+
|
|
39
|
+
**FIRST Bash call (Codex - 底层控制)**:
|
|
40
|
+
```
|
|
41
|
+
Bash({
|
|
42
|
+
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--backend codex - \"{{WORKDIR}}\" <<'EOF'\nROLE_FILE: ~/.claude/.ccg/prompts/codex/analyzer.md\n<TASK>\n需求:<增强后的需求>\n探索范围:底层控制相关上下文边界(C++节点/硬件驱动/实时算法/消息定义)\n</TASK>\nOUTPUT (JSON):\n{\n \"module_name\": \"探索的上下文边界\",\n \"existing_structures\": [\"发现的关键模式\"],\n \"existing_conventions\": [\"使用中的规范\"],\n \"constraints_discovered\": [\"限制解决方案空间的硬约束\"],\n \"open_questions\": [\"需要用户确认的歧义\"],\n \"dependencies\": [\"跨模块依赖\"],\n \"risks\": [\"潜在阻碍\"],\n \"success_criteria_hints\": [\"可观测的成功行为\"]\n}\nEOF",
|
|
43
|
+
run_in_background: true,
|
|
44
|
+
timeout: 3600000,
|
|
45
|
+
description: "Codex 底层控制探索"
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**SECOND Bash call (Gemini - 上层应用) - IN THE SAME MESSAGE**:
|
|
50
|
+
```
|
|
51
|
+
Bash({
|
|
52
|
+
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--backend gemini {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nROLE_FILE: ~/.claude/.ccg/prompts/gemini/analyzer.md\n<TASK>\n需求:<增强后的需求>\n探索范围:上层应用相关上下文边界(Launch文件/Python节点/RViz配置/仿真)\n</TASK>\nOUTPUT (JSON):\n{\n \"module_name\": \"探索的上下文边界\",\n \"existing_structures\": [\"发现的关键模式\"],\n \"existing_conventions\": [\"使用中的规范\"],\n \"constraints_discovered\": [\"限制解决方案空间的硬约束\"],\n \"open_questions\": [\"需要用户确认的歧义\"],\n \"dependencies\": [\"跨模块依赖\"],\n \"risks\": [\"潜在阻碍\"],\n \"success_criteria_hints\": [\"可观测的成功行为\"]\n}\nEOF",
|
|
53
|
+
run_in_background: true,
|
|
54
|
+
timeout: 3600000,
|
|
55
|
+
description: "Gemini 上层应用探索"
|
|
56
|
+
})
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**等待结果**:
|
|
60
|
+
```
|
|
61
|
+
TaskOutput({ task_id: "<codex_task_id>", block: true, timeout: 600000 })
|
|
62
|
+
TaskOutput({ task_id: "<gemini_task_id>", block: true, timeout: 600000 })
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
4. **聚合与综合**
|
|
66
|
+
- 合并所有探索输出为统一约束集:
|
|
67
|
+
* **硬约束**:技术限制、不可违反的模式(如 QoS 兼容性、实时性要求、硬件接口)
|
|
68
|
+
* **软约束**:惯例、偏好、ROS2 编码规范
|
|
69
|
+
* **依赖**:影响实施顺序的跨模块关系(如消息定义必须先于节点实现)
|
|
70
|
+
* **风险**:需要缓解的阻碍(如硬件依赖、驱动兼容性)
|
|
71
|
+
|
|
72
|
+
5. **歧义消解**
|
|
73
|
+
- 编译优先级排序的开放问题列表。
|
|
74
|
+
- 用 `AskUserQuestion` 系统性地呈现:
|
|
75
|
+
* 分组相关问题
|
|
76
|
+
* 为每个问题提供上下文
|
|
77
|
+
* 在适用时建议默认值
|
|
78
|
+
- 将用户回答转化为额外约束。
|
|
79
|
+
|
|
80
|
+
6. **写入研究文件**
|
|
81
|
+
- 路径:`.claude/team-plan/<任务名>-research.md`
|
|
82
|
+
- 格式:
|
|
83
|
+
|
|
84
|
+
```markdown
|
|
85
|
+
# Team Research: <任务名>
|
|
86
|
+
|
|
87
|
+
## 增强后的需求
|
|
88
|
+
<结构化需求描述>
|
|
89
|
+
|
|
90
|
+
## 约束集
|
|
91
|
+
|
|
92
|
+
### 硬约束
|
|
93
|
+
- [HC-1] <约束描述> — 来源:<Codex/Gemini/用户>
|
|
94
|
+
- [HC-2] ...
|
|
95
|
+
|
|
96
|
+
### 软约束
|
|
97
|
+
- [SC-1] <约束描述> — 来源:<Codex/Gemini/用户>
|
|
98
|
+
- [SC-2] ...
|
|
99
|
+
|
|
100
|
+
### 依赖关系
|
|
101
|
+
- [DEP-1] <模块A> → <模块B>:<原因>(如:消息定义 → 控制节点)
|
|
102
|
+
|
|
103
|
+
### 风险
|
|
104
|
+
- [RISK-1] <风险描述> — 缓解:<策略>
|
|
105
|
+
|
|
106
|
+
## 成功判据
|
|
107
|
+
- [OK-1] <可验证的成功行为>
|
|
108
|
+
- [OK-2] ...
|
|
109
|
+
|
|
110
|
+
## 开放问题(已解决)
|
|
111
|
+
- Q1: <问题> → A: <用户回答> → 约束:[HC/SC-N]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
7. **上下文检查点**
|
|
115
|
+
- 报告当前上下文使用量。
|
|
116
|
+
- 提示:`研究完成,运行 /clear 后执行 /ccg:team-plan <任务名> 开始规划`
|
|
117
|
+
|
|
118
|
+
**Exit Criteria**
|
|
119
|
+
- [ ] Codex + Gemini 探索完成
|
|
120
|
+
- [ ] 所有歧义已通过用户确认解决
|
|
121
|
+
- [ ] 约束集 + 成功判据已写入研究文件
|
|
122
|
+
- [ ] 零开放问题残留
|
|
123
|
+
<!-- CCG:TEAM:RESEARCH:END -->
|