GitRead 中文社区
首页趋势排行榜原创文章严选周刊
更多资源
新手训练营
精选专题热门话题GitHub 文档资源精选实战指南

codex-with-chatgpt

ChatGPT 思考,Codex 执行。将 ChatGPT 用作规划大脑,同时保留 Codex 运行框架。

  • 语言TypeScript
  • 默认分支main
  • 大小399 KB
  • 更新10月1日
  • Issues20
在 GitHub 打开
avatarXiaoDuoYa

技术解读

以下内容由 GitRead 中文社区 编辑团队基于项目 README 与官方资料整理, 结合中文开发者的常见使用场景补充技术选型建议。具体以项目官方文档为准。

把“想”和“做”拆开:codex-with-chatgpt 的规划-执行分离实验

项目背景与痛点

2025 年流行的 coding agent 几乎都走同一条路:让一个模型既做规划又做执行,边想边改边跑测试。短任务尚可,任务一长问题就暴露——工具返回的大段 diff、编译日志、测试输出会持续进入上下文窗口,模型的推理能力被这些无关信息分散,于是开始偏离原计划:改到第五个文件时忘了第一步的验收标准,或者在细节里反复打转,丢失了整体架构意图。

另一边的现实是:ChatGPT(尤其带 thinking 的版本)作为纯推理端,长程规划、方案权衡、任务拆解的能力很强,但它没有执行权——进不了你的仓库,也跑不了命令。

这个仓库的切入点很直接:ChatGPT 当大脑,Codex 当手和脚,中间用一份“计划”作为交接约定。它不是再造一个 agent,而是做编排层。

核心技术揭秘

它的架构本质是典型的 planner–executor 分离,与编译器前后端分离思路一致:前端只负责生成中间表示,后端照着 IR 干活,两边通过格式化的接口解耦。

graph TD A[开发者意图与仓库上下文] --> B[ChatGPT 规划层] B --> C[计划契约 Plan Spec] C --> D{"计划是否可执行?"} D -->|"通过"| E[Codex 执行 Harness] D -->|"驳回"| F[追问与计划修订] F --> B E --> G[工具调用-检索与改文件] E --> H[工具调用-执行命令与测试] G --> I[变更产物与执行日志] H --> I I --> J[摘要压缩后回灌] J --> B

数据流的关键在三个地方:

一是明确约定计划的结构。 ChatGPT 的输出必须能被机器直接使用——任务清单、涉及文件、每步的验收标准、风险点。这一步做不好,整个系统就变成“复制一段散文给 Codex 猜”。所以项目实际把大量精力用在 prompt 模板和输出格式约束上,让规划结果能被切分成可逐步执行的单元。

二是压缩并回传上下文。 Codex 执行完会产出大量日志,直接全部回传给 ChatGPT 会严重超限。合理做法是只回传三样东西:改动摘要、失败的测试与报错片段、与计划的偏差。执行层负责降低信息量,只保留关键内容,规划层只看到信噪比高的部分。

三是形成处理失败分类的闭环。 环境缺失、语法错误、逻辑不符合验收标准,是三种不同的失败,回传给 ChatGPT 的追问也应不同。项目在这方面的价值,是迫使开发者把“什么算做完”明确写出来。

值得指出的是桥接方式:ChatGPT 没有本地工具调用能力,因此这类项目通常依赖会话导出、粘贴式搬运或 MCP 类通道。这也是它最脆弱的环节。

功能亮点与差异

与“一个模型包打天下”的 agent 相比,它最大的差异是把推理预算和执行预算分离。规划阶段用最强推理模型,慢一点没关系;执行阶段用更快、更便宜的 Codex harness,还能保留其审批策略和 diff review。

第二个亮点是计划本身成为可审计的工件。传统 agent 的“思考”是黑盒,出问题只能翻日志;这里计划是一份可以 review、可以版本化、可以贴进 PR 描述的文档,团队协作时价值明显。

第三个是复用 Codex harness,而不是重新实现。沙箱、命令白名单、补丁应用这些基础工作不重复实现,这在工程上很明智。

应用场景与落地建议

适合:跨文件重构、框架迁移、需要先出方案再动手的中长期任务,以及需要团队评审计划的场景。

不适合:单文件小改(两次搬运的额外开销比改代码还大)、强交互的低延迟场景,以及代码不能外传的合规环境。ChatGPT 侧的上传是硬性约束。

