ccgx-workflow 2.4.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +134 -277
- package/README.zh-CN.md +134 -272
- package/dist/chunks/version-build.mjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +709 -16
- package/dist/index.d.ts +709 -16
- package/dist/index.mjs +1061 -30
- package/dist/shared/{ccgx-workflow.j1spUsik.mjs → ccgx-workflow.CdHnJLak.mjs} +106 -22
- package/package.json +1 -1
- package/templates/commands/agents/code-fixer.md +6 -6
- package/templates/commands/agents/phase-runner.md +46 -14
- package/templates/commands/agents/plan-checker.md +10 -0
- package/templates/commands/analyze.md +66 -25
- package/templates/commands/autonomous.md +428 -225
- package/templates/commands/cancel.md +9 -0
- package/templates/commands/codex-exec.md +12 -11
- package/templates/commands/context.md +14 -0
- package/templates/commands/debate.md +10 -6
- package/templates/commands/execute.md +76 -28
- package/templates/commands/optimize.md +53 -25
- package/templates/commands/plan.md +78 -28
- package/templates/commands/review.md +26 -19
- package/templates/commands/spec-impl.md +68 -127
- package/templates/commands/spec-plan.md +61 -82
- package/templates/commands/spec-research.md +35 -92
- package/templates/commands/spec-review.md +34 -119
- package/templates/commands/status.md +1 -0
- package/templates/commands/team-exec.md +45 -13
- package/templates/commands/team.md +64 -167
- package/templates/commands/test.md +56 -34
- package/templates/commands/verify-work.md +36 -13
- package/templates/commands/verify.md +35 -0
- package/templates/commands/workflow.md +22 -37
- package/templates/hooks/ccg-loop-detector.cjs +39 -8
- package/templates/hooks/ccg-statusline.js +142 -2
- package/templates/hooks/ccg-stop-gate.cjs +248 -19
- package/templates/hooks/ccg-subagent-context.cjs +505 -0
- package/templates/scripts/ccg-state-lock.cjs +510 -0
- package/templates/scripts/ccg-team-schedule.cjs +328 -0
- package/templates/scripts/ccgx-call-plugin.mjs +494 -141
- package/templates/scripts/invoke-model.mjs +28 -1
- package/templates/scripts/task-store.cjs +614 -0
- package/templates/skills/tools/verify-change/SKILL.md +7 -0
- package/templates/skills/tools/verify-module/SKILL.md +7 -0
- package/templates/skills/tools/verify-quality/SKILL.md +7 -0
- package/templates/skills/tools/verify-security/SKILL.md +8 -0
|
@@ -27,105 +27,64 @@ description: '多模型分析 → 消除歧义 → 零决策可执行计划'
|
|
|
27
27
|
|
|
28
28
|
**调用通道路由(CCG codeagent 退役,v2.2.0+)**
|
|
29
29
|
|
|
30
|
-
双模型并行通道从 `Bash(codeagent-wrapper)` **默认切换**为 plugin
|
|
30
|
+
双模型并行通道从 `Bash(codeagent-wrapper)` **默认切换**为 Bash 直调 plugin 快路径:
|
|
31
31
|
|
|
32
|
-
1. **优先 plugin
|
|
32
|
+
1. **优先 Bash 直调 plugin 快路径**(默认):装了 `codex@openai-codex` + gemini plugin(推荐 `gemini@gemini-ccgx` fork;或上游 `gemini@google-gemini` 配 repatch 脚本)→ 用 `{{CODEX_BASH_TASK}}` / `{{GEMINI_BASH_TASK}}` 占位符 + `--prompt-file` 并行 Bash 直调(review.md 同款),绕开 sonnet wrapper silent-fallback;**仅 `gemini-ccgx` fork 走 gemini-batch 29s 快路径,上游 + repatch 仍走 companion(ACP) 慢路径**(Windows 实测 5+min 卡死风险仍在),主线 `JSON.parse(stdout).text`。
|
|
33
33
|
2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → fallback Bash 调用,行为与 plugin 路径等价。
|
|
34
34
|
|
|
35
|
-
**判定**:preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`)。exit `0` + stdout `{"codex":"<ver>","gemini":"<ver>"}` → 通道 A(
|
|
35
|
+
**判定**:preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`)。exit `0` + stdout `{"codex":"<ver>","gemini":"<ver>"}` → 通道 A(Bash 直调快路径,默认);非 `0` → 通道 B(wrapper BC fallback)。
|
|
36
36
|
|
|
37
|
-
⚠️ spec-plan 命令在主线 context
|
|
37
|
+
⚠️ spec-plan 命令在主线 context 内执行,通道 A 走 Bash 直调(不再 spawn `Agent(...)`),无嵌套 spawn 顾虑。
|
|
38
38
|
|
|
39
39
|
- **CRITICAL**: You MUST launch BOTH {{BACKEND_PRIMARY}} AND {{FRONTEND_PRIMARY}} in a SINGLE message with TWO parallel tool calls.
|
|
40
40
|
- **DO NOT** call one model first and wait. Launch BOTH simultaneously.
|
|
41
41
|
- **工作目录**:`{{WORKDIR}}` **必须通过 Bash 执行 `pwd`(Unix)或 `cd`(Windows CMD)获取当前工作目录的绝对路径**,禁止从 `$HOME` 或环境变量推断。如果用户通过 `/add-dir` 添加了多个工作区,先确定任务相关的工作区。
|
|
42
42
|
|
|
43
|
-
**Step 2.1**: In ONE message, spawn TWO
|
|
43
|
+
**Step 2.1**: In ONE message, spawn TWO Bash-direct helper calls in parallel.
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
**通道 A — Bash 直调 plugin 快路径(默认)**:
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
-
|
|
47
|
+
> 占位符 `{{CODEX_BASH_TASK}}` / `{{GEMINI_BASH_TASK}}` 由 install 渲染为 `node <ccgx-call-plugin.mjs 绝对路径> <vendor> --json`。
|
|
48
|
+
> LLM 只需 Write tmpfile + 追加 `--prompt-file <tmpfile>` 运行,**不写 `Agent(...)`、不内联 role 全文**。
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
**Step 2.1a — Write 两个 tmpfile**(≤2KB;让模型自己 Read 角色文件):
|
|
51
|
+
```
|
|
52
|
+
Write({ file_path: ".context/tmp/ccg-specplan-codex-$JOB.txt", content: <backend 任务模板> })
|
|
53
|
+
Write({ file_path: ".context/tmp/ccg-specplan-gemini-$JOB.txt", content: <frontend 任务模板> })
|
|
54
|
+
```
|
|
51
55
|
|
|
52
|
-
|
|
56
|
+
backend 任务模板:
|
|
57
|
+
```
|
|
58
|
+
# 任务:spec-plan 后端实现分析
|
|
59
|
+
|
|
60
|
+
工作目录:{{WORKDIR}}(你已在此)
|
|
61
|
+
角色定义见 ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/analyzer.md,**先用 Read 工具读取再开始**。
|
|
62
|
+
**必须前台执行,禁止 --background / --wait**(外层已 run_in_background,插件内再 background = 双重后台,stop-gate/status/cancel 全盲)。对文件系统零写入。
|
|
63
|
+
|
|
64
|
+
Analyze change <change_id> from backend perspective: implementation approach / technical risks / alternative architectures / edge cases & failure modes.
|
|
65
|
+
Cite file:line for claims; mark hypotheses; distinguish observed vs potential risks.
|
|
66
|
+
Return JSON ONLY:
|
|
67
|
+
{ "approach": "...", "alternatives_rejected": [{"alt":"...","reason":"..."}],
|
|
68
|
+
"technical_risks": [{"risk":"...","severity":"high|medium|low","mitigation":"..."}],
|
|
69
|
+
"edge_cases": ["..."], "failure_modes": ["..."] }
|
|
70
|
+
```
|
|
53
71
|
|
|
54
|
-
|
|
72
|
+
frontend 任务模板(角色换 {{FRONTEND_PRIMARY}}/analyzer.md,同样硬约束):
|
|
55
73
|
```
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
})
|
|
74
|
+
Analyze change <change_id> from frontend/integration perspective: maintainability / scalability / integration conflicts.
|
|
75
|
+
Return JSON ONLY:
|
|
76
|
+
{ "maintainability": {"score":"good|moderate|concerning","factors":["..."]},
|
|
77
|
+
"scalability": [{"dimension":"...","consideration":"..."}],
|
|
78
|
+
"integration_conflicts": [{"target":"...","conflict":"...","resolution":"..."}] }
|
|
91
79
|
```
|
|
92
80
|
|
|
93
|
-
**
|
|
81
|
+
**Step 2.1b — 并行 Bash 直调**(同一 message,`run_in_background: true`;纯分析只读,加 `--no-write`):
|
|
94
82
|
```
|
|
95
|
-
|
|
96
|
-
|
|
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>`
|
|
125
|
-
})
|
|
83
|
+
Bash({ command: `{{CODEX_BASH_TASK}} --no-write --prompt-file .context/tmp/ccg-specplan-codex-$JOB.txt`, description: "spec-plan: backend (codex direct)", run_in_background: true })
|
|
84
|
+
Bash({ command: `{{GEMINI_BASH_TASK}} --no-write --prompt-file .context/tmp/ccg-specplan-gemini-$JOB.txt`, description: "spec-plan: frontend (gemini direct)", run_in_background: true })
|
|
126
85
|
```
|
|
127
86
|
|
|
128
|
-
**通道 B — codeagent-wrapper fallback**(plugin 未装时降级,并行用 `run_in_background: true
|
|
87
|
+
**通道 B — codeagent-wrapper fallback**(plugin 未装时降级,并行用 `run_in_background: true`;wrapper 的 `ROLE_FILE:` 由 `invoke-model.mjs` 解析故保留):
|
|
129
88
|
|
|
130
89
|
```
|
|
131
90
|
Bash({
|
|
@@ -145,8 +104,8 @@ Return ≤200 token structured summary.
|
|
|
145
104
|
> ⚠️ 通道 B `codeagent-wrapper` 已标 **deprecated**,仅为不能升级 plugin 的环境保留。
|
|
146
105
|
|
|
147
106
|
**Step 2.2 (事件驱动)**:
|
|
148
|
-
- **通道 A(
|
|
149
|
-
- **通道 B(BC wrapper
|
|
107
|
+
- **通道 A(Bash 直调快路径)**:spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在新 turn Read stdout 后 `JSON.parse(stdout).text` 取真实输出。两个 task 都收到通知后才进 step 2.3。
|
|
108
|
+
- **通道 B(BC wrapper)**:同上 bg + 事件驱动,但 parse `--progress` 行而非 `.text`。**不调 TaskOutput**。
|
|
150
109
|
|
|
151
110
|
⛔ **禁止**:调 `TaskOutput({block: true, timeout: 600000})` (旧 freeze poll 模式) / Kill task。
|
|
152
111
|
⚠️ **失败处理**:notification status=failed / exit ≠ 0 / parse 失败 → v1.7.87 标准 2-retry / 5s / 3-attempts;3 次全失败才降级单模型。
|
|
@@ -169,6 +128,8 @@ Return ≤200 token structured summary.
|
|
|
169
128
|
|
|
170
129
|
Iterate with user until ALL ambiguities resolved.
|
|
171
130
|
|
|
131
|
+
**REQ 编号固化(歧义全消后必做)**:把确认的需求清单编号为 `REQ-01`..`REQ-NN`,以 checkbox 格式 `- [ ] **REQ-NN** <描述>` 写回 `proposal.md` 的 Requirements 段(已有编号则沿用,不重排)。该格式是 Step 5.6 Requirements Coverage Gate 确定性提取的输入约定(提取规则权威:`src/utils/plan-checker.ts:extractRequirementIds`,checkbox 与表格首列双格式都认)。
|
|
132
|
+
|
|
172
133
|
4. **PBT Property Extraction**
|
|
173
134
|
- **{{BACKEND_PRIMARY}}**: "Extract PBT properties. For each requirement: [INVARIANT] → [FALSIFICATION STRATEGY]"
|
|
174
135
|
- **{{FRONTEND_PRIMARY}}**: "Define system properties: [PROPERTY] | [DEFINITION] | [BOUNDARY CONDITIONS] | [COUNTEREXAMPLE GENERATION]"
|
|
@@ -249,6 +210,7 @@ Return ≤200 token structured summary.
|
|
|
249
210
|
/opsx:continue
|
|
250
211
|
```
|
|
251
212
|
- The OPSX skill will use the above summary to create specs.md, design.md, and tasks.md.
|
|
213
|
+
- **tasks.md REQ 标注规则**:每条 task 行尾标注覆盖的 REQ(如 `- [ ] 1.1 实现密码重置接口 (REQ-01)`),供 Step 5.6 做 word-boundary 覆盖匹配。
|
|
252
214
|
- **Note**: This is an internal call. If this step fails, guide the user to re-run `/ccg:spec-plan`.
|
|
253
215
|
- **STOP**: After artifacts are generated, verify they exist and inform user:
|
|
254
216
|
"Plan phase complete. Artifacts generated: specs.md, design.md, tasks.md. Run `/ccg:spec-impl` to start implementation."
|
|
@@ -284,7 +246,24 @@ Return ≤200 token structured summary.
|
|
|
284
246
|
options: ["force: 忽略 BLOCKER 强制进入实施", "guide: 提供具体指导让 planner 再试", "abort: 放弃当前 plan"]
|
|
285
247
|
```
|
|
286
248
|
|
|
287
|
-
只有 plan-checker ✅ 放行 后才进入下一步(
|
|
249
|
+
只有 plan-checker ✅ 放行 后才进入下一步(Requirements Coverage Gate)。
|
|
250
|
+
|
|
251
|
+
5.6. **Requirements Coverage Gate(确定性,[Gate: escalation])**
|
|
252
|
+
|
|
253
|
+
plan-checker 放行后跑确定性 REQ-ID 覆盖检查(**算法权威:`src/utils/plan-checker.ts:extractRequirementIds` + `checkRequirementsCoverage` 等价规则**):
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
a) 从 proposal.md 提取 REQ-IDs(checkbox `- [ ] **REQ-NN**` 或表格首列 `| REQ-NN |`;
|
|
257
|
+
跳过表格分隔行与表头行;去重保序)
|
|
258
|
+
b) proposal.md 无任何 REQ-ID → SKIP(输出一行 skip 原因,进入 Step 6)
|
|
259
|
+
c) 对 specs.md + tasks.md 拼接全文做 word-boundary 匹配(REQ-1 不误配 REQ-10)
|
|
260
|
+
d) uncovered > 0 → 输出 GSD 风格 gap 表(| REQ-ID | Status | Covered By |)
|
|
261
|
+
+ **阻断**,AskUserQuestion 三选:
|
|
262
|
+
1. re-plan 补覆盖(推荐)——回 Step 5 修订 specs/tasks
|
|
263
|
+
2. 移到下一 change——把未覆盖 REQ 显式写入新的 OPSX change(不能口头承诺)
|
|
264
|
+
3. force 接受 gap——在 design.md 追加 "## Coverage Override" 段记录
|
|
265
|
+
e) 全覆盖 → 输出 `✓ Requirements coverage: N/N`,进入 Step 6
|
|
266
|
+
```
|
|
288
267
|
|
|
289
268
|
6. **Context Checkpoint**
|
|
290
269
|
- Report current context usage.
|
|
@@ -52,14 +52,14 @@ description: '需求 → 约束集(并行探索 + OPSX 提案)'
|
|
|
52
52
|
|
|
53
53
|
**调用通道路由(CCG codeagent 退役,v2.2.0+)**
|
|
54
54
|
|
|
55
|
-
双模型并行通道从 `Bash(codeagent-wrapper)` **默认切换**为 plugin
|
|
55
|
+
双模型并行通道从 `Bash(codeagent-wrapper)` **默认切换**为 Bash 直调 plugin 快路径:
|
|
56
56
|
|
|
57
|
-
1. **优先 plugin
|
|
57
|
+
1. **优先 Bash 直调 plugin 快路径**(默认):装了 `codex@openai-codex` + gemini plugin(推荐 `gemini@gemini-ccgx` fork,含 P-1..P-21 + W1/W2/I1 patch;或上游 `gemini@google-gemini` 配 repatch 脚本)→ 用 `{{CODEX_BASH_TASK}}` / `{{GEMINI_BASH_TASK}}` 占位符 + `--prompt-file` 并行 Bash 直调(review.md 同款),绕开 sonnet wrapper silent-fallback;**仅 `gemini-ccgx` fork 走 gemini-batch 29s 快路径,上游 + repatch 仍走 companion(ACP) 慢路径**,主线 `JSON.parse(stdout).text`。
|
|
58
58
|
2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → fallback Bash 调用,行为与 plugin 路径等价。
|
|
59
59
|
|
|
60
|
-
**判定**:preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`)。exit `0` + stdout `{"codex":"<ver>","gemini":"<ver>"}` → 通道 A(
|
|
60
|
+
**判定**:preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`)。exit `0` + stdout `{"codex":"<ver>","gemini":"<ver>"}` → 通道 A(Bash 直调快路径,默认);非 `0` → 通道 B(wrapper BC fallback)。
|
|
61
61
|
|
|
62
|
-
⚠️ spec-research 命令在主线 context
|
|
62
|
+
⚠️ spec-research 命令在主线 context 内执行,通道 A 走 Bash 直调(不再 spawn `Agent(...)`),无嵌套 spawn 顾虑。
|
|
63
63
|
|
|
64
64
|
- **CRITICAL**: You MUST launch BOTH {{BACKEND_PRIMARY}} AND {{FRONTEND_PRIMARY}} in a SINGLE message with TWO parallel tool calls.
|
|
65
65
|
- **DO NOT** call one model first and wait. Launch BOTH simultaneously.
|
|
@@ -79,102 +79,45 @@ description: '需求 → 约束集(并行探索 + OPSX 提案)'
|
|
|
79
79
|
}
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
**Step 4.1**: In ONE message, spawn TWO
|
|
82
|
+
**Step 4.1**: In ONE message, spawn TWO Bash-direct helper calls in parallel.
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
**通道 A — Bash 直调 plugin 快路径(默认)**:
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
-
|
|
86
|
+
> 占位符 `{{CODEX_BASH_TASK}}` / `{{GEMINI_BASH_TASK}}` 由 install 渲染为 `node <ccgx-call-plugin.mjs 绝对路径> <vendor> --json`。
|
|
87
|
+
> LLM 只需 Write tmpfile + 追加 `--prompt-file <tmpfile>` 运行,**不写 `Agent(...)`、不内联 role 全文**。
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
**Step 4.1a — Write 两个 tmpfile**(≤2KB;让模型自己 Read 角色文件,避免内联 role 全文撞 argv 上限):
|
|
90
|
+
```
|
|
91
|
+
Write({ file_path: ".context/tmp/ccg-specresearch-codex-$JOB.txt", content: <下方任务模板(backend)> })
|
|
92
|
+
Write({ file_path: ".context/tmp/ccg-specresearch-gemini-$JOB.txt", content: <下方任务模板(frontend)> })
|
|
93
|
+
```
|
|
92
94
|
|
|
93
|
-
|
|
95
|
+
任务模板(backend 版;frontend 版把 backend→frontend、analyzer 路径换前端):
|
|
94
96
|
```
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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>`
|
|
132
|
-
})
|
|
97
|
+
# 任务:spec-research 边界探索
|
|
98
|
+
|
|
99
|
+
工作目录:{{WORKDIR}}(你已在此,可直接用 Bash/Read)
|
|
100
|
+
角色定义见 ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/analyzer.md,**先用 Read 工具读取该文件再开始**。
|
|
101
|
+
**必须前台执行,禁止 --background / --wait**(外层已 run_in_background,插件内再 background = 双重后台,stop-gate/status/cancel 全盲)。对文件系统零写入。
|
|
102
|
+
|
|
103
|
+
Explore backend context boundaries for <change description>:
|
|
104
|
+
- Existing structures and patterns / Conventions in use
|
|
105
|
+
- Hard constraints limiting solution space / Dependencies and risks
|
|
106
|
+
Cite file:line for every claim; mark hypotheses explicitly; list unanswerable questions in open_questions.
|
|
107
|
+
|
|
108
|
+
Return JSON ONLY:
|
|
109
|
+
{ "module_name": "...", "existing_structures": [...], "existing_conventions": [...],
|
|
110
|
+
"constraints_discovered": [...], "open_questions": [...], "dependencies": [...],
|
|
111
|
+
"risks": [...], "success_criteria_hints": [...] }
|
|
133
112
|
```
|
|
134
113
|
|
|
135
|
-
**
|
|
114
|
+
**Step 4.1b — 并行 Bash 直调**(同一 message,`run_in_background: true`;纯探索只读,加 `--no-write`):
|
|
136
115
|
```
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
})
|
|
116
|
+
Bash({ command: `{{CODEX_BASH_TASK}} --no-write --prompt-file .context/tmp/ccg-specresearch-codex-$JOB.txt`, description: "spec-research: backend (codex direct)", run_in_background: true })
|
|
117
|
+
Bash({ command: `{{GEMINI_BASH_TASK}} --no-write --prompt-file .context/tmp/ccg-specresearch-gemini-$JOB.txt`, description: "spec-research: frontend (gemini direct)", run_in_background: true })
|
|
175
118
|
```
|
|
176
119
|
|
|
177
|
-
**通道 B — codeagent-wrapper fallback**(plugin 未装时降级,并行用 `run_in_background: true
|
|
120
|
+
**通道 B — codeagent-wrapper fallback**(plugin 未装时降级,并行用 `run_in_background: true`;wrapper 的 `ROLE_FILE:` 由 `invoke-model.mjs` 解析故保留):
|
|
178
121
|
|
|
179
122
|
```
|
|
180
123
|
Bash({
|
|
@@ -194,8 +137,8 @@ Return ≤200 token structured summary.
|
|
|
194
137
|
> ⚠️ 通道 B `codeagent-wrapper` 已标 **deprecated**,仅为不能升级 plugin 的环境保留。
|
|
195
138
|
|
|
196
139
|
**Step 4.2 (事件驱动)**:
|
|
197
|
-
- **通道 A(
|
|
198
|
-
- **通道 B(BC wrapper
|
|
140
|
+
- **通道 A(Bash 直调快路径)**:spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在新 turn Read stdout 后 `JSON.parse(stdout).text` 取真实输出。两个 task 都收到通知后才进 step 4.3。
|
|
141
|
+
- **通道 B(BC wrapper)**:同上 bg + 事件驱动,但 parse `--progress` 行而非 `.text`。**不调 TaskOutput**。
|
|
199
142
|
|
|
200
143
|
⛔ **禁止**:调 `TaskOutput({block: true, timeout: 600000})` (旧 freeze poll 模式) / Kill task。
|
|
201
144
|
⚠️ **失败处理**:notification status=failed / exit ≠ 0 / parse 失败 → v1.7.87 标准 2-retry / 5s / 3-attempts;3 次全失败才降级单模型。
|
|
@@ -28,142 +28,57 @@ description: '双模型交叉审查(独立工具,随时可用)'
|
|
|
28
28
|
|
|
29
29
|
**调用通道路由(CCG codeagent 退役,v2.2.0+)**
|
|
30
30
|
|
|
31
|
-
双模型并行通道从 `Bash(codeagent-wrapper)` **默认切换**为 plugin
|
|
31
|
+
双模型并行通道从 `Bash(codeagent-wrapper)` **默认切换**为 Bash 直调 plugin 快路径:
|
|
32
32
|
|
|
33
|
-
1. **优先 plugin
|
|
33
|
+
1. **优先 Bash 直调 plugin 快路径**(默认):装了 `codex@openai-codex` + gemini plugin(推荐 `gemini@gemini-ccgx` fork;或上游 `gemini@google-gemini` 配 repatch 脚本)→ 用 `{{CODEX_BASH_TASK}}` / `{{GEMINI_BASH_TASK}}` 占位符 + `--prompt-file` 并行 Bash 直调(review.md 同款),绕开 sonnet wrapper silent-fallback;**仅 `gemini-ccgx` fork 走 gemini-batch 29s 快路径,上游 + repatch 仍走 companion(ACP) 慢路径**(Windows 实测 5+min 卡死风险仍在),主线 `JSON.parse(stdout).text`。
|
|
34
34
|
2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → fallback Bash 调用,行为与 plugin 路径等价。
|
|
35
35
|
|
|
36
|
-
**判定**:preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`)。exit `0` + stdout `{"codex":"<ver>","gemini":"<ver>"}` → 通道 A(
|
|
36
|
+
**判定**:preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`)。exit `0` + stdout `{"codex":"<ver>","gemini":"<ver>"}` → 通道 A(Bash 直调快路径,默认);非 `0` → 通道 B(wrapper BC fallback)。
|
|
37
37
|
|
|
38
|
-
⚠️ spec-review 命令在主线 context
|
|
38
|
+
⚠️ spec-review 命令在主线 context 内执行,通道 A 走 Bash 直调(不再 spawn `Agent(...)`),无嵌套 spawn 顾虑;本路径输出直接落地(advance/revise verdict),Bash 直调消除 sonnet wrapper silent-fallback 风险。
|
|
39
39
|
|
|
40
40
|
- **CRITICAL**: You MUST launch BOTH {{BACKEND_PRIMARY}} AND {{FRONTEND_PRIMARY}} in a SINGLE message with TWO parallel tool calls.
|
|
41
41
|
- **DO NOT** call one model first and wait. Launch BOTH simultaneously.
|
|
42
42
|
- **工作目录**:`{{WORKDIR}}` **必须通过 Bash 执行 `pwd`(Unix)或 `cd`(Windows CMD)获取当前工作目录的绝对路径**,禁止从 `$HOME` 或环境变量推断。如果用户通过 `/add-dir` 添加了多个工作区,先确定任务相关的工作区。
|
|
43
43
|
|
|
44
|
-
**Step 3.1**: In ONE message, spawn TWO
|
|
44
|
+
**Step 3.1**: In ONE message, spawn TWO Bash-direct helper calls in parallel.
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
**通道 A — Bash 直调 plugin 快路径(默认)**:
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
-
|
|
48
|
+
> 占位符 `{{CODEX_BASH_TASK}}` / `{{GEMINI_BASH_TASK}}` 由 install 渲染为 `node <ccgx-call-plugin.mjs 绝对路径> <vendor> --json`。
|
|
49
|
+
> LLM 只需 Write tmpfile + 追加 `--prompt-file <tmpfile>` 运行,**不写 `Agent(...)`、不内联 role 全文**,让模型自己 Read 角色文件 + `git diff` 读 proposal 变更。
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
**Step 3.1a — Write 两个 tmpfile**(≤2KB):
|
|
52
|
+
```
|
|
53
|
+
Write({ file_path: ".context/tmp/ccg-specreview-codex-$JOB.txt", content: <backend review 模板> })
|
|
54
|
+
Write({ file_path: ".context/tmp/ccg-specreview-gemini-$JOB.txt", content: <frontend review 模板> })
|
|
55
|
+
```
|
|
54
56
|
|
|
55
|
-
|
|
57
|
+
backend review 模板:
|
|
56
58
|
```
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
})
|
|
59
|
+
# 任务:spec-review 后端/逻辑审查
|
|
60
|
+
|
|
61
|
+
工作目录:{{WORKDIR}}(你已在此)
|
|
62
|
+
角色定义见 ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/reviewer.md,**先用 Read 工具读取再开始**。
|
|
63
|
+
**必须前台执行,禁止 --background / --wait**(外层已 run_in_background,插件内再 background = 双重后台,stop-gate/status/cancel 全盲)。只读审查,不修改任何文件。
|
|
64
|
+
|
|
65
|
+
自己跑 `git diff` 读 proposal <proposal_id> 实现。沿后端维度审:
|
|
66
|
+
1. Spec Compliance 2. PBT 不变量/幂等/边界 3. 逻辑正确性/边界/错误处理 4. 后端安全(注入/鉴权/输入校验) 5. 回归风险(接口兼容/类型安全/breaking)
|
|
67
|
+
每个 finding 必引 file:line;满足的约束列 passed_checks;无法验证如实说,禁止编造;区分 bug 与 concern。
|
|
68
|
+
Return JSON ONLY:
|
|
69
|
+
{ "findings": [{ "severity":"Critical|Warning|Info","dimension":"spec_compliance|pbt|logic|security|regression","file":"...","line":42,"description":"...","constraint_violated":"...","fix_suggestion":"..." }],
|
|
70
|
+
"passed_checks": ["..."], "summary": "..." }
|
|
109
71
|
```
|
|
110
72
|
|
|
111
|
-
|
|
73
|
+
frontend review 模板(角色换 {{FRONTEND_PRIMARY}}/reviewer.md,同硬约束;维度=Pattern 一致性/可维护性/集成风险/前端安全(XSS/CSRF/敏感数据)/Spec 意图对齐;dimension 枚举 patterns|maintainability|integration|security|alignment,字段含 spec_reference)。
|
|
74
|
+
|
|
75
|
+
**Step 3.1b — 并行 Bash 直调**(同一 message,`run_in_background: true`;只读审查,加 `--no-write`):
|
|
112
76
|
```
|
|
113
|
-
|
|
114
|
-
|
|
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>`
|
|
163
|
-
})
|
|
77
|
+
Bash({ command: `{{CODEX_BASH_TASK}} --no-write --prompt-file .context/tmp/ccg-specreview-codex-$JOB.txt`, description: "spec-review: backend (codex direct)", run_in_background: true })
|
|
78
|
+
Bash({ command: `{{GEMINI_BASH_TASK}} --no-write --prompt-file .context/tmp/ccg-specreview-gemini-$JOB.txt`, description: "spec-review: frontend (gemini direct)", run_in_background: true })
|
|
164
79
|
```
|
|
165
80
|
|
|
166
|
-
**通道 B — codeagent-wrapper fallback**(plugin 未装时降级,并行用 `run_in_background: true
|
|
81
|
+
**通道 B — codeagent-wrapper fallback**(plugin 未装时降级,并行用 `run_in_background: true`;wrapper 的 `ROLE_FILE:` 由 `invoke-model.mjs` 解析故保留):
|
|
167
82
|
|
|
168
83
|
```
|
|
169
84
|
Bash({
|
|
@@ -183,8 +98,8 @@ Return ≤200 token structured summary.
|
|
|
183
98
|
> ⚠️ 通道 B `codeagent-wrapper` 已标 **deprecated**,仅为不能升级 plugin 的环境保留。
|
|
184
99
|
|
|
185
100
|
**Step 3.2 (事件驱动)**:
|
|
186
|
-
- **通道 A(
|
|
187
|
-
- **通道 B(BC wrapper
|
|
101
|
+
- **通道 A(Bash 直调快路径)**:spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在新 turn Read stdout 后 `JSON.parse(stdout).text` 取真实输出。两个 task 都收到通知后才进 step 3.3。
|
|
102
|
+
- **通道 B(BC wrapper)**:同上 bg + 事件驱动,但 parse `--progress` 行而非 `.text`。**不调 TaskOutput**。
|
|
188
103
|
|
|
189
104
|
⛔ **禁止**:调 `TaskOutput({block: true, timeout: 600000})` (旧 freeze poll 模式) / Kill task。
|
|
190
105
|
⚠️ **失败处理**:notification status=failed / exit ≠ 0 / parse 失败 → v1.7.87 标准 2-retry / 5s / 3-attempts;3 次全失败才降级单模型。
|
|
@@ -23,6 +23,7 @@ phase-runner 走 Bash subprocess(`claude -p --output-format stream-json ...`
|
|
|
23
23
|
| 文件 | 写者 | 内容 |
|
|
24
24
|
|------|------|------|
|
|
25
25
|
| `state.json` | 主线 / phase-runner | `{ task_id, kind, status, phase_id, started_at, last_update, summary, cancel_requested }` |
|
|
26
|
+
| `state.json`(workflow 模式增量) | autonomous 主线 | 追加 `workflow_run_id` / `run_mode: 'workflow'` 字段;此模式 progress.jsonl 由 phase-runner 逐 phase append `{"type":"phase-result","phase_id":...,"status":...}` 行,dashboard / tail 模式兼容 |
|
|
26
27
|
| `progress.jsonl` | phase-runner Bash subprocess | stream-json ndjson(D6) |
|
|
27
28
|
| `result.md` | phase-runner | ≤ 200 token 摘要 |
|
|
28
29
|
| `cancel.flag` | `/ccg:cancel` 或 `/ccg:status --cancel` | 协作退出哨兵 |
|