# The Codex harness: what it is and what runs on it

> The Codex harness is the agent loop under every Codex surface. The App Server hands it to apps like the IDE extension as JSON-RPC over stdio.

Source: https://shuriken.sh/guides/codex-harness

OpenAI calls the shared agent loop behind the Codex CLI, the IDE extension, Codex web and the desktop app the Codex harness. Its App Server lets another program drive that same loop over JSON-RPC on stdio, which is how Shuriken runs Codex chats.

[Guides](https://shuriken.sh/guides) By Shuriken Updated 5 December 2026 5 min read

**Contents**

The Codex harness is OpenAI's name for the agent loop and logic under every Codex surface: the CLI, the IDE extension, Codex web and the desktop app. The App Server exposes it to other programs as JSON-RPC over stdio. Any app that wants Codex can run that same harness instead of writing its own copy.

We know this from both sides. OpenAI described the design in February 2026, and Shuriken runs every Codex chat through codex app-server, so the details below come from their post and from our own code.

## What OpenAI means by the Codex harness #

The phrase comes from a post on OpenAI's engineering blog, [Unlocking the Codex harness](https://openai.com/index/unlocking-the-codex-harness/), by Celia Chen, dated 4 February 2026. It opens with the definition: every Codex surface is "powered by the same Codex harness—the agent loop and logic that underlies all Codex experiences."

The post counts three parts beyond the loop itself:

- Thread lifecycle and persistence. "Codex creates, resumes, forks, and archives threads, and persists the event history so clients can reconnect and render a consistent timeline."
- Config and auth. Loading configuration and running sign-in flows such as "Sign in with ChatGPT".
- Tool execution and extensions. Shell and file tools run in a sandbox, and MCP servers and skills join the loop "under a consistent policy model".

All of it lives in a part of the open-source Codex repository called Codex core. That is the inner harness in the sense of our [agent harness explainer](https://shuriken.sh/guides/what-is-an-agent-harness): the code that turns a model into an agent.

## What the App Server does #

Codex started as a terminal UI. When OpenAI built the VS Code extension it needed to drive the same loop from an editor "without re-implementing it". The post says the team first tried exposing Codex as an MCP server, "but maintaining MCP semantics in a way that made sense for VS Code proved difficult." So they wrote a JSON-RPC protocol that mirrored the terminal's loop. That became the App Server.

Today it is two things: the protocol, and "a long-lived process that hosts the Codex core threads". A client starts codex app-server as a child process and talks to it over stdin and stdout, one JSON message per line. OpenAI calls it "JSON-RPC lite": the usual request, response and notification shapes, without the "jsonrpc": "2.0" header.

The protocol has three building blocks, defined in the post and in the [app-server docs](https://learn.chatgpt.com/docs/app-server):

| Primitive | What it is |
| --- | --- |
| Item | "the atomic unit of input/output": a user message, an agent message, a tool run, an approval request, a diff. Each goes item/started , then optional deltas, then item/completed |
| Turn | "one unit of agent work initiated by user input", from the prompt to the last output |
| Thread | "the durable container for an ongoing Codex session", made of turns; it can be created, resumed, forked and archived |

The traffic runs both ways. When the agent wants approval for a command, the server sends a request to the client and the turn pauses until the client answers allow or deny.

## Which Codex surfaces use it #

From OpenAI's post, as of 4 February 2026:

- The VS Code extension and the desktop app ship a pinned Codex binary and run the App Server as a child process.
- Codex web runs the App Server inside a container next to your checked-out repository. The browser talks to OpenAI's backend over HTTP and SSE, so the work goes on when the tab closes.
- JetBrains and Xcode integrate through it. Xcode keeps its client stable and can point at a newer App Server binary.
- The CLI was still the exception: it ran in the same process as the loop. OpenAI wrote that it plans to move the terminal UI onto the App Server too, which would let it attach to Codex running on another machine.

For your own code, OpenAI names two lighter options. codex exec runs one task to completion and exits, which suits CI. The Codex SDK is a TypeScript library for driving local agents from a server. The post says the SDK "currently supports fewer languages and a smaller surface area" than the App Server, and the docs send CI jobs to the SDK.

To see the protocol for yourself, the post gives two commands. codex debug app-server send-message-v2 "run tests and summarize failures" prints the JSON of one full turn, and codex app-server generate-ts writes TypeScript types for the version you have installed. Our [config.toml guide](https://shuriken.sh/guides/codex-cli-config-toml) covers the settings that harness reads.

Shuriken runs Claude Code, Codex, Gemini CLI and 64 more agents side by side, with your own sign-ins.

[Download](https://shuriken.sh/download)

## How Shuriken runs Codex on the App Server #

Shuriken is an outer harness: it runs agents with your accounts and on your computers. For Codex it starts codex app-server with stdio pipes and speaks the protocol above. A few things in the app map straight onto it:

- Each ChatGPT sign-in you add is its own source with its own CODEX_HOME, and the app-server for a chat starts with the source that chat runs on. When that account runs out, the chat moves to another of your ChatGPT sign-ins when its current turn ends.
- The queue's Steer button sends turn/steer with the id of the running turn, so your message lands in the turn that is already working.
- A chat you import from Codex opens its history with thread/read. Its first new turn forks the thread with thread/fork, so Codex's own file stays as it was.

The App Server gave us what OpenAI says it was built for: the real Codex loop, sign-in and sandbox included, without reimplementing any of it. Codex is one of the [67 agents Shuriken runs](https://shuriken.sh/features/coding-agents), next to Claude Code and Gemini CLI.

## Picking a harness for Codex #

If Codex is your only agent and one ChatGPT account covers your work, OpenAI's own surfaces are the obvious choice. They are built on the same App Server and maintained by the people who write Codex. The desktop app is now the ChatGPT desktop app, for macOS, Windows and Linux, signed in with your ChatGPT account ([OpenAI's docs](https://learn.chatgpt.com/docs/app)). We compare it with Shuriken in [Shuriken vs the Codex app](https://shuriken.sh/compare/codex-app).

Third-party tools run the Codex CLI beside other agents:

| Tool | What it says it does | Where |
| --- | --- | --- |
| [Conductor](https://www.conductor.build/) | "Run parallel coding agents on your Mac", naming Claude Code, Codex and Cursor | Mac |
| [Claude Squad](https://github.com/smtg-ai/claude-squad) | A terminal app that manages Claude Code, Codex, Gemini and other local agents, each in its own git workspace; AGPL-3.0 | Terminal |
| Shuriken | Codex next to Claude Code and 65 more agents, moving Codex chats between your ChatGPT sign-ins | Mac, Windows, Linux, your servers |

Whether Codex or Claude Code is the better agent for your work is a different question, and [Claude Code vs Codex](https://shuriken.sh/compare/claude-code-vs-codex) is where we take it on. To run Codex through its own harness next to the agents you already use, [download Shuriken](https://shuriken.sh/download).

Share

[X](https://x.com/intent/post?url=https%3A%2F%2Fshuriken.sh%2Fguides%2Fcodex-harness&text=The%20Codex%20harness%3A%20what%20it%20is%20and%20what%20runs%20on%20it)[LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fshuriken.sh%2Fguides%2Fcodex-harness)[Hacker News](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fshuriken.sh%2Fguides%2Fcodex-harness&t=The%20Codex%20harness%3A%20what%20it%20is%20and%20what%20runs%20on%20it)[Reddit](https://www.reddit.com/submit?url=https%3A%2F%2Fshuriken.sh%2Fguides%2Fcodex-harness&title=The%20Codex%20harness%3A%20what%20it%20is%20and%20what%20runs%20on%20it)[E-mail](mailto:?subject=The%20Codex%20harness%3A%20what%20it%20is%20and%20what%20runs%20on%20it&body=https%3A%2F%2Fshuriken.sh%2Fguides%2Fcodex-harness)

## Sources

- [OpenAI: Unlocking the Codex harness: how we built the App Server (Celia Chen, 4 February 2026)](https://openai.com/index/unlocking-the-codex-harness/) (accessed 25 October 2026)
- [OpenAI docs: Codex app-server](https://learn.chatgpt.com/docs/app-server) (accessed 25 October 2026)
- [openai/codex on GitHub (licence)](https://github.com/openai/codex) (accessed 25 October 2026)
- [OpenAI docs: ChatGPT desktop app](https://learn.chatgpt.com/docs/app) (accessed 25 October 2026)
- [Conductor](https://www.conductor.build/) (accessed 25 October 2026)
- [Claude Squad README](https://github.com/smtg-ai/claude-squad) (accessed 25 October 2026)

## Frequently asked questions

**Is the Codex harness open source?**

Yes. OpenAI's post says all the App Server's source code lives in the Codex CLI repository, which GitHub lists under the Apache 2.0 licence.

**What's the difference between the Codex harness and the App Server?**

The harness is the agent itself: the loop, threads, config, sign-in and tools, in the part of the code OpenAI calls Codex core. The App Server is the long-lived process and JSON-RPC protocol that hands that harness to a client such as the VS Code extension.

**Should I use the App Server, codex exec or the Codex SDK?**

OpenAI's post recommends the App Server for a client that needs the full harness, codex exec for one-off tasks and CI runs that should finish and exit, and the TypeScript SDK when you want a library inside your own server-side code.

**Is the App Server a stable API?**

OpenAI designed it to be backward compatible, so older clients keep working with newer servers. Its docs still call the app-server command and the WebSocket transport experimental and not supported for production workloads.

Every coding agent

67 coding agents, one harness.

Run Claude Code, Codex, Gemini CLI and the rest on your own computers, with the sign-ins you already have.

[Download](https://shuriken.sh/download)

[Other platforms](https://shuriken.sh/download#main)

## Keep reading

- [Harness engineering: what it means, and how we do it: Guide 6 Dec 2026 4 min read Harness engineering is building the rules, checks and tools around a coding agent so it gets work right. Our repo's real harness, with dates and counts.](https://shuriken.sh/guides/harness-engineering)
- [Codex CLI resume session: codex resume, --last and fork: Guide 24 Nov 2026 4 min read Resume a Codex CLI session with codex resume, --last or a session ID. Where Codex keeps sessions, what comes back, and why one is missing from the list.](https://shuriken.sh/guides/codex-resume-session)
- [Codex CLI approval modes and sandbox, explained: Guide 27 Oct 2026 5 min read Codex CLI approval modes are two settings: the sandbox and the approval policy. Auto pairs workspace-write with on-request; untrusted is retired.](https://shuriken.sh/guides/codex-cli-approval-modes)
- [Codex CLI on Windows: native PowerShell or WSL?: Guide 27 Oct 2026 8 min read Codex CLI runs natively in PowerShell inside its own Windows sandbox. In WSL2 it uses the Linux sandbox, needs bubblewrap and no longer runs on WSL1.](https://shuriken.sh/guides/codex-cli-on-windows)
- [Codex "stream disconnected before completion": fixes: Guide 27 Oct 2026 5 min read Codex shows stream disconnected before completion when OpenAI's streamed reply breaks off. It retries 5 times, then stops the turn. How to find the cause.](https://shuriken.sh/guides/codex-stream-disconnected-before-completion)

## Free tools

- [Claude limit reset tracker](https://shuriken.sh/tools/limit-resets/claude)
- [Codex limit reset tracker](https://shuriken.sh/tools/limit-resets/codex)
