Codex CLI guide for real codebase work
A practical Codex CLI workflow for reading a repo, changing code, checking tests and keeping changes small.

Put it into practice
What you will produce
A patch limited to named files, a record of commands run, and a concise handoff that states what was and was not checked.
- 01
Read the repository contract
Open the project instructions and the named files or module; identify protected areas, acceptance criteria and the smallest relevant check before asking Codex to edit.
Expected result: A bounded task brief grounded in the actual repository rather than assumed conventions.
- 02
Delegate one narrow change
State the exact behavior to change, allowed files, constraints and evidence required; ask Codex to inspect first and explain any scope expansion before touching it.
Expected result: A focused plan that exposes missing context or proposed extra work for review.
- 03
Inspect commands and diff
Review every command result, inspect the complete diff and Git status, and compare edited paths against the allowed list; investigate generated or unexplained files.
Expected result: An understandable patch with no unexplained workspace changes.
- 04
Run and report the relevant check
Run the project-defined check for the changed behavior, then record its exact command and outcome alongside checks not run and remaining uncertainty.
Expected result: A verifiable handoff that distinguishes confirmed behavior from untested claims.
Acceptance checks
- The task uses the repository's actual instructions and named files.
- The diff stays within the agreed file and behavior scope.
- Git status has no unexplained generated or unrelated files.
- The handoff names commands run, outcomes and checks omitted.
Limits and trade-offs
Codex capabilities and approval behavior depend on the current client and settings. Check current documentation before relying on specific flags or defaults.
Official sources
Learn the workflow
Related guides
Building AI agents that actually work
Most 'agents' are brittle pipelines dressed up with AI. Here's the anatomy of a reliable agent, three patterns that hold up in production, and when to use n8n vs code.
Everyone is building agents. Most of them break on the third run. One common failure mode is asking the model to handle too many responsibilities without clear checks. Architecture, model behavior and external dependencies can all contribute to failures. Here's what I've learned building agents that actually run week after week. The anatomy of a reliable agent Every agent that works has three parts, and only one of them should involve AI. Trigger something deterministic starts the agent. A schedule, a webhook, a file drop, a form submission. Not "whenever the AI decides it's time." Context the agent gathers what it needs before calling the AI. The document, the data, the user preferences, the constraints. The AI call happens with full context, not halfway through discovery. Action after the AI produces output, something deterministic happens with it. It gets saved, sent, logged, or published. The action step doesn't retry or…
Read the guideCLAUDE.md: A Guide for Every Developer
One markdown file that makes AI coding assistants actually understand your codebase. Here's what to put in it.
There's a reason Claude Code writes great code in some projects and generic boilerplate in others. It's not the model. It's CLAUDE.md . It is one part of my Claude Code workflow: project conventions reduce guesswork, but they do not guarantee a speedup or remove the need to review the change. What it is CLAUDE.md is a plain markdown file that Claude Code reads at the start of every session. Think of it as the onboarding doc you'd give a senior contractor on day one: stack, conventions, rules, context. Without it, Claude infers patterns from what it sees in the codebase. Sometimes it infers correctly. Often it doesn't especially for implicit conventions your team just "knows". A CLAUDE.md makes your rules available without repeating them, but does not guarantee compliance: review the diff and run the checks. What to put in it 1. Stack and versions Simple but important. These…
Read the guide