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 committingHow it works
Codex runs asynchronously in a cloud sandbox:
- Your repo is cloned into the sandbox
- The agent reads
AGENTS.mdfor project context - It uses terminal commands (
forge build,forge test) for diagnostics - Changes are applied and committed
- 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.mdis 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