consult-codex

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Dual-AI Consultation: Codex GPT-5.3 vs Code-Searcher

双AI咨询:Codex GPT-5.3 对比 Code-Searcher

You orchestrate consultation between OpenAI's Codex GPT-5.3 and Claude's code-searcher to provide comprehensive analysis with comparison.
你可以协调OpenAI的Codex GPT-5.3与Claude的code-searcher进行咨询,从而提供包含对比的全面分析。

When to Use This Skill

何时使用该Skill

High value queries:
  • Complex code analysis requiring multiple perspectives
  • Debugging difficult issues
  • Architecture/design questions
  • Code review requests
  • Finding specific implementations across a codebase
Lower value (single AI may suffice):
  • Simple syntax questions
  • Basic file lookups
  • Straightforward documentation queries
高价值查询场景:
  • 需要多视角分析的复杂代码问题
  • 疑难问题调试
  • 架构/设计相关问题
  • 代码审查请求
  • 在代码库中查找特定实现
低价值查询场景(单个AI即可满足):
  • 简单语法问题
  • 基础文件查找
  • 直接的文档查询

Workflow

工作流程

When the user asks a code question:
当用户提出代码相关问题时:

1. Build Enhanced Prompt

1. 构建增强型提示词

Wrap the user's question with structured output requirements:
[USER_QUESTION]

=== Analysis Guidelines ===

**Structure your response with:**
1. **Summary:** 2-3 sentence overview
2. **Key Findings:** bullet points of discoveries
3. **Evidence:** file paths with line numbers (format: `file:line` or `file:start-end`)
4. **Confidence:** High/Medium/Low with reasoning
5. **Limitations:** what couldn't be determined

**Line Number Requirements:**
- ALWAYS include specific line numbers when referencing code
- Use format: `path/to/file.ext:42` or `path/to/file.ext:42-58`
- For multiple references: list each with its line number
- Include brief code snippets for key findings

**Examples of good citations:**
- "The authentication check at `src/auth/validate.ts:127-134`"
- "Configuration loaded from `config/settings.json:15`"
- "Error handling in `lib/errors.ts:45, 67-72, 98`"
用结构化输出要求包裹用户的问题:
[USER_QUESTION]

=== 分析指南 ===

**请按照以下结构组织响应:**
1. **摘要:** 2-3句话的概述
2. **关键发现:** 要点形式列出的发现内容
3. **证据:** 带行号的文件路径(格式:`file:line` 或 `file:start-end`)
4. **置信度:** 高/中/低,并说明理由
5. **局限性:** 无法确定的内容

**行号要求:**
- 引用代码时必须包含具体行号
- 使用格式:`path/to/file.ext:42` 或 `path/to/file.ext:42-58`
- 多个引用时:分别列出每个引用及其行号
- 为关键发现附上简短的代码片段

**优秀引用示例:**
- "`src/auth/validate.ts:127-134` 处的身份验证检查"
- "配置加载自 `config/settings.json:15`"
- "`lib/errors.ts:45, 67-72, 98` 中的错误处理"

2. Invoke Both Analyses in Parallel

2. 并行调用两个分析工具

Launch both simultaneously in a single message with multiple tool calls:
  • For Codex GPT-5.3: Use a temp file to avoid shell quoting issues:
    Step 1: Write the enhanced prompt to a temp file using the Write tool:
    Write to $CLAUDE_PROJECT_DIR/tmp/codex-prompt.txt with the ENHANCED_PROMPT content
    Step 2: Execute Codex with the temp file and have at least 10 minute timeout as Codex can take a while to respond:
    macOS:
    bash
    zsh -i -c 'codex -p readonly exec "$(cat $CLAUDE_PROJECT_DIR/tmp/codex-prompt.txt)" --json 2>&1'
    Linux:
    bash
    bash -i -c 'codex -p readonly exec "$(cat $CLAUDE_PROJECT_DIR/tmp/codex-prompt.txt)" --json 2>&1'
    This approach avoids all shell quoting issues regardless of prompt content.
  • For Code-Searcher: Use Task tool with
    subagent_type: "code-searcher"
    with the same enhanced prompt
This parallel execution significantly improves response time.
在单条消息中通过多个工具调用同时启动两者:
  • 针对Codex GPT-5.3: 使用临时文件避免Shell引用问题:
    步骤1: 使用Write工具将增强型提示词写入临时文件:
    将ENHANCED_PROMPT内容写入$CLAUDE_PROJECT_DIR/tmp/codex-prompt.txt
    步骤2: 执行Codex并设置至少10分钟超时(因为Codex响应可能较慢):
    macOS系统:
    bash
    zsh -i -c 'codex -p readonly exec "$(cat $CLAUDE_PROJECT_DIR/tmp/codex-prompt.txt)" --json 2>&1'
    Linux系统:
    bash
    bash -i -c 'codex -p readonly exec "$(cat $CLAUDE_PROJECT_DIR/tmp/codex-prompt.txt)" --json 2>&1'
    无论提示词内容如何,这种方法都能避免所有Shell引用问题。
  • 针对Code-Searcher: 使用Task工具,设置
    subagent_type: "code-searcher"
    并传入相同的增强型提示词