落地要注意几点:计划粒度控制在“一次能验证”的尺寸,太粗会偏离方向,太细则会淹没在协调成本里;每步验收标准必须可执行(能跑测试、能编译),否则回传的信号全是主观判断;在 CI 上设门禁,别让执行层的“我觉得改好了”直接进主干;给回传循环设重试上限,否则容易陷入“改—失败—再改”的死循环并消耗 token。

综合评价

优点:职责分离的思路是对的,也是长任务 agent 目前合理的演进方向;计划约定把黑盒推理变成可审计工件;复用 Codex harness,工程成本低;成本结构比全程使用最强模型更低。

缺点:桥接层依赖人工搬运,脆弱且不可自动化,这是架构上的先天缺陷;两个系统之间的上下文一致性完全取决于压缩策略的质量,做不好就会出现“计划一套、执行一套”;延迟高,不适合高频交互;高度依赖 ChatGPT 输出格式的稳定性,模型一换版本就可能失效。

一句话总结:这是一个架构方向正确、工程完成度待验证的实验性编排方案。如果你正在被长任务 agent 的上下文偏离困扰,这里的“计划即接口”思路值得借鉴;但要真正上生产,应先解决桥接和回传这两个问题,否则它只是一个更优雅的复制粘贴方案。

内容已同步仓库最新状态(最后提交:10月1日)。 编辑团队负责选题与抽样审核,详见 编辑准则。

相关仓库

freeCodeCamp/freeCodeCamp avatar
freeCodeCampfreeCodeCamp
5 小时前
458.9k
46.8k
87

freeCodeCamp.org 的开源代码库和课程体系。免费学习数学、编程和计算机科学。

learn-to-codenonprofitsprogramming+7
TypeScript
571.1 MB
9
详情
morluto/rea avatar
reamorluto
2 小时前
449.8k
110.7k
1.7k

借助智能体逆向分析任何内容,从应用行为直至原生二进制文件。

agent-skillsaiandroid+17
TypeScript
147.9 MB
0
详情
openclaw/openclaw avatar
openclawopenclaw
2 小时前
394.3k
81.6k
4.8k

真正做实事的 AI。任何 OS。任何平台。龙虾之道。🦞

aiassistantcrustacean+4
TypeScript
13.2 GB
18
详情
nilbuild/developer-roadmap avatar
developer-roadmapnilbuild
12 小时前
371.8k
45.8k
7

交互式路线图、指南及其他教育内容,帮助开发者在职业生涯中成长。

computer-scienceroadmapdeveloper-roadmap+7
TypeScript
356.1 MB
2
详情
deepseek-ai/deepseek-harness avatar
deepseek-harnessdeepseek-ai
6 天前
278.2k
34.0k
0

DeepSeek Harness:一切皆插件。

ai-agentscordisdsh+1
TypeScript
351.8 MB
3
详情
anomalyco/opencode avatar
opencodeanomalyco
1 小时前
225.9k
30.5k
4.2k

开源编码代理。

TypeScript
675.1 MB
0
详情
vuejs/vue avatar
vuevuejs
2024年10月10日
212.6k
34.1k
645

这是 Vue 2 的仓库。如需 Vue 3,请前往 https://github.com/vuejs/core

frameworkfrontendjavascript+1
TypeScript
31.4 MB
0
详情
n8n-io/n8n avatar
n8nn8n-io
1 小时前
210.0k
61.4k
1.2k

具备原生 AI 能力的公平代码工作流自动化平台。将可视化构建与自定义代码相结合,支持自托管或云端部署,提供 400+ 种集成。

automationipaasn8n+7
TypeScript
787.6 MB
3
详情

关于

GitHub 原始描述(英文)

ChatGPT thinks. Codex works. Use ChatGPT as the planning brain while keeping the Codex harness.

ai-agentschatgptcodexmcpmodel-context-protocoloauth
  • MIT License
  • 7.7k Stars
  • 710 Forks
  • 13 Watching

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
9126
价值分
4829
活跃状态
活跃
GitHub

语言占比

JavaScript
TypeScript

Release

  • v0.1.4 — Executor Records, Tunnel DNS & Media Workflows / 执行者记录、隧道 DNS 与媒体工作流10月1日
  • v0.1.3 — Connector Recovery, Hidden git_status & HTTP/2 / 连接器恢复、隐藏敏感路径与 HTTP/29月11日
  • v0.1.2 — Structured MCP, Safer Tunnels & Windows Polish / 结构化 MCP、更可靠的隧道与 Windows 优化9月4日
  • v0.1.1 — Setup Choice, Checkpoints & Sanitized Output / 配置二选一、任务存档与受控输出8月31日
  • v0.1.0 — First Public Release / 首个公开版本8月31日

