ccgx-workflow 2.2.0 → 2.3.1

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.
@@ -32,7 +32,7 @@ description: '多模型分析 → 消除歧义 → 零决策可执行计划'
32
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
33
  2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → fallback Bash 调用,行为与 plugin 路径等价。
34
34
 
35
- **判定**:preflight `Bash` 跑 `ls ~/.claude/plugins/` 看有无 `codex@*` / `gemini@*` 子目录。
35
+ **判定**:preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`)。exit `0` + stdout `{"codex":"<ver>","gemini":"<ver>"}` → 通道 A(plugin 默认);非 `0` → 通道 B(wrapper BC fallback)。
36
36
 
37
37
  ⚠️ spec-plan 命令在主线 context 内,**允许** `Agent(...)`——与 subagent "禁止嵌套 spawn" 约束不冲突。
38
38
 
@@ -42,6 +42,13 @@ description: '多模型分析 → 消除歧义 → 零决策可执行计划'
42
42
 
43
43
  **Step 2.1**: In ONE message, spawn TWO models in parallel.
44
44
 
45
+ **⚠ 预备动作(spawn 前必须执行)**:`codex:codex-rescue` / `gemini:gemini-rescue` 是 thin forwarder,不会主动 Read 路径文件。主线必须在 spawn 前先 Read 两个角色提示词文件,把**内容**直接拼入下方 Agent prompt 的 `<role>` 块。
46
+
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
+
45
52
  **通道 A — plugin spawn(默认)**:
46
53
 
47
54
  **FIRST Agent call ({{BACKEND_PRIMARY}})**:
@@ -49,20 +56,37 @@ description: '多模型分析 → 消除歧义 → 零决策可执行计划'
49
56
  Agent({
50
57
  subagent_type: "codex:codex-rescue",
51
58
  description: "spec-plan: backend analysis",
52
- prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/analyzer.md
59
+ prompt: `<role>
60
+ ${backendRole}
61
+ </role>
53
62
 
54
- WORKDIR: {{WORKDIR}}
63
+ <workdir>{{WORKDIR}}</workdir>
55
64
 
56
- <TASK>
65
+ <task>
57
66
  Analyze change <change_id> from backend perspective:
58
67
  - Implementation approach
59
68
  - Technical risks
60
69
  - Alternative architectures
61
70
  - Edge cases and failure modes
62
- </TASK>
63
-
64
- OUTPUT: JSON with analysis.
65
- Return ≤200 token structured summary (plugin-native protocol).`
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>`
66
90
  })
