Skip to content
Agent Orchestration
Command

/spec-research

需求 → 约束集(并行探索 + OPSX 提案)

From plugin
ccg
6k19 skills19 commands
> /plugin marketplace add fengshao1227/ccg-workflow
> /plugin install ccg@ccg

Command definition

spec-research.md
description: '需求 → 约束集(并行探索 + OPSX 提案)'

<!-- CCG:SPEC:RESEARCH:START --> **Core Philosophy**

  • Research produces **constraint sets**, not information dumps. Each constraint narrows the solution space.
  • Constraints tell subsequent stages "don't consider this direction," enabling mechanical execution without decisions.
  • Output: 约束集合 + 可验证的成功判据 (constraint sets + verifiable success criteria).
  • Strictly adhere to OPSX rules when writing spec-structured documents.

**Guardrails**

  • **STOP! BEFORE ANY OTHER ACTION**: You MUST perform Prompt Enhancement FIRST. This is NON-NEGOTIABLE.
  • **NEVER** divide subagent tasks by roles (e.g., "架构师agent", "安全专家agent").
  • **ALWAYS** divide by context boundaries (e.g., "user-related code", "authentication logic").
  • Each subagent context must be self-contained with independent output.
  • Use `{{MCP_SEARCH_TOOL}}` to minimize grep/find operations.
  • Do not make architectural decisions—surface constraints that guide decisions.
  • **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.
  • **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."

**Steps** 0. **MANDATORY: Enhance Requirement FIRST**

  • **DO THIS IMMEDIATELY. DO NOT SKIP.**
  • **Prompt 增强**(按 `/ccg:enhance` 的逻辑执行):分析 $ARGUMENTS 的意图、缺失信息、隐含假设,补全为结构化需求(明确目标、技术约束、范围边界、验收标准)。
  • Use enhanced prompt for ALL subsequent steps.

1. **Generate OPSX Change**

  • Check if change already exists:
     openspec list --json
  • If change doesn't exist, create it:
     openspec new change "<brief-descriptive-name>"
  • This scaffolds `openspec/changes/<name>/` with proposal.md.
  • If change already exists, continue with existing change.

2. **Initial Codebase Assessment**

  • Use `{{MCP_SEARCH_TOOL}}` to scan codebase.
  • Determine project scale: single vs multi-directory structure.
  • **Decision**: If multi-directory → enable parallel Explore subagents.

3. **Define Exploration Boundaries (Context-Based)**

  • Identify natural context boundaries (NOT functional roles):
  • Subagent 1: User domain code (models, services, UI)
  • Subagent 2: Auth & authorization (middleware, session, tokens)
  • Subagent 3: Infrastructure (configs, deployments, builds)
  • Each boundary should be self-contained: no cross-communication needed.

4. **Parallel Multi-Model Exploration**

  • **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` 添加了多个工作区,先确定任务相关的工作区。

**Output Template** (instruct both models to use this format):

   {
     "module_name": "context boundary explored",
     "existing_structures": ["key patterns found"],
     "existing_conventions": ["standards in use"],
     "constraints_discovered": ["hard constraints limiting solution space"],
     "open_questions": ["ambiguities requiring user input"],
     "dependencies": ["cross-module dependencies"],
     "risks": ["potential blockers"],
     "success_criteria_hints": ["observable success behaviors"]
   }

**Step 4.1**: In ONE message, make TWO parallel Bash calls:

**FIRST Bash call ({{BACKEND_PRIMARY}} — backend boundaries)**:

   Bash({
     command: "~/.claude/bin/codeagent-wrapper --progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}{{GROK_MODEL_FLAG}}{{KIMI_MODEL_FLAG}}{{OPENCODE_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",
     run_in_background: true,
     timeout: 3600000,
     description: "{{BACKEND_PRIMARY}}: backend boundary exploration"
   })

**SECOND Bash call ({{FRONTEND_PRIMARY}} — frontend boundaries) - 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'\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",
     run_in_background: true,
     timeout: 3600000,
     description: "{{FRONTEND_PRIMARY}}: frontend boundary exploration"
   })

**Step 4.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 分钟属正常,超时后继续轮询,禁止跳过。

5. **Aggregate and Synthesize**

  • Collect all subagent outputs.
  • Merge into unified constraint sets:
  • **Hard constraints**: Technical limitations, patterns that cannot be violated
  • **Soft constraints**: Conventions, preferences, style guides
  • **Dependencies**: Cross-module relationships affecting implementation order
  • **Risks**: Blockers needing mitigation

6. **User Interaction for Ambiguity Resolution**

  • Compile prio
Read more
@fengshao1227
Ships withccg

多模型协作工作流引擎 — /ccg:go 一个命令,AI 自动分析意图、选择策略、编排 Codex + Gemini + Claude 协作执行

Stars on GitHub

Momentum

stars in total
6.0k
Star history of fengshao1227/ccg-workflow on GitHub, a chart by star-history.com

Other commands on ccg.

init-architect

init-architect

Command

自适应初始化:根级简明 + 模块级详尽;分阶段遍历并回报覆盖率

@fengshao1227@fengshao1227Install Command
planner

planner

Command

📋 任务规划师 - 使用 WBS 方法论分解功能需求为可执行任务

@fengshao1227@fengshao1227Install Command
team-architect

team-architect

Command

🏗 架构师 - 扫描代码库,综合多模型分析,输出架构蓝图和文件分配矩阵

@fengshao1227@fengshao1227Install Command
team-qa

team-qa

Command

🧪 QA 工程师 - 检测测试框架,编写测试,运行全量测试 + lint + typecheck

@fengshao1227@fengshao1227Install Command
team-reviewer

team-reviewer

Command

🔬 代码审查员 - 综合 Codex/Gemini 审查结果,分级输出 Critical/Warning/Info

@fengshao1227@fengshao1227Install Command

More commands from other plugins.

COMMAND_COMPLIANCE_REPORT

COMMAND_COMPLIANCE_REP…

Command

Reviewed all command files in `.claude/commands/analysis/` directory to ensure proper usage of: - `mcp__claude-flow__*` tools…

@ruvnet@ruvnetInstall Command
ask

ask

Command

This compatibility command keeps `/oh-my-claudecode:ask` available without loading the full `ask` skill description in every…

@yeachan-heo@yeachan-heoInstall Command