November 10, 2026

Codex Harness: What It Is, How It Works and How to Use It

Choosing how to build with Codex means choosing more than a model. Your application also needs a way to start work, receive results, preserve a conversation, and handle actions that need approval. The Codex harness provides the runtime behind those operations.

The integration choice depends on the work. A CI assessment can finish with a report; an editor needs to show progress and let a developer steer the task. Exec, the SDK, and App Server expose Codex in different ways.

This guide explains those choices and what remains your responsibility. We'll follow a hypothetical invoice-export change to show why the harness also needs access to consumer contracts and architecture decisions outside the repository.

What is the Codex harness?

The Codex harness is the runtime around the model that manages the agent loop, tools, conversation state, and execution policies. It connects a user's request to model reasoning and actions, then feeds results back into the conversation. Codex's interfaces share this underlying agent logic.

The model proposes what to do next; the harness makes the tools and working context available. Changing the interface from a terminal to an IDE doesn't mean building the whole agent again.

For the invoice change, this is what lets a request become a sequence of file searches, edits, and checks rather than a single code suggestion. Whether those checks cover the archival consumer is a separate design question for the team.

What's inside the Codex harness

The Codex agent loop repeatedly sends the current input to the model, executes requested tools, and returns their results until the model completes the turn. Context management keeps that interaction within the model's working limits; compaction reduces the conversation carried forward as it grows.

Around the loop, Codex manages several responsibilities:

  • Conversation history: creating and resuming sessions so work can continue across requests.
  • Configuration and authentication: loading settings and maintaining the account state the runtime uses.
  • Tools and extensions: file and shell operations, skills, and connections to MCP servers.
  • Execution controls: applying the configured sandbox and approval policies.

The conversation has a useful hierarchy. An item is an individual input or output, such as a message or tool execution. A turn groups the work prompted by an input. A thread holds the ongoing conversation across turns. Your invoice assessment and a later request to implement the migration can therefore belong to the same thread without being the same turn.

Treat permissions and correctness as separate checks. Restricting where a command can write doesn't tell you whether a field rename preserves a downstream contract. That requires evidence and an acceptance test the agent can actually run.

How Codex surfaces share one harness: the App Server

The Codex App Server lets a client drive the runtime through a bidirectional protocol. Your application starts work and receives events as it progresses; it can also receive requests that need a response, such as an approval. That gives an editor enough information to show intermediate activity instead of waiting for one final answer.

Its default transport is newline-delimited JSON over standard input and output. The messages use JSON-RPC request, response, and notification shapes, with the usual protocol-version header omitted. A client starts by sending initialize, receives the server's response, then sends initialized before normal requests. That protocol setup is separate from asking the model to perform a task.

Check support for the App Server methods and transport your application needs. The CLI command is labeled Experimental, but the protocol includes stable methods alongside fields that require experimentalApi. WebSocket transport is experimental and unsupported. Pin a version you have tested against the capabilities you plan to use.

How to use the Codex harness in your own tools

Start with the interaction your tool needs. A nightly assessment that writes a report has different requirements from an editor where a person must interrupt a change or approve an action midway through it.

Integration option

What you get

Best for

Tradeoff

Codex Exec

Non-interactive runs, JSONL events, and optional schema-shaped final output

Scripts and bounded CI jobs

Your script owns result handling and the surrounding workflow

Codex SDK

Programmatic thread creation, continuation, and resumption

Application code orchestrating Codex tasks

Choose the supported language library and manage its execution environment

App Server

Direct access to threads, streamed events, and approval interactions

A custom agent interface inside a product

More lifecycle and interface work, with version-sensitive capabilities

Codex as an MCP server

A historical integration option

Existing integrations that need migration

codex mcp-server has been removed; use current App Server guidance

If you're maintaining an integration built around codex mcp-server, move to App Server. The old MCP-server command has been removed.

Connecting an MCP server into Codex remains a different, supported direction. That is how external services can supply tools and context, including our architecture context for coding agents. It doesn't turn Catio into Codex's runtime.

For the invoice example, begin with an assessment: identify references to invoice_id, list consumers the available evidence supports, and separate confirmed dependencies from unanswered questions. With Exec, capture the JSONL events and final result for your review step. Ask for an implementation only after the missing consumer contract has been resolved. A successful agent run should not itself be your release condition.

Third-party hosts such as Warp and OpenClaw also expose Codex workflows. Evaluate what the host adds and which responsibilities remain yours rather than assuming every host exposes the same Codex controls.

App Server authentication isn't permitted for commercial or hosted services. If you're building that kind of product, check the authentication guidance for the Sign in with ChatGPT route before designing around an existing subscription login.

