01 / PURPOSE
The autonomous job
Take one small repository task, inspect the code and AGENTS.md, edit files inside the workspace, run the documented checks and report what changed and what could not be verified. A person reviews the diff before any commit.
02 / SYSTEM
Architecture and handoffs
Single local agent. Codex CLI reads the task and AGENTS.md, sends prompts and file context to the OpenAI model service, and runs model-proposed shell commands inside an OS sandbox (Seatbelt on macOS, bubblewrap plus seccomp on Linux and WSL2). This kit uses sandbox workspace-write with command network access off and approval policy on-request: actions that would leave the sandbox stop for a human decision.
Developer
Writes the task, answers approval prompts, reviews the diff and runs the checks
HandoffAccepts the patch into the normal commit and review process, or rejects it
Codex CLI agent
Inspects the repository, edits files in the workspace and runs checks inside the sandbox
HandoffEnds the turn with a summary of changes, checks run and open risks
OpenAI model service
Generates each step from the prompt, instructions and file context
HandoffReturns proposed edits and commands to the CLI
- Model
- OpenAI hosted model selected by Codex for the signed-in account; change it with /model or --model. Model availability depends on the ChatGPT plan or API organization. No model ID is pinned here.
- Memory
- Durable instructions come from AGENTS.md files, rebuilt at the start of every run (32 KiB combined cap by default). Session transcripts are saved locally under CODEX_HOME and can be resumed with codex resume; this kit does not rely on them.
03 / CONNECTIONS
Tools and triggers
| Tool | Purpose | Access |
|---|---|---|
| Shell commands | Build, lint and test using the repository's own commands | Run inside the OS sandbox; writes limited to the workspace and temp dirs; command network access off |
| File edits | Change source and test files for the task | Workspace only; .git, .codex, .agents and .aws inside it stay read-only |
| Web search | Look up documentation | Upstream default is a cached OpenAI search index; the kit profile sets web_search = "disabled" |
What starts the work
- Manual A developer runs codex --sandbox workspace-write --ask-for-approval on-request in the repository root and pastes the first-task prompt.
| Control | Decision |
|---|---|
| Read files the user can read | Yes |
| Edit files inside the workspace | Yes |
| Run shell commands inside the sandbox without network | Yes |
| Send prompts and file context to the OpenAI model service | Yes |
| Use the web search tool (cached index) unless disabled; the kit profile disables it | Yes |
| Enforced by the OS sandbox: writing outside the workspace or using the network requires the user's approval under on-request. | Ask |
| Not a per-edit gate: inside the workspace Codex edits and runs commands without asking; the model decides when to ask. | Ask |
| never means no prompts, not deny-all; the sandbox is then the only limit. | Ask |
| Approvals go to the user (approvals_reviewer = user); the auto_review reviewer agent and --approve-for-me are not used. | Ask |
| For an approval on every command, upstream's replacement is a per-project trust_level = "untrusted" entry in ~/.codex/config.toml. | Ask |
| AGENTS.md rules such as do not push or deploy are model guidance, not enforcement. | Ask |
| A person reviews the diff and re-runs checks before any commit; nothing in the kit commits, merges or pushes. | Ask |
| OS sandbox in workspace-write mode: writes limited to the workspace and temp dirs, .git/.codex/.agents/.aws read-only, command network access off. The approval policy is on-request with approvals routed to the user. | Yes |
04 / BOUNDARIES
Capabilities and safety
- Credentials
- ChatGPT sign-in or an OpenAI API key piped through stdin (printenv OPENAI_API_KEY | codex login --with-api-key). Cached in ~/.codex/auth.json or the OS keyring; treat that file like a password and keep keys out of prompts, AGENTS.md and commits.
- Shutdown
- Ctrl+C interrupts the turn; exit the TUI to end the session. codex logout clears stored credentials. Revert unwanted edits with Git.
Capabilities
- Read files the user can read
- Edit files inside the workspace
- Run shell commands inside the sandbox without network
- Send prompts and file context to the OpenAI model service
- Use the web search tool (cached index) unless disabled; the kit profile disables it
05 / SETUP
The files behind the workflow.
Start with INSTALL.md and the setup notes above. Original-project files retain their attribution and license; our installation notes, dependency profiles and custom wrappers are identified separately.
Install Codex CLI
Sign in
Set sandbox and approval policy
Add AGENTS.md
Give it one small task
Review the change
INSTALL.mdView file +
Setup instructions, prerequisites and edition-specific integration notes
# Codex CLI setup kit: install notes
Checked 2026-10-22 against openai/codex at commit 83086188ae0614bd882818ff1aa23f3194962012 (tag rust-v0.163.0) and the official Codex docs.
## Requirements (from upstream docs/install.md)
- macOS 12+, Ubuntu 20.04+ or Debian 10+, or Windows 11 via WSL2 (install doc)
- Native Windows is also supported: the README gives a PowerShell installer, and Codex has a native Windows sandbox. WSL1 has been unsupported since 0.115
- 4 GB RAM minimum, 8 GB recommended
- Git 2.23+ (optional, recommended)
- A ChatGPT plan that includes Codex, or an OpenAI API key (billed at API rates)
- For the npm route only: Node.js 16 or later (package engines field)
## Install (pick one)
```bash
# Standalone installer, macOS and Linux (also used to update)
curl -fsSL https://chatgpt.com/codex/install.sh | sh
# npm
npm install -g @openai/codex@0.163.0
# Homebrew
brew install --cask codex
```
```powershell
# Windows (native)
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
```
Check `codex --version` afterwards; this kit was checked against codex-cli 0.163.0.
To update later, rerun the installer or run `codex update`. A pinned npm install (`npm install -g @openai/codex@<version>`) keeps you on an exact release. Updating moves you off this kit's pin, so re-check flags.
## Sign in
```bash
codex login # browser sign-in with ChatGPT
printenv OPENAI_API_KEY | codex login --with-api-key # or an API key from stdin
codex login status # confirm which method is active
```
On a headless machine, `codex login --device-auth` is the documented route (beta). Turn on device code login in your ChatGPT security settings first, or ask your workspace admin to allow it.
Credentials are cached in `~/.codex/auth.json` or the OS credential store. Treat that file like a password.
## Start the first session
```bash
cd /path/to/your-repo
git status # start clean, or know what is already changed
codex --sandbox workspace-write --ask-for-approval on-request
```
Or, with the kit profile saved as `~/.codex/first-run.config.toml`, run `codex --profile first-run`.
Then type `/status` to confirm the sandbox, approval policy and writable roots before giving the task.
Agent Setup Kits authored documentation for Pinned source guide with authored setup files; upstream code and licenses remain attributed separately
AGENTS.mdView file +
Starter repository instructions: scope, project map, required checks, completion report
# Repository instructions
## Scope
- Work only inside this repository.
- Preserve unrelated changes that are already in the working tree.
- Do not commit, push, merge, publish or deploy.
- Do not add dependencies unless the task explicitly asks for one.
## Project map
- Application code: [replace with the real path]
- Tests: [replace with the real path]
- Documentation: [replace with the real path]
## Required checks
- Build: [replace with the documented build command]
- Lint: [replace with the documented lint command]
- Test: [replace with the documented test command]
## Completion report
- Summarize the behavior you changed.
- List the checks you actually ran and their results.
- Name any check you could not run, and why.
- Call out remaining risks and unverified assumptions.
Agent Setup Kits authored template
first-task.mdView file +
A bounded first-task prompt and guidance on choosing a task
# First task prompt
Paste this into Codex after it starts in the repository root. Replace the bracketed line first.
```text
Read AGENTS.md and find the files relevant to the task before editing anything.
Task: [describe one small, concrete change, ideally one with an existing failing test].
Before you change files, explain the likely cause and the scope you propose.
Make the smallest change that resolves the task. Run the checks listed in
AGENTS.md. Do not touch unrelated files, add dependencies, commit, push,
merge or deploy. Finish with: behavior changed, files touched, checks run
and their results, anything you could not run, and remaining uncertainty.
```
Good first tasks: one documented edge case, a small bug with a failing test, a stale internal reference, a narrow error message plus its test, or "explain this subsystem" with no edits.
Poor first tasks: migrations, dependency upgrades, authentication code, CI changes, anything that deploys.
Agent Setup Kits authored
review-checklist.mdView file +
Five-step human review of the resulting diff
Download review-checklist.md ↓
# Review checklist for a Codex change
Treat the result as a candidate patch. A finished session is not proof the change is right.
1. Scope: `git status` and `git diff --stat`. Every changed file should belong to the task. Look hard at manifests, lockfiles, generated files, CI config, auth code and deploy settings.
2. Read the patch: does it match Codex's explanation? Watch for removed validation, swallowed errors, hardcoded paths or secrets, weakened tests and large reformatting that hides the real edit.
3. Re-run the checks yourself, using the commands in AGENTS.md. Write down what ran and what passed. "Not run" never becomes "passed".
4. Exercise the behavior: reproduce the original problem, then confirm the fix on the real path, not only in the test.
5. Final state: no secrets, debug output, temp files or stray artifacts. Only then does the patch enter your normal commit and review process.
Agent Setup Kits authored
first-run.config.tomlView file +
Optional Codex profile: workspace-write, on-request, approvals to user, web search off
Download first-run.config.toml ↓
# Save as ~/.codex/first-run.config.toml, then start Codex with:
# codex --profile first-run
# Keys from the Codex configuration reference (checked 2026-10-22).
# Confirm inside the session with /status. (codex doctor does not take --profile.)
sandbox_mode = "workspace-write" # writes limited to the workspace
approval_policy = "on-request" # ask before leaving the sandbox
approvals_reviewer = "user" # approvals come to you, not an auto-reviewer
web_search = "disabled" # optional: no web search tool for a first run
[sandbox_workspace_write]
network_access = false # the default; listed so it is visible
Agent Setup Kits authored; keys from the official configuration reference; parsed when copied as config.toml (codex doctor 0.163.0) and loaded as a profile by codex --profile first-run debug prompt-input
SOURCE.mdView file +
Original-project attribution, source hashes and adaptation notes
# Sources and attribution
Based on Codex CLI, by OpenAI: https://github.com/openai/codex
Pinned commit: https://github.com/openai/codex/commit/83086188ae0614bd882818ff1aa23f3194962012 (tag rust-v0.163.0, released 2026-10-15)
License: Apache-2.0 (https://github.com/openai/codex/blob/83086188ae0614bd882818ff1aa23f3194962012/LICENSE)
The CLI source is Apache-2.0. The models it calls are OpenAI's paid, hosted service under OpenAI's own terms.
What Agent Setup Kits wrote: AGENTS.md, first-task.md, review-checklist.md, first-run.config.toml, INSTALL.md and this file. No upstream code is redistributed here. Commands, flags and config keys were checked against the pinned source and the official docs on 2026-10-22. This guide is independent and not endorsed by OpenAI.
Agent Setup Kits authored documentation for Pinned source guide with authored setup files; upstream code and licenses remain attributed separately
06 / ORIGINAL WORK
Sources, pins, and license
This guide draws on Codex CLI by OpenAI, at the linked source revision. Agent Setup Kits is independent of the upstream project. Edition-specific changes are labeled in the file provenance.
Pinned source guide with authored setup files
| Source | What it supports |
|---|---|
| Immutable source revision (tag rust-v0.163.0) ↗ | Exact source snapshot for every flag and file cited |
| README.md ↗ | Install channels (install.sh, PowerShell, npm, Homebrew), ChatGPT plan sign-in, Apache-2.0 |
| docs/install.md ↗ | System requirements: macOS 12+, Ubuntu 20.04+/Debian 10+, Windows 11 via WSL2, 4 GB RAM minimum, Git 2.23+ optional |
| codex-rs/utils/cli/src/sandbox_mode_cli_arg.rs ↗ | --sandbox values read-only, workspace-write, danger-full-access |
| codex-rs/utils/cli/src/approval_mode_cli_arg.rs ↗ | --ask-for-approval values on-request and never only |
| codex-rs/utils/cli/src/shared_options.rs ↗ | --approve-for-me, --dangerously-bypass-approvals-and-sandbox (alias --yolo), --profile, --add-dir |
| codex-rs/cli/src/main.rs ↗ | codex login --with-api-key reading from stdin, --device-auth, login status, logout, exec, doctor |
| codex-cli/package.json ↗ | npm package @openai/codex, Node.js >=16 engines, Apache-2.0 |
| Agent approvals and security (official docs) ↗ | Sandbox vs approval layers, Auto preset, network off by default, protected paths, OS sandbox per platform, auto-review, Docker caveat, web search cache |
| Configuration reference (official docs) ↗ | approval_policy values; untrusted unsupported, on-failure deprecated; approvals_reviewer |
| Authentication (official docs) ↗ | ChatGPT and API-key sign-in, auth.json storage, device auth, data-policy differences |
| Custom instructions with AGENTS.md (official docs) ↗ | Discovery order, AGENTS.override.md, 32 KiB project_doc_max_bytes default |
| Codex CLI (official docs) ↗ | Install and first-run flow, /status, /permissions |
| Release rust-v0.163.0 ↗ | Latest stable release on 2026-10-22, published 2026-10-15 |
| Component | Pin | Source |
|---|---|---|
| Repository source (tag rust-v0.163.0) | 83086188ae0614bd882818ff1aa23f3194962012 | Original source ↗ |
| Codex CLI release | 0.163.0 | Original source ↗ |
| npm @openai/codex | 0.163.0 | Original source ↗ |
| Homebrew cask codex | 0.163.0 | Original source ↗ |
Apache-2.0
Codex CLI source is Apache-2.0. The models it calls are OpenAI's paid hosted service under OpenAI's own terms. No upstream code is redistributed in this kit; all kit files are authored by Agent Setup Kits.
Read the original license ↗Related guides
Part of: Which setup should I use to add human approval to an agent?