plan
Create or revise a CCG implementation plan with Codex as planner and Gemini as a read-only analysis helper. Use when the user invokes /ccg:plan, asks to generate a .codex/ccg/plans/*.md CCG plan, asks to revise an existing CCG plan, or wants multi-model Codex+Gemini planning without modifying product code.
- License 许可
- MIT
- 最近更新
- 2026-10-01
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- plan
- description
- Create or revise a CCG implementation plan with Codex as planner and Gemini as a read-only analysis helper. Use when the user invokes /ccg:plan, asks to generate a .codex/ccg/plans/*.md CCG plan, asks to revise an existing CCG plan, or wants multi-model Codex+Gemini planning without modifying product code.
02 资源文件 1
- 参考文档agents/openai.yaml177 B
03 SKILL.md 正文
CCG Plan
Create decision-complete CCG plans for later /ccg:execute. This skill replaces the original Claude-led /ccg:plan with a Codex-native planner: Codex gathers context and writes the final plan under .codex/ccg/plans/; Gemini contributes read-only analysis from a disposable snapshot.
Boundaries
- Write new plans only to
.codex/ccg/plans/*.md. Do not create new.claude/plan/*.mdfiles. - Legacy
.claude/plan/*.mdfiles are read-compatible inputs. Revise a legacy.claude/plan/*.mdfile only when the user explicitly names that existing legacy file; mention in Chinese that it is a compatibility write. - Do not modify product code, tests, migrations, package files, or original Claude CCG plugin files.
- Do not call
~/.claude/bin/codeagent-wrapper.exeor any Claude-side execution wrapper. - Do not call
/ccg:executeautomatically and do not ask for a Y/N execution handoff. - If no user requirement is provided, answer in Chinese with usage examples and do not write files.
- If the user explicitly asks to revise an existing plan file, update only that plan file. Otherwise create a new plan and never overwrite an existing plan; use
-v2,-v3, and so on.
Language Contract
All /ccg:plan user-facing output must be Chinese by default. This includes empty-input usage/help, progress summaries, ambiguity questions, Gemini launch or failure reports, saved-plan summaries, and the final /ccg:execute <plan-path> handoff. English is allowed only for literal commands, file paths, code identifiers, generated English slugs, model names, environment variables, and raw Gemini excerpts that are clearly labeled as excerpts.
The generated plan file itself must also be Chinese by default. Hard requirement:
- Use Chinese section headings, table headers, checklist labels, narrative text, risk descriptions, test strategy, and handoff explanation.
- Keep English only for literal commands, file paths, code identifiers, model names, environment variables, generated slugs, URLs, and clearly labeled raw Gemini excerpts.
- Do not write an English plan template and then summarize it in Chinese; the saved
.codex/ccg/plans/*.mdcontent is the final CCG planning output and must be Chinese. - If Gemini responds in English, synthesize it into Chinese before writing the final plan, while preserving short literal excerpts only when useful.
Internal prompts to tools or Gemini may use English when that improves retrieval or technical precision, but Codex must translate the final planning interaction and the saved plan content back into concise Chinese for the user.
Gemini gate
For any real plan creation or plan revision, Gemini participation is mandatory. Before you write or present a final plan, you must have all of the following:
- a successful Gemini helper launch using
gemini-3.1-pro-previewby default, unless the user explicitly provided another model; CCG_GEMINI_PREVIEW_URLand eitherCCG_GEMINI_BROWSER_OPENED=1or a clear note that the user should open the preview URL manually;- a real
CCG_GEMINI_RESPONSE_FILEpath printed by the helper; - a non-empty response read from that response file;
- a final synthesis that includes both Codex analysis and Gemini analysis.
If the Gemini helper cannot start, exits unsuccessfully, does not print CCG_GEMINI_RESPONSE_FILE, writes an empty response, or still fails after two retries, stop and report the failure in Chinese. In that case, do not write or present a final plan, do not create or edit .codex/ccg/plans/*.md or legacy .claude/plan/*.md, and do not emit a fake multi-model <proposed_plan>.
This gate does not apply to empty-input usage/help responses.
Workflow
-
Preflight
- Run
git status --short. - Read relevant project instructions such as
AGENTS.md, local README files, and existing plan files only when they affect the requested plan. - Resolve the absolute project root from the current workspace; do not infer it from home paths.
- Run
-
Enhance the requirement
- Convert the user request into structured planning input: goal, in-scope behavior, out-of-scope behavior, constraints, acceptance criteria, likely affected areas, and open questions.
- Score the enhanced requirement with the original CCG-style
需求完整性评分(0-10)before writing a plan:目标明确性(0-3)预期结果(0-3)边界范围(0-2)约束条件(0-2)总分:X/10判定:>=7 继续;<7 停止并提出补充问题
- If high-impact ambiguity remains, ask the user before writing any plan.
- If the requirement score is
<7, stop and ask concise follow-up questions instead of creating or revising a plan.
-
Search project context
- Prefer
mcp__ace-tool__search_contextwhen available. - Fall back to
mcp__fast-context__fast_context_searchif available, thenrg, PowerShell-native search,Glob,Grep, and targeted file reads. - If ace-tool, fast-context, or
rgfail because credentials are missing or access is denied, continue with targeted reads and exact search instead of aborting. - Gather enough evidence to name key files, symbols, existing patterns, and verification commands. Do not invent paths.
- Prefer
-
Run Gemini read-only analysis
- Use the bundled helper from
../ccg-executor/scripts/invoke_gemini_preview.py. - Invoke Gemini with
--approval-mode plan --detach --prompt-template plan, default modelgemini-3.1-pro-preview, no--direct-workdir, and no--no-browserunless the user explicitly asks for headless mode. - Confirm the helper prints
CCG_GEMINI_BROWSER_OPENED=1or report the printedCCG_GEMINI_PREVIEW_URLso the user can open it manually. - Record
CCG_GEMINI_PROMPT_TEMPLATE=planandCCG_GEMINI_AUTO_CLOSE_BROWSER_SECONDS; the preview should close itself after completion unless the user explicitly disables auto-close. - Treat
CCG_GEMINI_SNAPSHOT_EXCLUDESas a security boundary. If excluded secret/config files are relevant, ask the user for sanitized details instead of weakening the snapshot exclusions. - Include the enhanced requirement, context evidence, and a request for concise analysis: alternative approaches, edge cases, UI/UX concerns when relevant, tests, risks, and recommended plan steps.
- Retry failed Gemini calls up to 2 times. If all attempts fail, stop and report the failure; do not generate a fake multi-model plan.
- After detach, Poll
CCG_GEMINI_RESPONSE_FILEevery 5 seconds. Stop only when the file exists and has size > 0, then read it before writing the final plan. - If the response file is still missing or empty after 10 minutes, inspect
CCG_GEMINI_LAUNCHER_LOG; if the launcher log shows a failure, retry the helper call. After two retries or 10 minutes on the final attempt, stop and report failure without writing a plan.
- Use the bundled helper from
-
Synthesize the plan
- Codex is authoritative for backend, data, architecture, repository patterns, and final sequencing.
- Treat Gemini as a strong reference for frontend, UX, accessibility, integration risks, and missing test cases.
- Record disagreements and the final tradeoff instead of hiding them.
- Translate or synthesize all Gemini findings into Chinese before saving the final plan.
-
Write the plan
- Create
.codex/ccg/plans/if missing. - Generate an English kebab-case slug from the task name. If it cannot be inferred cleanly, use
ccg-plan. - For a new plan, choose
.codex/ccg/plans/<slug>.md; if it exists, use.codex/ccg/plans/<slug>-v2.md, then-v3, etc. - For an explicit revision request, write only the specified existing plan file. If that file is under
.claude/plan/, treat it as a legacy compatibility write and say so in Chinese. - Ensure the saved plan content follows the Chinese plan template below. Then show the full plan summary in Chinese and stop. Do not continue into implementation.
- Create
Plan Template
Use this Chinese Markdown structure:
# CCG 计划:<任务名称>
**生成者**:Codex CCG Planner
**任务类型**:后端 / 前端 / 全栈 / 文档 / 重构
**计划路径**:`.codex/ccg/plans/<file>.md`
**Gemini 模型**:`gemini-3.1-pro-preview`
**Gemini 预览**:`<CCG_GEMINI_PREVIEW_URL>`;浏览器已打开:<是/否>
**Gemini 响应文件**:`<CCG_GEMINI_RESPONSE_FILE>`
## 1. 增强需求
### 目标
<业务或技术目标>
### 范围内
- <包含的行为>
### 不在范围内
- <排除的行为>
### 约束
- <技术或流程约束>
### 验收标准
- [ ] <可观察的验收条件>
### 需求完整性评分(0-10)
- 目标明确性(0-3):X/3 - <理由>
- 预期结果(0-3):X/3 - <理由>
- 边界范围(0-2):X/2 - <理由>
- 约束条件(0-2):X/2 - <理由>
- 总分:X/10
- 判定:>=7 继续;<7 停止并提出补充问题
## 2. 上下文证据
| 区域 | 证据 |
|------|------|
| <模块> | `<file-or-symbol>` - <关键点> |
## 3. 多模型分析
### Codex 分析
<架构、后端/数据影响、仓库模式适配>
### Gemini 分析
<从响应文件综合后的只读助手发现,用中文表述>
### 分歧与最终决策
| 主题 | 决策 | 原因 |
|------|------|------|
## 4. WBS 实施步骤
### 模块 A:<名称>(<点数> 任务点)
**文件**:`<path>`
- [ ] **任务 A.1**:<任务>(<点数> 点)
- **输入**:<依赖>
- **输出**:<交付物>
- **步骤**:
1. <机械步骤>
2. <机械步骤>
## 5. 关键文件
| 文件 | 动作 | 说明 |
|------|------|------|
| `<path>` | 新建 / 修改 / 验证 | <原因> |
## 6. 测试策略
- **单元测试**:<聚焦测试>
- **集成测试**:<API/数据流测试>
- **E2E/手工验证**:<关键用户流程或手工检查>
## 7. 风险与缓解
| 风险 | 缓解 |
|------|------|
## 8. Codex 原生交接
审阅后手动运行:
```text
/ccg:execute .codex/ccg/plans/<file>.md
Gemini 模型:gemini-3.1-pro-preview
Gemini 预览 URL:<url>
Gemini 浏览器已打开:<是/否>
Gemini 响应文件:<path>
## 交付消息
保存计划后,用中文回复:
- 说明保存路径。
- 概括选定的技术方案。
- 说明 Gemini 是否参与,以及响应文件在哪里。
- 提供准确的手动执行命令:
```text
/ccg:execute .codex/ccg/plans/<file>.md
然后停止。不要询问是否要继续执行。
04 同仓库更多 Skills
verify-security
安全校验关卡。自动扫描代码安全漏洞,检测危险模式,确保安全决策有文档记录。当用户提到安全扫描、漏洞检测、安全审计、代码安全、OWASP、注入检测、敏感信息泄露时使用。在新建模块、安全相关变更、攻防任务、重构完成时自动触发。
verify-quality
代码质量校验关卡。检测复杂度、重复代码、命名规范、函数长度等质量指标。当用户提到代码质量、复杂度检查、代码异味、重构建议、lint检查、代码规范时使用。在复杂模块、重构完成时自动触发。
verify-module
模块完整性校验关卡。扫描目录结构、检测缺失文档、验证代码与文档同步。当用户提到模块校验、文档检查、结构完整性、README检查、DESIGN检查时使用。在新建模块完成时自动触发。
verify-change
变更校验关卡。分析代码变更,检测文档同步状态,评估变更影响范围。当用户提到变更检查、文档同步、代码审查、提交前检查、diff分析时使用。在设计级变更、重构完成时自动触发。
gen-docs
文档生成器。自动分析模块结构,生成 README.md 和 DESIGN.md 骨架。当用户提到生成文档、创建README、创建DESIGN、文档骨架、文档模板时使用。在新建模块开始时自动触发。
ccg
CCG command index for Codex. Use when the user invokes /ccg, asks what CCG commands are available, or gives a CCG plan/task without choosing a subcommand.