Loading...
Loading...
Compare original and translation side by side
| You do | Codex does (via MCP tools) |
|---|---|
| Plan what to do next | |
| Handle a targeted read-only follow-up | |
| Craft the prompt for each turn | |
| Route to the right thread | |
| Report results to user | |
| Decide when to resume vs start fresh | |
thread_idcodex_run(mode=build)codex_review| 你需要做的事 | Codex(通过MCP工具)完成的工作 |
|---|---|
| 规划下一步行动 | |
| 处理定向只读后续查询 | |
| 为每一轮交互设计提示词 | |
| 路由到正确的线程 | |
| 向用户反馈结果 | |
| 决定是继续之前的任务还是重新开始 | |
thread_idcodex_run(mode=build)codex_reviewcodex_runcodex_review.gitignorecodex_runcodex_review.gitignore| Tool | Modes | Thread | When to use |
|---|---|---|---|
| explore | new or resume | Read/navigate codebase — never modifies files |
| inspect | new or resume | Targeted read-only checks on files, config, or injected context |
| build | new or resume | Write, edit, create, and run code |
| debug | new or resume | Reproduce → diagnose → fix → verify a bug |
| test | new or resume | Write or run tests, report pass/fail |
| research | new or resume | Web search only — no file writes |
| — | isolated | Independent code review — fresh thread, no self-bias |
thread_idcodex_runcodex_reviewthread_idcodex_runexploreinspect| 工具 | 模式 | 线程 | 使用场景 |
|---|---|---|---|
| explore | 新建或续接 | 读取/导航代码库——不会修改任何文件 |
| inspect | 新建或续接 | 对文件、配置或注入上下文进行定向只读检查 |
| build | 新建或续接 | 编写、编辑、创建和运行代码 |
| debug | 新建或续接 | 复现→诊断→修复→验证Bug |
| test | 新建或续接 | 编写或运行测试,报告通过/失败结果 |
| research | 新建或续接 | 仅网页搜索——不会写入文件 |
| — | 隔离 | 独立代码审查——全新线程,无自我偏差 |
codex_runthread_idcodex_reviewthread_idcodex_runexploreinspectnpx skills add.agents/skills/codex-mcp/scripts/codex-mcp-server.mjs.claude/skills/references/setup.md.agents/skills/codex-mcp/scripts/codex-mcp-server.mjscodex.codex/config.tomlmodelargscodex-mcp~$HOMEmemory/codex-threads.json.gitignorecodex_run(mode=inspect, prompt="echo ok")Transport closednpx skills add.agents/skills/codex-mcp/scripts/codex-mcp-server.mjs.claude/skills/references/setup.md.agents/skills/codex-mcp/scripts/codex-mcp-server.mjscodex.codex/config.tomlmodelcodex-mcpargs~$HOMEmemory/codex-threads.json.gitignorecodex_run(mode=inspect, prompt="echo ok")Transport closedmemory/codex-threads.jsonthread/resumereferences/thread-registry.mdthread_idmemory/codex-threads.jsonthread/resumereferences/thread-registry.mdthread_idthread_idexplorereferences/thread-registry.mdcodex_run(explore, prompt="Map skills/project-memory/") → T1
codex_run(explore, thread_id=T1, prompt="Now map skills/agent-handoff/")timeout=120timeout=180codex_run(explore): "List all exported functions in src/auth/ and their error handling patterns."
codex_run(inspect): "Use the injected `pwd` output and report the exact project root. Do not modify any files."
codex_run(build): "Add null checks to all auth functions that access user.email."
codex_run(build, thread_id=T1): "Also add the same null checks in src/payment/."
codex_run(test): "Write tests for the null-check cases in src/auth/. Cover: null, undefined, empty string."
codex_review: "Read src/auth/. Requirement: every user.email access has a null check. List any gaps."
codex_run(debug): "Login fails with TypeError on line 42 of src/auth.ts when email is null. Fix it."thread_idexplorereferences/thread-registry.mdcodex_run(explore, prompt="Map skills/project-memory/") → T1
codex_run(explore, thread_id=T1, prompt="Now map skills/agent-handoff/")timeout=120timeout=180codex_run(explore): "List all exported functions in src/auth/ and their error handling patterns."
codex_run(inspect): "Use the injected `pwd` output and report the exact project root. Do not modify any files."
codex_run(build): "Add null checks to all auth functions that access user.email."
codex_run(build, thread_id=T1): "Also add the same null checks in src/payment/."
codex_run(test): "Write tests for the null-check cases in src/auth/. Cover: null, undefined, empty string."
codex_review: "Read src/auth/. Requirement: every user.email access has a null check. List any gaps."
codex_run(debug): "Login fails with TypeError on line 42 of src/auth.ts when email is null. Fix it."codex_runTransport closedargs~/.codex/config.tomlreferences/troubleshooting-windows.mdnode "$(realpath .agents/skills/codex-mcp/scripts/codex-mcp-server.mjs)"codex app-serverspawn()codex_runTransport closed~/.codex/config.tomlargsreferences/troubleshooting-windows.mdnode "$(realpath .agents/skills/codex-mcp/scripts/codex-mcp-server.mjs)"codex app-serverspawn()| Problem | Fix |
|---|---|
| "Codex CLI not found" | |
| Tools don't appear in agent | Check config path is absolute. Restart agent session. |
Wrong project used for | Always pass |
| Timeout errors | Default is 60s inactivity. Pass |
| "app-server exited" | Check |
| Check config-path drift first (most common cause). Then see |
| Turn hangs then times out | Likely an unhandled approval request. Update wrapper to latest version. Check stderr for unhandled method names. |
| "Codex completed with no output" | Check the |
| bwrap/sandbox errors | Expected in containers. The server uses |
| Thread state lost after restart | Expected — server state is in-memory. Registry staleness check (Step 0) handles this automatically. |
| Wrong thread routed | Check |
| Cross-namespace thread_id error | You passed a review thread_id to codex_run or vice versa. Check registry status column. |
| 问题 | 修复方案 |
|---|---|
| "Codex CLI not found" | |
| 工具未在Agent中显示 | 检查配置路径为绝对路径。重启Agent会话。 |
| 总是在工具调用中明确传入 |
| 超时错误 | 默认非活动超时为60秒。大型任务可以传入 |
| "app-server exited" | 检查 |
| 首先检查配置路径漂移(最常见原因)。然后参考 |
| 轮次挂起然后超时 | 很可能是未处理的授权请求。将包装脚本更新到最新版本。检查stderr中未处理的方法名。 |
| "Codex completed with no output" | 检查响应中的 |
| bwrap/sandbox错误 | 容器中属于预期行为。服务器默认使用 |
| 重启后线程状态丢失 | 属于预期行为——服务器状态存储在内存中。注册表过期检查(步骤0)会自动处理这个问题。 |
| 路由到错误的线程 | 检查 |
| 跨命名空间thread_id错误 | 你将审查线程的thread_id传给了codex_run,反之亦然。检查注册表的状态列。 |
Agent (Claude Code / Gemini CLI / Cursor / Codex CLI / Antigravity / Augment)
└─ MCP protocol (stdio)
└─ codex-mcp-server.mjs (.agents/skills/codex-mcp/scripts/)
├─ runServers map (per projectDir, codex_run threads)
├─ reviewServers map (per projectDir, codex_review threads, isolated)
└─ Codex app-server (JSON-RPC over stdio)
└─ GPT model (reads, writes, executes)
<project-root>/memory/codex-threads.json
└─ thread registry (topic-based routing, managed by the orchestrating agent)
created automatically on first tool call, isolated per projectmemory/codex-threads.jsonthread/forkturn/steeritem/tool/call-32601Agent (Claude Code / Gemini CLI / Cursor / Codex CLI / Antigravity / Augment)
└─ MCP protocol (stdio)
└─ codex-mcp-server.mjs (.agents/skills/codex-mcp/scripts/)
├─ runServers map (per projectDir, codex_run threads)
├─ reviewServers map (per projectDir, codex_review threads, isolated)
└─ Codex app-server (JSON-RPC over stdio)
└─ GPT model (reads, writes, executes)
<project-root>/memory/codex-threads.json
└─ thread registry (topic-based routing, managed by the orchestrating agent)
created automatically on first tool call, isolated per projectmemory/codex-threads.jsonthread/forkturn/steeritem/tool/call-32601