ccgx-workflow 2.1.1 → 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/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import cac from 'cac';
3
3
  import ansis from 'ansis';
4
- import { d as diagnoseMcpConfig, i as isWindows, r as readClaudeCodeConfig, f as fixWindowsMcpConfig, w as writeClaudeCodeConfig, a as readCcgConfig, b as initI18n, c as i18n, s as showMainMenu, e as init, g as configMcp, v as version } from './shared/ccgx-workflow.BIcRT31-.mjs';
4
+ import { d as diagnoseMcpConfig, i as isWindows, r as readClaudeCodeConfig, f as fixWindowsMcpConfig, w as writeClaudeCodeConfig, a as readCcgConfig, b as initI18n, c as i18n, s as showMainMenu, e as init, g as configMcp, v as version } from './shared/ccgx-workflow.k6gRMX3r.mjs';
5
5
  import { execSync } from 'node:child_process';
6
6
  import 'inquirer';
7
7
  import 'ora';
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { h as collectSkills, j as resolvePluginBashCommand } from './shared/ccgx-workflow.BIcRT31-.mjs';
2
- export { k as changeLanguage, G as checkForUpdates, I as collectInvocableSkills, H as compareVersions, m as createDefaultConfig, n as createDefaultRouting, J as generateCommandContent, o as getCcgDir, p as getConfigPath, E as getCurrentVersion, F as getLatestVersion, t as getWorkflowById, q as getWorkflowConfigs, c as i18n, e as init, b as initI18n, y as installAceTool, z as installAceToolRs, K as installSkillCommands, x as installWorkflows, C as migrateToV1_4_0, D as needsMigration, L as parseFrontmatter, a as readCcgConfig, s as showMainMenu, B as uninstallAceTool, A as uninstallWorkflows, u as update, l as writeCcgConfig } from './shared/ccgx-workflow.BIcRT31-.mjs';
1
+ import { h as collectSkills, j as resolvePluginBashCommand } from './shared/ccgx-workflow.k6gRMX3r.mjs';
2
+ export { k as changeLanguage, G as checkForUpdates, I as collectInvocableSkills, H as compareVersions, m as createDefaultConfig, n as createDefaultRouting, J as generateCommandContent, o as getCcgDir, p as getConfigPath, E as getCurrentVersion, F as getLatestVersion, t as getWorkflowById, q as getWorkflowConfigs, c as i18n, e as init, b as initI18n, y as installAceTool, z as installAceToolRs, K as installSkillCommands, x as installWorkflows, C as migrateToV1_4_0, D as needsMigration, L as parseFrontmatter, a as readCcgConfig, s as showMainMenu, B as uninstallAceTool, A as uninstallWorkflows, u as update, l as writeCcgConfig } from './shared/ccgx-workflow.k6gRMX3r.mjs';
3
3
  import { existsSync, readFileSync, mkdirSync, writeFileSync, statSync, readdirSync } from 'node:fs';
4
4
  import { join, dirname } from 'node:path';
5
5
  import { homedir } from 'node:os';
@@ -13,7 +13,7 @@ import { join as join$2 } from 'node:path/posix';
13
13
  import { join as join$1 } from 'node:path';
14
14
  import i18next from 'i18next';
15
15
 
16
- const version = "2.1.1";
16
+ const version = "2.2.0";
17
17
 