67
91
  ```
68
92
 
@@ -71,19 +95,33 @@ Return ≤200 token structured summary (plugin-native protocol).`
71
95
  Agent({
72
96
  subagent_type: "gemini:gemini-rescue",
73
97
  description: "spec-plan: frontend analysis",
74
- prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/analyzer.md
98
+ prompt: `<role>
99
+ ${frontendRole}
100
+ </role>
75
101
 
76
- WORKDIR: {{WORKDIR}}
102
+ <workdir>{{WORKDIR}}</workdir>
77
103
 
78
- <TASK>
104
+ <task>
79
105
  Analyze change <change_id> from frontend/integration perspective:
80
106
  - Maintainability assessment
81
107
  - Scalability considerations
82
108
  - Integration conflicts
83
- </TASK>
84
-
85
- OUTPUT: JSON with analysis.
86
- Return ≤200 token structured summary (plugin-native protocol).`
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>`
87
125
  })
88
126
  ```
89
127
 
@@ -57,7 +57,7 @@ description: '需求 → 约束集(并行探索 + OPSX 提案)'
57
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
58
  2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → fallback Bash 调用,行为与 plugin 路径等价。
59
59
 
60
- **判定**:preflight `Bash` 跑 `ls ~/.claude/plugins/` 看有无 `codex@*` / `gemini@*` 子目录。
60
+ **判定**:preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`)。exit `0` + stdout `{"codex":"<ver>","gemini":"<ver>"}` → 通道 A(plugin 默认);非 `0` → 通道 B(wrapper BC fallback)。
61
61
 
62
62
  ⚠️ spec-research 命令在主线 context 内,**允许** `Agent(...)`——与 subagent "禁止嵌套 spawn" 约束不冲突。
63
63
 
@@ -81,6 +81,13 @@ description: '需求 → 约束集(并行探索 + OPSX 提案)'
81
81
 
82
82
  **Step 4.1**: In ONE message, spawn TWO models in parallel.
83
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}`
88
+
89
+ Prompt 结构按 `gpt-5-4-prompting` skill 推荐(XML 块、紧凑、操作性):`<role>` + `<task>` + `<grounding_rules>` + `<structured_output_contract>`。
90
+
84
91
  **通道 A — plugin spawn(默认)**:
85
92
 
86
93
  **FIRST Agent call ({{BACKEND_PRIMARY}} — backend boundaries)**:
@@ -88,20 +95,40 @@ description: '需求 → 约束集(并行探索 + OPSX 提案)'
88
95
  Agent({
89
96
  subagent_type: "codex:codex-rescue",
90
97
  description: "spec-research: backend boundary exploration",
91
- prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/analyzer.md
98
+ prompt: `<role>
99
+ ${backendRole}
100
+ </role>
92
101
 
93
- WORKDIR: {{WORKDIR}}
102
+ <workdir>{{WORKDIR}}</workdir>
94
103
 
95
- <TASK>
104
+ <task>
96
105
  Explore backend context boundaries for <change description>:
97
106
  - Existing structures and patterns
98
107
  - Conventions in use
99
108
  - Hard constraints limiting solution space
100
109
  - Dependencies and risks
101
- </TASK>
102
-
103
- OUTPUT: JSON using the output template above.
104
- Return ≤200 token structured summary (plugin-native protocol).`
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>`
105
132
  })
106
133
  ```
107
134
 
@@ -110,20 +137,40 @@ Return ≤200 token structured summary (plugin-native protocol).`
110
137
  Agent({
111
138
  subagent_type: "gemini:gemini-rescue",
112
139
  description: "spec-research: frontend boundary exploration",
113
- prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/analyzer.md
140
+ prompt: `<role>
141
+ ${frontendRole}
142
+ </role>
114
143
 
115
- WORKDIR: {{WORKDIR}}
144
+ <workdir>{{WORKDIR}}</workdir>
116
145
 
117
- <TASK>
146
+ <task>
118
147
  Explore frontend context boundaries for <change description>:
119
148
  - Existing structures and patterns
120
149
  - Conventions in use
121
150
  - Hard constraints limiting solution space
122
151
  - Dependencies and risks
123
- </TASK>
124
-
125
- OUTPUT: JSON using the output template above.
126
- Return ≤200 token structured summary (plugin-native protocol).`
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>`
127
174
  })
128
175
  ```
129
176
 
@@ -33,7 +33,7 @@ description: '双模型交叉审查(独立工具,随时可用)'
33
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
34
  2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → fallback Bash 调用,行为与 plugin 路径等价。
35
35
 
36
- **判定**:preflight `Bash` 跑 `ls ~/.claude/plugins/` 看有无 `codex@*` / `gemini@*` 子目录。
36
+ **判定**:preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`)。exit `0` + stdout `{"codex":"<ver>","gemini":"<ver>"}` → 通道 A(plugin 默认);非 `0` → 通道 B(wrapper BC fallback)。
37
37
 
38
38
  ⚠️ spec-review 命令在主线 context 内,**允许** `Agent(...)`——与 subagent "禁止嵌套 spawn" 约束不冲突。
39
39
 
@@ -43,6 +43,13 @@ description: '双模型交叉审查(独立工具,随时可用)'
43
43
 
44
44
  **Step 3.1**: In ONE message, spawn TWO models in parallel.
45
45
 
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
+
46
53
  **通道 A — plugin spawn(默认)**:
47
54
 
48
55
  **FIRST Agent call ({{BACKEND_PRIMARY}})**:
@@ -50,22 +57,37 @@ description: '双模型交叉审查(独立工具,随时可用)'
50
57
  Agent({
51
58
  subagent_type: "codex:codex-rescue",
52
59
  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):
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):
69
91
  {
70
92
  "findings": [
71
93
  {
@@ -81,8 +103,8 @@ OUTPUT (JSON):
81
103
  "passed_checks": ["List of verified constraints/properties"],
82
104
  "summary": "Overall assessment"
83
105
  }
84
-
85
- Return ≤200 token structured summary (plugin-native protocol).`
106
+ Return ≤200 token structured summary.
107
+ </structured_output_contract>`
86
108
  })
87
109
  ```
88
110
 
@@ -91,22 +113,36 @@ Return ≤200 token structured summary (plugin-native protocol).`
91
113
  Agent({
92
114
  subagent_type: "gemini:gemini-rescue",
93
115
  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):
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):
110
146
  {
111
147
  "findings": [
112
148
  {
@@ -122,8 +158,8 @@ OUTPUT (JSON):
122
158
  "passed_checks": ["List of verified aspects"],
123
159
  "summary": "Overall assessment"
124
160
  }
125
-
126
- Return ≤200 token structured summary (plugin-native protocol).`
161
+ Return ≤200 token structured summary.
162
+ </structured_output_contract>`
127
163
  })
128
164
  ```
129
165
 
@@ -164,10 +164,15 @@ Phase 8: INTEGRATION → Lead 全量验证 + 报告 + 清理
164
164
  1. **优先 plugin spawn**(默认):装了 `codex@openai-codex` + gemini plugin → 用 `Agent(subagent_type="codex:codex-rescue")` + `Agent(subagent_type="gemini:gemini-rescue")` 并行,主线接 ≤200 token 摘要。
165
165
  2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → fallback Bash 调用,行为与 plugin 路径等价。
166
166
 
167
- **判定**:preflight `Bash` 跑 `ls ~/.claude/plugins/` 看有无 `codex@*` / `gemini@*` 子目录。
167
+ **判定**:preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`)。exit `0` + stdout `{"codex":"<ver>","gemini":"<ver>"}` → 通道 A(plugin 默认);非 `0` → 通道 B(wrapper BC fallback)。
168
168
 