贡献者

XiaoDuoYaXiaoDuoYalunar-melunar-mepeak-xiongpeak-xiongUV26isUV26ismitre88mitre88EdisonJwaEdisonJwartxmythicallyrtxmythicallyKerwin-kKerwin-kvetrovkvetrovkcatball912catball912OrdoAbChao7OrdoAbChao7Oscar-WilliamsOscar-Williams

Codex with ChatGPT

ChatGPT thinks. Codex works. ChatGPT 负责思考,Codex 负责干活。

[!IMPORTANT] 遇到问题? 请先向 Codex 发送 「更新 Codex with ChatGPT」 并重试。更新到最新版本可以解决大多数已知问题。
Having trouble? First ask Codex to “Update Codex with ChatGPT” and try again. Updating to the latest version resolves most known issues.

The problem · 解决什么问题

中文 — ChatGPT 付费订阅的网页版额度大量闲置,Codex 却在消耗紧张的 API 额度做规划和 Review。本项目把"思考"交给你已付费的网页版 ChatGPT, Codex 只负责执行。不用 API Key、不搞逆向代理——官方网页 + 只读 MCP 桥接。

EN — ChatGPT Plus/Pro web quota sits idle while your coding agent burns scarce API/Codex tokens on planning and review. This project moves the thinking to the subscription you already pay for; Codex only executes. No API keys, no reverse proxy — official web UI plus a read-only MCP bridge.

What it is · 这是什么

中文 — 把 ChatGPT 网页版变成 Codex 编码会话的"规划与审查大脑",执行权 完全保留在 Codex 手里。你的仓库永远不会被上传:ChatGPT 通过一条安全的、 OAuth 保护的只读 MCP 连接,按需读取当前工作区里它真正需要的那几行代码。

EN — Use the ChatGPT web app as the planning and review brain for your Codex coding sessions, while Codex keeps full ownership of execution. Your repository is never uploaded: ChatGPT reads exactly the lines it needs through a secure, OAuth-protected, read-only MCP connection to your current workspace.

Detailed docs below are in English · 详细中文文档见 README.zh-CN.md

One-paste install · 一段话安装

中文 — 不懂 git、Node、终端?完全不需要懂。把下面这段话原样复制给你的 编码 Agent(Codex),然后去倒杯咖啡:

请帮我完整安装并配置 Codex with ChatGPT,全程自动,我是不懂技术的小白,
所有事情你自己做:

1. 环境自检:需要 git 和 Node.js ≥ 20,缺什么就自动安装
  (macOS 用 Homebrew,Windows 用 winget),同时安装 cloudflared。
2. 下载:把 https://github.com/XiaoDuoYa/codex-with-chatgpt 克隆到
   ~/codex-with-chatgpt(已存在就 git pull 更新)。
3. 构建:在该目录里执行 corepack pnpm install 和 corepack pnpm build。
4. 安装 Skill:先确定 Codex home:如果设置了非空的 CODEX_HOME 就使用它,
   否则使用 ~/.codex(Windows 默认为 %USERPROFILE%\.codex)。把仓库里的
   skill/SKILL.md 复制到 <codex-home>/skills/codex-with-chatgpt/SKILL.md,
   并把文件中 "The codex-with-chatgpt checkout lives at:" 那一行的路径改成实际克隆路径。
5. 首次配置:按 SKILL.md 里的 first-time setup 流程执行
  (运行 c2c setup,用内置浏览器打开 ChatGPT 配置连接器并输入配对码)。
   全程只用内置浏览器,禁止打开任何第三方浏览器。
6. 只有遇到需要我登录(ChatGPT / Cloudflare)、验证码或两步验证时才叫我,
   而且一次只告诉我一个动作。
7. 完成后给我看 ✓ 清单,并确认文件读取测试通过。我不懂 MCP、OAuth、
   Tunnel、端口这些词,不要向我解释;出了问题先自己修。

EN — Don’t know git, Node, or terminals? You don’t need to. Copy the paragraph below, paste it to your coding agent (Codex), and go grab a coffee:

