Codex CLI: Code-Focused AI Backend

The Codex CLI backend wraps OpenAI’s Codex CLI as a subprocess, providing code-focused agent capabilities with MCP support.

Overview

  • Status: Beta
  • Provider support: OpenAI
  • Built-in tools: shell, file_edit, web_search, mcp
  • MCP support: Yes
  • Architecture: Subprocess wrapper — spawns the codex binary

Prerequisites

Install the Codex CLI globally:

Terminal window
npm install -g @openai/codex

Verify it’s on your PATH:

Terminal window
codex --version

Configuration

Terminal window
export POCKETPAW_AGENT_BACKEND="codex_cli"
export POCKETPAW_OPENAI_API_KEY="sk-..."

The backend also accepts CODEX_API_KEY as an alternative to OPENAI_API_KEY.

Backend-Specific Settings

SettingEnv VariableDefaultDescription
codex_cli_modelPOCKETPAW_CODEX_CLI_MODEL"gpt-5.3-codex"Model to use
codex_cli_max_turnsPOCKETPAW_CODEX_CLI_MAX_TURNS0 (unlimited)Max tool-use turns per query

Built-in Tools

Codex ToolPolicy Mapping
shellshell
file_editwrite_file
web_searchbrowser
mcpmcp

How It Works

  1. PocketPaw spawns the codex CLI binary as a subprocess
  2. Messages and history are injected via the CLI’s input interface
  3. Output streams as NDJSON (newline-delimited JSON)
  4. PocketPaw parses NDJSON events into AgentEvent objects
  5. MCP servers are forwarded to the Codex CLI

When to Use

Choose Codex CLI when:

  • You want a code-focused agent optimized for programming tasks
  • You’re already using OpenAI’s Codex CLI and want it integrated into PocketPaw
  • You need MCP support with an OpenAI-based backend