169
169
  - **CRITICAL**: 必须在一条消息中同时发起两个并行调用。
170
170
 
171
+ **⚠ 预备动作(spawn 前必须执行)**:`codex:codex-rescue` / `gemini:gemini-rescue` 是 thin forwarder,不会主动 Read 路径文件。主线必须在 spawn 前先 Read 两个角色提示词文件,把**内容**直接拼入下方 Agent prompt 的 `<role>` 块。
172
+
173
+ - backend role: `Read("~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/architect.md")` → `${backendRole}`
174
+ - frontend role: `Read("~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/architect.md")` → `${frontendRole}`
175
+
171
176
  **通道 A — plugin spawn(默认)**:
172
177
 
173
178
  **FIRST Agent call ({{BACKEND_PRIMARY}})**:
@@ -175,16 +180,38 @@ Phase 8: INTEGRATION → Lead 全量验证 + 报告 + 清理
175
180
  Agent({
176
181
  subagent_type: "codex:codex-rescue",
177
182
  description: "team Phase 2: 后端架构分析",
178
- prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/architect.md
183
+ prompt: `<role>
184
+ ${backendRole}
185
+ </role>
186
+
187
+ <workdir>{{WORKDIR}}</workdir>
179
188
 
180
- WORKDIR: {{WORKDIR}}
189
+ <task>
190
+ PRD:<PRD 内容>
181
191
 
182
- <TASK>
183
- 需求:<PRD 内容>
184
- 请分析后端架构:模块边界、API 设计、数据模型、依赖关系、实施建议。
185
- </TASK>
192
+ 请分析后端架构:
193
+ - 模块边界、API 设计、数据模型
194
+ - 依赖关系、关键算法选择
195
+ - 实施风险与建议
196
+ </task>
186
197
 
187
- Return ≤200 token structured summary (plugin-native protocol).`
198
+ <grounding_rules>
199
+ - 引用 file:line 标注现有代码模式
200
+ - 区分「现有模式已支持」vs「需要新建」
201
+ - 不要捏造未观察到的依赖
202
+ </grounding_rules>
203
+
204
+ <structured_output_contract>
205
+ Return JSON ONLY:
206
+ {
207
+ "module_boundaries": [{"name": "...", "responsibility": "...", "files_involved": []}],
208
+ "api_design": [{"endpoint": "...", "verb": "...", "purpose": "..."}],
209
+ "data_model": [{"entity": "...", "fields": [], "relations": []}],
210
+ "dependencies": [{"from": "...", "to": "...", "reason": "..."}],
211
+ "implementation_risks": [{"risk": "...", "mitigation": "..."}]
212
+ }
213
+ Return ≤200 token structured summary.
214
+ </structured_output_contract>`
188
215
  })
189
216
  ```
190
217
 
@@ -193,16 +220,38 @@ Return ≤200 token structured summary (plugin-native protocol).`
193
220
  Agent({
194
221
  subagent_type: "gemini:gemini-rescue",
195
222
  description: "team Phase 2: 前端架构分析",
196
- prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/architect.md
223
+ prompt: `<role>
224
+ ${frontendRole}
225
+ </role>
226
+
227
+ <workdir>{{WORKDIR}}</workdir>
228
+
229
+ <task>
230
+ PRD:<PRD 内容>
197
231
 
198
- WORKDIR: {{WORKDIR}}
232
+ 请分析前端架构:
233
+ - 组件拆分、状态管理、路由设计
234
+ - UI/UX 关键流程、无障碍考量
235
+ - 实施风险与建议
236
+ </task>
199
237
 
200
- <TASK>
201
- 需求:<PRD 内容>
202
- 请分析前端架构:组件拆分、状态管理、路由设计、UI/UX 要点、实施建议。
203
- </TASK>
238
+ <grounding_rules>
239
+ - 引用 file:line 标注现有组件 / 设计 token
240
+ - 区分「现有组件复用」vs「需新建」
241
+ - 不要捏造未观察到的设计系统约定
242
+ </grounding_rules>
204
243
 
205
- Return ≤200 token structured summary (plugin-native protocol).`
244
+ <structured_output_contract>
245
+ Return JSON ONLY:
246
+ {
247
+ "component_decomposition": [{"component": "...", "purpose": "...", "reuses": []}],
248
+ "state_management": {"approach": "...", "stores": []},
249
+ "routing": [{"path": "...", "screen": "..."}],
250
+ "ux_flows": [{"flow": "...", "steps": []}],
251
+ "implementation_risks": [{"risk": "...", "mitigation": "..."}]
252
+ }
253
+ Return ≤200 token structured summary.
254
+ </structured_output_contract>`
206
255
  })