Please install and configure "Codex with ChatGPT" for me, fully automatically.
I am a non-technical user — do everything yourself:

1. Check the environment: git and Node.js >= 20 must be available. Install
   anything missing yourself (macOS: Homebrew, Windows: winget). Also install
   cloudflared.
2. Download: clone https://github.com/XiaoDuoYa/codex-with-chatgpt into
   ~/codex-with-chatgpt (if it already exists, git pull to update).
3. Build: inside that folder run `corepack pnpm install` then `corepack pnpm build`.
4. Install the Skill: determine the Codex home first: use a non-empty CODEX_HOME
   when set, otherwise use ~/.codex (%USERPROFILE%\.codex on Windows). Copy
   skill/SKILL.md to <codex-home>/skills/codex-with-chatgpt/SKILL.md, and update
   the line "The codex-with-chatgpt checkout lives at:" to the actual clone path.
5. First-time setup: follow the SKILL.md "first-time setup" workflow
   (run c2c setup, configure the ChatGPT connector in the BUILT-IN browser,
   enter the pairing code). Never open a third-party browser.
6. Only interrupt me for logins (ChatGPT / Cloudflare), CAPTCHAs or 2FA —
   and give me exactly ONE action at a time.
7. When done, show me the ✓ checklist and confirm the file-read test passed.
   I don't know what MCP, OAuth, tunnels or ports are. Don't explain them.
   If anything breaks, fix it yourself first.

Updates · 更新 — The Skill checks GitHub once a day and updates itself when a new version is released; no action needed. You can also say “更新 Codex with ChatGPT” anytime. / Skill 每天自动检查一次 GitHub,有新版本会自动更新,无需任何操作; 也可以随时对 Codex 说"更新 Codex with ChatGPT"。


The sections below are in English. 以下详细内容为英文,中文完整版见 README.zh-CN.md。

Install → Setup → Use (manual)

Let <codex-home> be a non-empty CODEX_HOME when set; otherwise use ~/.codex (%USERPROFILE%\.codex on Windows).

  1. Install the Codex Skill: copy skill/ to <codex-home>/skills/codex-with-chatgpt/.
  2. Tell Codex: “Set up Codex with ChatGPT.” (中文: “使用 Codex with ChatGPT 完成首次配置。”)
  3. Use Codex normally: “Use Codex with ChatGPT to implement XXX.”

Installation scope: This repository does not publish or install a Codex Web GPT, launcher, or model-catalog entry. Installation consists of building this checkout, installing skill/SKILL.md as a Codex Skill, and running c2c setup to configure the ChatGPT connector. For Web GPT or model-catalog problems, see troubleshooting.

That’s the whole manual. You don’t need to know what MCP, OAuth, tunnels, ports or localhost are — Codex configures everything automatically and you just see:

Codex with ChatGPT

✓ Project detected
✓ Workspace Bridge started
✓ Secure connection established
✓ ChatGPT connected
✓ File read test passed

Ready.

The only steps that may need you: logging into ChatGPT (and, if you want a stable hostname, logging into Cloudflare once). A new workspace also asks you to create a ChatGPT Project (collection) once — pick project-only memory, name it after the workspace. If the sidebar has no Projects row, hover Chats, open the … menu, and choose Organize by project. Codex then saves that collection link and starts chats from that page. Existing workspaces that already have a C2C chat stay on the old one-conversation style until you ask to switch.

Optional stable hostname

The default public address is a temporary Cloudflare URL. It changes when the bridge restarts, and Codex repairs ChatGPT by deleting that workspace’s connector and adding it again.

If you have a Cloudflare account and a domain already on Cloudflare, first-time setup (and the next coding session, once) will ask whether you want a stable hostname such as c2c-<project>.your-domain.com. That path opens a browser so you can authorize Cloudflare. After that, the ChatGPT connector keeps working across restarts. If you skip it, or the login fails, Codex stays on the temporary address — same features, just a slower repair.

Credentials stay in the OS app state directory, not in the project.

