ccg-workflow 1.7.48 → 1.7.49
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 +3 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/{ccg-workflow.e4y82GtN.mjs → ccg-workflow.zPy2yt7f.mjs} +1 -1
- package/package.json +6 -1
- package/templates/commands/spec-impl.md +123 -0
- package/templates/commands/spec-init.md +72 -0
- package/templates/commands/spec-plan.md +109 -0
- package/templates/commands/spec-research.md +101 -0
- package/templates/commands/spec-review.md +120 -0
package/README.md
CHANGED
|
@@ -16,7 +16,9 @@ Claude Code 编排 Codex + Gemini 的多模型协作开发系统。前端任务
|
|
|
16
16
|
npx ccg-workflow
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
**要求**:Claude Code CLI、Node.js
|
|
19
|
+
**要求**:Claude Code CLI、Node.js 20+
|
|
20
|
+
|
|
21
|
+
> **重要**:本项目依赖 `ora@9.x` 和 `string-width@8.x`,这些包要求 Node.js >= 20。使用 Node.js 18 会导致 `SyntaxError: Invalid regular expression flags` 错误。请确保升级到 Node.js 20 或更高版本。
|
|
20
22
|
|
|
21
23
|
**可选**:Codex CLI(后端)、Gemini CLI(前端)
|
|
22
24
|
|
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 { z as diagnoseMcpConfig, A as isWindows, B as readClaudeCodeConfig, C as fixWindowsMcpConfig, D as writeClaudeCodeConfig, r as readCcgConfig, b as initI18n, s as showMainMenu, i as init, E as configMcp, F as version, a as i18n } from './shared/ccg-workflow.
|
|
4
|
+
import { z as diagnoseMcpConfig, A as isWindows, B as readClaudeCodeConfig, C as fixWindowsMcpConfig, D as writeClaudeCodeConfig, r as readCcgConfig, b as initI18n, s as showMainMenu, i as init, E as configMcp, F as version, a as i18n } from './shared/ccg-workflow.zPy2yt7f.mjs';
|
|
5
5
|
import 'inquirer';
|
|
6
6
|
import 'node:child_process';
|
|
7
7
|
import 'node:util';
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { c as changeLanguage, x as checkForUpdates, y as compareVersions, d as createDefaultConfig, e as createDefaultRouting, g as getCcgDir, f as getConfigPath, t as getCurrentVersion, v as getLatestVersion, j as getWorkflowById, h as getWorkflowConfigs, a as i18n, i as init, b as initI18n, l as installAceTool, m as installAceToolRs, k as installWorkflows, p as migrateToV1_4_0, q as needsMigration, r as readCcgConfig, s as showMainMenu, o as uninstallAceTool, n as uninstallWorkflows, u as update, w as writeCcgConfig } from './shared/ccg-workflow.
|
|
1
|
+
export { c as changeLanguage, x as checkForUpdates, y as compareVersions, d as createDefaultConfig, e as createDefaultRouting, g as getCcgDir, f as getConfigPath, t as getCurrentVersion, v as getLatestVersion, j as getWorkflowById, h as getWorkflowConfigs, a as i18n, i as init, b as initI18n, l as installAceTool, m as installAceToolRs, k as installWorkflows, p as migrateToV1_4_0, q as needsMigration, r as readCcgConfig, s as showMainMenu, o as uninstallAceTool, n as uninstallWorkflows, u as update, w as writeCcgConfig } from './shared/ccg-workflow.zPy2yt7f.mjs';
|
|
2
2
|
import 'ansis';
|
|
3
3
|
import 'inquirer';
|
|
4
4
|
import 'node:child_process';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccg-workflow",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.49",
|
|
4
4
|
"description": "Claude-Codex-Gemini 多模型协作系统 - 智能路由多模型开发工作流",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@10.17.1",
|
|
@@ -44,6 +44,11 @@
|
|
|
44
44
|
"templates/commands/test.md",
|
|
45
45
|
"templates/commands/workflow.md",
|
|
46
46
|
"templates/commands/worktree.md",
|
|
47
|
+
"templates/commands/spec-init.md",
|
|
48
|
+
"templates/commands/spec-research.md",
|
|
49
|
+
"templates/commands/spec-plan.md",
|
|
50
|
+
"templates/commands/spec-impl.md",
|
|
51
|
+
"templates/commands/spec-review.md",
|
|
47
52
|
"templates/commands/agents/",
|
|
48
53
|
"templates/prompts/codex/",
|
|
49
54
|
"templates/prompts/gemini/analyzer.md",
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: '按规范执行 + 多模型协作 + 归档'
|
|
3
|
+
---
|
|
4
|
+
<!-- CCG:SPEC:IMPL:START -->
|
|
5
|
+
**Core Philosophy**
|
|
6
|
+
- Implementation is pure mechanical execution—all decisions were made in Plan phase.
|
|
7
|
+
- External model outputs are prototypes only; must be rewritten to production-grade code.
|
|
8
|
+
- Keep changes tightly scoped; enforce side-effect review before any modification.
|
|
9
|
+
- Minimize documentation—prefer self-explanatory code over comments.
|
|
10
|
+
|
|
11
|
+
**Guardrails**
|
|
12
|
+
- **NEVER** apply Codex/Gemini prototypes directly—all outputs are reference only.
|
|
13
|
+
- **MANDATORY**: Request `unified diff patch` format from external models; they have zero write permission.
|
|
14
|
+
- Keep implementation strictly within `tasks.md` scope—no scope creep.
|
|
15
|
+
- Refer to `openspec/AGENTS.md` for conventions.
|
|
16
|
+
|
|
17
|
+
**Steps**
|
|
18
|
+
1. **Select Proposal**
|
|
19
|
+
- Run `openspec list` to inspect Active Changes.
|
|
20
|
+
- Confirm with user which proposal ID to implement.
|
|
21
|
+
- Run `openspec show <proposal_id>` to review tasks.
|
|
22
|
+
|
|
23
|
+
2. **Apply OpenSpec Change**
|
|
24
|
+
- Run `/openspec:apply <proposal_id>` to enter implementation mode.
|
|
25
|
+
|
|
26
|
+
3. **Identify Minimal Verifiable Phase**
|
|
27
|
+
- Review `tasks.md` and identify the **smallest verifiable phase**.
|
|
28
|
+
- Do NOT complete all tasks at once—control context window.
|
|
29
|
+
- Announce: "Implementing Phase X: [task group name]"
|
|
30
|
+
|
|
31
|
+
4. **Route Tasks to Appropriate Model**
|
|
32
|
+
- **Route A: Gemini** — Frontend/UI/styling (CSS, React, Vue, HTML, components)
|
|
33
|
+
- **Route B: Codex** — Backend/logic/algorithm (API, data processing, business logic)
|
|
34
|
+
|
|
35
|
+
For each task:
|
|
36
|
+
```
|
|
37
|
+
codeagent-wrapper --backend <codex|gemini> - "$PWD" <<'EOF'
|
|
38
|
+
TASK: <task description from tasks.md>
|
|
39
|
+
CONTEXT: <relevant code context>
|
|
40
|
+
CONSTRAINTS: <constraints from spec>
|
|
41
|
+
OUTPUT: Unified Diff Patch format ONLY
|
|
42
|
+
EOF
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
5. **Rewrite Prototype to Production Code**
|
|
46
|
+
Upon receiving diff patch, **NEVER apply directly**. Rewrite by:
|
|
47
|
+
- Removing redundancy
|
|
48
|
+
- Ensuring clear naming and simple structure
|
|
49
|
+
- Aligning with project style
|
|
50
|
+
- Eliminating unnecessary comments
|
|
51
|
+
- Verifying no new dependencies introduced
|
|
52
|
+
|
|
53
|
+
6. **Side-Effect Review** (Mandatory before apply)
|
|
54
|
+
Verify the change:
|
|
55
|
+
- [ ] Does not exceed `tasks.md` scope
|
|
56
|
+
- [ ] Does not affect unrelated modules
|
|
57
|
+
- [ ] Does not introduce new dependencies
|
|
58
|
+
- [ ] Does not break existing interfaces
|
|
59
|
+
|
|
60
|
+
If issues found, make targeted corrections.
|
|
61
|
+
|
|
62
|
+
7. **Multi-Model Review (PARALLEL)**
|
|
63
|
+
- **CRITICAL**: You MUST launch BOTH Codex AND Gemini in a SINGLE message with TWO Bash tool calls.
|
|
64
|
+
- **DO NOT** call one model first and wait. Launch BOTH simultaneously with `run_in_background: true`.
|
|
65
|
+
|
|
66
|
+
**Step 7.1**: In ONE message, make TWO parallel Bash calls:
|
|
67
|
+
|
|
68
|
+
**FIRST Bash call (Codex)**:
|
|
69
|
+
```
|
|
70
|
+
Bash({
|
|
71
|
+
command: "~/.claude/bin/codeagent-wrapper --backend codex - \"$PWD\" <<'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",
|
|
72
|
+
run_in_background: true,
|
|
73
|
+
timeout: 300000,
|
|
74
|
+
description: "Codex: correctness/security review"
|
|
75
|
+
})
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**SECOND Bash call (Gemini) - IN THE SAME MESSAGE**:
|
|
79
|
+
```
|
|
80
|
+
Bash({
|
|
81
|
+
command: "~/.claude/bin/codeagent-wrapper --backend gemini - \"$PWD\" <<'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",
|
|
82
|
+
run_in_background: true,
|
|
83
|
+
timeout: 300000,
|
|
84
|
+
description: "Gemini: maintainability/patterns review"
|
|
85
|
+
})
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Step 7.2**: After BOTH Bash calls return task IDs, wait for results with TWO TaskOutput calls:
|
|
89
|
+
```
|
|
90
|
+
TaskOutput({ task_id: "<codex_task_id>", block: true, timeout: 600000 })
|
|
91
|
+
TaskOutput({ task_id: "<gemini_task_id>", block: true, timeout: 600000 })
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Address any critical findings before proceeding.
|
|
95
|
+
|
|
96
|
+
8. **Update Task Status**
|
|
97
|
+
- Mark completed task in `tasks.md`: `- [x] Task description`
|
|
98
|
+
- Commit changes if appropriate.
|
|
99
|
+
|
|
100
|
+
9. **Context Checkpoint**
|
|
101
|
+
- After completing a phase, report context usage.
|
|
102
|
+
- If below 80K: Ask user "Continue to next phase?"
|
|
103
|
+
- If approaching 80K: Suggest "Run `/clear` and resume with `/ccg:spec:impl`"
|
|
104
|
+
|
|
105
|
+
10. **Archive on Completion**
|
|
106
|
+
- When ALL tasks in `tasks.md` are marked `[x]`:
|
|
107
|
+
- Run `/openspec:archive <proposal_id>`
|
|
108
|
+
- This merges spec deltas to `openspec/specs/` and moves change to archive.
|
|
109
|
+
|
|
110
|
+
**Reference**
|
|
111
|
+
- Check task status: `openspec show <id>`
|
|
112
|
+
- Validate before archive: `openspec validate <id>`
|
|
113
|
+
- View active changes: `openspec list`
|
|
114
|
+
- Search existing patterns: `rg -n "function|class" <file>`
|
|
115
|
+
|
|
116
|
+
**Exit Criteria**
|
|
117
|
+
Implementation is complete when:
|
|
118
|
+
- [ ] All tasks in `tasks.md` marked `[x]`
|
|
119
|
+
- [ ] All multi-model reviews passed
|
|
120
|
+
- [ ] Side-effect review confirmed no regressions
|
|
121
|
+
- [ ] `openspec validate <id>` returns zero issues
|
|
122
|
+
- [ ] Change archived successfully
|
|
123
|
+
<!-- CCG:SPEC:IMPL:END -->
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: '初始化 OpenSpec 环境 + 验证多模型 MCP 工具'
|
|
3
|
+
---
|
|
4
|
+
<!-- CCG:SPEC:INIT:START -->
|
|
5
|
+
**Core Philosophy**
|
|
6
|
+
- OpenSpec provides the specification framework; CCG adds multi-model collaboration.
|
|
7
|
+
- This phase ensures all tools are ready before any development work begins.
|
|
8
|
+
- Fail fast: detect missing dependencies early rather than mid-workflow.
|
|
9
|
+
|
|
10
|
+
**Guardrails**
|
|
11
|
+
- Detect OS (Linux/macOS/Windows) and adapt commands accordingly.
|
|
12
|
+
- Do not proceed to next step until current step completes successfully.
|
|
13
|
+
- Provide clear, actionable error messages when a step fails.
|
|
14
|
+
- Respect user's existing configurations; avoid overwriting without confirmation.
|
|
15
|
+
|
|
16
|
+
**Steps**
|
|
17
|
+
1. **Detect Operating System**
|
|
18
|
+
- Identify OS using `uname -s` (Unix) or environment variables (Windows).
|
|
19
|
+
- Inform user which OS was detected.
|
|
20
|
+
|
|
21
|
+
2. **Check and Install OpenSpec**
|
|
22
|
+
- Verify if `openspec` CLI is installed: `openspec --version`
|
|
23
|
+
- If not installed:
|
|
24
|
+
```bash
|
|
25
|
+
npm install -g @fission-ai/openspec@latest
|
|
26
|
+
```
|
|
27
|
+
- Confirm installation success.
|
|
28
|
+
|
|
29
|
+
3. **Initialize OpenSpec for Current Project**
|
|
30
|
+
- Run:
|
|
31
|
+
```bash
|
|
32
|
+
openspec init --tools claude
|
|
33
|
+
```
|
|
34
|
+
- Verify `openspec/` directory structure is created.
|
|
35
|
+
- Report any errors with remediation steps.
|
|
36
|
+
|
|
37
|
+
4. **Validate Multi-Model MCP Tools**
|
|
38
|
+
- Check `codeagent-wrapper` availability: `~/.claude/bin/codeagent-wrapper --version`
|
|
39
|
+
- Test Codex backend:
|
|
40
|
+
```bash
|
|
41
|
+
~/.claude/bin/codeagent-wrapper --backend codex - "$PWD" <<< "echo test"
|
|
42
|
+
```
|
|
43
|
+
- Test Gemini backend:
|
|
44
|
+
```bash
|
|
45
|
+
~/.claude/bin/codeagent-wrapper --backend gemini - "$PWD" <<< "echo test"
|
|
46
|
+
```
|
|
47
|
+
- For each unavailable tool, display warning with installation instructions.
|
|
48
|
+
|
|
49
|
+
5. **Validate Context Retrieval MCP** (Optional)
|
|
50
|
+
- Check if `mcp__ace-tool__search_context` is available.
|
|
51
|
+
- If not, suggest: "Run `npx ccg-workflow` and select ace-tool MCP option."
|
|
52
|
+
|
|
53
|
+
6. **Summary Report**
|
|
54
|
+
Display status table:
|
|
55
|
+
```
|
|
56
|
+
Component Status
|
|
57
|
+
─────────────────────────────────
|
|
58
|
+
OpenSpec CLI ✓/✗
|
|
59
|
+
Project initialized ✓/✗
|
|
60
|
+
codeagent-wrapper ✓/✗
|
|
61
|
+
Codex backend ✓/✗
|
|
62
|
+
Gemini backend ✓/✗
|
|
63
|
+
ace-tool MCP ✓/✗ (optional)
|
|
64
|
+
```
|
|
65
|
+
If any required components missing, list actions before proceeding.
|
|
66
|
+
|
|
67
|
+
**Reference**
|
|
68
|
+
- OpenSpec CLI: `openspec --help`
|
|
69
|
+
- CCG Workflow: `npx ccg-workflow`
|
|
70
|
+
- Codex/Gemini MCP: Bundled with codeagent-wrapper
|
|
71
|
+
- Node.js >= 18.x required for OpenSpec
|
|
72
|
+
<!-- CCG:SPEC:INIT:END -->
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: '多模型分析 → 消除歧义 → 零决策可执行计划'
|
|
3
|
+
---
|
|
4
|
+
<!-- CCG:SPEC:PLAN:START -->
|
|
5
|
+
**Core Philosophy**
|
|
6
|
+
- The goal is to eliminate ALL decision points—implementation should be pure mechanical execution.
|
|
7
|
+
- Every ambiguity must be resolved into explicit constraints before proceeding.
|
|
8
|
+
- Multi-model collaboration surfaces blind spots and conflicting assumptions.
|
|
9
|
+
- Every requirement must have Property-Based Testing (PBT) properties—focus on invariants.
|
|
10
|
+
|
|
11
|
+
**Guardrails**
|
|
12
|
+
- Do not proceed to implementation until every ambiguity is resolved.
|
|
13
|
+
- Multi-model collaboration is **mandatory**: use both Codex and Gemini.
|
|
14
|
+
- If constraints cannot be fully specified, escalate to user or return to research phase.
|
|
15
|
+
- Refer to `openspec/AGENTS.md` for conventions; run `openspec update` if missing.
|
|
16
|
+
|
|
17
|
+
**Steps**
|
|
18
|
+
1. **Select Proposal**
|
|
19
|
+
- Run `openspec list` to display Active Changes.
|
|
20
|
+
- Confirm with user which proposal ID to refine.
|
|
21
|
+
- Run `openspec show <proposal_id>` to review current state.
|
|
22
|
+
|
|
23
|
+
2. **Multi-Model Implementation Analysis (PARALLEL)**
|
|
24
|
+
- **CRITICAL**: You MUST launch BOTH Codex AND Gemini in a SINGLE message with TWO Bash tool calls.
|
|
25
|
+
- **DO NOT** call one model first and wait. Launch BOTH simultaneously with `run_in_background: true`.
|
|
26
|
+
|
|
27
|
+
**Step 2.1**: In ONE message, make TWO parallel Bash calls:
|
|
28
|
+
|
|
29
|
+
**FIRST Bash call (Codex)**:
|
|
30
|
+
```
|
|
31
|
+
Bash({
|
|
32
|
+
command: "~/.claude/bin/codeagent-wrapper --backend codex - \"$PWD\" <<'EOF'\nAnalyze proposal <proposal_id> from backend perspective:\n- Implementation approach\n- Technical risks\n- Alternative architectures\n- Edge cases and failure modes\nOUTPUT: JSON with analysis\nEOF",
|
|
33
|
+
run_in_background: true,
|
|
34
|
+
timeout: 300000,
|
|
35
|
+
description: "Codex: backend analysis"
|
|
36
|
+
})
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**SECOND Bash call (Gemini) - IN THE SAME MESSAGE**:
|
|
40
|
+
```
|
|
41
|
+
Bash({
|
|
42
|
+
command: "~/.claude/bin/codeagent-wrapper --backend gemini - \"$PWD\" <<'EOF'\nAnalyze proposal <proposal_id> from frontend/integration perspective:\n- Maintainability assessment\n- Scalability considerations\n- Integration conflicts\nOUTPUT: JSON with analysis\nEOF",
|
|
43
|
+
run_in_background: true,
|
|
44
|
+
timeout: 300000,
|
|
45
|
+
description: "Gemini: frontend analysis"
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Step 2.2**: After BOTH Bash calls return task IDs, wait for results with TWO TaskOutput calls:
|
|
50
|
+
```
|
|
51
|
+
TaskOutput({ task_id: "<codex_task_id>", block: true, timeout: 600000 })
|
|
52
|
+
TaskOutput({ task_id: "<gemini_task_id>", block: true, timeout: 600000 })
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- Synthesize responses and present consolidated options to user.
|
|
56
|
+
|
|
57
|
+
3. **Uncertainty Elimination Audit**
|
|
58
|
+
- **Codex**: "Review proposal for unspecified decision points. List each as: [AMBIGUITY] → [REQUIRED CONSTRAINT]"
|
|
59
|
+
- **Gemini**: "Identify implicit assumptions. Specify: [ASSUMPTION] → [EXPLICIT CONSTRAINT NEEDED]"
|
|
60
|
+
|
|
61
|
+
**Anti-Pattern Detection** (flag and reject):
|
|
62
|
+
- Information collection without decision boundaries
|
|
63
|
+
- Technical comparisons without selection criteria
|
|
64
|
+
- Deferred decisions marked "to be determined during implementation"
|
|
65
|
+
|
|
66
|
+
**Target Pattern** (required for approval):
|
|
67
|
+
- Explicit technology choices with parameters (e.g., "JWT with TTL=15min")
|
|
68
|
+
- Concrete algorithm selections with configs (e.g., "bcrypt cost=12")
|
|
69
|
+
- Precise behavioral rules (e.g., "Lock account 30min after 5 failed attempts")
|
|
70
|
+
|
|
71
|
+
Iterate with user until ALL ambiguities resolved.
|
|
72
|
+
|
|
73
|
+
4. **PBT Property Extraction**
|
|
74
|
+
- **Codex**: "Extract PBT properties. For each requirement: [INVARIANT] → [FALSIFICATION STRATEGY]"
|
|
75
|
+
- **Gemini**: "Define system properties: [PROPERTY] | [DEFINITION] | [BOUNDARY CONDITIONS] | [COUNTEREXAMPLE GENERATION]"
|
|
76
|
+
|
|
77
|
+
**Property Categories**:
|
|
78
|
+
- **Commutativity/Associativity**: Order-independent operations
|
|
79
|
+
- **Idempotency**: Repeated operations yield same result
|
|
80
|
+
- **Round-trip**: Encode→Decode returns original
|
|
81
|
+
- **Invariant Preservation**: State constraints maintained
|
|
82
|
+
- **Monotonicity**: Ordering guarantees (e.g., timestamps increase)
|
|
83
|
+
- **Bounds**: Value ranges, size limits, rate constraints
|
|
84
|
+
|
|
85
|
+
5. **Update OpenSpec Documents**
|
|
86
|
+
- Run `/openspec:proposal <proposal_id>` to update specs with:
|
|
87
|
+
* All resolved constraints
|
|
88
|
+
* PBT properties in spec format
|
|
89
|
+
* Zero-decision task sequence
|
|
90
|
+
- Run `openspec validate <proposal_id>` to verify format.
|
|
91
|
+
|
|
92
|
+
6. **Context Checkpoint**
|
|
93
|
+
- Report current context usage.
|
|
94
|
+
- If approaching 80K tokens, suggest: "Run `/clear` and continue with `/ccg:spec:impl`"
|
|
95
|
+
|
|
96
|
+
**Exit Criteria**
|
|
97
|
+
A proposal is ready for implementation only when:
|
|
98
|
+
- [ ] All multi-model analyses completed and synthesized
|
|
99
|
+
- [ ] Zero ambiguities remain (verified by step 3 audit)
|
|
100
|
+
- [ ] All PBT properties documented with falsification strategies
|
|
101
|
+
- [ ] `openspec validate <id>` returns zero issues
|
|
102
|
+
- [ ] User has explicitly approved all constraint decisions
|
|
103
|
+
|
|
104
|
+
**Reference**
|
|
105
|
+
- Inspect proposal: `openspec show <id> --json`
|
|
106
|
+
- Check conflicts: `openspec list --specs`
|
|
107
|
+
- Search patterns: `rg -n "INVARIANT:|PROPERTY:" openspec/`
|
|
108
|
+
- Use `AskUserQuestion` for ANY ambiguity—never assume
|
|
109
|
+
<!-- CCG:SPEC:PLAN:END -->
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: '需求 → 约束集(并行探索 + OpenSpec 提案)'
|
|
3
|
+
---
|
|
4
|
+
<!-- CCG:SPEC:RESEARCH:START -->
|
|
5
|
+
**Core Philosophy**
|
|
6
|
+
- Research produces **constraint sets**, not information dumps. Each constraint narrows the solution space.
|
|
7
|
+
- Constraints tell subsequent stages "don't consider this direction," enabling mechanical execution without decisions.
|
|
8
|
+
- Output: 约束集合 + 可验证的成功判据 (constraint sets + verifiable success criteria).
|
|
9
|
+
- Strictly adhere to OpenSpec rules when writing spec-structured documents.
|
|
10
|
+
|
|
11
|
+
**Guardrails**
|
|
12
|
+
- **STOP! BEFORE ANY OTHER ACTION**: You MUST call `mcp__ace-tool__enhance_prompt` FIRST. This is NON-NEGOTIABLE.
|
|
13
|
+
- **NEVER** divide subagent tasks by roles (e.g., "架构师agent", "安全专家agent").
|
|
14
|
+
- **ALWAYS** divide by context boundaries (e.g., "user-related code", "authentication logic").
|
|
15
|
+
- Each subagent context must be self-contained with independent output.
|
|
16
|
+
- Use `mcp__ace-tool__search_context` to minimize grep/find operations.
|
|
17
|
+
- Do not make architectural decisions—surface constraints that guide decisions.
|
|
18
|
+
|
|
19
|
+
**Steps**
|
|
20
|
+
0. **MANDATORY: Enhance Requirement FIRST**
|
|
21
|
+
- **DO THIS IMMEDIATELY. DO NOT SKIP. DO NOT CALL ANY OTHER TOOL FIRST.**
|
|
22
|
+
- Call:
|
|
23
|
+
```
|
|
24
|
+
mcp__ace-tool__enhance_prompt({
|
|
25
|
+
prompt: "$ARGUMENTS",
|
|
26
|
+
conversation_history: "<recent conversation>",
|
|
27
|
+
project_root_path: "$PWD"
|
|
28
|
+
})
|
|
29
|
+
```
|
|
30
|
+
- Wait for enhanced prompt result.
|
|
31
|
+
- Use enhanced prompt for ALL subsequent steps.
|
|
32
|
+
|
|
33
|
+
1. **Generate OpenSpec Proposal**
|
|
34
|
+
- Run: `/openspec:proposal $ARGUMENTS`
|
|
35
|
+
- This scaffolds `openspec/changes/<name>/` with proposal.md, tasks.md, specs/.
|
|
36
|
+
|
|
37
|
+
2. **Initial Codebase Assessment**
|
|
38
|
+
- Use `mcp__ace-tool__search_context` to scan codebase.
|
|
39
|
+
- Determine project scale: single vs multi-directory structure.
|
|
40
|
+
- **Decision**: If multi-directory → enable parallel Explore subagents.
|
|
41
|
+
|
|
42
|
+
3. **Define Exploration Boundaries (Context-Based)**
|
|
43
|
+
- Identify natural context boundaries (NOT functional roles):
|
|
44
|
+
* Subagent 1: User domain code (models, services, UI)
|
|
45
|
+
* Subagent 2: Auth & authorization (middleware, session, tokens)
|
|
46
|
+
* Subagent 3: Infrastructure (configs, deployments, builds)
|
|
47
|
+
- Each boundary should be self-contained: no cross-communication needed.
|
|
48
|
+
|
|
49
|
+
4. **Parallel Multi-Model Exploration**
|
|
50
|
+
- Dispatch Explore subagents with unified output template:
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"module_name": "context boundary explored",
|
|
54
|
+
"existing_structures": ["key patterns found"],
|
|
55
|
+
"existing_conventions": ["standards in use"],
|
|
56
|
+
"constraints_discovered": ["hard constraints limiting solution space"],
|
|
57
|
+
"open_questions": ["ambiguities requiring user input"],
|
|
58
|
+
"dependencies": ["cross-module dependencies"],
|
|
59
|
+
"risks": ["potential blockers"],
|
|
60
|
+
"success_criteria_hints": ["observable success behaviors"]
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
- Run Codex for backend boundaries, Gemini for frontend boundaries.
|
|
64
|
+
|
|
65
|
+
5. **Aggregate and Synthesize**
|
|
66
|
+
- Collect all subagent outputs.
|
|
67
|
+
- Merge into unified constraint sets:
|
|
68
|
+
* **Hard constraints**: Technical limitations, patterns that cannot be violated
|
|
69
|
+
* **Soft constraints**: Conventions, preferences, style guides
|
|
70
|
+
* **Dependencies**: Cross-module relationships affecting implementation order
|
|
71
|
+
* **Risks**: Blockers needing mitigation
|
|
72
|
+
|
|
73
|
+
6. **User Interaction for Ambiguity Resolution**
|
|
74
|
+
- Compile prioritized list of open questions.
|
|
75
|
+
- Use `AskUserQuestion` tool to present systematically:
|
|
76
|
+
* Group related questions
|
|
77
|
+
* Provide context for each
|
|
78
|
+
* Suggest defaults when applicable
|
|
79
|
+
- Capture responses as additional constraints.
|
|
80
|
+
|
|
81
|
+
7. **Finalize OpenSpec Proposal**
|
|
82
|
+
- Transform constraint sets into OpenSpec format:
|
|
83
|
+
* **Context**: User need + discovered constraints
|
|
84
|
+
* **Requirements**: Each constraint becomes requirement with scenario
|
|
85
|
+
* **Success Criteria**: Derived from hints and user confirmations
|
|
86
|
+
- Ensure proposal includes:
|
|
87
|
+
* All discovered constraints as requirements
|
|
88
|
+
* Verifiable scenarios for each requirement
|
|
89
|
+
* Clear dependencies and sequencing
|
|
90
|
+
* Risk mitigation strategies
|
|
91
|
+
|
|
92
|
+
8. **Context Checkpoint**
|
|
93
|
+
- Report current context usage.
|
|
94
|
+
- If approaching 80K tokens, suggest: "Run `/clear` and continue with `/ccg:spec:plan`"
|
|
95
|
+
|
|
96
|
+
**Reference**
|
|
97
|
+
- Review constraints: `rg -n "Constraint:|MUST|MUST NOT" openspec/specs`
|
|
98
|
+
- Check prior research: `ls openspec/changes/*/`
|
|
99
|
+
- Use `openspec show <name>` to inspect proposal structure
|
|
100
|
+
- Use `AskUserQuestion` for ANY ambiguity—never assume or guess
|
|
101
|
+
<!-- CCG:SPEC:RESEARCH:END -->
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: '双模型交叉审查(独立工具,随时可用)'
|
|
3
|
+
---
|
|
4
|
+
<!-- CCG:SPEC:REVIEW:START -->
|
|
5
|
+
**Core Philosophy**
|
|
6
|
+
- Dual-model cross-validation catches blind spots single-model review would miss.
|
|
7
|
+
- Critical findings SHOULD be addressed before proceeding.
|
|
8
|
+
- Review validates implementation against spec constraints and code quality.
|
|
9
|
+
- This is an independent review tool—can be used anytime, not tied to archive workflow.
|
|
10
|
+
|
|
11
|
+
**Guardrails**
|
|
12
|
+
- **MANDATORY**: Both Codex AND Gemini must complete review before synthesis.
|
|
13
|
+
- Review scope is strictly limited to the proposal's changes—no scope creep.
|
|
14
|
+
- Refer to `openspec/AGENTS.md` for spec conventions if reviewing OpenSpec proposals.
|
|
15
|
+
|
|
16
|
+
**Steps**
|
|
17
|
+
1. **Select Proposal**
|
|
18
|
+
- Run `openspec list` to display Active Changes.
|
|
19
|
+
- Confirm with user which proposal ID to review.
|
|
20
|
+
- Run `openspec show <proposal_id>` to load spec and tasks.
|
|
21
|
+
|
|
22
|
+
2. **Collect Implementation Artifacts**
|
|
23
|
+
- Identify all files modified by this proposal.
|
|
24
|
+
- Use `git diff` or `openspec diff <proposal_id>` to get change summary.
|
|
25
|
+
- Load relevant spec constraints and PBT properties from `openspec/changes/<id>/specs/`.
|
|
26
|
+
|
|
27
|
+
3. **Multi-Model Review (PARALLEL)**
|
|
28
|
+
- **CRITICAL**: You MUST launch BOTH Codex AND Gemini 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`.
|
|
30
|
+
|
|
31
|
+
**Step 3.1**: In ONE message, make TWO parallel Bash calls:
|
|
32
|
+
|
|
33
|
+
**FIRST Bash call (Codex)**:
|
|
34
|
+
```
|
|
35
|
+
Bash({
|
|
36
|
+
command: "~/.claude/bin/codeagent-wrapper --backend codex - \"$PWD\" <<'EOF'\nReview proposal <proposal_id> implementation:\n\n## Codex Review Dimensions\n1. **Spec Compliance**: Verify ALL constraints from spec are satisfied\n2. **PBT Properties**: Check invariants, idempotency, bounds are correctly implemented\n3. **Logic Correctness**: Edge cases, error handling, algorithm correctness\n4. **Backend Security**: Injection vulnerabilities, auth checks, input validation\n5. **Regression Risk**: Interface compatibility, type safety, breaking changes\n\n## Output Format (JSON)\n{\n \"findings\": [\n {\n \"severity\": \"Critical|Warning|Info\",\n \"dimension\": \"spec_compliance|pbt|logic|security|regression\",\n \"file\": \"path/to/file.ts\",\n \"line\": 42,\n \"description\": \"What is wrong\",\n \"constraint_violated\": \"Constraint ID from spec (if applicable)\",\n \"fix_suggestion\": \"How to fix\"\n }\n ],\n \"passed_checks\": [\"List of verified constraints/properties\"],\n \"summary\": \"Overall assessment\"\n}\nEOF",
|
|
37
|
+
run_in_background: true,
|
|
38
|
+
timeout: 300000,
|
|
39
|
+
description: "Codex: backend/logic review"
|
|
40
|
+
})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**SECOND Bash call (Gemini) - IN THE SAME MESSAGE**:
|
|
44
|
+
```
|
|
45
|
+
Bash({
|
|
46
|
+
command: "~/.claude/bin/codeagent-wrapper --backend gemini - \"$PWD\" <<'EOF'\nReview proposal <proposal_id> implementation:\n\n## Gemini Review Dimensions\n1. **Pattern Consistency**: Naming conventions, code style, project patterns\n2. **Maintainability**: Readability, complexity, documentation adequacy\n3. **Integration Risk**: Dependency changes, cross-module impacts\n4. **Frontend Security**: XSS, CSRF, sensitive data exposure\n5. **Spec Alignment**: Implementation matches spec intent (not just letter)\n\n## Output Format (JSON)\n{\n \"findings\": [\n {\n \"severity\": \"Critical|Warning|Info\",\n \"dimension\": \"patterns|maintainability|integration|security|alignment\",\n \"file\": \"path/to/file.ts\",\n \"line\": 42,\n \"description\": \"What is wrong\",\n \"spec_reference\": \"Spec section (if applicable)\",\n \"fix_suggestion\": \"How to fix\"\n }\n ],\n \"passed_checks\": [\"List of verified aspects\"],\n \"summary\": \"Overall assessment\"\n}\nEOF",
|
|
47
|
+
run_in_background: true,
|
|
48
|
+
timeout: 300000,
|
|
49
|
+
description: "Gemini: patterns/integration review"
|
|
50
|
+
})
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Step 3.2**: After BOTH Bash calls return task IDs, wait for results with TWO TaskOutput calls:
|
|
54
|
+
```
|
|
55
|
+
TaskOutput({ task_id: "<codex_task_id>", block: true, timeout: 600000 })
|
|
56
|
+
TaskOutput({ task_id: "<gemini_task_id>", block: true, timeout: 600000 })
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
4. **Synthesize Findings**
|
|
60
|
+
- Merge findings from both models.
|
|
61
|
+
- Deduplicate overlapping issues.
|
|
62
|
+
- Classify by severity:
|
|
63
|
+
* **Critical**: Spec violation, security vulnerability, breaking change → MUST fix
|
|
64
|
+
* **Warning**: Pattern deviation, maintainability concern → SHOULD fix
|
|
65
|
+
* **Info**: Minor improvement suggestion → MAY fix
|
|
66
|
+
|
|
67
|
+
5. **Present Review Report**
|
|
68
|
+
- Display findings grouped by severity:
|
|
69
|
+
```
|
|
70
|
+
## Review Report: <proposal_id>
|
|
71
|
+
|
|
72
|
+
### Critical (X issues) - MUST FIX
|
|
73
|
+
- [ ] [SPEC] file.ts:42 - Constraint X violated: description
|
|
74
|
+
- [ ] [SEC] api.ts:15 - SQL injection vulnerability
|
|
75
|
+
|
|
76
|
+
### Warning (Y issues) - SHOULD FIX
|
|
77
|
+
- [ ] [PATTERN] utils.ts:88 - Inconsistent naming convention
|
|
78
|
+
|
|
79
|
+
### Info (Z issues) - MAY FIX
|
|
80
|
+
- [ ] [MAINT] helper.ts:20 - Consider extracting to separate function
|
|
81
|
+
|
|
82
|
+
### Passed Checks
|
|
83
|
+
- ✅ PBT: Idempotency property verified
|
|
84
|
+
- ✅ Security: No XSS vulnerabilities found
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
6. **Decision Gate**
|
|
88
|
+
- **If Critical > 0**:
|
|
89
|
+
* Present findings to user.
|
|
90
|
+
* Ask: "Fix now or return to `/ccg:spec-impl` to address?"
|
|
91
|
+
* Do NOT allow archiving.
|
|
92
|
+
|
|
93
|
+
- **If Critical = 0**:
|
|
94
|
+
* Ask user: "All critical checks passed. Proceed to archive?"
|
|
95
|
+
* If Warning > 0, recommend addressing before archive.
|
|
96
|
+
|
|
97
|
+
7. **Optional: Inline Fix Mode**
|
|
98
|
+
- If user chooses "Fix now" for Critical issues:
|
|
99
|
+
* Route each fix to appropriate model (backend→Codex, frontend→Gemini).
|
|
100
|
+
* Apply fix using unified diff patch pattern.
|
|
101
|
+
* Re-run affected review dimension.
|
|
102
|
+
* Repeat until Critical = 0.
|
|
103
|
+
|
|
104
|
+
8. **Context Checkpoint**
|
|
105
|
+
- Report current context usage.
|
|
106
|
+
- If approaching 80K tokens, suggest: "Run `/clear` and continue with `/ccg:spec-review` or `/ccg:spec-impl`"
|
|
107
|
+
|
|
108
|
+
**Exit Criteria**
|
|
109
|
+
Review is complete when:
|
|
110
|
+
- [ ] Both Codex and Gemini reviews completed
|
|
111
|
+
- [ ] All findings synthesized and classified
|
|
112
|
+
- [ ] Zero Critical issues remain (fixed or user-acknowledged)
|
|
113
|
+
- [ ] User decision captured (archive / return to impl / defer)
|
|
114
|
+
|
|
115
|
+
**Reference**
|
|
116
|
+
- View proposal: `openspec show <id>`
|
|
117
|
+
- Check spec constraints: `rg -n "CONSTRAINT:|MUST|INVARIANT:" openspec/changes/<id>/specs/`
|
|
118
|
+
- View implementation diff: `openspec diff <id>` or `git diff`
|
|
119
|
+
- Archive (after passing): `/ccg:spec-impl` → Step 10
|
|
120
|
+
<!-- CCG:SPEC:REVIEW:END -->
|