ccgx-workflow 1.0.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/LICENSE +22 -0
- package/README.md +469 -0
- package/README.zh-CN.md +466 -0
- package/bin/ccg.mjs +2 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.mjs +173 -0
- package/dist/index.d.mts +1774 -0
- package/dist/index.d.ts +1774 -0
- package/dist/index.mjs +2029 -0
- package/dist/shared/ccgx-workflow.WgUzkiC3.mjs +5248 -0
- package/package.json +129 -0
- package/templates/commands/agents/assumptions-analyzer.md +129 -0
- package/templates/commands/agents/code-fixer.md +292 -0
- package/templates/commands/agents/codebase-mapper.md +152 -0
- package/templates/commands/agents/debug-session-manager.md +247 -0
- package/templates/commands/agents/debugger.md +111 -0
- package/templates/commands/agents/eval-auditor.md +171 -0
- package/templates/commands/agents/framework-selector.md +152 -0
- package/templates/commands/agents/get-current-datetime.md +29 -0
- package/templates/commands/agents/init-architect.md +114 -0
- package/templates/commands/agents/integration-checker.md +163 -0
- package/templates/commands/agents/interface-auditor.md +170 -0
- package/templates/commands/agents/nyquist-auditor.md +131 -0
- package/templates/commands/agents/pattern-mapper.md +111 -0
- package/templates/commands/agents/phase-runner.md +321 -0
- package/templates/commands/agents/plan-checker.md +255 -0
- package/templates/commands/agents/planner.md +320 -0
- package/templates/commands/agents/team-architect.md +186 -0
- package/templates/commands/agents/team-qa.md +121 -0
- package/templates/commands/agents/team-reviewer.md +157 -0
- package/templates/commands/agents/ui-ux-designer.md +573 -0
- package/templates/commands/agents/verifier.md +274 -0
- package/templates/commands/analyze.md +210 -0
- package/templates/commands/autonomous.md +792 -0
- package/templates/commands/cancel.md +132 -0
- package/templates/commands/clean-branches.md +117 -0
- package/templates/commands/codex-exec.md +404 -0
- package/templates/commands/commit.md +151 -0
- package/templates/commands/context.md +332 -0
- package/templates/commands/debate.md +165 -0
- package/templates/commands/debug.md +226 -0
- package/templates/commands/enhance.md +64 -0
- package/templates/commands/execute.md +380 -0
- package/templates/commands/init.md +123 -0
- package/templates/commands/optimize.md +217 -0
- package/templates/commands/plan.md +373 -0
- package/templates/commands/result.md +106 -0
- package/templates/commands/review.md +338 -0
- package/templates/commands/rollback.md +116 -0
- package/templates/commands/spec-impl.md +139 -0
- package/templates/commands/spec-init.md +101 -0
- package/templates/commands/spec-plan.md +210 -0
- package/templates/commands/spec-research.md +152 -0
- package/templates/commands/spec-review.md +120 -0
- package/templates/commands/status.md +206 -0
- package/templates/commands/team-exec.md +265 -0
- package/templates/commands/test.md +236 -0
- package/templates/commands/verify-work.md +338 -0
- package/templates/commands/verify.md +66 -0
- package/templates/commands/workflow.md +190 -0
- package/templates/commands/worktree.md +128 -0
- package/templates/hooks/ccg-context-monitor.js +159 -0
- package/templates/hooks/ccg-session-state.cjs +510 -0
- package/templates/hooks/ccg-statusline.js +142 -0
- package/templates/output-styles/abyss-command.md +56 -0
- package/templates/output-styles/abyss-concise.md +89 -0
- package/templates/output-styles/abyss-cultivator.md +302 -0
- package/templates/output-styles/abyss-ritual.md +70 -0
- package/templates/output-styles/engineer-professional.md +89 -0
- package/templates/output-styles/laowang-engineer.md +127 -0
- package/templates/output-styles/nekomata-engineer.md +120 -0
- package/templates/output-styles/ojousama-engineer.md +121 -0
- package/templates/prompts/claude/analyzer.md +59 -0
- package/templates/prompts/claude/architect.md +54 -0
- package/templates/prompts/claude/debugger.md +71 -0
- package/templates/prompts/claude/optimizer.md +73 -0
- package/templates/prompts/claude/reviewer.md +63 -0
- package/templates/prompts/claude/tester.md +69 -0
- package/templates/prompts/codex/analyzer.md +58 -0
- package/templates/prompts/codex/architect.md +54 -0
- package/templates/prompts/codex/debugger.md +74 -0
- package/templates/prompts/codex/optimizer.md +81 -0
- package/templates/prompts/codex/reviewer.md +73 -0
- package/templates/prompts/codex/tester.md +62 -0
- package/templates/prompts/gemini/analyzer.md +61 -0
- package/templates/prompts/gemini/architect.md +55 -0
- package/templates/prompts/gemini/debugger.md +78 -0
- package/templates/prompts/gemini/frontend.md +64 -0
- package/templates/prompts/gemini/optimizer.md +84 -0
- package/templates/prompts/gemini/reviewer.md +80 -0
- package/templates/prompts/gemini/tester.md +68 -0
- package/templates/rules/ccg-skill-routing.md +83 -0
- package/templates/rules/ccg-skills.md +71 -0
- package/templates/scripts/ccg-phase-runner-launcher.mjs +467 -0
- package/templates/scripts/invoke-model.mjs +949 -0
- package/templates/scripts/repatch-gemini-plugin.mjs +194 -0
- package/templates/skills/SKILL.md +92 -0
- package/templates/skills/domains/ai/SKILL.md +35 -0
- package/templates/skills/domains/ai/agent-dev.md +242 -0
- package/templates/skills/domains/ai/llm-security.md +288 -0
- package/templates/skills/domains/ai/prompt-and-eval.md +279 -0
- package/templates/skills/domains/ai/rag-system.md +542 -0
- package/templates/skills/domains/architecture/SKILL.md +43 -0
- package/templates/skills/domains/architecture/api-design.md +225 -0
- package/templates/skills/domains/architecture/caching.md +299 -0
- package/templates/skills/domains/architecture/cloud-native.md +285 -0
- package/templates/skills/domains/architecture/message-queue.md +329 -0
- package/templates/skills/domains/architecture/security-arch.md +297 -0
- package/templates/skills/domains/data-engineering/SKILL.md +208 -0
- package/templates/skills/domains/development/SKILL.md +47 -0
- package/templates/skills/domains/development/cpp.md +246 -0
- package/templates/skills/domains/development/go.md +323 -0
- package/templates/skills/domains/development/java.md +277 -0
- package/templates/skills/domains/development/python.md +288 -0
- package/templates/skills/domains/development/rust.md +313 -0
- package/templates/skills/domains/development/shell.md +313 -0
- package/templates/skills/domains/development/typescript.md +277 -0
- package/templates/skills/domains/devops/SKILL.md +40 -0
- package/templates/skills/domains/devops/cost-optimization.md +272 -0
- package/templates/skills/domains/devops/database.md +217 -0
- package/templates/skills/domains/devops/devsecops.md +198 -0
- package/templates/skills/domains/devops/git-workflow.md +181 -0
- package/templates/skills/domains/devops/observability.md +280 -0
- package/templates/skills/domains/devops/performance.md +336 -0
- package/templates/skills/domains/devops/testing.md +283 -0
- package/templates/skills/domains/frontend-design/SKILL.md +244 -0
- package/templates/skills/domains/frontend-design/agents/openai.yaml +4 -0
- package/templates/skills/domains/frontend-design/claymorphism/SKILL.md +121 -0
- package/templates/skills/domains/frontend-design/claymorphism/references/tokens.css +52 -0
- package/templates/skills/domains/frontend-design/component-patterns.md +202 -0
- package/templates/skills/domains/frontend-design/engineering.md +287 -0
- package/templates/skills/domains/frontend-design/glassmorphism/SKILL.md +142 -0
- package/templates/skills/domains/frontend-design/glassmorphism/references/tokens.css +32 -0
- package/templates/skills/domains/frontend-design/liquid-glass/SKILL.md +139 -0
- package/templates/skills/domains/frontend-design/liquid-glass/references/tokens.css +81 -0
- package/templates/skills/domains/frontend-design/neubrutalism/SKILL.md +145 -0
- package/templates/skills/domains/frontend-design/neubrutalism/references/tokens.css +44 -0
- package/templates/skills/domains/frontend-design/reference/color-and-contrast.md +132 -0
- package/templates/skills/domains/frontend-design/reference/interaction-design.md +195 -0
- package/templates/skills/domains/frontend-design/reference/motion-design.md +99 -0
- package/templates/skills/domains/frontend-design/reference/responsive-design.md +114 -0
- package/templates/skills/domains/frontend-design/reference/spatial-design.md +100 -0
- package/templates/skills/domains/frontend-design/reference/typography.md +133 -0
- package/templates/skills/domains/frontend-design/reference/ux-writing.md +107 -0
- package/templates/skills/domains/frontend-design/state-management.md +680 -0
- package/templates/skills/domains/frontend-design/ui-aesthetics.md +110 -0
- package/templates/skills/domains/frontend-design/ux-principles.md +156 -0
- package/templates/skills/domains/infrastructure/SKILL.md +201 -0
- package/templates/skills/domains/mobile/SKILL.md +225 -0
- package/templates/skills/domains/orchestration/SKILL.md +30 -0
- package/templates/skills/domains/orchestration/multi-agent.md +263 -0
- package/templates/skills/domains/security/SKILL.md +73 -0
- package/templates/skills/domains/security/blue-team.md +436 -0
- package/templates/skills/domains/security/code-audit.md +265 -0
- package/templates/skills/domains/security/pentest.md +226 -0
- package/templates/skills/domains/security/red-team.md +374 -0
- package/templates/skills/domains/security/threat-intel.md +372 -0
- package/templates/skills/domains/security/vuln-research.md +369 -0
- package/templates/skills/impeccable/adapt/SKILL.md +201 -0
- package/templates/skills/impeccable/animate/SKILL.md +176 -0
- package/templates/skills/impeccable/arrange/SKILL.md +126 -0
- package/templates/skills/impeccable/audit/SKILL.md +149 -0
- package/templates/skills/impeccable/bolder/SKILL.md +118 -0
- package/templates/skills/impeccable/clarify/SKILL.md +185 -0
- package/templates/skills/impeccable/colorize/SKILL.md +144 -0
- package/templates/skills/impeccable/critique/SKILL.md +203 -0
- package/templates/skills/impeccable/critique/reference/cognitive-load.md +106 -0
- package/templates/skills/impeccable/critique/reference/heuristics-scoring.md +234 -0
- package/templates/skills/impeccable/critique/reference/personas.md +178 -0
- package/templates/skills/impeccable/delight/SKILL.md +305 -0
- package/templates/skills/impeccable/distill/SKILL.md +123 -0
- package/templates/skills/impeccable/extract/SKILL.md +94 -0
- package/templates/skills/impeccable/harden/SKILL.md +357 -0
- package/templates/skills/impeccable/normalize/SKILL.md +72 -0
- package/templates/skills/impeccable/onboard/SKILL.md +248 -0
- package/templates/skills/impeccable/optimize/SKILL.md +268 -0
- package/templates/skills/impeccable/overdrive/SKILL.md +143 -0
- package/templates/skills/impeccable/polish/SKILL.md +205 -0
- package/templates/skills/impeccable/quieter/SKILL.md +104 -0
- package/templates/skills/impeccable/teach-impeccable/SKILL.md +72 -0
- package/templates/skills/impeccable/typeset/SKILL.md +117 -0
- package/templates/skills/orchestration/multi-agent/SKILL.md +533 -0
- package/templates/skills/run_skill.js +129 -0
- package/templates/skills/scrapling/SKILL.md +98 -0
- package/templates/skills/scrapling/references/api-quick-ref.md +127 -0
- package/templates/skills/scrapling/references/cookie-vault.md +56 -0
- package/templates/skills/scrapling/references/maintenance.md +79 -0
- package/templates/skills/scrapling/references/site-patterns.md +86 -0
- package/templates/skills/scrapling/references/troubleshooting.md +95 -0
- package/templates/skills/scrapling/templates/basic_fetch.py +19 -0
- package/templates/skills/scrapling/templates/parse_only.py +15 -0
- package/templates/skills/scrapling/templates/session_login.py +19 -0
- package/templates/skills/scrapling/templates/stealth_cloudflare.py +28 -0
- package/templates/skills/tools/extract-learnings/SKILL.md +77 -0
- package/templates/skills/tools/forensics/SKILL.md +89 -0
- package/templates/skills/tools/gen-docs/SKILL.md +116 -0
- package/templates/skills/tools/gen-docs/scripts/doc_generator.js +435 -0
- package/templates/skills/tools/health/SKILL.md +121 -0
- package/templates/skills/tools/lib/shared.js +98 -0
- package/templates/skills/tools/map-codebase/SKILL.md +118 -0
- package/templates/skills/tools/override-refusal/SKILL.md +53 -0
- package/templates/skills/tools/override-refusal/agents/openai.yaml +4 -0
- package/templates/skills/tools/override-refusal/scripts/refusal_rewriter.js +226 -0
- package/templates/skills/tools/verify-change/SKILL.md +143 -0
- package/templates/skills/tools/verify-change/scripts/change_analyzer.js +289 -0
- package/templates/skills/tools/verify-module/SKILL.md +130 -0
- package/templates/skills/tools/verify-module/scripts/module_scanner.js +171 -0
- package/templates/skills/tools/verify-quality/SKILL.md +163 -0
- package/templates/skills/tools/verify-quality/scripts/quality_checker.js +337 -0
- package/templates/skills/tools/verify-security/SKILL.md +146 -0
- package/templates/skills/tools/verify-security/scripts/security_scanner.js +283 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: '初始化 OpenSpec (OPSX) 环境 + 验证多模型 MCP 工具'
|
|
3
|
+
---
|
|
4
|
+
<!-- CCG:SPEC:INIT:START -->
|
|
5
|
+
**Core Philosophy**
|
|
6
|
+
- OPSX 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 (OPSX)**
|
|
22
|
+
- **IMPORTANT**: OpenSpec CLI command is `openspec`, NOT `opsx`
|
|
23
|
+
- Verify if OpenSpec is available:
|
|
24
|
+
```bash
|
|
25
|
+
npx @fission-ai/openspec --version
|
|
26
|
+
```
|
|
27
|
+
- If not found, install globally:
|
|
28
|
+
```bash
|
|
29
|
+
npm install -g @fission-ai/openspec@latest
|
|
30
|
+
```
|
|
31
|
+
- After installation, verify again:
|
|
32
|
+
```bash
|
|
33
|
+
openspec --version
|
|
34
|
+
```
|
|
35
|
+
- If `openspec` command not found after global install, use `npx`:
|
|
36
|
+
```bash
|
|
37
|
+
npx @fission-ai/openspec --version
|
|
38
|
+
```
|
|
39
|
+
- **Note**: Always use `openspec` (not `opsx`) for CLI commands.
|
|
40
|
+
|
|
41
|
+
3. **Initialize OPSX for Current Project**
|
|
42
|
+
- **重要**:所有命令必须在当前工作目录下执行,禁止 `cd` 到其他路径。如不确定当前目录,先执行 `pwd` 确认。
|
|
43
|
+
- Check if already initialized:
|
|
44
|
+
```bash
|
|
45
|
+
ls -la openspec/ .claude/skills/openspec-* 2>/dev/null || echo "Not initialized"
|
|
46
|
+
```
|
|
47
|
+
- If not initialized, run interactive setup (v1.2+ auto-detects AI tools):
|
|
48
|
+
```bash
|
|
49
|
+
npx @fission-ai/openspec init
|
|
50
|
+
```
|
|
51
|
+
- **Profile Selection** (v1.2+):
|
|
52
|
+
- `core` profile (default): 4 essential workflows (`propose`, `explore`, `apply`, `archive`)
|
|
53
|
+
- `custom` profile: Pick any subset of workflows
|
|
54
|
+
- To change profile later: `openspec config profile`
|
|
55
|
+
- Verify initialization:
|
|
56
|
+
- Check `openspec/` directory exists
|
|
57
|
+
- Check `.claude/skills/` contains `openspec-*` skills
|
|
58
|
+
- Check `.claude/commands/opsx/` contains OPSX commands
|
|
59
|
+
- Report any errors with remediation steps.
|
|
60
|
+
|
|
61
|
+
4. **Validate Multi-Model MCP Tools**
|
|
62
|
+
- Check `codeagent-wrapper` availability: `~/.claude/bin/codeagent-wrapper --version`
|
|
63
|
+
- **工作目录**:`{{WORKDIR}}` **必须通过 Bash 执行 `pwd`(Unix)或 `cd`(Windows CMD)获取当前工作目录的绝对路径**,禁止从 `$HOME` 或环境变量推断。如果用户通过 `/add-dir` 添加了多个工作区,先确定任务相关的工作区。
|
|
64
|
+
- Test {{BACKEND_PRIMARY}} backend:
|
|
65
|
+
```bash
|
|
66
|
+
echo "echo test" | ~/.claude/bin/codeagent-wrapper --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- "{{WORKDIR}}"
|
|
67
|
+
```
|
|
68
|
+
- Test {{FRONTEND_PRIMARY}} backend:
|
|
69
|
+
```bash
|
|
70
|
+
echo "echo test" | ~/.claude/bin/codeagent-wrapper --backend {{FRONTEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- "{{WORKDIR}}"
|
|
71
|
+
```
|
|
72
|
+
- For each unavailable tool, display warning with installation instructions.
|
|
73
|
+
|
|
74
|
+
5. **Summary Report**
|
|
75
|
+
Display status table:
|
|
76
|
+
```
|
|
77
|
+
Component Status
|
|
78
|
+
─────────────────────────────────
|
|
79
|
+
OpenSpec (OPSX) CLI ✓/✗
|
|
80
|
+
Project initialized ✓/✗
|
|
81
|
+
OPSX Skills ✓/✗
|
|
82
|
+
codeagent-wrapper ✓/✗
|
|
83
|
+
{{BACKEND_PRIMARY}} backend ✓/✗
|
|
84
|
+
{{FRONTEND_PRIMARY}} backend ✓/✗
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Next Steps (Use CCG Encapsulated Commands)**
|
|
88
|
+
1. Start Research: `/ccg:spec-research "description"`
|
|
89
|
+
2. Plan & Design: `/ccg:spec-plan`
|
|
90
|
+
3. Implement: `/ccg:spec-impl` (Includes auto-review & archive)
|
|
91
|
+
|
|
92
|
+
**Standalone Tools (Available Anytime)**
|
|
93
|
+
- Code Review: `/ccg:spec-review` (Independent dual-model review)
|
|
94
|
+
|
|
95
|
+
**Reference**
|
|
96
|
+
- OpenSpec (OPSX) CLI: `npx @fission-ai/openspec --help`
|
|
97
|
+
- Profile Management: `openspec config profile`
|
|
98
|
+
- CCG Workflow: `npx ccg-workflow`
|
|
99
|
+
- 后端/前端模型 MCP: Bundled with codeagent-wrapper
|
|
100
|
+
- Node.js >= 18.x required for OpenSpec
|
|
101
|
+
<!-- CCG:SPEC:INIT:END -->
|
|
@@ -0,0 +1,210 @@
|
|
|
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 {{BACKEND_PRIMARY}} and {{FRONTEND_PRIMARY}}.
|
|
14
|
+
- If constraints cannot be fully specified, escalate to user or return to research phase.
|
|
15
|
+
- Refer to `openspec/config.yaml` for project conventions.
|
|
16
|
+
- **USER GUIDANCE RULE**: When suggesting next steps to the user, ALWAYS use CCG commands (`/ccg:spec-research`, `/ccg:spec-plan`, `/ccg:spec-impl`, `/ccg:spec-review`). NEVER suggest `/opsx:*` commands to the user. If OpenSpec CLI returns error messages referencing OPSX skills, translate them to CCG equivalents.
|
|
17
|
+
- **TASKS FORMAT RULE**: When generating or modifying `tasks.md`, ALL tasks MUST use checkbox format (`- [ ] X.Y description`). Heading+bullet format will cause OpenSpec CLI to parse 0 tasks and block the workflow.
|
|
18
|
+
- **PHASE BOUNDARY**: This phase ONLY generates OPSX artifacts (specs.md, design.md, tasks.md). Do NOT modify any source code. Do NOT proceed to implementation. After artifacts are generated, STOP and inform the user: "Plan complete. Run `/ccg:spec-impl` to start implementation."
|
|
19
|
+
|
|
20
|
+
**Steps**
|
|
21
|
+
1. **Select Change**
|
|
22
|
+
- Run `openspec list --json` to display Active Changes.
|
|
23
|
+
- Confirm with user which change ID to refine.
|
|
24
|
+
- Run `openspec status --change "<change_id>" --json` to review current state.
|
|
25
|
+
|
|
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`.
|
|
29
|
+
- **工作目录**:`{{WORKDIR}}` **必须通过 Bash 执行 `pwd`(Unix)或 `cd`(Windows CMD)获取当前工作目录的绝对路径**,禁止从 `$HOME` 或环境变量推断。如果用户通过 `/add-dir` 添加了多个工作区,先确定任务相关的工作区。
|
|
30
|
+
|
|
31
|
+
**Step 2.1**: In ONE message, make TWO parallel Bash calls:
|
|
32
|
+
|
|
33
|
+
**FIRST Bash call ({{BACKEND_PRIMARY}})**:
|
|
34
|
+
```
|
|
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"
|
|
40
|
+
})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**SECOND Bash call ({{FRONTEND_PRIMARY}}) - IN THE SAME MESSAGE**:
|
|
44
|
+
```
|
|
45
|
+
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",
|
|
47
|
+
run_in_background: true,
|
|
48
|
+
timeout: 300000,
|
|
49
|
+
description: "{{FRONTEND_PRIMARY}}: frontend analysis"
|
|
50
|
+
})
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Step 2.2 (v4.5.2 事件驱动)**: spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理结果。**不调 TaskOutput**。两个 task 都收到通知后才进 step 2.3。
|
|
54
|
+
|
|
55
|
+
⛔ **禁止**:调 `TaskOutput({block: true, timeout: 600000})` (旧 freeze poll 模式) / Kill task。
|
|
56
|
+
⚠️ **失败处理**:notification status=failed / exit ≠ 0 / parse 失败 → v1.7.87 标准 2-retry / 5s / 3-attempts;3 次全失败才降级单模型。
|
|
57
|
+
|
|
58
|
+
- Synthesize responses and present consolidated options to user.
|
|
59
|
+
|
|
60
|
+
3. **Uncertainty Elimination Audit**
|
|
61
|
+
- **{{BACKEND_PRIMARY}}**: "Review proposal for unspecified decision points. List each as: [AMBIGUITY] → [REQUIRED CONSTRAINT]"
|
|
62
|
+
- **{{FRONTEND_PRIMARY}}**: "Identify implicit assumptions. Specify: [ASSUMPTION] → [EXPLICIT CONSTRAINT NEEDED]"
|
|
63
|
+
|
|
64
|
+
**Anti-Pattern Detection** (flag and reject):
|
|
65
|
+
- Information collection without decision boundaries
|
|
66
|
+
- Technical comparisons without selection criteria
|
|
67
|
+
- Deferred decisions marked "to be determined during implementation"
|
|
68
|
+
|
|
69
|
+
**Target Pattern** (required for approval):
|
|
70
|
+
- Explicit technology choices with parameters (e.g., "JWT with TTL=15min")
|
|
71
|
+
- Concrete algorithm selections with configs (e.g., "bcrypt cost=12")
|
|
72
|
+
- Precise behavioral rules (e.g., "Lock account 30min after 5 failed attempts")
|
|
73
|
+
|
|
74
|
+
Iterate with user until ALL ambiguities resolved.
|
|
75
|
+
|
|
76
|
+
4. **PBT Property Extraction**
|
|
77
|
+
- **{{BACKEND_PRIMARY}}**: "Extract PBT properties. For each requirement: [INVARIANT] → [FALSIFICATION STRATEGY]"
|
|
78
|
+
- **{{FRONTEND_PRIMARY}}**: "Define system properties: [PROPERTY] | [DEFINITION] | [BOUNDARY CONDITIONS] | [COUNTEREXAMPLE GENERATION]"
|
|
79
|
+
|
|
80
|
+
**Property Categories**:
|
|
81
|
+
- **Commutativity/Associativity**: Order-independent operations
|
|
82
|
+
- **Idempotency**: Repeated operations yield same result
|
|
83
|
+
- **Round-trip**: Encode→Decode returns original
|
|
84
|
+
- **Invariant Preservation**: State constraints maintained
|
|
85
|
+
- **Monotonicity**: Ordering guarantees (e.g., timestamps increase)
|
|
86
|
+
- **Bounds**: Value ranges, size limits, rate constraints
|
|
87
|
+
|
|
88
|
+
4.5. **Scope Reduction Detection(范围缩水检测,BLOCKER 级)**
|
|
89
|
+
|
|
90
|
+
**这是 plan-checker 维度 7b 的等价扫描,移植自 GSD 真实事故反推(D-26:动态成本引用被静态硬编码 v1)。**
|
|
91
|
+
|
|
92
|
+
在生成 OPSX artifacts 之前,对当前规划文本(多模型分析结果 + 即将写入 tasks.md 的内容)做软化语言扫描:
|
|
93
|
+
|
|
94
|
+
**扫描关键词集合**(中英双语,大小写不敏感):
|
|
95
|
+
- 阶段拆分类:`v1 简化` / `v1 静态` / `v1 硬编码` / `simplified version` / `static for now` / `static first`
|
|
96
|
+
- 推迟类:`future enhancement` / `未来增强` / `后续连接` / `will be wired later` / `not connected to`
|
|
97
|
+
- 占位类:`placeholder` / `占位符` / `占位实现` / `暂时硬编码` / `temporary hardcode`
|
|
98
|
+
- 知难而退类:`太复杂` / `太困难` / `too complex` / `too difficult` / `too hard`
|
|
99
|
+
|
|
100
|
+
**关键设计:与原始需求对比,避免合理 v1 渐进交付误报**
|
|
101
|
+
|
|
102
|
+
命中关键词后必须交叉对比,**不**直接阻断:
|
|
103
|
+
|
|
104
|
+
1. 抽取命中行的领域名词(如 `billing`, `cost reference`)
|
|
105
|
+
2. 与 OPSX `proposal.md` / `requirements.md` / 用户在 Step 1 选定的 change ID 对应需求做对比
|
|
106
|
+
3. 判决:
|
|
107
|
+
|
|
108
|
+
| 命中关键词 + 该能力在原始需求中存在 | plan 是否显式分阶段(v2/phase 2/增量交付被规划) | 判决 |
|
|
109
|
+
|-------------------------------------|--------------------------------------------------|------|
|
|
110
|
+
| ✅ 是 | ❌ 无 | **🔴 BLOCKER**(用户决策被缩水) |
|
|
111
|
+
| ✅ 是 | ✅ 有 | **NONE**(合理渐进,放行) |
|
|
112
|
+
| ❌ 否 | — | **🟡 WARNING**(人工确认) |
|
|
113
|
+
|
|
114
|
+
**BLOCKER 永远是 BLOCKER——不接受 warning 降级。** 命中 BLOCKER 时停止生成 artifacts,向用户输出:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
🔴 SCOPE REDUCTION BLOCKER
|
|
118
|
+
- 命中关键词:<keyword>
|
|
119
|
+
- 原文:<line>
|
|
120
|
+
- 对应需求:<requirement>
|
|
121
|
+
- 选项:
|
|
122
|
+
1. 完整实施该需求(重新规划,不再缩水)
|
|
123
|
+
2. 拆分阶段:把 v2 phase 显式列入计划(写入下一个 OPSX change,不能口头承诺)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
只有 BLOCKER 数量为 0 时才进入 Step 5。
|
|
127
|
+
|
|
128
|
+
5. **Update OPSX Artifacts** (then auto plan-checker)
|
|
129
|
+
- **BEFORE calling `/opsx:continue`** (internal skill call — do NOT expose this command to user), output a structured summary for OPSX context:
|
|
130
|
+
```markdown
|
|
131
|
+
## Planning Summary for OPSX
|
|
132
|
+
|
|
133
|
+
**Multi-Model Analysis Results**:
|
|
134
|
+
- {{BACKEND_PRIMARY}} (Backend): [Key findings and recommendations]
|
|
135
|
+
- {{FRONTEND_PRIMARY}} (Frontend): [Key findings and recommendations]
|
|
136
|
+
- Consolidated Approach: [Selected implementation strategy]
|
|
137
|
+
|
|
138
|
+
**Resolved Constraints**:
|
|
139
|
+
- [All explicit constraints from Step 3]
|
|
140
|
+
|
|
141
|
+
**PBT Properties**:
|
|
142
|
+
- [All extracted properties from Step 4 with falsification strategies]
|
|
143
|
+
|
|
144
|
+
**Technical Decisions**:
|
|
145
|
+
- [All finalized technology choices, algorithms, configurations]
|
|
146
|
+
|
|
147
|
+
**Implementation Tasks**:
|
|
148
|
+
- [High-level task breakdown ready for tasks.md]
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
- Then call `/opsx:continue` internally to generate next artifacts:
|
|
152
|
+
```
|
|
153
|
+
/opsx:continue
|
|
154
|
+
```
|
|
155
|
+
- The OPSX skill will use the above summary to create specs.md, design.md, and tasks.md.
|
|
156
|
+
- **Note**: This is an internal call. If this step fails, guide the user to re-run `/ccg:spec-plan`.
|
|
157
|
+
- **STOP**: After artifacts are generated, verify they exist and inform user:
|
|
158
|
+
"Plan phase complete. Artifacts generated: specs.md, design.md, tasks.md. Run `/ccg:spec-impl` to start implementation."
|
|
159
|
+
Do NOT proceed to modify source code.
|
|
160
|
+
|
|
161
|
+
5.5. **自动 plan-checker 校验(5 维度 + max-3-loop,CCG v4.0 Phase 6)**
|
|
162
|
+
|
|
163
|
+
生成 OPSX artifacts 后,**必须**自动 spawn `plan-checker` agent 对 specs.md / design.md / tasks.md 做 5 维度校验:
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
Agent({
|
|
167
|
+
subagent_type: "plan-checker",
|
|
168
|
+
description: "Validate OPSX plan artifacts (Dim 1/2/5/7b/10)",
|
|
169
|
+
prompt: "请对 openspec/changes/<change_id>/ 下的 specs.md / design.md / tasks.md 做 5 维度强校验:\n- Dim 1: Requirement Coverage(每条需求 ID 被某 plan/spec 声明)\n- Dim 2: Task Completeness(tasks.md 每条 task 含 Files/Action/Verify/Done)\n- Dim 5: Scope Sanity(≤3 tasks/plan)\n- Dim 7b: Scope Reduction(与 proposal.md 原始需求交叉对比)\n- Dim 10: CLAUDE.md Compliance(不违反项目 CLAUDE.md 禁用模式)\n输出 Plan Checker Report,并给出 ✅ 放行 / ❌ 退回 verdict。"
|
|
170
|
+
})
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**max-3-loop 收敛环**:
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
loop_count = 0
|
|
177
|
+
while loop_count < 3:
|
|
178
|
+
result = spawn plan-checker
|
|
179
|
+
if not result.hasBlocker:
|
|
180
|
+
break # ✅ 通过
|
|
181
|
+
# 退回 planner 修订(仅针对 BLOCKER)
|
|
182
|
+
回到 Step 5 重新调用 /opsx:continue 修订 specs/design/tasks
|
|
183
|
+
loop_count += 1
|
|
184
|
+
|
|
185
|
+
if loop_count == 3 and result.hasBlocker:
|
|
186
|
+
AskUserQuestion:
|
|
187
|
+
prompt: "plan-checker 3 轮仍存在 BLOCKER,请选择:"
|
|
188
|
+
options: ["force: 忽略 BLOCKER 强制进入实施", "guide: 提供具体指导让 planner 再试", "abort: 放弃当前 plan"]
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
只有 plan-checker ✅ 放行 后才进入下一步(Context Checkpoint)。
|
|
192
|
+
|
|
193
|
+
6. **Context Checkpoint**
|
|
194
|
+
- Report current context usage.
|
|
195
|
+
- If approaching 80K tokens, suggest: "Run `/clear` and continue with `/ccg:spec-impl`"
|
|
196
|
+
|
|
197
|
+
**Exit Criteria**
|
|
198
|
+
A change is ready for implementation only when:
|
|
199
|
+
- [ ] All multi-model analyses completed and synthesized
|
|
200
|
+
- [ ] Zero ambiguities remain (verified by step 3 audit)
|
|
201
|
+
- [ ] All PBT properties documented with falsification strategies
|
|
202
|
+
- [ ] Artifacts (specs, design, tasks) generated via OpenSpec skills
|
|
203
|
+
- [ ] User has explicitly approved all constraint decisions
|
|
204
|
+
|
|
205
|
+
**Reference**
|
|
206
|
+
- Inspect change: `openspec status --change "<id>" --json`
|
|
207
|
+
- List changes: `openspec list --json`
|
|
208
|
+
- Search patterns: `rg -n "INVARIANT:|PROPERTY:" openspec/`
|
|
209
|
+
- Use `AskUserQuestion` for ANY ambiguity—never assume
|
|
210
|
+
<!-- CCG:SPEC:PLAN:END -->
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: '需求 → 约束集(并行探索 + OPSX 提案)'
|
|
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 OPSX rules when writing spec-structured documents.
|
|
10
|
+
|
|
11
|
+
**Guardrails**
|
|
12
|
+
- **STOP! BEFORE ANY OTHER ACTION**: You MUST perform Prompt Enhancement 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_SEARCH_TOOL}}` to minimize grep/find operations.
|
|
17
|
+
- Do not make architectural decisions—surface constraints that guide decisions.
|
|
18
|
+
- **USER GUIDANCE RULE**: When suggesting next steps to the user, ALWAYS use CCG commands (`/ccg:spec-research`, `/ccg:spec-plan`, `/ccg:spec-impl`, `/ccg:spec-review`). NEVER suggest `/opsx:*` commands to the user. If OpenSpec CLI returns error messages referencing OPSX skills, translate them to CCG equivalents.
|
|
19
|
+
- **PHASE BOUNDARY**: This phase ONLY generates the OPSX proposal artifact. Do NOT modify any source code. Do NOT proceed to planning or implementation. After the proposal is generated, STOP and inform the user: "Research complete. Run `/ccg:spec-plan` to continue."
|
|
20
|
+
|
|
21
|
+
**Steps**
|
|
22
|
+
0. **MANDATORY: Enhance Requirement FIRST**
|
|
23
|
+
- **DO THIS IMMEDIATELY. DO NOT SKIP.**
|
|
24
|
+
- **Prompt 增强**(按 `/ccg:enhance` 的逻辑执行):分析 $ARGUMENTS 的意图、缺失信息、隐含假设,补全为结构化需求(明确目标、技术约束、范围边界、验收标准)。
|
|
25
|
+
- Use enhanced prompt for ALL subsequent steps.
|
|
26
|
+
|
|
27
|
+
1. **Generate OPSX Change**
|
|
28
|
+
- Check if change already exists:
|
|
29
|
+
```bash
|
|
30
|
+
openspec list --json
|
|
31
|
+
```
|
|
32
|
+
- If change doesn't exist, create it:
|
|
33
|
+
```bash
|
|
34
|
+
openspec new change "<brief-descriptive-name>"
|
|
35
|
+
```
|
|
36
|
+
- This scaffolds `openspec/changes/<name>/` with proposal.md.
|
|
37
|
+
- If change already exists, continue with existing change.
|
|
38
|
+
|
|
39
|
+
2. **Initial Codebase Assessment**
|
|
40
|
+
- Use `{{MCP_SEARCH_TOOL}}` to scan codebase.
|
|
41
|
+
- Determine project scale: single vs multi-directory structure.
|
|
42
|
+
- **Decision**: If multi-directory → enable parallel Explore subagents.
|
|
43
|
+
|
|
44
|
+
3. **Define Exploration Boundaries (Context-Based)**
|
|
45
|
+
- Identify natural context boundaries (NOT functional roles):
|
|
46
|
+
* Subagent 1: User domain code (models, services, UI)
|
|
47
|
+
* Subagent 2: Auth & authorization (middleware, session, tokens)
|
|
48
|
+
* Subagent 3: Infrastructure (configs, deployments, builds)
|
|
49
|
+
- Each boundary should be self-contained: no cross-communication needed.
|
|
50
|
+
|
|
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`.
|
|
54
|
+
- **工作目录**:`{{WORKDIR}}` **必须通过 Bash 执行 `pwd`(Unix)或 `cd`(Windows CMD)获取当前工作目录的绝对路径**,禁止从 `$HOME` 或环境变量推断。如果用户通过 `/add-dir` 添加了多个工作区,先确定任务相关的工作区。
|
|
55
|
+
|
|
56
|
+
**Output Template** (instruct both models to use this format):
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"module_name": "context boundary explored",
|
|
60
|
+
"existing_structures": ["key patterns found"],
|
|
61
|
+
"existing_conventions": ["standards in use"],
|
|
62
|
+
"constraints_discovered": ["hard constraints limiting solution space"],
|
|
63
|
+
"open_questions": ["ambiguities requiring user input"],
|
|
64
|
+
"dependencies": ["cross-module dependencies"],
|
|
65
|
+
"risks": ["potential blockers"],
|
|
66
|
+
"success_criteria_hints": ["observable success behaviors"]
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Step 4.1**: In ONE message, make TWO parallel Bash calls:
|
|
71
|
+
|
|
72
|
+
**FIRST Bash call ({{BACKEND_PRIMARY}} — backend boundaries)**:
|
|
73
|
+
```
|
|
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"
|
|
79
|
+
})
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**SECOND Bash call ({{FRONTEND_PRIMARY}} — frontend boundaries) - IN THE SAME MESSAGE**:
|
|
83
|
+
```
|
|
84
|
+
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",
|
|
86
|
+
run_in_background: true,
|
|
87
|
+
timeout: 300000,
|
|
88
|
+
description: "{{FRONTEND_PRIMARY}}: frontend boundary exploration"
|
|
89
|
+
})
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Step 4.2 (v4.5.2 事件驱动)**: spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理结果。**不调 TaskOutput**。两个 task 都收到通知后才进 step 4.3。
|
|
93
|
+
|
|
94
|
+
⛔ **禁止**:调 `TaskOutput({block: true, timeout: 600000})` (旧 freeze poll 模式) / Kill task。
|
|
95
|
+
⚠️ **失败处理**:notification status=failed / exit ≠ 0 / parse 失败 → v1.7.87 标准 2-retry / 5s / 3-attempts;3 次全失败才降级单模型。
|
|
96
|
+
|
|
97
|
+
5. **Aggregate and Synthesize**
|
|
98
|
+
- Collect all subagent outputs.
|
|
99
|
+
- Merge into unified constraint sets:
|
|
100
|
+
* **Hard constraints**: Technical limitations, patterns that cannot be violated
|
|
101
|
+
* **Soft constraints**: Conventions, preferences, style guides
|
|
102
|
+
* **Dependencies**: Cross-module relationships affecting implementation order
|
|
103
|
+
* **Risks**: Blockers needing mitigation
|
|
104
|
+
|
|
105
|
+
6. **User Interaction for Ambiguity Resolution**
|
|
106
|
+
- Compile prioritized list of open questions.
|
|
107
|
+
- Use `AskUserQuestion` tool to present systematically:
|
|
108
|
+
* Group related questions
|
|
109
|
+
* Provide context for each
|
|
110
|
+
* Suggest defaults when applicable
|
|
111
|
+
- Capture responses as additional constraints.
|
|
112
|
+
|
|
113
|
+
7. **Finalize OPSX Proposal**
|
|
114
|
+
- **BEFORE calling `/opsx:continue`** (internal skill call — do NOT expose this command to user), output a structured summary for OPSX context:
|
|
115
|
+
```markdown
|
|
116
|
+
## Research Summary for OPSX
|
|
117
|
+
|
|
118
|
+
**Discovered Constraints**:
|
|
119
|
+
- [List all hard and soft constraints from Step 5]
|
|
120
|
+
|
|
121
|
+
**Dependencies**:
|
|
122
|
+
- [List cross-module dependencies]
|
|
123
|
+
|
|
124
|
+
**Risks & Mitigations**:
|
|
125
|
+
- [List identified risks and mitigation strategies]
|
|
126
|
+
|
|
127
|
+
**Success Criteria**:
|
|
128
|
+
- [List verifiable success behaviors]
|
|
129
|
+
|
|
130
|
+
**User Confirmations**:
|
|
131
|
+
- [List all user decisions from Step 6]
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
- Then call `/opsx:continue` internally to generate proposal artifact:
|
|
135
|
+
```
|
|
136
|
+
/opsx:continue
|
|
137
|
+
```
|
|
138
|
+
- The OPSX skill will use the above summary to write proposal.md.
|
|
139
|
+
- **Note**: This is an internal call. If this step fails, guide the user to re-run `/ccg:spec-research`.
|
|
140
|
+
- **STOP**: After proposal is generated, verify it exists and inform user:
|
|
141
|
+
"Research phase complete. Proposal generated. Run `/ccg:spec-plan` to continue planning."
|
|
142
|
+
Do NOT proceed to planning or implementation.
|
|
143
|
+
|
|
144
|
+
8. **Context Checkpoint**
|
|
145
|
+
- Report current context usage.
|
|
146
|
+
- If approaching 80K tokens, suggest: "Run `/clear` and continue with `/ccg:spec-plan`"
|
|
147
|
+
|
|
148
|
+
**Reference**
|
|
149
|
+
- OPSX CLI: `openspec status --change "<id>" --json`, `openspec list --json`
|
|
150
|
+
- Check prior research: `ls openspec/changes/*/`
|
|
151
|
+
- Use `AskUserQuestion` for ANY ambiguity—never assume or guess
|
|
152
|
+
<!-- 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 {{BACKEND_PRIMARY}} AND {{FRONTEND_PRIMARY}} must complete review before synthesis.
|
|
13
|
+
- Review scope is strictly limited to the proposal's changes—no scope creep.
|
|
14
|
+
- Refer to `openspec/config.yaml` for project conventions when reviewing OpenSpec proposals.
|
|
15
|
+
|
|
16
|
+
**Steps**
|
|
17
|
+
1. **Select Proposal**
|
|
18
|
+
- Run `openspec list --json` to display Active Changes.
|
|
19
|
+
- Confirm with user which proposal ID to review.
|
|
20
|
+
- Run `openspec status --change "<proposal_id>" --json` to load spec and tasks.
|
|
21
|
+
|
|
22
|
+
2. **Collect Implementation Artifacts**
|
|
23
|
+
- Identify all files modified by this proposal.
|
|
24
|
+
- Use `git diff` 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 {{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`.
|
|
30
|
+
- **工作目录**:`{{WORKDIR}}` **必须通过 Bash 执行 `pwd`(Unix)或 `cd`(Windows CMD)获取当前工作目录的绝对路径**,禁止从 `$HOME` 或环境变量推断。如果用户通过 `/add-dir` 添加了多个工作区,先确定任务相关的工作区。
|
|
31
|
+
|
|
32
|
+
**Step 3.1**: In ONE message, make TWO parallel Bash calls:
|
|
33
|
+
|
|
34
|
+
**FIRST Bash call ({{BACKEND_PRIMARY}})**:
|
|
35
|
+
```
|
|
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"
|
|
41
|
+
})
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**SECOND Bash call ({{FRONTEND_PRIMARY}}) - IN THE SAME MESSAGE**:
|
|
45
|
+
```
|
|
46
|
+
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",
|
|
48
|
+
run_in_background: true,
|
|
49
|
+
timeout: 300000,
|
|
50
|
+
description: "{{FRONTEND_PRIMARY}}: patterns/integration review"
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Step 3.2 (v4.5.2 事件驱动)**: spawn 两个 Bash bg 后说明 task-id 然后 **turn end**。引擎在每个 task 完成时自动发 `<task-notification>`,主线在通知触发的新 turn 处理结果。**不调 TaskOutput**。两个 task 都收到通知后才进 step 3.3。
|
|
55
|
+
|
|
56
|
+
⛔ **禁止**:调 `TaskOutput({block: true, timeout: 600000})` (旧 freeze poll 模式) / Kill task。
|
|
57
|
+
⚠️ **失败处理**:notification status=failed / exit ≠ 0 / parse 失败 → v1.7.87 标准 2-retry / 5s / 3-attempts;3 次全失败才降级单模型。
|
|
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→{{BACKEND_PRIMARY}}, frontend→{{FRONTEND_PRIMARY}}).
|
|
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 {{BACKEND_PRIMARY}} and {{FRONTEND_PRIMARY}} 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 status --change "<id>" --json`
|
|
117
|
+
- Check spec constraints: `rg -n "CONSTRAINT:|MUST|INVARIANT:" openspec/changes/<id>/specs/`
|
|
118
|
+
- View implementation diff: `git diff`
|
|
119
|
+
- Archive (after passing): `/ccg:spec-impl` → Step 10
|
|
120
|
+
<!-- CCG:SPEC:REVIEW:END -->
|