Codex CLI tutorial: a careful workflow for real code changes

AI Router Aug 30, 2026

Codex CLI works in a project directory: it can inspect files, edit code, and run local commands. Start with a small, checkable task such as fixing a failing test. Run codex from the repository root, describe the outcome, and review the diff. See the official Codex CLI guide for current installation instructions.

Give it a bounded task

Name the affected area, the behavior to change, and how to verify success. For example: “Fix the locale lost by saveProfile; keep the API unchanged and run its related test.” For wider work, ask for a plan before edits and correct any mistaken assumptions.

Match permissions to the work

Use /permissions to inspect access and /status to review session settings. Codex has controls for approvals and sandbox access; choose them for the repository and task. Investigation needs less access than editing. Inspect commands with effects such as deleting files or publishing changes.

Keep changes reviewable

Create a Git checkpoint before work. For a risky experiment, use a separate branch or worktree. Ask for one coherent change at a time, then inspect the diff for unrelated edits, generated files, and secrets. /review can help find issues, but does not replace your review.

Verify before accepting

Specify the tests or checks that matter, and ask Codex to report what it ran. Read their output, then inspect the final diff. A passing test only supports the behavior it covers; manually check user-facing paths that automation misses. The official best-practices guide recommends clear success criteria, suitable permissions, testing, and review.