How to use Codex: 3 habits that work

Codex works better as a teammate than a chatbot. Three habits from OpenAI's own guide: a Git checkpoint first, a prompt that says what done looks like, and /review before you keep the change.

Short answer: Save a Git checkpoint before Codex starts, so you can undo. Say in the prompt what done looks like, for example "done when all tests pass", so Codex can check its own work. Then type /review and read the changes before you keep them. Those three habits come straight from OpenAI's Codex docs.

Typing "fix the login bug" and hoping is how most people start. Codex will try, but it cannot know when it is finished, and you cannot easily take the change back if it goes wrong. Three small habits fix both.

Checked against the Codex docs on 14 November 2026.

Nothing loads from YouTube until you press play. Then Google receives your IP address and may set its own storage. Narrated with an AI-generated voice. Privacy

Why save a Git checkpoint first?

Codex edits real files. A commit before the task gives you a clean point to return to:

git add -A
git commit -m "checkpoint before codex"

The Codex CLI docs say it plainly: create Git checkpoints before and after a task so you can revert changes. If the result is wrong, git restore . takes the changed files back to that commit (the other ways back are in the 20 Git commands you actually need).

What does "say what done looks like" mean?

OpenAI's best practices guide suggests four things in a prompt: the goal, the context (files, errors, examples), the constraints, and done when. The last one is the habit most people skip.

Weak promptBetter prompt
Fix the login bugFix the login bug in src/auth/login.ts. Done when all tests pass and a wrong password shows the error message again.

With a finish line, Codex can run the tests itself, see them fail, and keep going until they pass. Without one, it stops when the code looks right to it.

How do you review the change before keeping it?

Type /review. Codex starts a separate reviewer that reports findings by priority without changing your files. You can review:

  • your uncommitted changes (the usual case after a task),
  • a single commit,
  • your branch against a base branch, like a pull request.

/review only appears when the project is inside a Git repository, which is one more reason for the checkpoint. Read the findings, ask Codex to fix what matters, then commit.

What controls when Codex asks before acting?

/permissions. By default Codex works in a sandbox: it can read files, edit inside your project folder and run routine commands there, and asks before it goes further. Pick a tighter or looser setting for the session with /permissions, or set a default in config.toml. Codex sandbox and approval modes explains every value.

Where can you check this?

Can you write the rules once instead of in every prompt?

Put the finish line and your test command in AGENTS.md, and Codex reads them every time. Config Studio for Codex writes your AGENTS.md, rules and config.toml with every option explained, and shows which layer wins. Nothing touches your disk until you copy what it writes.

The tool

Do it in your browser.

Codex

Config Studio for Codex

Every file Codex reads, explained: config.toml, sandbox and approvals, AGENTS.md, rules, hooks, skills, MCP servers and the status line, with an editor that writes them for you.

Keep reading

More from the blog.

Every post