Is the Codex harness open source?

Yes. The OpenAI Codex repository uses the Apache 2.0 license and includes the Rust implementation under codex-rs, alongside SDK code. The core runtime and App Server are available to inspect. That gives a platform team a way to trace behavior rather than relying entirely on an integration's visible output.

The IDE extension and Codex cloud aren't open source. Model access and managed services remain separate from the open harness. Budget and assess those dependencies separately if you plan to host an integration.

Harness engineering: what OpenAI learned building with Codex

Harness engineering also describes work on the environment an agent operates in: making knowledge discoverable, requirements executable, and failures useful for the next attempt.

In its February engineering report, OpenAI describes roughly a million lines and 1,500 merged pull requests over five months.

The more reusable lessons concern how the work was organized. OpenAI kept AGENTS.md to roughly 100 lines pointing into a structured documentation tree. Custom linters and structural tests enforced architecture boundaries, while recurring cleanup addressed documentation and code drift.

Apply that idea to the invoice export. Put the contract location and migration rules somewhere the agent is instructed to look. If consumers require a compatibility window, encode that requirement in a check that fails when the old field disappears too soon. Give the failure a useful explanation: which consumer still depends on it and what has to change first.

This is where spec-driven development becomes practical. The specification names the required behavior, and the test makes one part of that intent observable. A larger prompt is a poor substitute for a missing contract.

The context the Codex harness can't load on its own

In the hypothetical export change, the producer repository may be complete while the evidence is incomplete. The archival consumer could belong to another team, and the decision to preserve the old field could live in an architecture note. Reading every file in the producer would still leave those questions unanswered.

At Catio, we make that wider architecture context available through our MCP server. Its tools let a coding client search components and relationships, retrieve workspace requirements, and search indexed policies and architecture notes with citation references. Blueprints can supply the reviewed design behind the implementation.

Start with an inventory summary, follow a component's relationships, search for the workload those relationships reveal, then find a Blueprint addressing the concern. Our architecture-query walkthrough takes you through those steps in Claude Code.

For the invoice export, adapt that investigation to the export service and its consumers. Retrieve the compatibility requirements and intended design, then include the source of each constraint in the assessment so a reviewer can distinguish evidence from inference.

Coverage still depends on what your workspace contains. Inventory comes from integrations, and context must be maintained in Catio; the MCP doesn't query arbitrary production infrastructure directly. Check the inventory's update time and investigate missing relationships before treating the result as complete.

Codex supports Streamable HTTP and OAuth, and Catio uses OAuth for its MCP connection. Use the setup documentation and verify a read from the intended workspace before relying on it for a change.

Codex harness vs. Claude Code harness

Both combine a model with tools and an ongoing agent loop. The useful comparison is how you extend that loop and integrate it with your application, rather than which name sounds like a more complete platform.

Concern

Codex

Claude Code

Agent loop

Shared runtime behind Codex interfaces

Context gathering, action, and verification loop

Extensions

Repository instructions, skills, MCP tools

Repository instructions, skills, hooks, MCP tools

Embedding

Exec, Codex SDK, App Server

Claude Agent SDK in Python or TypeScript; non-interactive CLI

Runtime source

Apache-licensed code in openai/codex

Claude Code is proprietary; its public repository is not an open-source runtime release

For a cross-service migration, either choice needs access to the same missing contract. Evaluate the integration with that task, including how it asks for clarification and surfaces evidence, instead of selecting on code-generation output alone.

Conclusion

A field rename is complete only when the producer and its consumers still agree on the contract. Codex gives you the execution loop; your integration must make the relevant code, tests, and architecture decisions available to it. Choose Exec, the SDK, or App Server for the interaction you need, then judge the result against that wider system.

Give your next Codex change that context. Book a Catio demo to see how we bring your architecture, dependencies, and design decisions into the coding workflow. If you already use Catio, connect the MCP and start by reviewing the dependencies behind one cross-service change.

Codex harness FAQ

What does Codex harness mean?

It means the agent runtime surrounding the model: the loop, tools, conversation management, and configured execution controls that make an interactive coding workflow possible.

What harness does Codex use?

Codex uses its own shared runtime. App Server exposes that runtime to clients; it is one integration surface, rather than a different model.

What is the best harness for Codex?

For ordinary Codex use, start with the supplied runtime. For an integration, choose Exec for a bounded job, an SDK for application orchestration, or App Server when you need direct control over the client interaction.

Is the Codex harness open source?

The CLI, core, App Server, and SDK sources are public. The model and hosted product boundaries should be evaluated separately.

Share this Post

Related posts

No related post.