并行执行可显著提升响应速度。

2a. Parse Codex
--json
Output Files (jq Recipes)

2a. 解析Codex的
--json
输出文件(jq工具脚本)

Codex CLI with
--json
typically emits newline-delimited JSON events (JSONL). Some environments may prefix lines with terminal escape sequences; these recipes strip everything before the first
{
and then
fromjson?
safely.
Set a variable first:
bash
FILE="/private/tmp/claude/.../tasks/<task_id>.output"   # or a symlinked *.output to agent-*.jsonl
List event types (top-level
.type
)
bash
jq -Rr 'sub("^[^{]*";"") | fromjson? | .type // empty' "$FILE" | sort | uniq -c | sort -nr
List item types (nested
.item.type
on
item.completed
)
bash
jq -Rr 'sub("^[^{]*";"") | fromjson? | select(.type=="item.completed") | .item.type? // empty' "$FILE" | sort | uniq -c | sort -nr
Extract only “reasoning” and “agent_message” text (human-readable)
bash
jq -Rr '
  sub("^[^{]*";"")
  | fromjson?
  | select(.type=="item.completed" and (.item.type? | IN("reasoning","agent_message")))
  | "===== \(.item.type) \(.item.id) =====\n\(.item.text // "")\n"
' "$FILE"
Extract just the final
agent_message
(useful for summaries)
bash
jq -Rr '
  sub("^[^{]*";"")
  | fromjson?
  | select(.type=="item.completed" and .item.type?=="agent_message")
  | .item.text // empty
' "$FILE" | tail -n 1
Build a clean JSON array for downstream tools
bash
jq -Rn '
  [inputs
   | sub("^[^{]*";"")
   | fromjson?
   | select(.type=="item.completed" and (.item.type? | IN("reasoning","agent_message")))
   | {type:.item.type, id:.item.id, text:(.item.text // "")}
  ]
' "$FILE"
Extract command executions (command + exit code), avoiding huge stdout/stderr
Codex JSON schemas vary slightly; this tries multiple common field names.
bash
jq -Rr '
  sub("^[^{]*";"")
  | fromjson?
  | select(.type=="item.completed" and .item.type?=="command_execution")
  | [
      (.item.id // ""),
      (.item.command // .item.cmd // .item.command_line // "<no command field>"),
      (.item.exit_code // .item.exitCode // "<no exit>")
    ]
  | @tsv
' "$FILE"
Discover actual fields present in
command_execution
for your environment
bash
jq -Rr '
  sub("^[^{]*";"")
  | fromjson?
  | select(.type=="item.completed" and .item.type?=="command_execution")
  | (.item | keys | @json)
' "$FILE" | head -n 5
--json
参数的Codex CLI通常会输出换行分隔的JSON事件(JSONL格式)。部分环境可能会在行首添加终端转义序列;以下脚本会先移除第一个
{
之前的所有内容,再安全执行
fromjson?
先设置变量:
bash
FILE="/private/tmp/claude/.../tasks/<task_id>.output"   # 或指向agent-*.jsonl的符号链接*.output
列出事件类型(顶层
.type
字段)
bash
jq -Rr 'sub("^[^{]*";"") | fromjson? | .type // empty' "$FILE" | sort | uniq -c | sort -nr
列出条目类型(
item.completed
中的嵌套
.item.type
字段)
bash
jq -Rr 'sub("^[^{]*";"") | fromjson? | select(.type=="item.completed") | .item.type? // empty' "$FILE" | sort | uniq -c | sort -nr
仅提取“reasoning”和“agent_message”文本(人类可读内容)
bash
jq -Rr '
  sub("^[^{]*";"")
  | fromjson?
  | select(.type=="item.completed" and (.item.type? | IN("reasoning","agent_message")))
  | "===== \(.item.type) \(.item.id) =====\n\(.item.text // "")\n"
' "$FILE"
仅提取最终的
agent_message
(适用于摘要)
bash
jq -Rr '
  sub("^[^{]*";"")
  | fromjson?
  | select(.type=="item.completed" and .item.type?=="agent_message")
  | .item.text // empty
' "$FILE" | tail -n 1
构建干净的JSON数组供下游工具使用
bash
jq -Rn '
  [inputs
   | sub("^[^{]*";"")
   | fromjson?
   | select(.type=="item.completed" and (.item.type? | IN("reasoning","agent_message")))
   | {type:.item.type, id:.item.id, text:(.item.text // "")}
  ]
' "$FILE"
提取命令执行记录(命令+退出码),避免过大的stdout/stderr内容
Codex的JSON架构略有差异;以下脚本会尝试匹配多个常见字段名。
bash
jq -Rr '
  sub("^[^{]*";"")
  | fromjson?
  | select(.type=="item.completed" and .item.type?=="command_execution")
  | [
      (.item.id // ""),
      (.item.command // .item.cmd // .item.command_line // "<no command field>"),
      (.item.exit_code // .item.exitCode // "<no exit>")
    ]
  | @tsv
' "$FILE"
发现你的环境中
command_execution
实际包含的字段
bash
jq -Rr '
  sub("^[^{]*";"")
  | fromjson?
  | select(.type=="item.completed" and .item.type?=="command_execution")
  | (.item | keys | @json)
' "$FILE" | head -n 5

3. Cleanup Temp Files

3. 清理临时文件

After processing the Codex response (success or failure), clean up the temp prompt file:
bash
rm -f $CLAUDE_PROJECT_DIR/tmp/codex-prompt.txt
This prevents stale prompts from accumulating and avoids potential confusion in future runs.
处理完Codex响应后(无论成功或失败),清理临时提示词文件:
bash
rm -f $CLAUDE_PROJECT_DIR/tmp/codex-prompt.txt
这可以避免旧提示词堆积,防止在后续运行中造成混淆。

4. Handle Errors

4. 错误处理

  • If one agent fails or times out, still present the successful agent's response
  • Note the failure in the comparison: "Agent X failed to respond: [error message]"
  • Provide analysis based on the available response
  • 如果其中一个AI响应失败或超时,仍需展示成功响应的AI结果
  • 在对比部分注明失败情况:“Agent X未能响应:[错误信息]”
  • 基于可用的响应内容提供分析

5. Create Comparison Analysis

5. 创建对比分析报告

Use this exact format:

请严格使用以下格式:

Codex (GPT-5.3) Response

Codex (GPT-5.3) 响应

[Raw output from codex-cli agent]

[来自codex-cli agent的原始输出]

Code-Searcher (Claude) Response

Code-Searcher (Claude) 响应

[Raw output from code-searcher agent]

[来自code-searcher agent的原始输出]

Comparison Table

对比表格

AspectCodex (GPT-5.3)Code-Searcher (Claude)
File paths[Specific/Generic/None][Specific/Generic/None]
Line numbers[Provided/Missing][Provided/Missing]
Code snippets[Yes/No + details][Yes/No + details]
Unique findings[List any][List any]
Accuracy[Note discrepancies][Note discrepancies]
Strengths[Summary][Summary]
维度Codex (GPT-5.3)Code-Searcher (Claude)
文件路径[具体/通用/无][具体/通用/无]
行号[已提供/缺失][已提供/缺失]
代码片段[是/否 + 详情][是/否 + 详情]
独特发现[列出内容][列出内容]
准确性[标注差异][标注差异]
优势[总结][总结]

Agreement Level

一致程度

  • High Agreement: Both AIs reached similar conclusions - Higher confidence in findings
  • Partial Agreement: Some overlap with unique findings - Investigate differences
  • Disagreement: Contradicting findings - Manual verification recommended
[State which level applies and explain]
  • 高度一致: 两个AI得出相似结论 - 对发现内容的置信度更高
  • 部分一致: 存在重叠内容但各有独特发现 - 需深入调查差异点
  • 不一致: 结论相互矛盾 - 建议手动验证
[说明适用的一致程度并解释]

Key Differences

核心差异

  • Codex GPT-5.3: [unique findings, strengths, approach]
  • Code-Searcher: [unique findings, strengths, approach]
  • Codex GPT-5.3: [独特发现、优势、分析方式]
  • Code-Searcher: [独特发现、优势、分析方式]

Synthesized Summary

综合摘要

[Combine the best insights from both sources into unified analysis. Prioritize findings that are:
  1. Corroborated by both agents
  2. Supported by specific file:line citations
  3. Include verifiable code snippets]
[整合两个来源的最佳洞见,形成统一分析。优先考虑以下发现:
  1. 两个AI均验证的内容
  2. 带有具体file:line引用的内容
  3. 包含可验证代码片段的内容]

Recommendation

建议

[Which source was more helpful for this specific query and why. Consider:
  • Accuracy of file paths and line numbers
  • Quality of code snippets provided
  • Completeness of analysis
  • Unique insights offered]
[哪个来源对本次查询更有帮助,原因是什么。请考虑:
  • 文件路径和行号的准确性
  • 提供的代码片段质量
  • 分析的完整性
  • 提供的独特洞见]