Skip to content

ImplementationAgent Runtimes

Codex Setup Guide

Set up OpenAI Codex in the terminal or desktop app to work with project files, AGENTS.md instructions, and MCP servers.

Intermediate15–20 minTerminal access; ChatGPT plan or OpenAI API key

ToolkitCarrelKimi Plugin

We work in Codex every day alongside Claude Code and Kimi; this guide shows how it fits a shared research repository.

Why Codex fits Research Memex

Codex is OpenAI's workspace agent, available as a terminal CLI (codex) and a desktop app. In research work, it fits three jobs well:

  • following explicit multi-step protocols and checklists in AGENTS.md
  • reviewing Git changes with codex review and checking named research files with codex exec
  • sharing a Git repository with Claude Code and Kimi so a second model critiques what the first produced

Read Agent Runtimes: How Workspace Agents Work first for the six layers all workspace agents share.

Install and authenticate

Install the CLI or desktop app from the official Codex documentation (opens in a new tab) (or GitHub (opens in a new tab)) and verify with codex --version. Choose one authentication route:

  • ChatGPT plan sign-in — run codex login to use your subscription allowance. Leave OPENAI_API_KEY unset in your shell profile so requests do not silently route to API billing.
  • OpenAI API key — export OPENAI_API_KEY before launching Codex for pay-per-token Platform billing.

Model availability differs by route; see Subscriptions you already hold and the AI Model Reference Guide.

Configuration, sandbox, and MCP servers

Codex reads AGENTS.md from the repository root down to your working directory (pair it with CLAUDE.md on multi-host projects) and stores user settings in ~/.codex/config.toml (overridable per run with -c key=value). You can also route Codex to custom providers such as OpenRouter in config.toml; see OpenRouter's Codex CLI guide (opens in a new tab).

Codex separates two safety controls: the filesystem sandbox (read-only inspection versus workspace-write) and command approval (when Codex pauses before running commands or editing files). Inspect your version's flags with codex --help, and start screening or coding in read-only or on-request approval mode on a clean Git tree.

Codex has built-in file and shell tools and needs no Filesystem MCP. To register remote HTTP or local stdio servers (including https://research-memex.org/mcp), follow Transports and host registration.

Skills, plugins, and non-interactive checks

Package repeatable procedures as skills invoked with $ (for example, $kimi after installing the Kimi Plugin), or install multi-host plugins such as the Kimi Plugin via codex plugin marketplace add.

Use Codex's session and non-interactive commands to audit work across hosts:

# Resume the latest session or fork to test an alternative framing
codex resume --last
codex fork

# From a Git repository, review uncommitted changes against AGENTS.md
codex review --uncommitted

# From the same repository, run a scripted verification check
codex exec "Verify that every row in analysis/extraction.csv cites a file in literature/"

Use codex review --uncommitted for changes in a Git repository, or give codex review an explicit base branch or commit. For a standalone vault or a table already committed, open Codex in the project folder and name the file, sources, and criteria you want it to check. See Composing an Agentic Research System for the full shared-repository workflow.

cite this page

Lin, X. (2026). Codex Setup Guide. Research Memex. https://research-memex.org/docs/implementation/agentic-ai-tools/codex-setup-guide

@misc{docs-implementation-agentic-ai-tools-codex-setup-guide-2026,
  author = {Xule Lin},
  title = {Codex Setup Guide},
  year = {2026},
  howpublished = {\url{https://research-memex.org/docs/implementation/agentic-ai-tools/codex-setup-guide}},
  note = {ORCID: 0000-0001-7885-4194}
}

one renderingthe source remains