How it works

             ┌───────────────────────────┐
             │       ChatGPT Web         │
             │  Reason / Plan / Review   │
             └──────────┬──────────▲─────┘
                        │          │
               MCP      │          │ Computer Use
            Data Plane  │          │ Control Plane (<1 KB messages)
                        ▼          │
             ┌─────────────────────┐
             │      C2C Bridge     │   loopback-only HTTP server
             │  read-only MCP      │   OAuth 2.1 + one-time pairing code
             │  OAuth + Pairing    │   Cloudflare Quick Tunnel
             │  Tunnel Manager     │
             └──────────┬──────────┘
                        │  read-only
                        ▼
             ┌─────────────────────┐          ┌─────────────────────┐
             │   Local Workspace   │◀─────────│    Codex Harness    │
             └─────────────────────┘ edit/git │ shell / tests / fix │
                                              └─────────────────────┘
  • Control plane (Computer Use): Codex and ChatGPT exchange tiny structured [C2C] state messages — INIT → PLAN → EXECUTED → REVIEW → DONE. No diffs, no logs, no file bodies are ever pasted.
  • Data plane (MCP): ChatGPT pulls what it needs itself through 10 read-only tools: workspace_info, list_directory, read_file, search_workspace, git_status, git_diff, test_status, execution_summary, execution_output, read_image.
  • Independent review: after Codex executes, ChatGPT inspects the actual git diff and test records through MCP — it never trusts “all tests passed” claims blindly.

Generated media handoff

The connector remains read-only: read_image can inspect supported workspace images but cannot write files. After a requested image or video is downloaded through the visible ChatGPT UI, the local executor can validate and import the original with c2c asset import -w <workspace> --from <download> --to <new-path>. Imports are workspace-contained, signature-checked, size-limited, reject active SVG content, and never overwrite an existing file.

Security model (short version)

  • Read-only by construction: write/delete/shell/commit tools simply do not exist on the server. No prompt injection can enable them.
  • One workspace = one boundary: every token is bound to a single workspace; path containment uses canonical realpaths (symlink/..//absolute-path escapes are all blocked and tested).
  • Sensitive files never leave: .env*, keys, SSH, credentials are denied by default (.env.example allowed); .c2cignore adds your own rules.
  • Knowing the URL grants nothing: the public MCP endpoint requires OAuth 2.1 (PKCE S256, dynamic client registration, rotating refresh tokens). Without a token: 401. Wrong workspace: 403.
  • The model never sees long-lived credentials: the only secret that ever touches a browser is a one-time pairing code (5-minute TTL, 5 attempts, rate-limited, destroyed on use).

Full threat model: docs/security.md

For developers

pnpm install
pnpm build          # -> dist/, exposes the `c2c` bin
pnpm test           # vitest: 150 tests (path security, OAuth, pairing, MCP e2e)

c2c setup           # bridge + tunnel + pairing code, all in one
c2c sandbox-allow   # whitelist the settings dir in Codex (macOS + Windows)
c2c status / doctor / pair / unpair / logs / stop

Requirements: Node.js >= 20, git. cloudflared for the public connection (auto-detected; the Skill installs it for you). If QUIC is blocked, set C2C_TUNNEL_PROTOCOL=http2 and restart the bridge.

Docs: architecture · protocol · security · troubleshooting

Project layout

src/
  bridge/     loopback HTTP server, port recovery, admin API
  mcp/        9 read-only tools, stateless Streamable HTTP
  auth/       OAuth 2.1 (PKCE, DCR, refresh rotation, revocation)
  pairing/    one-time pairing codes (CSPRNG, TTL, rate limits)
  workspace/  path containment, sensitive-file policy, search, git
  tunnel/     TunnelProvider abstraction + Cloudflare Quick/Named Tunnel
  execution/  execution records for the review loop
  process/    daemon lifecycle
  cli/        the c2c CLI
skill/        the Codex Skill (the real UX layer)
tests/        unit + integration tests
docs/         architecture / protocol / security / troubleshooting

Status & disclaimer

V1. Verified end-to-end: bridge, OAuth + pairing, public tunnel, ChatGPT connector setup, zero-touch first-run experience.

Unofficial community project. Not affiliated with or endorsed by OpenAI.

License

MIT

Star History

Star History Chart

评论

登录 后发表评论
暂无评论
GitRead 中文社区
深度解读 · 趋势洞察 · 价值精选

关于

关于我们联系我们编辑准则收录标准赞赏人员

发现

技术趋势新手训练营资源精选实战指南精选专题热门话题GitHub 文档

条款

隐私政策服务条款网站地图
26.9万收录项目
6万中文话题
155精选专题
发现技术价值,连接开源智慧
© 2026 GitRead · GitHub 中文社区 本站与 GitHub, Inc. 无隶属关系;GitHub 是 GitHub, Inc. 的商标。