207
256
  ```
208
257
 
@@ -357,7 +406,12 @@ Return ≤200 token structured summary (plugin-native protocol).`
357
406
  - `Bash: git diff` 获取完整变更内容。
358
407
 
359
408
  2. **{{BACKEND_PRIMARY}} + {{FRONTEND_PRIMARY}} 并行审查(PARALLEL)**
360
- - 模式与 Phase 2 相同(plugin 优先 + wrapper BC fallback),使用 reviewer prompt
409
+ - 模式与 Phase 2 相同(plugin 优先 + wrapper BC fallback),使用 reviewer prompt
410
+
411
+ **⚠ 预备动作(spawn 前必须执行)**:主线先 Read 角色提示词,把内容拼入 `<role>` 块。
412
+
413
+ - backend role: `Read("~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/reviewer.md")` → `${backendRole}`
414
+ - frontend role: `Read("~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/reviewer.md")` → `${frontendRole}`
361
415
 
362
416
  **通道 A — plugin spawn(默认)**:
363
417
 
@@ -366,23 +420,39 @@ Return ≤200 token structured summary (plugin-native protocol).`
366
420
  Agent({
367
421
  subagent_type: "codex:codex-rescue",
368
422
  description: "team Phase 6: 后端审查",
369
- prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/reviewer.md
423
+ prompt: `<role>
424
+ ${backendRole}
425
+ </role>
370
426
 
371
- WORKDIR: {{WORKDIR}}
427
+ <workdir>{{WORKDIR}}</workdir>
372
428
 
373
- <TASK>
374
- 审查以下变更:
429
+ <task>
430
+ 审查以下变更(后端维度:逻辑 / 安全 / 性能 / 错误处理):
375
431
  <git diff 输出或变更文件列表>
376
- </TASK>
377
432
 
