/spec-plan
多模型分析 → 消除歧义 → 零决策可执行计划
> /plugin marketplace add fengshao1227/ccg-workflow > /plugin install ccg@ccg
How it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/spec-plan
Context preview
What this command does when you run it.
多模型分析 → 消除歧义 → 零决策可执行计划
Command definition
spec-plan.mddescription: '多模型分析 → 消除歧义 → 零决策可执行计划'
<!-- CCG:SPEC:PLAN:START --> **Core Philosophy**
- The goal is to eliminate ALL decision points—implementation should be pure mechanical execution.
- Every ambiguity must be resolved into explicit constraints before proceeding.
- Multi-model collaboration surfaces blind spots and conflicting assumptions.
- Every requirement must have Property-Based Testing (PBT) properties—focus on invariants.
**Guardrails**
- Do not proceed to implementation until every ambiguity is resolved.
- Multi-model collaboration is **mandatory**: use both {{BACKEND_PRIMARY}} and {{FRONTEND_PRIMARY}}.
- If constraints cannot be fully specified, escalate to user or return to research phase.
- Refer to `openspec/config.yaml` for project conventions.
- **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.
- **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.
- **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."
**Steps** 1. **Select Change**
- Run `openspec list --json` to display Active Changes.
- Confirm with user which change ID to refine.
- Run `openspec status --change "<change_id>" --json` to review current state.
2. **Multi-Model Implementation Analysis (PARALLEL)**
- **CRITICAL**: You MUST launch BOTH {{BACKEND_PRIMARY}} AND {{FRONTEND_PRIMARY}} in a SINGLE message with TWO Bash tool calls.
- **DO NOT** call one model first and wait. Launch BOTH simultaneously with `run_in_background: true`.
- **工作目录**:`{{WORKDIR}}` **必须通过 Bash 执行 `pwd`(Unix)或 `cd`(Windows CMD)获取当前工作目录的绝对路径**,禁止从 `$HOME` 或环境变量推断。如果用户通过 `/add-dir` 添加了多个工作区,先确定任务相关的工作区。
**Step 2.1**: In ONE message, make TWO parallel Bash calls:
**FIRST Bash call ({{BACKEND_PRIMARY}})**:
Bash({
command: "~/.claude/bin/codeagent-wrapper --progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}{{GROK_MODEL_FLAG}}{{KIMI_MODEL_FLAG}}{{OPENCODE_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",
run_in_background: true,
timeout: 300000,
description: "{{BACKEND_PRIMARY}}: backend analysis"
})**SECOND Bash call ({{FRONTEND_PRIMARY}}) - IN THE SAME MESSAGE**:
Bash({
command: "~/.claude/bin/codeagent-wrapper --progress --backend {{FRONTEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}{{GROK_MODEL_FLAG}}{{KIMI_MODEL_FLAG}}{{OPENCODE_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",
run_in_background: true,
timeout: 300000,
description: "{{FRONTEND_PRIMARY}}: frontend analysis"
})**Step 2.2**: After BOTH Bash calls return task IDs, wait for results with TWO TaskOutput calls:
TaskOutput({ task_id: "<codex_task_id>", block: true, timeout: 600000 })
TaskOutput({ task_id: "<gemini_task_id>", block: true, timeout: 600000 })⛔ **前端模型失败必须重试**:若前端模型调用失败,最多重试 2 次(间隔 5 秒)。3 次全败才跳过。 ⛔ **后端模型结果必须等待**:后端模型执行 5-15 分钟属正常,超时后继续轮询,禁止跳过。
- Synthesize responses and present consolidated options to user.
3. **Uncertainty Elimination Audit**
- **{{BACKEND_PRIMARY}}**: "Review proposal for unspecified decision points. List each as: [AMBIGUITY] → [REQUIRED CONSTRAINT]"
- **{{FRONTEND_PRIMARY}}**: "Identify implicit assumptions. Specify: [ASSUMPTION] → [EXPLICIT CONSTRAINT NEEDED]"
**Anti-Pattern Detection** (flag and reject):
- Information collection without decision boundaries
- Technical comparisons without selection criteria
- Deferred decisions marked "to be determined during implementation"
**Target Pattern** (required for approval):
- Explicit technology choices with parameters (e.g., "JWT with TTL=15min")
- Concrete algorithm selections with configs (e.g., "bcrypt cost=12")
- Precise behavioral rules (e.g., "Lock account 30min after 5 failed attempts")
Iterate with user until ALL ambiguities resolved.
4. **PBT Property Extraction**
- **{{BACKEND_PRIMARY}}**: "Extract PBT properties. For each requirement: [INVARIANT] → [FALSIFICATION STRATEGY]"
- **{{FRONTEND_PRIMARY}}**: "Define system properties: [PROPERTY] | [DEFINITION] | [BOUNDARY CONDITIONS] | [COUNTEREXAMPLE GENERATION]"
**Property Categories**:
- **Commutativity/Associativity**: Order-independent operations
- **Idempotency**: Repeated operations yield same result
- **Round-trip**: Encode→Decode returns original
- **Invariant Preservation**: State constraints maintained
- **Monotonicity**: Ordering guarantees (e.g., timestamps increase)
- **Bounds**: Value ranges, size limits, rate constraints
5. **Update OPSX Artifacts**
- **BEFORE calling `/opsx:continue`** (internal skill call — do NOT expose this command to user), output a structured summary for OPSX context:
## Planning Summary for OPSX
**Multi-Model Analysis Results**:
- {{BACKEND_PRIMARY}} (Backend): [Key findings and recommendations]
- {{FRONTEND_PRIMARY}} (Frontend): [Key findings and recommendations]
- Consolidated Approach: [Selected implementation strategy]
**Resolved Constraints**:Read more
description: '多模型分析 → 消除歧义 → 零决策可执行计划'
<!-- CCG:SPEC:PLAN:START --> **Core Philosophy**
- The goal is to eliminate ALL decision points—implementation should be pure mechanical execution.
- Every ambiguity must be resolved into explicit constraints before proceeding.
- Multi-model collaboration surfaces blind spots and conflicting assumptions.
- Every requirement must have Property-Based Testing (PBT) properties—focus on invariants.
**Guardrails**
- Do not proceed to implementation until every ambiguity is resolved.
- Multi-model collaboration is **mandatory**: use both {{BACKEND_PRIMARY}} and {{FRONTEND_PRIMARY}}.
- If constraints cannot be fully specified, escalate to user or return to research phase.
- Refer to `openspec/config.yaml` for project conventions.
- **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.
- **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.
- **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."
**Steps** 1. **Select Change**
- Run `openspec list --json` to display Active Changes.
- Confirm with user which change ID to refine.
- Run `openspec status --change "<change_id>" --json` to review current state.
2. **Multi-Model Implementation Analysis (PARALLEL)**
- **CRITICAL**: You MUST launch BOTH {{BACKEND_PRIMARY}} AND {{FRONTEND_PRIMARY}} in a SINGLE message with TWO Bash tool calls.
- **DO NOT** call one model first and wait. Launch BOTH simultaneously with `run_in_background: true`.
- **工作目录**:`{{WORKDIR}}` **必须通过 Bash 执行 `pwd`(Unix)或 `cd`(Windows CMD)获取当前工作目录的绝对路径**,禁止从 `$HOME` 或环境变量推断。如果用户通过 `/add-dir` 添加了多个工作区,先确定任务相关的工作区。
**Step 2.1**: In ONE message, make TWO parallel Bash calls:
**FIRST Bash call ({{BACKEND_PRIMARY}})**:
Bash({
command: "~/.claude/bin/codeagent-wrapper --progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}{{GROK_MODEL_FLAG}}{{KIMI_MODEL_FLAG}}{{OPENCODE_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",
run_in_background: true,
timeout: 300000,
description: "{{BACKEND_PRIMARY}}: backend analysis"
})**SECOND Bash call ({{FRONTEND_PRIMARY}}) - IN THE SAME MESSAGE**:
Bash({
command: "~/.claude/bin/codeagent-wrapper --progress --backend {{FRONTEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}{{GROK_MODEL_FLAG}}{{KIMI_MODEL_FLAG}}{{OPENCODE_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",
run_in_background: true,
timeout: 300000,
description: "{{FRONTEND_PRIMARY}}: frontend analysis"
})**Step 2.2**: After BOTH Bash calls return task IDs, wait for results with TWO TaskOutput calls:
TaskOutput({ task_id: "<codex_task_id>", block: true, timeout: 600000 })
TaskOutput({ task_id: "<gemini_task_id>", block: true, timeout: 600000 })⛔ **前端模型失败必须重试**:若前端模型调用失败,最多重试 2 次(间隔 5 秒)。3 次全败才跳过。 ⛔ **后端模型结果必须等待**:后端模型执行 5-15 分钟属正常,超时后继续轮询,禁止跳过。
- Synthesize responses and present consolidated options to user.
3. **Uncertainty Elimination Audit**
- **{{BACKEND_PRIMARY}}**: "Review proposal for unspecified decision points. List each as: [AMBIGUITY] → [REQUIRED CONSTRAINT]"
- **{{FRONTEND_PRIMARY}}**: "Identify implicit assumptions. Specify: [ASSUMPTION] → [EXPLICIT CONSTRAINT NEEDED]"
**Anti-Pattern Detection** (flag and reject):
- Information collection without decision boundaries
- Technical comparisons without selection criteria
- Deferred decisions marked "to be determined during implementation"
**Target Pattern** (required for approval):
- Explicit technology choices with parameters (e.g., "JWT with TTL=15min")
- Concrete algorithm selections with configs (e.g., "bcrypt cost=12")
- Precise behavioral rules (e.g., "Lock account 30min after 5 failed attempts")
Iterate with user until ALL ambiguities resolved.
4. **PBT Property Extraction**
- **{{BACKEND_PRIMARY}}**: "Extract PBT properties. For each requirement: [INVARIANT] → [FALSIFICATION STRATEGY]"
- **{{FRONTEND_PRIMARY}}**: "Define system properties: [PROPERTY] | [DEFINITION] | [BOUNDARY CONDITIONS] | [COUNTEREXAMPLE GENERATION]"
**Property Categories**:
- **Commutativity/Associativity**: Order-independent operations
- **Idempotency**: Repeated operations yield same result
- **Round-trip**: Encode→Decode returns original
- **Invariant Preservation**: State constraints maintained
- **Monotonicity**: Ordering guarantees (e.g., timestamps increase)
- **Bounds**: Value ranges, size limits, rate constraints
5. **Update OPSX Artifacts**
- **BEFORE calling `/opsx:continue`** (internal skill call — do NOT expose this command to user), output a structured summary for OPSX context:
## Planning Summary for OPSX
**Multi-Model Analysis Results**:
- {{BACKEND_PRIMARY}} (Backend): [Key findings and recommendations]
- {{FRONTEND_PRIMARY}} (Frontend): [Key findings and recommendations]
- Consolidated Approach: [Selected implementation strategy]
**Resolved Constraints**:多模型协作工作流引擎 — /ccg:go 一个命令,AI 自动分析意图、选择策略、编排 Codex + Gemini + Claude 协作执行
Repo: fengshao1227/ccg-workflow