18
18
  function cmd(id, order, category, name, nameEn, description, descriptionEn, cmdOverride) {
19
19
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccgx-workflow",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "Multi-model orchestration for Claude Code. Codex + Gemini parallel collaboration with fresh-context subagent protocols, OS-level process isolation, and Plan-Critic-Verify quality tiers. Successor to ccg-workflow.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.17.1",
@@ -75,32 +75,94 @@ description: '按规范执行 + 多模型协作 + 归档'
75
75
  If issues found, make targeted corrections.
76
76
 
77
77
  7. **Multi-Model Review (PARALLEL)**
78
- - **CRITICAL**: You MUST launch BOTH {{BACKEND_PRIMARY}} AND {{FRONTEND_PRIMARY}} in a SINGLE message with TWO Bash tool calls.
79
- - **DO NOT** call one model first and wait. Launch BOTH simultaneously with `run_in_background: true`.
80
78
 
81
- **Step 7.1**: In ONE message, make TWO parallel Bash calls:
79
+ **调用通道路由(CCG codeagent 退役,v2.2.0+)**
80
+
81
+ 双模型并行通道从 `Bash(codeagent-wrapper)` **默认切换**为 plugin spawn:
82
+
83
+ 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 摘要。
84
+ 2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → fallback Bash 调用,**保留 Step 4 session resume** 以维持会话上下文。
85
+
86
+ **判定**:preflight `Bash` 跑 `ls ~/.claude/plugins/` 看有无 `codex@*` / `gemini@*` 子目录。
87
+
88
+ ⚠️ spec-impl 命令在主线 context 内,**允许** `Agent(...)`——与 subagent "禁止嵌套 spawn" 约束不冲突。
89
+ ⚠️ **plugin 路径无 session resume 能力**:通道 A 不接 Step 4 的 SESSION_ID,review 任务作为独立无状态分析跑(review 是 read-only 审查,无需会话连续性)。
90
+
91
+ - **CRITICAL**: You MUST launch BOTH {{BACKEND_PRIMARY}} AND {{FRONTEND_PRIMARY}} in a SINGLE message with TWO parallel tool calls.
92
+ - **DO NOT** call one model first and wait. Launch BOTH simultaneously.
93
+
94
+ **Step 7.1**: In ONE message, spawn TWO models in parallel.
95
+
96
+ **通道 A — plugin spawn(默认,无 session)**:
97
+
98
+ **FIRST Agent call ({{BACKEND_PRIMARY}})**:
99
+ ```
100
+ Agent({
101
+ subagent_type: "codex:codex-rescue",
102
+ description: "spec-impl: correctness/security review",
103
+ prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/reviewer.md
104
+
105
+ WORKDIR: {{WORKDIR}}
106
+
107
+ <TASK>
108
+ Review the implementation changes:
109
+ - Correctness: logic errors, edge cases
110
+ - Security: injection, auth issues
111
+ - Spec compliance: constraints satisfied
112
+
113
+ 变更摘要:<列出 Step 5/6 涉及的文件 + 关键 diff>
114
+ </TASK>
115
+
116
+ OUTPUT: JSON with findings.
117
+ Return ≤200 token structured summary (plugin-native protocol).`
118
+ })
119
+ ```
120
+
121
+ **SECOND Agent call ({{FRONTEND_PRIMARY}}) - IN THE SAME MESSAGE**:
122
+ ```
123
+ Agent({
124
+ subagent_type: "gemini:gemini-rescue",
125
+ description: "spec-impl: maintainability/patterns review",
126
+ prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/reviewer.md
127
+
128
+ WORKDIR: {{WORKDIR}}
129
+
130
+ <TASK>
131
+ Review the implementation changes:
132
+ - Maintainability: readability, complexity
133
+ - Patterns: consistency with project style
134
+ - Integration: cross-module impacts
135
+
136
+ 变更摘要:<列出 Step 5/6 涉及的文件 + 关键 diff>
137
+ </TASK>
138
+
139
+ OUTPUT: JSON with findings.
140
+ Return ≤200 token structured summary (plugin-native protocol).`
141
+ })
142
+ ```
143
+
144
+ **通道 B — codeagent-wrapper fallback**(plugin 未装时降级,**保留 session resume**):
82
145
 
83
- **FIRST Bash call ({{BACKEND_PRIMARY}})**:
84
146
  ```
85
147
  Bash({
86
148
  command: "~/.claude/bin/codeagent-wrapper --progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}resume <CODEX_PROTO_SESSION> - \"{{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",
87
149
  run_in_background: true,
88
150
  timeout: 300000,
89
- description: "{{BACKEND_PRIMARY}}: correctness/security review"
151
+ description: "{{BACKEND_PRIMARY}}: correctness/security review (BC, resume session)"
90
152
  })
91
- ```
92
-
93
- **SECOND Bash call ({{FRONTEND_PRIMARY}}) - IN THE SAME MESSAGE**:
94
- ```
95
153
  Bash({
96
154
  command: "~/.claude/bin/codeagent-wrapper --progress --backend {{FRONTEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}resume <GEMINI_PROTO_SESSION> - \"{{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",
97
155
  run_in_background: true,
98
156
  timeout: 300000,
99
- description: "{{FRONTEND_PRIMARY}}: maintainability/patterns review"
157
+ description: "{{FRONTEND_PRIMARY}}: maintainability/patterns review (BC, resume session)"
100
158
  })
101
159
  ```
102
160
 
103
- **Step 7.2 (事件驱动)**: spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理结果。**不调 TaskOutput**。两个 task 都收到通知后才进 step 7.3。
161
+ > ⚠️ 通道 B `codeagent-wrapper` 已标 **deprecated**,仅为不能升级 plugin 的环境保留——但本 step 仍是 wrapper 唯一能利用 Step 4 SESSION_ID 的场景。
162
+
163
+ **Step 7.2 (事件驱动)**:
164
+ - **通道 A(plugin)**:两个 Agent 同 message 内 spawn,主线接 ≤200 token 摘要。Agent 完成后自动返回结果。
165
+ - **通道 B(BC wrapper)**:spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理结果。**不调 TaskOutput**。两个 task 都收到通知后才进 step 7.3。
104
166
 
105
167
  ⛔ **禁止**:调 `TaskOutput({block: true, timeout: 600000})` (旧 freeze poll 模式) / Kill task。
106
168
  ⚠️ **失败处理**:notification status=failed / exit ≠ 0 / parse 失败 → v1.7.87 标准 2-retry / 5s / 3-attempts;3 次全失败才降级单模型。
@@ -24,33 +24,91 @@ 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
- - **CRITICAL**: You MUST launch BOTH {{BACKEND_PRIMARY}} AND {{FRONTEND_PRIMARY}} in a SINGLE message with TWO Bash tool calls.
28
- - **DO NOT** call one model first and wait. Launch BOTH simultaneously with `run_in_background: true`.
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, make TWO parallel Bash calls:
43
+ **Step 2.1**: In ONE message, spawn TWO models in parallel.
44
+
45
+ **通道 A — plugin spawn(默认)**:
32
46
 
33
- **FIRST Bash call ({{BACKEND_PRIMARY}})**:
47
+ **FIRST Agent call ({{BACKEND_PRIMARY}})**:
34
48
  ```
35
- Bash({
36
- command: "~/.claude/bin/codeagent-wrapper --progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{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",
37
- run_in_background: true,
38
- timeout: 300000,
39
- description: "{{BACKEND_PRIMARY}}: backend analysis"
49
+ Agent({
50
+ subagent_type: "codex:codex-rescue",
51
+ description: "spec-plan: backend analysis",
52
+ prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/analyzer.md
53
+
54
+ WORKDIR: {{WORKDIR}}
55
+
56
+ <TASK>
57
+ Analyze change <change_id> from backend perspective:
58
+ - Implementation approach
59
+ - Technical risks
60
+ - Alternative architectures
61
+ - Edge cases and failure modes
62
+ </TASK>
63
+
64
+ OUTPUT: JSON with analysis.
65
+ Return ≤200 token structured summary (plugin-native protocol).`
40
66
  })