378
- OUTPUT (JSON):
433
+ Read-only review. Do NOT modify any file.
434
+ </task>
435
+
436
+ <grounding_rules>
437
+ - 每条 finding 必须含 file:line
438
+ - 区分 bug(可触发失败路径)与 concern(风格/可维护性偏好)
439
+ - 检查过但没问题的项放进 passed_checks
440
+ </grounding_rules>
441
+
442
+ <dig_deeper_nudge>
443
+ - 同根因可能扩散到其他文件——抽样验证
444
+ - 一条精准 Critical > 五条模糊 Warning
445
+ </dig_deeper_nudge>
446
+
447
+ <structured_output_contract>
448
+ Return JSON ONLY:
379
449
  {
380
450
  "findings": [{"severity": "Critical|Warning|Info", "dimension": "logic|security|performance|error_handling", "file": "path", "line": N, "description": "描述", "fix_suggestion": "修复建议"}],
381
451
  "passed_checks": ["检查项"],
382
452
  "summary": "总体评估"
383
453
  }
384
-
385
- Return ≤200 token structured summary (plugin-native protocol).`
454
+ Return ≤200 token structured summary.
455
+ </structured_output_contract>`
386
456
  })
387
457
  ```
388
458
 
@@ -391,23 +461,38 @@ Return ≤200 token structured summary (plugin-native protocol).`
391
461
  Agent({
392
462
  subagent_type: "gemini:gemini-rescue",
393
463
  description: "team Phase 6: 前端审查",
394
- prompt: `ROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/reviewer.md
464
+ prompt: `<role>
465
+ ${frontendRole}
466
+ </role>
395
467
 
396
- WORKDIR: {{WORKDIR}}
468
+ <workdir>{{WORKDIR}}</workdir>
397
469
 
398
- <TASK>
399
- 审查以下变更:
470
+ <task>
471
+ 审查以下变更(前端维度:模式一致性 / 可维护性 / 无障碍 / UX / 前端安全):
400
472
  <git diff 输出或变更文件列表>
401
- </TASK>
402
473
 
403
- OUTPUT (JSON):
474
+ Read-only review. Do NOT modify any file.
475
+ </task>
476
+
477
+ <grounding_rules>
478
+ - 每条 finding 必须含 file:line
479
+ - 检查过但没问题的项放进 passed_checks
480
+ </grounding_rules>
481
+
482
+ <dig_deeper_nudge>
483
+ - 同模式问题可能扩散到相邻文件——抽样验证
484
+ - 一条精准 Critical > 五条模糊 Warning
485
+ </dig_deeper_nudge>
486
+
487
+ <structured_output_contract>
488
+ Return JSON ONLY:
404
489
  {
405
490
  "findings": [{"severity": "Critical|Warning|Info", "dimension": "patterns|maintainability|accessibility|ux|frontend_security", "file": "path", "line": N, "description": "描述", "fix_suggestion": "修复建议"}],
406
491
  "passed_checks": ["检查项"],
407
492
  "summary": "总体评估"
408
493
  }
409
-
410
- Return ≤200 token structured summary (plugin-native protocol).`
494
+ Return ≤200 token structured summary.
495
+ </structured_output_contract>`
411
496
  })
412
497
  ```
413
498
 
@@ -47,7 +47,7 @@ CCG 把双模型并行通道从 `Bash(codeagent-wrapper)` **默认切换**为 pl
47
47
  1. **优先 plugin spawn**(默认):装了 `codex@openai-codex` + `gemini@google-gemini` plugin → 用 `Agent(subagent_type="codex:codex-rescue")` + `Agent(subagent_type="gemini:gemini-rescue")` 并行,主线接 ≤200 token 摘要。
48
48
  2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → fallback 到 Bash 调用,行为与 plugin 路径等价。
49
49
 
50
- **判定**:preflight `Bash` 跑 `ls ~/.claude/plugins/` 看有无 `codex@*` / `gemini@*` 子目录。helper `src/utils/plugin-detection.ts`。
50
+ **判定**:preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`)。exit `0` + stdout `{"codex":"<ver>","gemini":"<ver>"}` 通道 A(plugin 默认);非 `0` → 通道 B(wrapper BC fallback)。
51
51
 
52
52
  ⚠️ Test 命令在主线 context 内,**允许** `Agent(...)`——与 subagent "禁止嵌套 spawn" 约束不冲突。
53
53