Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Codex

Codex is OpenAI's cloud-based coding agent. It runs tasks in an isolated sandbox with your repo pre-loaded. It doesn't have built-in LSP integration — it uses terminal commands, test harnesses, and file operations to work with your code.

Configure

Codex reads AGENTS.md files for project instructions. Create one in your project root:

AGENTS.md
# Project
 
This is a Solidity project using Foundry.
 
## Build and Test
 
- Build: `forge build`
- Test: `forge test`
- Single test: `forge test --match-test testFunctionName -vvv`
 
## Structure
 
- `src/` — Solidity source contracts
- `test/` — Foundry test files
- `script/` — Deploy scripts
- `lib/` — Dependencies (git submodules)
 
## Conventions
 
- Use Solidity 0.8.x
- Follow NatSpec documentation for all public/external functions
- Tests use the `test_` prefix for passing tests
- Run `forge fmt` before committing

How it works

Codex runs asynchronously in a cloud sandbox:

  1. Your repo is cloned into the sandbox
  2. The agent reads AGENTS.md for project context
  3. It uses terminal commands (forge build, forge test) for diagnostics
  4. Changes are applied and committed
  5. Tasks typically complete in 1–30 minutes

Environment setup

The sandbox needs Foundry installed. Add setup instructions to your AGENTS.md:

AGENTS.md
## Environment
 
Install Foundry if not available:
 
\`\`\`sh
curl -L https://foundry.paradigm.xyz | bash
foundryup
\`\`\`
 
Install dependencies:
 
\`\`\`sh
forge install
\`\`\`

Tips

  • AGENTS.md is the primary configuration — make it detailed enough that the agent understands your project structure and build process
  • Include test commands so the agent can verify its changes
  • Specify Solidity version and conventions to get consistent code style
  • Tasks run asynchronously — you assign work and check back for results
  • The sandbox is isolated — external services and private dependencies need explicit configuration