41
67
  ```
42
68
 
43
- **SECOND Bash call ({{FRONTEND_PRIMARY}}) - IN THE SAME MESSAGE**:
69
+ **SECOND Agent call ({{FRONTEND_PRIMARY}}) - IN THE SAME MESSAGE**:
44
70
  ```
71
+ Agent({
72
+ subagent_type: "gemini:gemini-rescue",
73
+ description: "spec-plan: frontend analysis",
74
+ prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/analyzer.md
75
+
76
+ WORKDIR: {{WORKDIR}}
77
+
78
+ <TASK>
79
+ Analyze change <change_id> from frontend/integration perspective:
80
+ - Maintainability assessment
81
+ - Scalability considerations
82
+ - Integration conflicts
83
+ </TASK>
84
+
85
+ OUTPUT: JSON with analysis.
86
+ Return ≤200 token structured summary (plugin-native protocol).`
87
+ })
88
+ ```
89
+
90
+ **通道 B — codeagent-wrapper fallback**(plugin 未装时降级,并行用 `run_in_background: true`):
91
+
92
+ ```
93
+ Bash({
94
+ 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",
95
+ run_in_background: true,
96
+ timeout: 300000,
97
+ description: "{{BACKEND_PRIMARY}}: backend analysis (BC)"
98
+ })
45
99
  Bash({
46
- command: "~/.claude/bin/codeagent-wrapper --progress --backend {{FRONTEND_PRIMARY}} {{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",
100
+ 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
101
  run_in_background: true,
48
102
  timeout: 300000,
49
- description: "{{FRONTEND_PRIMARY}}: frontend analysis"
103
+ description: "{{FRONTEND_PRIMARY}}: frontend analysis (BC)"
50
104
  })
51
105
  ```
52
106
 
53
- **Step 2.2 (事件驱动)**: spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理结果。**不调 TaskOutput**。两个 task 都收到通知后才进 step 2.3。
107
+ > ⚠️ 通道 B `codeagent-wrapper` 已标 **deprecated**,仅为不能升级 plugin 的环境保留。
108
+
109
+ **Step 2.2 (事件驱动)**:
110
+ - **通道 A(plugin)**:两个 Agent 同 message 内 spawn,主线接 ≤200 token 摘要。Agent 完成后自动返回结果。
111
+ - **通道 B(BC wrapper)**:spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理结果。**不调 TaskOutput**。两个 task 都收到通知后才进 step 2.3。
54
112
 
55
113
  ⛔ **禁止**:调 `TaskOutput({block: true, timeout: 600000})` (旧 freeze poll 模式) / Kill task。
56
114
  ⚠️ **失败处理**: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
- - **CRITICAL**: You MUST launch BOTH {{BACKEND_PRIMARY}} AND {{FRONTEND_PRIMARY}} in a SINGLE message with TWO Bash tool calls.
53
- - **DO NOT** call one model first and wait. Launch BOTH simultaneously with `run_in_background: true`.
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,76 @@ description: '需求 → 约束集(并行探索 + OPSX 提案)'
67
79
  }
68
80
  ```
69
81
 
70
- **Step 4.1**: In ONE message, make TWO parallel Bash calls:
82
+ **Step 4.1**: In ONE message, spawn TWO models in parallel.
83
+
84
+ **通道 A — plugin spawn(默认)**:
71
85
 
72
- **FIRST Bash call ({{BACKEND_PRIMARY}} — backend boundaries)**:
86
+ **FIRST Agent call ({{BACKEND_PRIMARY}} — backend boundaries)**:
73
87
  ```
74
- Bash({
75
- command: "~/.claude/bin/codeagent-wrapper --progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\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",
76
- run_in_background: true,
77
- timeout: 300000,
78
- description: "{{BACKEND_PRIMARY}}: backend boundary exploration"
88
+ Agent({
89
+ subagent_type: "codex:codex-rescue",
90
+ description: "spec-research: backend boundary exploration",
91
+ prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/analyzer.md
92
+
93
+ WORKDIR: {{WORKDIR}}
94
+
95
+ <TASK>
96
+ Explore backend context boundaries for <change description>:
97
+ - Existing structures and patterns
98
+ - Conventions in use
99
+ - Hard constraints limiting solution space
100
+ - Dependencies and risks
101
+ </TASK>
102
+
103
+ OUTPUT: JSON using the output template above.
104
+ Return ≤200 token structured summary (plugin-native protocol).`
79
105
  })
80
106
  ```
81
107
 
82
- **SECOND Bash call ({{FRONTEND_PRIMARY}} — frontend boundaries) - IN THE SAME MESSAGE**:
108
+ **SECOND Agent call ({{FRONTEND_PRIMARY}} — frontend boundaries) - IN THE SAME MESSAGE**:
109
+ ```
110
+ Agent({
111
+ subagent_type: "gemini:gemini-rescue",
112
+ description: "spec-research: frontend boundary exploration",
113
+ prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/analyzer.md
114
+
115
+ WORKDIR: {{WORKDIR}}
116
+
117
+ <TASK>
118
+ Explore frontend context boundaries for <change description>:
119
+ - Existing structures and patterns
120
+ - Conventions in use
121
+ - Hard constraints limiting solution space
122
+ - Dependencies and risks
123
+ </TASK>
124
+
125
+ OUTPUT: JSON using the output template above.
126
+ Return ≤200 token structured summary (plugin-native protocol).`
127
+ })
128
+ ```
129
+
130
+ **通道 B — codeagent-wrapper fallback**(plugin 未装时降级,并行用 `run_in_background: true`):
131
+
83
132
  ```
84
133
  Bash({
85
- command: "~/.claude/bin/codeagent-wrapper --progress --backend {{FRONTEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\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",
134
+ 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
135
  run_in_background: true,
87
136
  timeout: 300000,
88
- description: "{{FRONTEND_PRIMARY}}: frontend boundary exploration"
137
+ description: "{{BACKEND_PRIMARY}}: backend boundary exploration (BC)"
138
+ })
139
+ Bash({
140
+ 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",
141
+ run_in_background: true,
142
+ timeout: 300000,
143
+ description: "{{FRONTEND_PRIMARY}}: frontend boundary exploration (BC)"
89
144
  })
90
145
  ```
91
146
 
92
- **Step 4.2 (事件驱动)**: spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理结果。**不调 TaskOutput**。两个 task 都收到通知后才进 step 4.3。
147
+ > ⚠️ 通道 B `codeagent-wrapper` 已标 **deprecated**,仅为不能升级 plugin 的环境保留。
148
+
149
+ **Step 4.2 (事件驱动)**:
150
+ - **通道 A(plugin)**:两个 Agent 同 message 内 spawn,主线接 ≤200 token 摘要。Agent 完成后自动返回结果到调用上下文,主线直接处理。
151
+ - **通道 B(BC wrapper)**:spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理结果。**不调 TaskOutput**。两个 task 都收到通知后才进 step 4.3。
93
152
 
94
153
  ⛔ **禁止**:调 `TaskOutput({block: true, timeout: 600000})` (旧 freeze poll 模式) / Kill task。
95
154
  ⚠️ **失败处理**:notification status=failed / exit ≠ 0 / parse 失败 → v1.7.87 标准 2-retry / 5s / 3-attempts;3 次全失败才降级单模型。
@@ -25,33 +25,130 @@ 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
- - **CRITICAL**: You MUST launch BOTH {{BACKEND_PRIMARY}} AND {{FRONTEND_PRIMARY}} in a SINGLE message with TWO Bash tool calls.
29
- - **DO NOT** call one model first and wait. Launch BOTH simultaneously with `run_in_background: true`.
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, make TWO parallel Bash calls:
44
+ **Step 3.1**: In ONE message, spawn TWO models in parallel.
45
+
46
+ **通道 A — plugin spawn(默认)**:
33
47
 
34
- **FIRST Bash call ({{BACKEND_PRIMARY}})**:
48
+ **FIRST Agent call ({{BACKEND_PRIMARY}})**:
35
49
  ```
36
- Bash({
37
- command: "~/.claude/bin/codeagent-wrapper --progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nReview proposal <proposal_id> implementation:\n\n## {{BACKEND_PRIMARY}} 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",
38
- run_in_background: true,
39
- timeout: 300000,
40
- description: "{{BACKEND_PRIMARY}}: backend/logic review"
50
+ Agent({
51
+ subagent_type: "codex:codex-rescue",
52
+ description: "spec-review: backend/logic review",
53
+ prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/reviewer.md
54
+
55
+ WORKDIR: {{WORKDIR}}
56
+
57
+ <TASK>
58
+ Review proposal <proposal_id> implementation:
59
+
60
+ ## {{BACKEND_PRIMARY}} Review Dimensions
61
+ 1. **Spec Compliance**: Verify ALL constraints from spec are satisfied
62
+ 2. **PBT Properties**: Check invariants, idempotency, bounds are correctly implemented
63
+ 3. **Logic Correctness**: Edge cases, error handling, algorithm correctness
64
+ 4. **Backend Security**: Injection vulnerabilities, auth checks, input validation
65
+ 5. **Regression Risk**: Interface compatibility, type safety, breaking changes
66
+ </TASK>
67
+
68
+ OUTPUT (JSON):
69
+ {
70
+ "findings": [
71
+ {
72
+ "severity": "Critical|Warning|Info",
73
+ "dimension": "spec_compliance|pbt|logic|security|regression",
74
+ "file": "path/to/file.ts",
75
+ "line": 42,
76
+ "description": "What is wrong",
77
+ "constraint_violated": "Constraint ID from spec (if applicable)",
78
+ "fix_suggestion": "How to fix"
79
+ }
80
+ ],
81
+ "passed_checks": ["List of verified constraints/properties"],
82
+ "summary": "Overall assessment"
83
+ }
84
+
85
+ Return ≤200 token structured summary (plugin-native protocol).`
41
86
  })
42
87
  ```
43
88
 
44
- **SECOND Bash call ({{FRONTEND_PRIMARY}}) - IN THE SAME MESSAGE**:
89
+ **SECOND Agent call ({{FRONTEND_PRIMARY}}) - IN THE SAME MESSAGE**:
90
+ ```
91
+ Agent({
92
+ subagent_type: "gemini:gemini-rescue",
93
+ description: "spec-review: patterns/integration review",
94
+ prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/reviewer.md
95
+
96
+ WORKDIR: {{WORKDIR}}
97
+
98
+ <TASK>
99
+ Review proposal <proposal_id> implementation:
100
+
101
+ ## {{FRONTEND_PRIMARY}} Review Dimensions
102
+ 1. **Pattern Consistency**: Naming conventions, code style, project patterns
103
+ 2. **Maintainability**: Readability, complexity, documentation adequacy
104
+ 3. **Integration Risk**: Dependency changes, cross-module impacts
105
+ 4. **Frontend Security**: XSS, CSRF, sensitive data exposure
106
+ 5. **Spec Alignment**: Implementation matches spec intent (not just letter)
107
+ </TASK>
108
+
109
+ OUTPUT (JSON):
110
+ {
111
+ "findings": [
112
+ {
113
+ "severity": "Critical|Warning|Info",
114
+ "dimension": "patterns|maintainability|integration|security|alignment",
115
+ "file": "path/to/file.ts",
116
+ "line": 42,
117
+ "description": "What is wrong",
118
+ "spec_reference": "Spec section (if applicable)",
119
+ "fix_suggestion": "How to fix"
120
+ }
121
+ ],
122
+ "passed_checks": ["List of verified aspects"],
123
+ "summary": "Overall assessment"
124
+ }
125
+
126
+ Return ≤200 token structured summary (plugin-native protocol).`
127
+ })
128
+ ```
129
+
130
+ **通道 B — codeagent-wrapper fallback**(plugin 未装时降级,并行用 `run_in_background: true`):
131
+
45
132
  ```
46
133
  Bash({
47
- command: "~/.claude/bin/codeagent-wrapper --progress --backend {{FRONTEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nReview proposal <proposal_id> implementation:\n\n## {{FRONTEND_PRIMARY}} 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",
134
+ 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
135
  run_in_background: true,
49
136
  timeout: 300000,
50
- description: "{{FRONTEND_PRIMARY}}: patterns/integration review"
137
+ description: "{{BACKEND_PRIMARY}}: backend/logic review (BC)"
138
+ })
139
+ Bash({
140
+ 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",
141
+ run_in_background: true,
142
+ timeout: 300000,
143
+ description: "{{FRONTEND_PRIMARY}}: patterns/integration review (BC)"
51
144
  })
52
145
  ```
53
146
 
54
- **Step 3.2 (事件驱动)**: spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理结果。**不调 TaskOutput**。两个 task 都收到通知后才进 step 3.3。
147
+ > ⚠️ 通道 B `codeagent-wrapper` 已标 **deprecated**,仅为不能升级 plugin 的环境保留。
148
+
149
+ **Step 3.2 (事件驱动)**:
150
+ - **通道 A(plugin)**:两个 Agent 同 message 内 spawn,主线接 ≤200 token 摘要。Agent 完成后自动返回结果。
151
+ - **通道 B(BC wrapper)**:spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理结果。**不调 TaskOutput**。两个 task 都收到通知后才进 step 3.3。
55
152
 
56
153
  ⛔ **禁止**:调 `TaskOutput({block: true, timeout: 600000})` (旧 freeze poll 模式) / Kill task。
57
154
  ⚠️ **失败处理**:notification status=failed / exit ≠ 0 / parse 失败 → v1.7.87 标准 2-retry / 5s / 3-attempts;3 次全失败才降级单模型。
@@ -70,8 +70,8 @@ TaskUpdate({ taskId: "1", owner: "architect" })
70
70
  | 📜 Dev × N | Agent Teams teammates | `Agent(team_name=T, name="dev-1")` | Sonnet | 并行编码,文件隔离 |
71
71
  | 🧪 QA | Agent Teams teammate | `Agent(team_name=T, name="qa")` | Sonnet | 写测试、跑测试、lint、typecheck |
72
72
  | 🔬 Reviewer | Agent Teams teammate | `Agent(team_name=T, name="reviewer")` | Sonnet | 综合审查,分级判决 |
73
- | 🔥 {{BACKEND_PRIMARY}} | 外部模型(非 teammate) | Bash + codeagent-wrapper | {{BACKEND_PRIMARY}} | 后端分析/审查(Phase 2, 6) |
74
- | 🔮 {{FRONTEND_PRIMARY}} | 外部模型(非 teammate) | Bash + codeagent-wrapper | {{FRONTEND_PRIMARY}} | 前端分析/审查(Phase 2, 6) |
73
+ | 🔥 {{BACKEND_PRIMARY}} | 外部模型(非 teammate) | 默认 `Agent(codex:codex-rescue)` / BC fallback Bash codeagent-wrapper | {{BACKEND_PRIMARY}} | 后端分析/审查(Phase 2, 6) |
74
+ | 🔮 {{FRONTEND_PRIMARY}} | 外部模型(非 teammate) | 默认 `Agent(gemini:gemini-rescue)` / BC fallback Bash codeagent-wrapper | {{FRONTEND_PRIMARY}} | 前端分析/审查(Phase 2, 6) |
75
75
 
76
76
  **8 阶段流水线**
77
77
 
@@ -156,29 +156,78 @@ Phase 8: INTEGRATION → Lead 全量验证 + 报告 + 清理
156
156
  1. **Team 已在 Phase 0 创建**,直接使用已有的 team_name。
157
157
 
158
158
  2. **{{BACKEND_PRIMARY}} + {{FRONTEND_PRIMARY}} 并行分析(PARALLEL)**
159
- - **CRITICAL**: 必须在一条消息中同时发起两个 Bash 调用,`run_in_background: true`。
160
159
 
161
- **FIRST Bash call ({{BACKEND_PRIMARY}})**:
160
+ **调用通道路由(CCG codeagent 退役,v2.2.0+)**
161
+
162
+ 双模型并行通道从 `Bash(codeagent-wrapper)` **默认切换**为 plugin spawn:
163
+
164
+ 1. **优先 plugin spawn**(默认):装了 `codex@openai-codex` + gemini plugin → 用 `Agent(subagent_type="codex:codex-rescue")` + `Agent(subagent_type="gemini:gemini-rescue")` 并行,主线接 ≤200 token 摘要。
165
+ 2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → fallback Bash 调用,行为与 plugin 路径等价。
166
+
167
+ **判定**:preflight `Bash` 跑 `ls ~/.claude/plugins/` 看有无 `codex@*` / `gemini@*` 子目录。
168
+
169
+ - **CRITICAL**: 必须在一条消息中同时发起两个并行调用。
170
+
171
+ **通道 A — plugin spawn(默认)**:
172
+
173
+ **FIRST Agent call ({{BACKEND_PRIMARY}})**:
174
+ ```
175
+ Agent({
176
+ subagent_type: "codex:codex-rescue",
177
+ description: "team Phase 2: 后端架构分析",
178
+ prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/architect.md
179
+
180
+ WORKDIR: {{WORKDIR}}
181
+
182
+ <TASK>
183
+ 需求:<PRD 内容>
184
+ 请分析后端架构:模块边界、API 设计、数据模型、依赖关系、实施建议。
185
+ </TASK>
186
+
187
+ Return ≤200 token structured summary (plugin-native protocol).`
188
+ })
189
+ ```
190
+
191
+ **SECOND Agent call ({{FRONTEND_PRIMARY}}) - IN THE SAME MESSAGE**:
192
+ ```
193
+ Agent({
194
+ subagent_type: "gemini:gemini-rescue",
195
+ description: "team Phase 2: 前端架构分析",
196
+ prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/architect.md
197
+
198
+ WORKDIR: {{WORKDIR}}
199
+
200
+ <TASK>
201
+ 需求:<PRD 内容>
202
+ 请分析前端架构:组件拆分、状态管理、路由设计、UI/UX 要点、实施建议。
203
+ </TASK>
204
+
205
+ Return ≤200 token structured summary (plugin-native protocol).`
206
+ })
207
+ ```
208
+
209
+ **通道 B — codeagent-wrapper fallback**(plugin 未装时降级,并行用 `run_in_background: true`):
210
+
162
211
  ```
163
212
  Bash({
164
213
  command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nROLE_FILE: ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/architect.md\n<TASK>\n需求:<PRD 内容>\n请分析后端架构:模块边界、API 设计、数据模型、依赖关系、实施建议。\n</TASK>\nEOF",
165
214
  run_in_background: true,
166
215
  timeout: 3600000,
167
- description: "{{BACKEND_PRIMARY}} 后端架构分析"
216
+ description: "{{BACKEND_PRIMARY}} 后端架构分析 (BC)"
168
217
  })
169
- ```
170
-
171
- **SECOND Bash call ({{FRONTEND_PRIMARY}}) - IN THE SAME MESSAGE**:
172
- ```
173
218
  Bash({
174
219
  command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--progress --backend {{FRONTEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/architect.md\n<TASK>\n需求:<PRD 内容>\n请分析前端架构:组件拆分、状态管理、路由设计、UI/UX 要点、实施建议。\n</TASK>\nEOF",
175
220
  run_in_background: true,
176
221
  timeout: 3600000,
177
- description: "{{FRONTEND_PRIMARY}} 前端架构分析"
222
+ description: "{{FRONTEND_PRIMARY}} 前端架构分析 (BC)"
178
223
  })
179
224
  ```
180
225
 
181
- **事件驱动等待**:spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理结果。**不调 TaskOutput**。两个 task 都收到通知后才进下一步。
226
+ > ⚠️ 通道 B `codeagent-wrapper` 已标 **deprecated**,仅为不能升级 plugin 的环境保留。
227
+
228
+ **事件驱动等待**:
229
+ - **通道 A(plugin)**:两个 Agent 同 message 内 spawn,主线接 ≤200 token 摘要。Agent 完成后自动返回结果。
230
+ - **通道 B(BC wrapper)**:spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理结果。**不调 TaskOutput**。两个 task 都收到通知后才进下一步。
182
231
 
183
232
  ⛔ **禁止**:调 `TaskOutput({block: true, timeout: 600000})` (旧 freeze poll 模式) / Kill task。
184
233
  ⚠️ **失败处理**:notification status=failed / exit ≠ 0 / parse 失败 → v1.7.87 标准 2-retry / 5s / 3-attempts;3 次全失败才降级单模型。
@@ -308,29 +357,82 @@ Phase 8: INTEGRATION → Lead 全量验证 + 报告 + 清理
308
357
  - `Bash: git diff` 获取完整变更内容。
309
358
 
310
359
  2. **{{BACKEND_PRIMARY}} + {{FRONTEND_PRIMARY}} 并行审查(PARALLEL)**
311
- - 模式与 Phase 2 相同,使用 reviewer prompt:
360
+ - 模式与 Phase 2 相同(plugin 优先 + wrapper BC fallback),使用 reviewer prompt:
312
361
 
313
- **FIRST Bash call ({{BACKEND_PRIMARY}})**:
362
+ **通道 A plugin spawn(默认)**:
363
+
364
+ **FIRST Agent call ({{BACKEND_PRIMARY}})**:
314
365
  ```
315
- Bash({
316
- command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nROLE_FILE: ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/reviewer.md\n<TASK>\n审查以下变更:\n<git diff 输出或变更文件列表>\n</TASK>\nOUTPUT (JSON):\n{\n \"findings\": [{\"severity\": \"Critical|Warning|Info\", \"dimension\": \"logic|security|performance|error_handling\", \"file\": \"path\", \"line\": N, \"description\": \"描述\", \"fix_suggestion\": \"修复建议\"}],\n \"passed_checks\": [\"检查项\"],\n \"summary\": \"总体评估\"\n}\nEOF",
317
- run_in_background: true,
318
- timeout: 3600000,
319
- description: "{{BACKEND_PRIMARY}} 后端审查"
366
+ Agent({
367
+ subagent_type: "codex:codex-rescue",
368
+ description: "team Phase 6: 后端审查",
369
+ prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/reviewer.md
370
+
371
+ WORKDIR: {{WORKDIR}}
372
+
373
+ <TASK>
374
+ 审查以下变更:
375
+ <git diff 输出或变更文件列表>
376
+ </TASK>
377
+
378
+ OUTPUT (JSON):
379
+ {
380
+ "findings": [{"severity": "Critical|Warning|Info", "dimension": "logic|security|performance|error_handling", "file": "path", "line": N, "description": "描述", "fix_suggestion": "修复建议"}],
381
+ "passed_checks": ["检查项"],
382
+ "summary": "总体评估"
383
+ }
384
+
385
+ Return ≤200 token structured summary (plugin-native protocol).`
320
386
  })
321
387
  ```
322
388
 
323
- **SECOND Bash call ({{FRONTEND_PRIMARY}}) - IN THE SAME MESSAGE**:
389
+ **SECOND Agent call ({{FRONTEND_PRIMARY}}) - IN THE SAME MESSAGE**:
390
+ ```
391
+ Agent({
392
+ subagent_type: "gemini:gemini-rescue",
393
+ description: "team Phase 6: 前端审查",
394
+ prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/reviewer.md
395
+
396
+ WORKDIR: {{WORKDIR}}
397
+
398
+ <TASK>
399
+ 审查以下变更:
400
+ <git diff 输出或变更文件列表>
401
+ </TASK>
402
+
403
+ OUTPUT (JSON):
404
+ {
405
+ "findings": [{"severity": "Critical|Warning|Info", "dimension": "patterns|maintainability|accessibility|ux|frontend_security", "file": "path", "line": N, "description": "描述", "fix_suggestion": "修复建议"}],
406
+ "passed_checks": ["检查项"],
407
+ "summary": "总体评估"
408
+ }
409
+
410
+ Return ≤200 token structured summary (plugin-native protocol).`
411
+ })
412
+ ```
413
+
414
+ **通道 B — codeagent-wrapper fallback**(plugin 未装时降级):
415
+
324
416
  ```
325
417
  Bash({
326
- command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--progress --backend {{FRONTEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/reviewer.md\n<TASK>\n审查以下变更:\n<git diff 输出或变更文件列表>\n</TASK>\nOUTPUT (JSON):\n{\n \"findings\": [{\"severity\": \"Critical|Warning|Info\", \"dimension\": \"patterns|maintainability|accessibility|ux|frontend_security\", \"file\": \"path\", \"line\": N, \"description\": \"描述\", \"fix_suggestion\": \"修复建议\"}],\n \"passed_checks\": [\"检查项\"],\n \"summary\": \"总体评估\"\n}\nEOF",
418
+ command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nROLE_FILE: ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/reviewer.md\n<TASK>\n审查以下变更:\n<git diff 输出或变更文件列表>\n</TASK>\nOUTPUT (JSON): [same schema as 通道 A]\nEOF",
327
419
  run_in_background: true,
328
420
  timeout: 3600000,
329
- description: "{{FRONTEND_PRIMARY}} 前端审查"
421
+ description: "{{BACKEND_PRIMARY}} 后端审查 (BC)"
422
+ })
423
+ Bash({
424
+ command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--progress --backend {{FRONTEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/reviewer.md\n<TASK>\n审查以下变更:\n<git diff 输出或变更文件列表>\n</TASK>\nOUTPUT (JSON): [same schema as 通道 A]\nEOF",
425
+ run_in_background: true,
426
+ timeout: 3600000,
427
+ description: "{{FRONTEND_PRIMARY}} 前端审查 (BC)"
330
428
  })
331
429
  ```
332
430
 
333
- **事件驱动等待**:spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理。**不调 TaskOutput**。两个 task 都收到通知才进 step 3。
431
+ > ⚠️ 通道 B `codeagent-wrapper` 已标 **deprecated**,仅为不能升级 plugin 的环境保留。
432
+
433
+ **事件驱动等待**:
434
+ - **通道 A(plugin)**:两个 Agent 同 message 内 spawn,主线接 ≤200 token 摘要。
435
+ - **通道 B(BC wrapper)**:spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理。**不调 TaskOutput**。两个 task 都收到通知才进 step 3。
334
436
 
335
437
  ⛔ **禁止**:调 `TaskOutput({block: true, timeout: 600000})` (旧 freeze poll 模式) / Kill task。
336
438
  ⚠️ **失败处理**:notification status=failed / exit ≠ 0 / parse 失败 → v1.7.87 标准 2-retry / 5s / 3-attempts;3 次全失败才降级单模型。
@@ -108,12 +108,21 @@ function parseArgs(argv) {
108
108
  // 600s default was SIGTERM-ing healthy tasks mid-thought. 2h is a
109
109
  // generous safety ceiling — pass 0 to disable entirely.
110
110
  timeoutMs: 7200000,
111
- // 2.1.1: NEW idle timeout. Wall-time alone is the wrong signal — a
112
- // healthy long-running audit produces continuous stdout/stderr (tool
113
- // calls, progress lines). A truly hung companion produces nothing.
114
- // We track lastActivityAt on every stdout/stderr chunk and SIGTERM if
115
- // silent for idleTimeoutMs (default 600s = 10min). Pass 0 to disable.
116
- idleTimeoutMs: 600000,
111
+ // 2.1.2: idle detection is OPT-IN (default 0 = disabled). The original
112
+ // 2.1.1 assumption that "healthy long-running audits emit continuous
113
+ // stdout/stderr chunks" is FALSE for both vendors:
114
+ // - codex-companion `task`: writes progress to its internal job
115
+ // state.json (read via `codex status`); helper sees ZERO stdout
116
+ // until the final JSON envelope.
117
+ // - gemini-batch / gemini-cli `--output-format json`: emits 4-5
118
+ // startup warning lines, then SILENT through model reasoning + all
119
+ // tool calls, then the final JSON.
120
+ // Deep reasoning passes can silently exceed any reasonable idle
121
+ // threshold while being perfectly healthy. Wall-time (default 2h)
122
+ // remains the only safety bound by default. Callers who know their
123
+ // task class is supposed to stream (e.g. future protocol additions)
124
+ // can pass --idle-timeout-ms <N> explicitly.
125
+ idleTimeoutMs: 0,
117
126
  maxBudgetUsd: 50,
118
127
  // 1.0.5 regression fix: pre-1.0.5 callers always passed --write directly
119
128
  // to codex-companion. Default true preserves BC; --no-write opt-out for
@@ -178,7 +187,7 @@ Optional:
178
187
  --json Pass --json to companion (default: true)
179
188
  --no-json Disable --json (text output)
180
189
  --timeout-ms <N> Kill companion if total wall-time exceeds N ms (default: 7200000, 2h; pass 0 to disable)
181
- --idle-timeout-ms <N> Kill companion if no stdout/stderr output for N ms (default: 600000, 10min; pass 0 to disable). Idle detection is the right signal for "hung" healthy long-running audits keep producing tool-call progress.
190
+ --idle-timeout-ms <N> Kill companion if no stdout/stderr output for N ms (default: 0 = disabled). NOTE: codex-companion and gemini-batch both emit NOTHING to stdout/stderr during execution (progress lives in internal state files); idle defaults to disabled to avoid false-positive kills of healthy long tasks. Set to a positive value only if your task class is known to stream.
182
191
  --max-budget-usd <N> Per-call cost cap (default: 50)
183
192
  --write Enable workspace-write sandbox (default: true; codex needs this to spawn read commands too under default approval policy)
184
193
  --no-write Force read-only sandbox (companion approval-policy will decline most commands)