Codex with ChatGPT: ChatGPT Plans, Codex Executes

Move planning and review to your ChatGPT web subscription while Codex handles code execution, tests, and Git through its coding harness.

ChatGPT Plus and Pro subscribers have a problem: you’re already paying for web access, but your coding agent burns through scarce API or Codex tokens just to plan and review code.

Codex with ChatGPT solves that by turning your ChatGPT subscription into the planning and review brain for Codex sessions, while Codex keeps full ownership of execution.

The connection uses a read-only MCP bridge. ChatGPT requests source files, searches, Git data, and test records from the active workspace when it needs them. Planning and review run in the ChatGPT web session, and the bridge does not require an OpenAI API key.

How ChatGPT and Codex Work Together

A coding task starts with Codex sending ChatGPT a compact INIT message that contains the goal and asks for a plan. ChatGPT reads the repository through MCP, identifies the files involved, and returns a PLAN with implementation steps, tests, and success criteria.

Codex executes that plan with its coding harness. After the coding pass finishes, Codex records the iteration and sends an EXECUTED message. ChatGPT then reads the actual Git diff and recorded test information before returning another plan, finishing the task, or reporting a blocker.

The protocol uses states such as INIT, PLAN, EXECUTING, EXECUTED, REVIEW, DONE, BLOCKED, and ERROR. C2C control messages stay under 1 KB and carry task state. Source files, diffs, search results, and test details move through MCP when ChatGPT requests them.

After each coding pass, ChatGPT can inspect the changed files and Git diff before it accepts the result. A failed review returns another plan.

         ┌───────────────────────────┐
│ 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 │
└─────────────────────┘

Read-Only Repository Access and Security

The MCP server exposes no tools for file writes, deletion, shell execution, package installation, or Git commits. ChatGPT can inspect code and return instructions to Codex, but it cannot change the repository through the C2C bridge.

Each bridge is bound to one workspace, and OAuth tokens are tied to that workspace. Filesystem checks resolve canonical locations before a read. Traversal attempts through .., absolute locations, symlinks, backslash tricks, and null bytes are rejected when they would escape the authorized workspace.

Sensitive-file rules block .env*, private keys, SSH data, cloud credentials, keychains, and related secrets. .env.example is allowed, and .c2cignore can define additional exclusions for a repository. File reads, directory listings, searches, and Git diff access pass through these restrictions.

The public MCP endpoint requires OAuth 2.1 authorization. Pairing uses an eight-character one-time code with a five-minute lifetime and attempt limits. OAuth uses PKCE S256, access tokens expire after one hour, and refresh tokens rotate after use. Token hashes and client registrations live in the operating system’s application-state directory. V1 does not store them in the OS keychain.

Requested repository content leaves the local computer when MCP returns a source file, search result, Git diff, or test record to ChatGPT for analysis.

Requirements and ChatGPT Plan Support

The project requires Node.js 20 or newer, Git, and cloudflared. The one-paste installation instructions use Homebrew on macOS and winget on Windows when dependencies are missing.

Your ChatGPT plan must expose the required custom MCP controls. Pro users can connect custom MCP servers with read/fetch permissions through Developer Mode. Business, Enterprise, and Edu workspaces can deploy custom MCP apps under the admin controls. Plus users do not currently support this feature.

How to Install and Start a Session

Clone the repository and build the c2c command with pnpm. Run the commands below.

git clone https://github.com/XiaoDuoYa/codex-with-chatgpt
cd codex-with-chatgpt
corepack pnpm install
corepack pnpm build

Copy the Codex Skill from the repository into this directory.

~/.codex/skills/codex-with-chatgpt/SKILL.md

Update the checkout location inside SKILL.md, then start the first configuration with the command below.

The setup process starts the local bridge, creates the Cloudflare connection, generates a pairing code, and opens the ChatGPT configuration flow. Login, CAPTCHA, two-factor authentication, and optional Cloudflare authorization can require your input.

c2c setup

After configuration, invoke the Skill from Codex. One task prompt is shown below.

Use Codex with ChatGPT to implement dark mode.

Codex detects the active project, starts or reuses its bridge, connects the saved ChatGPT session, and sends the task for planning.

Temporary and Stable Cloudflare Connections

The default configuration uses a Cloudflare Quick Tunnel. Its public address changes after the tunnel stops, and the ChatGPT connector for that workspace then needs repair with the new address.

A named Cloudflare tunnel keeps one hostname across restarts. It requires a Cloudflare account and a domain managed through Cloudflare. During configuration, the project can create a hostname such as c2c-myproject.example.com after Cloudflare authorization.

A fixed hostname keeps the connector address stable across restarts and reduces repair work. You can keep the temporary tunnel if you do not have a Cloudflare-managed domain.

c2c doctor checks the runtime, workspace, bridge, MCP connection, OAuth state, and tunnel. It can recover several bridge or tunnel failures. c2c pair creates a new one-time pairing code, and c2c unpair revokes the current workspace authorization. The CLI also exposes status, logs, and stop commands.

c2c status
c2c doctor
c2c pair
c2c unpair
c2c logs
c2c stop

ChatGPT Projects and Longer Coding Tasks

New workspaces can use one ChatGPT Project for their C2C chats. Project instructions store the workspace identity and connector name, and project-only memory can retain durable information about that repository.

A new Codex conversation can start a new chat inside the assigned ChatGPT Project. Codex sends a compact HANDOFF message with the original goal, completed work, known issues, current state, and next expected action. The new chat reads current code again through MCP when it needs repository details.

The protocol prioritizes current repository data over the handoff, Project instructions, and Project memory. Current code takes precedence when remembered project details have become outdated.

The default iteration limit is 12 and can be configured in .c2c.json. Once the limit is reached, Codex pauses and asks whether the task should continue.

Pros

  • ChatGPT plans from current repository content.
  • Reviews inspect the actual Git diff and recorded tests.- Sensitive-file rules block credential files such as .env*, private keys, SSH data, and cloud credentials.
  • OAuth authorization is bound to one workspace.
  • Codex keeps control of edits, commands, tests, and Git.

Cons

  • Setup depends on a local bridge, OAuth, ChatGPT MCP access, and a Cloudflare connection.
  • Temporary tunnel addresses can require connector repair after restarts.
  • Small coding tasks can take longer once planning and review iterations are introduced.

Alternatives & Related Resources

FAQs

Does Codex with ChatGPT need an OpenAI API key for the ChatGPT connection?

No. The C2C connection uses the ChatGPT web app and an OAuth-protected MCP connection.

Does Codex with ChatGPT upload my entire repository?

It does not bundle the repository into ChatGPT Project files or paste the repository into the control messages. ChatGPT requests files, searches, diffs, and test records through MCP as needed. Content returned by those tools is transmitted to ChatGPT.

Can ChatGPT run commands or edit files through the bridge?

No. V1 exposes read operations for repository inspection. Shell execution, file writes, deletion, package installation, and commits are not available through the MCP server.

Is Codex with ChatGPT an OpenAI project?

No. Codex with ChatGPT is an unofficial community project released under the MIT License. It is not affiliated with or endorsed by OpenAI.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest & top AI tools sent directly to your email.

Subscribe now to explore the latest & top AI tools and resources, all in one convenient newsletter. No spam, we promise!