codex-collab

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Codex 协同开发 Skill

Codex Collaborative Development Skill

核心使命

Core Mission

当用户明确要求与 codex 协同时,你必须思考如何与 codex 进行协作,如何调用 Codex MCP 工具作为客观全面分析的保障。
When the user explicitly requests to collaborate with codex, you must consider how to collaborate with codex and how to call the Codex MCP tool as a guarantee for objective and comprehensive analysis.

协作流程(必须执行的 4 个步骤)

Collaboration Process (4 Mandatory Steps)

1. 需求分析与计划完善

1. Requirement Analysis and Plan Refinement

在你对用户需求形成初步分析后,将用户需求、初始思路告知 codex,并要求其完善需求分析和实施计划。
After forming a preliminary analysis of the user's requirements, inform codex of the user's requirements and initial ideas, and request it to refine the requirement analysis and implementation plan.

2. 代码原型索取

2. Code Prototype Request

在实施具体编码任务前,必须向 codex 索要代码实现原型。
关键约束
  • 要求 codex 仅给出 unified diff patch
  • 严禁对代码做任何真实修改(使用
    sandbox="read-only"
  • 获取原型后,以此为逻辑参考,重写为企业生产级代码
  • 确保可读性极高、可维护性极高后,才能实施具体编程修改
Before implementing specific coding tasks, you must request a code implementation prototype from codex.
Key Constraints:
  • Require codex to only provide unified diff patch
  • Strictly prohibit any actual code modifications (use
    sandbox="read-only"
    )
  • After obtaining the prototype, use it as a logical reference to rewrite it into enterprise production-level code
  • Only proceed with specific programming modifications after ensuring extremely high readability and maintainability

3. 代码 Review

3. Code Review

无论何时,只要完成切实编码行为后,必须立即使用 codex review 代码改动和对应需求完成程度。
Whenever you complete actual coding actions, you must immediately use codex to review the code changes and the degree of requirement fulfillment.

4. 争辩与完善

4. Debate and Refinement

  • codex 只能给出参考,你必须有自己的思考
  • 需要对 codex 的回答提出质疑
  • 通过不断争辩以找到通向真理的唯一途径
  • 最终使命是达成统一、全面、精准的意见
  • Codex only provides references; you must think independently
  • Need to question codex's responses
  • Find the only path to truth through continuous debate
  • The ultimate mission is to reach a unified, comprehensive, and precise consensus

Codex MCP 工具调用规范

Codex MCP Tool Calling Specifications

工具参数

Tool Parameters

必选参数
  • PROMPT
    (string): 发送给 codex 的任务指令
  • cd
    (Path): codex 执行任务的工作目录根路径
可选参数
  • sandbox
    (string): 沙箱策略
    • "read-only"
      (默认): 只读模式,最安全
    • "workspace-write"
      : 允许在工作区写入
    • "danger-full-access"
      : 完全访问权限
  • SESSION_ID
    (UUID | null): 用于继续之前的会话以与 codex 进行多轮交互,默认为
    None
    (开启新会话)
  • skip_git_repo_check
    (boolean): 是否允许在非 Git 仓库中运行,默认
    False
  • return_all_messages
    (boolean): 是否返回所有消息(包括推理、工具调用等),默认
    False
返回值
json
// 成功时
{
  "success": true,
  "SESSION_ID": "uuid-string",
  "agent_messages": "agent回复的文本内容",
  "all_messages": []
}

// 失败时
{
  "success": false,
  "error": "错误信息"
}
Mandatory Parameters:
  • PROMPT
    (string): Task instructions sent to codex
  • cd
    (Path): Root path of the working directory where codex executes tasks
Optional Parameters:
  • sandbox
    (string): Sandbox strategy
    • "read-only"
      (default): Read-only mode, most secure
    • "workspace-write"
      : Allow writing to the workspace
    • "danger-full-access"
      : Full access permission
  • SESSION_ID
    (UUID | null): Used to continue previous sessions for multi-round interactions with codex, default is
    None
    (starts a new session)
  • skip_git_repo_check
    (boolean): Whether to allow running in non-Git repositories, default
    False
  • return_all_messages
    (boolean): Whether to return all messages (including reasoning, tool calls, etc.), default
    False
Return Values:
json
// 成功时
{
  "success": true,
  "SESSION_ID": "uuid-string",
  "agent_messages": "agent回复的文本内容",
  "all_messages": []
}

// 失败时
{
  "success": false,
  "error": "错误信息"
}

使用方式

Usage Methods

开启新对话
  • 不传
    SESSION_ID
    参数(或传
    None
  • 工具会返回新的
    SESSION_ID
    用于后续对话
继续之前的对话
  • 将之前返回的
    SESSION_ID
    作为参数传入
  • 同一会话的上下文会被保留
Start a New Conversation:
  • Do not pass the
    SESSION_ID
    parameter (or pass
    None
    )
  • The tool will return a new
    SESSION_ID
    for subsequent conversations
Continue a Previous Conversation:
  • Pass the
    SESSION_ID
    returned from the previous interaction as a parameter
  • The context of the same session will be retained

调用规范

Calling Specifications

必须遵守
  • 每次调用 codex 工具时,必须保存返回的
    SESSION_ID
    ,以便后续继续对话
  • cd
    参数必须指向存在的目录,否则工具会静默失败
  • 严禁 codex 对代码进行实际修改,使用
    sandbox="read-only"
    以避免意外
  • 要求 codex 仅给出 unified diff patch
推荐用法
  • 如需详细追踪 codex 的推理过程和工具调用,设置
    return_all_messages=True
  • 对于精准定位、debug、代码原型快速编写等任务,优先使用 codex 工具
Must Comply:
  • Save the returned
    SESSION_ID
    every time you call the codex tool to facilitate subsequent conversations
  • The
    cd
    parameter must point to an existing directory, otherwise the tool will fail silently
  • Strictly prohibit codex from making actual code modifications; use
    sandbox="read-only"
    to avoid accidents
  • Require codex to only provide unified diff patch
Recommended Usage:
  • Set
    return_all_messages=True
    if you need to track codex's reasoning process and tool calls in detail
  • Prioritize using the codex tool for tasks such as precise positioning, debugging, and rapid code prototype writing

注意事项

Notes

会话管理

Session Management

  • 始终追踪
    SESSION_ID
    ,避免会话混乱
  • 多轮对话时必须传递正确的
    SESSION_ID
  • Always track the
    SESSION_ID
    to avoid session confusion
  • Must pass the correct
    SESSION_ID
    during multi-round conversations

工作目录

Working Directory

  • 确保
    cd
    参数指向正确且存在的目录
  • 路径错误会导致工具静默失败
  • Ensure the
    cd
    parameter points to the correct and existing directory
  • Path errors will cause the tool to fail silently

错误处理

Error Handling

  • 检查返回值的
    success
    字段
  • 处理可能的错误情况
  • Check the
    success
    field in the return value
  • Handle possible error situations

协作原则

Collaboration Principles

  • codex 提供参考,你必须独立思考
  • 通过争辩达成共识,而非盲从
  • 最终目标是统一、全面、精准的解决方案
  • Codex provides references; you must think independently
  • Reach consensus through debate rather than blind obedience
  • The ultimate goal is a unified, comprehensive, and precise solution