ccgx-workflow 2.1.2 → 2.3.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/dist/cli.mjs +1 -1
- package/dist/index.mjs +2 -2
- package/dist/shared/{ccgx-workflow.dK6O-vwe.mjs → ccgx-workflow.BYuVglaM.mjs} +1 -1
- package/package.json +1 -1
- package/templates/commands/codex-exec.md +114 -68
- package/templates/commands/spec-impl.md +172 -19
- package/templates/commands/spec-plan.md +109 -13
- package/templates/commands/spec-research.md +119 -13
- package/templates/commands/spec-review.md +146 -13
- package/templates/commands/team.md +209 -22
- package/templates/commands/workflow.md +56 -21
|
@@ -24,33 +24,129 @@ description: '多模型分析 → 消除歧义 → 零决策可执行计划'
|
|
|
24
24
|
- Run `openspec status --change "<change_id>" --json` to review current state.
|
|
25
25
|
|
|
26
26
|
2. **Multi-Model Implementation Analysis (PARALLEL)**
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
|
|
28
|
+
**调用通道路由(CCG codeagent 退役,v2.2.0+)**
|
|
29
|
+
|
|
30
|
+
双模型并行通道从 `Bash(codeagent-wrapper)` **默认切换**为 plugin spawn:
|
|
31
|
+
|
|
32
|
+
1. **优先 plugin spawn**(默认):装了 `codex@openai-codex` + gemini plugin(推荐 `gemini@gemini-ccgx` fork;或上游 `gemini@google-gemini` 配 repatch 脚本)→ 用 `Agent(subagent_type="codex:codex-rescue")` + `Agent(subagent_type="gemini:gemini-rescue")` 并行,主线接 ≤200 token 摘要。
|
|
33
|
+
2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → fallback Bash 调用,行为与 plugin 路径等价。
|
|
34
|
+
|
|
35
|
+
**判定**:preflight `Bash` 跑 `ls ~/.claude/plugins/` 看有无 `codex@*` / `gemini@*` 子目录。
|
|
36
|
+
|
|
37
|
+
⚠️ spec-plan 命令在主线 context 内,**允许** `Agent(...)`——与 subagent "禁止嵌套 spawn" 约束不冲突。
|
|
38
|
+
|
|
39
|
+
- **CRITICAL**: You MUST launch BOTH {{BACKEND_PRIMARY}} AND {{FRONTEND_PRIMARY}} in a SINGLE message with TWO parallel tool calls.
|
|
40
|
+
- **DO NOT** call one model first and wait. Launch BOTH simultaneously.
|
|
29
41
|
- **工作目录**:`{{WORKDIR}}` **必须通过 Bash 执行 `pwd`(Unix)或 `cd`(Windows CMD)获取当前工作目录的绝对路径**,禁止从 `$HOME` 或环境变量推断。如果用户通过 `/add-dir` 添加了多个工作区,先确定任务相关的工作区。
|
|
30
42
|
|
|
31
|
-
**Step 2.1**: In ONE message,
|
|
43
|
+
**Step 2.1**: In ONE message, spawn TWO models in parallel.
|
|
44
|
+
|
|
45
|
+
**⚠ 预备动作(spawn 前必须执行)**:`codex:codex-rescue` / `gemini:gemini-rescue` 是 thin forwarder,不会主动 Read 路径文件。主线必须在 spawn 前先 Read 两个角色提示词文件,把**内容**直接拼入下方 Agent prompt 的 `<role>` 块。
|
|
32
46
|
|
|
33
|
-
|
|
47
|
+
- backend role: `Read("~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/analyzer.md")` → `${backendRole}`
|
|
48
|
+
- frontend role: `Read("~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/analyzer.md")` → `${frontendRole}`
|
|
49
|
+
|
|
50
|
+
Prompt 结构按 `gpt-5-4-prompting` skill 推荐:`<role>` + `<task>` + `<grounding_rules>` + `<structured_output_contract>`。
|
|
51
|
+
|
|
52
|
+
**通道 A — plugin spawn(默认)**:
|
|
53
|
+
|
|
54
|
+
**FIRST Agent call ({{BACKEND_PRIMARY}})**:
|
|
34
55
|
```
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
56
|
+
Agent({
|
|
57
|
+
subagent_type: "codex:codex-rescue",
|
|
58
|
+
description: "spec-plan: backend analysis",
|
|
59
|
+
prompt: `<role>
|
|
60
|
+
${backendRole}
|
|
61
|
+
</role>
|
|
62
|
+
|
|
63
|
+
<workdir>{{WORKDIR}}</workdir>
|
|
64
|
+
|
|
65
|
+
<task>
|
|
66
|
+
Analyze change <change_id> from backend perspective:
|
|
67
|
+
- Implementation approach
|
|
68
|
+
- Technical risks
|
|
69
|
+
- Alternative architectures
|
|
70
|
+
- Edge cases and failure modes
|
|
71
|
+
</task>
|
|
72
|
+
|
|
73
|
+
<grounding_rules>
|
|
74
|
+
- Cite file:line for claims about existing code
|
|
75
|
+
- Mark hypotheses; don't state guesses as facts
|
|
76
|
+
- For risks, distinguish "observed" (specific code path) vs "potential" (theoretical)
|
|
77
|
+
</grounding_rules>
|
|
78
|
+
|
|
79
|
+
<structured_output_contract>
|
|
80
|
+
Return JSON ONLY (no preamble):
|
|
81
|
+
{
|
|
82
|
+
"approach": "selected implementation strategy with rationale",
|
|
83
|
+
"alternatives_rejected": [{"alt": "...", "reason": "..."}],
|
|
84
|
+
"technical_risks": [{"risk": "...", "severity": "high|medium|low", "mitigation": "..."}],
|
|
85
|
+
"edge_cases": ["..."],
|
|
86
|
+
"failure_modes": ["..."]
|
|
87
|
+
}
|
|
88
|
+
Return ≤200 token structured summary.
|
|
89
|
+
</structured_output_contract>`
|
|
90
|
+
})
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**SECOND Agent call ({{FRONTEND_PRIMARY}}) - IN THE SAME MESSAGE**:
|
|
94
|
+
```
|
|
95
|
+
Agent({
|
|
96
|
+
subagent_type: "gemini:gemini-rescue",
|
|
97
|
+
description: "spec-plan: frontend analysis",
|
|
98
|
+
prompt: `<role>
|
|
99
|
+
${frontendRole}
|
|
100
|
+
</role>
|
|
101
|
+
|
|
102
|
+
<workdir>{{WORKDIR}}</workdir>
|
|
103
|
+
|
|
104
|
+
<task>
|
|
105
|
+
Analyze change <change_id> from frontend/integration perspective:
|
|
106
|
+
- Maintainability assessment
|
|
107
|
+
- Scalability considerations
|
|
108
|
+
- Integration conflicts
|
|
109
|
+
</task>
|
|
110
|
+
|
|
111
|
+
<grounding_rules>
|
|
112
|
+
- Cite file:line for claims about existing code
|
|
113
|
+
- Mark hypotheses; don't state guesses as facts
|
|
114
|
+
</grounding_rules>
|
|
115
|
+
|
|
116
|
+
<structured_output_contract>
|
|
117
|
+
Return JSON ONLY (no preamble):
|
|
118
|
+
{
|
|
119
|
+
"maintainability": {"score": "good|moderate|concerning", "factors": ["..."]},
|
|
120
|
+
"scalability": [{"dimension": "...", "consideration": "..."}],
|
|
121
|
+
"integration_conflicts": [{"target": "...", "conflict": "...", "resolution": "..."}]
|
|
122
|
+
}
|
|
123
|
+
Return ≤200 token structured summary.
|
|
124
|
+
</structured_output_contract>`
|
|
40
125
|
})
|
|
41
126
|
```
|
|
42
127
|
|
|
43
|
-
|
|
128
|
+
**通道 B — codeagent-wrapper fallback**(plugin 未装时降级,并行用 `run_in_background: true`):
|
|
129
|
+
|
|
44
130
|
```
|
|
45
131
|
Bash({
|
|
46
|
-
command: "~/.claude/bin/codeagent-wrapper --progress --backend {{
|
|
132
|
+
command: "~/.claude/bin/codeagent-wrapper --progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nROLE_FILE: ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/analyzer.md\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",
|
|
133
|
+
run_in_background: true,
|
|
134
|
+
timeout: 300000,
|
|
135
|
+
description: "{{BACKEND_PRIMARY}}: backend analysis (BC)"
|
|
136
|
+
})
|
|
137
|
+
Bash({
|
|
138
|
+
command: "~/.claude/bin/codeagent-wrapper --progress --backend {{FRONTEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/analyzer.md\nAnalyze change <change_id> from frontend/integration perspective:\n- Maintainability assessment\n- Scalability considerations\n- Integration conflicts\nOUTPUT: JSON with analysis\nEOF",
|
|
47
139
|
run_in_background: true,
|
|
48
140
|
timeout: 300000,
|
|
49
|
-
description: "{{FRONTEND_PRIMARY}}: frontend analysis"
|
|
141
|
+
description: "{{FRONTEND_PRIMARY}}: frontend analysis (BC)"
|
|
50
142
|
})
|
|
51
143
|
```
|
|
52
144
|
|
|
53
|
-
|
|
145
|
+
> ⚠️ 通道 B `codeagent-wrapper` 已标 **deprecated**,仅为不能升级 plugin 的环境保留。
|
|
146
|
+
|
|
147
|
+
**Step 2.2 (事件驱动)**:
|
|
148
|
+
- **通道 A(plugin)**:两个 Agent 同 message 内 spawn,主线接 ≤200 token 摘要。Agent 完成后自动返回结果。
|
|
149
|
+
- **通道 B(BC wrapper)**:spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理结果。**不调 TaskOutput**。两个 task 都收到通知后才进 step 2.3。
|
|
54
150
|
|
|
55
151
|
⛔ **禁止**:调 `TaskOutput({block: true, timeout: 600000})` (旧 freeze poll 模式) / Kill task。
|
|
56
152
|
⚠️ **失败处理**:notification status=failed / exit ≠ 0 / parse 失败 → v1.7.87 标准 2-retry / 5s / 3-attempts;3 次全失败才降级单模型。
|
|
@@ -49,8 +49,20 @@ description: '需求 → 约束集(并行探索 + OPSX 提案)'
|
|
|
49
49
|
- Each boundary should be self-contained: no cross-communication needed.
|
|
50
50
|
|
|
51
51
|
4. **Parallel Multi-Model Exploration**
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
|
|
53
|
+
**调用通道路由(CCG codeagent 退役,v2.2.0+)**
|
|
54
|
+
|
|
55
|
+
双模型并行通道从 `Bash(codeagent-wrapper)` **默认切换**为 plugin spawn:
|
|
56
|
+
|
|
57
|
+
1. **优先 plugin spawn**(默认):装了 `codex@openai-codex` + gemini plugin(推荐 `gemini@gemini-ccgx` fork,含 P-1..P-21 + W1/W2/I1 patch;或上游 `gemini@google-gemini` 配 repatch 脚本)→ 用 `Agent(subagent_type="codex:codex-rescue")` + `Agent(subagent_type="gemini:gemini-rescue")` 并行,主线接 ≤200 token 摘要。
|
|
58
|
+
2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → fallback Bash 调用,行为与 plugin 路径等价。
|
|
59
|
+
|
|
60
|
+
**判定**:preflight `Bash` 跑 `ls ~/.claude/plugins/` 看有无 `codex@*` / `gemini@*` 子目录。
|
|
61
|
+
|
|
62
|
+
⚠️ spec-research 命令在主线 context 内,**允许** `Agent(...)`——与 subagent "禁止嵌套 spawn" 约束不冲突。
|
|
63
|
+
|
|
64
|
+
- **CRITICAL**: You MUST launch BOTH {{BACKEND_PRIMARY}} AND {{FRONTEND_PRIMARY}} in a SINGLE message with TWO parallel tool calls.
|
|
65
|
+
- **DO NOT** call one model first and wait. Launch BOTH simultaneously.
|
|
54
66
|
- **工作目录**:`{{WORKDIR}}` **必须通过 Bash 执行 `pwd`(Unix)或 `cd`(Windows CMD)获取当前工作目录的绝对路径**,禁止从 `$HOME` 或环境变量推断。如果用户通过 `/add-dir` 添加了多个工作区,先确定任务相关的工作区。
|
|
55
67
|
|
|
56
68
|
**Output Template** (instruct both models to use this format):
|
|
@@ -67,29 +79,123 @@ description: '需求 → 约束集(并行探索 + OPSX 提案)'
|
|
|
67
79
|
}
|
|
68
80
|
```
|
|
69
81
|
|
|
70
|
-
**Step 4.1**: In ONE message,
|
|
82
|
+
**Step 4.1**: In ONE message, spawn TWO models in parallel.
|
|
83
|
+
|
|
84
|
+
**⚠ 预备动作(spawn 前必须执行)**:`codex:codex-rescue` / `gemini:gemini-rescue` 是 thin forwarder(一行 `Bash node companion.mjs task <prompt>` 转发),**不会**主动 Read 路径文件。主线必须在 spawn 前先 Read 两个角色提示词文件,把**内容**直接拼入下方 Agent prompt 的 `<role>` 块——不是写路径。
|
|
85
|
+
|
|
86
|
+
- backend role: `Read("~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/analyzer.md")` → `${backendRole}`
|
|
87
|
+
- frontend role: `Read("~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/analyzer.md")` → `${frontendRole}`
|
|
71
88
|
|
|
72
|
-
|
|
89
|
+
Prompt 结构按 `gpt-5-4-prompting` skill 推荐(XML 块、紧凑、操作性):`<role>` + `<task>` + `<grounding_rules>` + `<structured_output_contract>`。
|
|
90
|
+
|
|
91
|
+
**通道 A — plugin spawn(默认)**:
|
|
92
|
+
|
|
93
|
+
**FIRST Agent call ({{BACKEND_PRIMARY}} — backend boundaries)**:
|
|
73
94
|
```
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
95
|
+
Agent({
|
|
96
|
+
subagent_type: "codex:codex-rescue",
|
|
97
|
+
description: "spec-research: backend boundary exploration",
|
|
98
|
+
prompt: `<role>
|
|
99
|
+
${backendRole}
|
|
100
|
+
</role>
|
|
101
|
+
|
|
102
|
+
<workdir>{{WORKDIR}}</workdir>
|
|
103
|
+
|
|
104
|
+
<task>
|
|
105
|
+
Explore backend context boundaries for <change description>:
|
|
106
|
+
- Existing structures and patterns
|
|
107
|
+
- Conventions in use
|
|
108
|
+
- Hard constraints limiting solution space
|
|
109
|
+
- Dependencies and risks
|
|
110
|
+
</task>
|
|
111
|
+
|
|
112
|
+
<grounding_rules>
|
|
113
|
+
- Cite file:line for every claim about existing code
|
|
114
|
+
- Mark hypotheses explicitly; don't state guesses as facts
|
|
115
|
+
- If a question can't be answered from the repo, list it in open_questions
|
|
116
|
+
</grounding_rules>
|
|
117
|
+
|
|
118
|
+
<structured_output_contract>
|
|
119
|
+
Return JSON ONLY (no preamble, no commentary):
|
|
120
|
+
{
|
|
121
|
+
"module_name": "context boundary explored",
|
|
122
|
+
"existing_structures": ["key patterns found"],
|
|
123
|
+
"existing_conventions": ["standards in use"],
|
|
124
|
+
"constraints_discovered": ["hard constraints limiting solution space"],
|
|
125
|
+
"open_questions": ["ambiguities requiring user input"],
|
|
126
|
+
"dependencies": ["cross-module dependencies"],
|
|
127
|
+
"risks": ["potential blockers"],
|
|
128
|
+
"success_criteria_hints": ["observable success behaviors"]
|
|
129
|
+
}
|
|
130
|
+
Return ≤200 token structured summary.
|
|
131
|
+
</structured_output_contract>`
|
|
79
132
|
})
|
|
80
133
|
```
|
|
81
134
|
|
|
82
|
-
**SECOND
|
|
135
|
+
**SECOND Agent call ({{FRONTEND_PRIMARY}} — frontend boundaries) - IN THE SAME MESSAGE**:
|
|
136
|
+
```
|
|
137
|
+
Agent({
|
|
138
|
+
subagent_type: "gemini:gemini-rescue",
|
|
139
|
+
description: "spec-research: frontend boundary exploration",
|
|
140
|
+
prompt: `<role>
|
|
141
|
+
${frontendRole}
|
|
142
|
+
</role>
|
|
143
|
+
|
|
144
|
+
<workdir>{{WORKDIR}}</workdir>
|
|
145
|
+
|
|
146
|
+
<task>
|
|
147
|
+
Explore frontend context boundaries for <change description>:
|
|
148
|
+
- Existing structures and patterns
|
|
149
|
+
- Conventions in use
|
|
150
|
+
- Hard constraints limiting solution space
|
|
151
|
+
- Dependencies and risks
|
|
152
|
+
</task>
|
|
153
|
+
|
|
154
|
+
<grounding_rules>
|
|
155
|
+
- Cite file:line for every claim about existing code
|
|
156
|
+
- Mark hypotheses explicitly; don't state guesses as facts
|
|
157
|
+
- If a question can't be answered from the repo, list it in open_questions
|
|
158
|
+
</grounding_rules>
|
|
159
|
+
|
|
160
|
+
<structured_output_contract>
|
|
161
|
+
Return JSON ONLY (no preamble, no commentary):
|
|
162
|
+
{
|
|
163
|
+
"module_name": "context boundary explored",
|
|
164
|
+
"existing_structures": ["key patterns found"],
|
|
165
|
+
"existing_conventions": ["standards in use"],
|
|
166
|
+
"constraints_discovered": ["hard constraints limiting solution space"],
|
|
167
|
+
"open_questions": ["ambiguities requiring user input"],
|
|
168
|
+
"dependencies": ["cross-module dependencies"],
|
|
169
|
+
"risks": ["potential blockers"],
|
|
170
|
+
"success_criteria_hints": ["observable success behaviors"]
|
|
171
|
+
}
|
|
172
|
+
Return ≤200 token structured summary.
|
|
173
|
+
</structured_output_contract>`
|
|
174
|
+
})
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**通道 B — codeagent-wrapper fallback**(plugin 未装时降级,并行用 `run_in_background: true`):
|
|
178
|
+
|
|
83
179
|
```
|
|
84
180
|
Bash({
|
|
85
|
-
command: "~/.claude/bin/codeagent-wrapper --progress --backend {{
|
|
181
|
+
command: "~/.claude/bin/codeagent-wrapper --progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nROLE_FILE: ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/analyzer.md\nExplore backend context boundaries for <change description>:\n- Existing structures and patterns\n- Conventions in use\n- Hard constraints limiting solution space\n- Dependencies and risks\nOUTPUT: JSON using the output template above\nEOF",
|
|
86
182
|
run_in_background: true,
|
|
87
183
|
timeout: 300000,
|
|
88
|
-
description: "{{
|
|
184
|
+
description: "{{BACKEND_PRIMARY}}: backend boundary exploration (BC)"
|
|
185
|
+
})
|
|
186
|
+
Bash({
|
|
187
|
+
command: "~/.claude/bin/codeagent-wrapper --progress --backend {{FRONTEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/analyzer.md\nExplore frontend context boundaries for <change description>:\n- Existing structures and patterns\n- Conventions in use\n- Hard constraints limiting solution space\n- Dependencies and risks\nOUTPUT: JSON using the output template above\nEOF",
|
|
188
|
+
run_in_background: true,
|
|
189
|
+
timeout: 300000,
|
|
190
|
+
description: "{{FRONTEND_PRIMARY}}: frontend boundary exploration (BC)"
|
|
89
191
|
})
|
|
90
192
|
```
|
|
91
193
|
|
|
92
|
-
|
|
194
|
+
> ⚠️ 通道 B `codeagent-wrapper` 已标 **deprecated**,仅为不能升级 plugin 的环境保留。
|
|
195
|
+
|
|
196
|
+
**Step 4.2 (事件驱动)**:
|
|
197
|
+
- **通道 A(plugin)**:两个 Agent 同 message 内 spawn,主线接 ≤200 token 摘要。Agent 完成后自动返回结果到调用上下文,主线直接处理。
|
|
198
|
+
- **通道 B(BC wrapper)**:spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理结果。**不调 TaskOutput**。两个 task 都收到通知后才进 step 4.3。
|
|
93
199
|
|
|
94
200
|
⛔ **禁止**:调 `TaskOutput({block: true, timeout: 600000})` (旧 freeze poll 模式) / Kill task。
|
|
95
201
|
⚠️ **失败处理**:notification status=failed / exit ≠ 0 / parse 失败 → v1.7.87 标准 2-retry / 5s / 3-attempts;3 次全失败才降级单模型。
|
|
@@ -25,33 +25,166 @@ description: '双模型交叉审查(独立工具,随时可用)'
|
|
|
25
25
|
- Load relevant spec constraints and PBT properties from `openspec/changes/<id>/specs/`.
|
|
26
26
|
|
|
27
27
|
3. **Multi-Model Review (PARALLEL)**
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
|
|
29
|
+
**调用通道路由(CCG codeagent 退役,v2.2.0+)**
|
|
30
|
+
|
|
31
|
+
双模型并行通道从 `Bash(codeagent-wrapper)` **默认切换**为 plugin spawn:
|
|
32
|
+
|
|
33
|
+
1. **优先 plugin spawn**(默认):装了 `codex@openai-codex` + gemini plugin(推荐 `gemini@gemini-ccgx` fork;或上游 `gemini@google-gemini` 配 repatch 脚本)→ 用 `Agent(subagent_type="codex:codex-rescue")` + `Agent(subagent_type="gemini:gemini-rescue")` 并行,主线接 ≤200 token 摘要。
|
|
34
|
+
2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → fallback Bash 调用,行为与 plugin 路径等价。
|
|
35
|
+
|
|
36
|
+
**判定**:preflight `Bash` 跑 `ls ~/.claude/plugins/` 看有无 `codex@*` / `gemini@*` 子目录。
|
|
37
|
+
|
|
38
|
+
⚠️ spec-review 命令在主线 context 内,**允许** `Agent(...)`——与 subagent "禁止嵌套 spawn" 约束不冲突。
|
|
39
|
+
|
|
40
|
+
- **CRITICAL**: You MUST launch BOTH {{BACKEND_PRIMARY}} AND {{FRONTEND_PRIMARY}} in a SINGLE message with TWO parallel tool calls.
|
|
41
|
+
- **DO NOT** call one model first and wait. Launch BOTH simultaneously.
|
|
30
42
|
- **工作目录**:`{{WORKDIR}}` **必须通过 Bash 执行 `pwd`(Unix)或 `cd`(Windows CMD)获取当前工作目录的绝对路径**,禁止从 `$HOME` 或环境变量推断。如果用户通过 `/add-dir` 添加了多个工作区,先确定任务相关的工作区。
|
|
31
43
|
|
|
32
|
-
**Step 3.1**: In ONE message,
|
|
44
|
+
**Step 3.1**: In ONE message, spawn TWO models in parallel.
|
|
33
45
|
|
|
34
|
-
|
|
46
|
+
**⚠ 预备动作(spawn 前必须执行)**:`codex:codex-rescue` / `gemini:gemini-rescue` 是 thin forwarder,不会主动 Read 路径文件。主线必须在 spawn 前先 Read 两个角色提示词文件,把**内容**直接拼入下方 Agent prompt 的 `<role>` 块。
|
|
47
|
+
|
|
48
|
+
- backend role: `Read("~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/reviewer.md")` → `${backendRole}`
|
|
49
|
+
- frontend role: `Read("~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/reviewer.md")` → `${frontendRole}`
|
|
50
|
+
|
|
51
|
+
Prompt 结构按 `gpt-5-4-prompting` skill 推荐(review 类任务额外加 `<grounding_rules>` + `<dig_deeper_nudge>`)。
|
|
52
|
+
|
|
53
|
+
**通道 A — plugin spawn(默认)**:
|
|
54
|
+
|
|
55
|
+
**FIRST Agent call ({{BACKEND_PRIMARY}})**:
|
|
35
56
|
```
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
57
|
+
Agent({
|
|
58
|
+
subagent_type: "codex:codex-rescue",
|
|
59
|
+
description: "spec-review: backend/logic review",
|
|
60
|
+
prompt: `<role>
|
|
61
|
+
${backendRole}
|
|
62
|
+
</role>
|
|
63
|
+
|
|
64
|
+
<workdir>{{WORKDIR}}</workdir>
|
|
65
|
+
|
|
66
|
+
<task>
|
|
67
|
+
Review proposal <proposal_id> implementation along backend dimensions:
|
|
68
|
+
1. Spec Compliance — Verify ALL constraints from spec are satisfied
|
|
69
|
+
2. PBT Properties — Check invariants, idempotency, bounds correctly implemented
|
|
70
|
+
3. Logic Correctness — Edge cases, error handling, algorithm correctness
|
|
71
|
+
4. Backend Security — Injection vulnerabilities, auth checks, input validation
|
|
72
|
+
5. Regression Risk — Interface compatibility, type safety, breaking changes
|
|
73
|
+
|
|
74
|
+
Read-only review. Do NOT modify any file.
|
|
75
|
+
</task>
|
|
76
|
+
|
|
77
|
+
<grounding_rules>
|
|
78
|
+
- Every finding must cite file:line
|
|
79
|
+
- If a constraint was satisfied, list it in passed_checks (don't omit positives)
|
|
80
|
+
- "I couldn't verify X" is acceptable; fabricating X is not
|
|
81
|
+
- Distinguish bug (observable failure path) from concern (style/maintainability preference)
|
|
82
|
+
</grounding_rules>
|
|
83
|
+
|
|
84
|
+
<dig_deeper_nudge>
|
|
85
|
+
- For each Critical finding, check whether the same root cause appears elsewhere in the diff
|
|
86
|
+
- Prefer one well-cited Critical over five vague Warnings
|
|
87
|
+
</dig_deeper_nudge>
|
|
88
|
+
|
|
89
|
+
<structured_output_contract>
|
|
90
|
+
Return JSON ONLY (no preamble):
|
|
91
|
+
{
|
|
92
|
+
"findings": [
|
|
93
|
+
{
|
|
94
|
+
"severity": "Critical|Warning|Info",
|
|
95
|
+
"dimension": "spec_compliance|pbt|logic|security|regression",
|
|
96
|
+
"file": "path/to/file.ts",
|
|
97
|
+
"line": 42,
|
|
98
|
+
"description": "What is wrong",
|
|
99
|
+
"constraint_violated": "Constraint ID from spec (if applicable)",
|
|
100
|
+
"fix_suggestion": "How to fix"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"passed_checks": ["List of verified constraints/properties"],
|
|
104
|
+
"summary": "Overall assessment"
|
|
105
|
+
}
|
|
106
|
+
Return ≤200 token structured summary.
|
|
107
|
+
</structured_output_contract>`
|
|
108
|
+
})
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**SECOND Agent call ({{FRONTEND_PRIMARY}}) - IN THE SAME MESSAGE**:
|
|
112
|
+
```
|
|
113
|
+
Agent({
|
|
114
|
+
subagent_type: "gemini:gemini-rescue",
|
|
115
|
+
description: "spec-review: patterns/integration review",
|
|
116
|
+
prompt: `<role>
|
|
117
|
+
${frontendRole}
|
|
118
|
+
</role>
|
|
119
|
+
|
|
120
|
+
<workdir>{{WORKDIR}}</workdir>
|
|
121
|
+
|
|
122
|
+
<task>
|
|
123
|
+
Review proposal <proposal_id> implementation along frontend/integration dimensions:
|
|
124
|
+
1. Pattern Consistency — Naming conventions, code style, project patterns
|
|
125
|
+
2. Maintainability — Readability, complexity, documentation adequacy
|
|
126
|
+
3. Integration Risk — Dependency changes, cross-module impacts
|
|
127
|
+
4. Frontend Security — XSS, CSRF, sensitive data exposure
|
|
128
|
+
5. Spec Alignment — Implementation matches spec intent (not just letter)
|
|
129
|
+
|
|
130
|
+
Read-only review. Do NOT modify any file.
|
|
131
|
+
</task>
|
|
132
|
+
|
|
133
|
+
<grounding_rules>
|
|
134
|
+
- Every finding must cite file:line
|
|
135
|
+
- If an aspect was clean, list it in passed_checks
|
|
136
|
+
- "I couldn't verify X" is acceptable; fabricating X is not
|
|
137
|
+
</grounding_rules>
|
|
138
|
+
|
|
139
|
+
<dig_deeper_nudge>
|
|
140
|
+
- For each Critical finding, check whether the same pattern issue appears in adjacent files
|
|
141
|
+
- Prefer one well-cited Critical over five vague Warnings
|
|
142
|
+
</dig_deeper_nudge>
|
|
143
|
+
|
|
144
|
+
<structured_output_contract>
|
|
145
|
+
Return JSON ONLY (no preamble):
|
|
146
|
+
{
|
|
147
|
+
"findings": [
|
|
148
|
+
{
|
|
149
|
+
"severity": "Critical|Warning|Info",
|
|
150
|
+
"dimension": "patterns|maintainability|integration|security|alignment",
|
|
151
|
+
"file": "path/to/file.ts",
|
|
152
|
+
"line": 42,
|
|
153
|
+
"description": "What is wrong",
|
|
154
|
+
"spec_reference": "Spec section (if applicable)",
|
|
155
|
+
"fix_suggestion": "How to fix"
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
"passed_checks": ["List of verified aspects"],
|
|
159
|
+
"summary": "Overall assessment"
|
|
160
|
+
}
|
|
161
|
+
Return ≤200 token structured summary.
|
|
162
|
+
</structured_output_contract>`
|
|
41
163
|
})
|
|
42
164
|
```
|
|
43
165
|
|
|
44
|
-
|
|
166
|
+
**通道 B — codeagent-wrapper fallback**(plugin 未装时降级,并行用 `run_in_background: true`):
|
|
167
|
+
|
|
45
168
|
```
|
|
46
169
|
Bash({
|
|
47
|
-
command: "~/.claude/bin/codeagent-wrapper --progress --backend {{
|
|
170
|
+
command: "~/.claude/bin/codeagent-wrapper --progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nROLE_FILE: ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/reviewer.md\nReview proposal <proposal_id> implementation:\n[Backend review dimensions - same as 通道 A]\nOUTPUT (JSON): [same schema as 通道 A]\nEOF",
|
|
48
171
|
run_in_background: true,
|
|
49
172
|
timeout: 300000,
|
|
50
|
-
description: "{{
|
|
173
|
+
description: "{{BACKEND_PRIMARY}}: backend/logic review (BC)"
|
|
174
|
+
})
|
|
175
|
+
Bash({
|
|
176
|
+
command: "~/.claude/bin/codeagent-wrapper --progress --backend {{FRONTEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/reviewer.md\nReview proposal <proposal_id> implementation:\n[Frontend review dimensions - same as 通道 A]\nOUTPUT (JSON): [same schema as 通道 A]\nEOF",
|
|
177
|
+
run_in_background: true,
|
|
178
|
+
timeout: 300000,
|
|
179
|
+
description: "{{FRONTEND_PRIMARY}}: patterns/integration review (BC)"
|
|
51
180
|
})
|
|
52
181
|
```
|
|
53
182
|
|
|
54
|
-
|
|
183
|
+
> ⚠️ 通道 B `codeagent-wrapper` 已标 **deprecated**,仅为不能升级 plugin 的环境保留。
|
|
184
|
+
|
|
185
|
+
**Step 3.2 (事件驱动)**:
|
|
186
|
+
- **通道 A(plugin)**:两个 Agent 同 message 内 spawn,主线接 ≤200 token 摘要。Agent 完成后自动返回结果。
|
|
187
|
+
- **通道 B(BC wrapper)**:spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理结果。**不调 TaskOutput**。两个 task 都收到通知后才进 step 3.3。
|
|
55
188
|
|
|
56
189
|
⛔ **禁止**:调 `TaskOutput({block: true, timeout: 600000})` (旧 freeze poll 模式) / Kill task。
|
|
57
190
|
⚠️ **失败处理**:notification status=failed / exit ≠ 0 / parse 失败 → v1.7.87 标准 2-retry / 5s / 3-attempts;3 次全失败才降级单模型。
|