Reviewing & Verifying Changes
/diff, /review, and trusting the transcript
- Use /diff to inspect every pending change, including files Git isn't tracking yet, and scroll through it inside the TUI
- Run /review to launch a dedicated reviewer over a selected diff and read its prioritized, actionable findings
- Read the Codex transcript to verify edits and commands before approving anything destructive
- Roll back changes using your normal git workflow, knowing there is no built-in /undo command
- Pair human review with self-verification by having Codex run tests and lint and report the results
- Copy the latest completed output with /copy or Ctrl+O to share a review or paste it into a PR
Codex can edit files and run commands for you, but you stay the final reviewer. This lesson teaches the local review discipline that keeps the agent honest: read the transcript before you approve destructive steps, use /diff to see every change (untracked files included), run /review to get a dedicated reviewer's prioritized findings, and lean on git — not a non-existent /undo — for rollback. You'll also pair review with self-verification by having Codex run tests and lint.
- 1The mental model: you are the merge gate
- 2Trust the transcript, then approve
- 3/diff — see everything that changed
- 4/review — a dedicated reviewer with prioritized findings
- 5Rollback is git — there is no /undo
- 6Pair review with self-verification — and share it
The mental model: you are the merge gate
Here is the one idea that makes working with Codex safe: the agent writes the code, but you are the merge gate. Codex is fast and usually right — but "usually" is not "always," and the cost of a bad edit slipping into your codebase is far higher than the cost of a thirty-second review. So treat every Codex turn the way a senior engineer treats a junior's pull request: assume good intent, then verify before you trust.
The good news is that Codex is built for exactly this. It does not hide what it does. Every edit it makes and every command it runs is surfaced in a transcript, and it always leaves your changes sitting in the working tree where your normal Git tools can see them. Reviewing is not a bolt-on; it's the second half of the loop.
This lesson is about three habits that turn "the agent did some stuff" into "I know exactly what changed and I trust it":
- Read the transcript as Codex works — especially before approving anything that edits files or runs commands.
- Inspect the diff with
/diffand, when it matters, get a second opinion with/review. - Verify with reality — have Codex run the tests and lint, and use Git as your safety net and rollback path.
Tie-back: This is verification-driven development applied locally. The agent's job isn't done when the code looks right; it's done when a check confirms it is right — and when you've seen the diff that proves it.
Key insight
Review is the second half of the loop
Codex's loop is inspect repo → propose changes → pause for approval → iterate. The "pause for approval" step only protects you if you actually read what you're approving. The diff and the transcript are there precisely so you can.
Trust the transcript, then approve
As Codex works, it streams a transcript of everything it's doing: the files it reads, the edits it proposes, and the shell commands it wants to run. This is your primary review surface during a turn — before changes are even applied.
Why this matters: depending on your approval mode, Codex will pause and ask before it does something it can't take back (writing files, running a command that leaves the sandbox, anything network- or system-touching). That approval prompt is only as useful as your attention to it. Read what's in front of you before you press approve — especially for destructive steps like rm, a force-push, a database migration, or a command that reaches the network.
The transcript is also how you reconstruct what happened after the fact. Because every action is logged, you can scroll back and answer "wait, what did it just change?" without guessing.
A few mechanics worth knowing:
- Ctrl+T opens (and closes) the transcript overlay so you can scroll the full history of the turn.
- Ctrl+C cancels the current turn if you see it heading somewhere wrong — interrupt is Ctrl+C, not Esc. (Esc Esc edits your previous message; it does not stop a running turn.)
- Codex never silently mutates your repo. If a change landed, it's in the transcript and it's in your working tree.
Gotcha: The approval prompt is a review checkpoint, not a formality. The most common way people get burned is reflexively approving a batch of commands without reading the one destructive line buried in it. Slow down for anything that deletes, pushes, or hits the network.
Watch out
Interrupt is Ctrl+C, not Esc
To stop Codex mid-turn, press Ctrl+C. Esc Esc (on an empty composer) edits your previous message and walks back through the transcript — useful, but it will not halt a running command. Knowing the difference matters when you spot something going wrong.
/diff — see everything that changed
Once Codex has made edits, /diff is your go-to for reviewing them. It shows the Git diff of your working tree, including files Git isn't tracking yet — and that last part is the detail that saves you.
Why untracked files matter: a plain git diff will not show you a brand-new file Codex just created, because Git doesn't know it exists until you git add it. So if Codex scaffolded a new module, a config file, or a script, a naive git diff hides it — but Codex's /diff surfaces it. You see the complete picture of what the turn produced, additions and modifications alike.
The diff is scrollable right inside the TUI, so you can page through a large change set without leaving Codex or switching to another terminal.
/diff → scrollable Git diff of the working tree, INCLUDING untracked (new) filesHow to actually use it in a review pass:
- Run
/diffafter any turn that edited code, before you move on or approve a commit. - Scan for scope creep — files you didn't expect to change are the #1 red flag.
- Check that new files (which
git diffwould miss) are ones you actually want. - For anything you're unsure about, escalate to
/review(next section) rather than eyeballing it.
Plain git diff | Codex /diff | |
|---|---|---|
| Modified tracked files | Yes | Yes |
| New / untracked files | No (until git add) | Yes |
| Scroll inside Codex | — | Yes |
| One keystroke in-session | No | Yes |
Tip
Untracked files are the blind spot
The single biggest reason to use /diff over a raw git diff is that it shows new files Codex created. Those are exactly the changes a quick git diff silently omits — and exactly the ones worth a careful look.
/review — a dedicated reviewer with prioritized findings
/diff shows you what changed. /review tells you what might be wrong with it. Running /review launches a dedicated reviewer that reads a diff you select and reports prioritized, actionable findings — think of it as a second Codex whose only job is to critique the change, not defend it.
This separation is the point. The agent that wrote the code is invested in its own solution; a fresh reviewer reading just the diff is far better at spotting the bug, the missed edge case, or the security regression. It's the generator–critic pattern, built into the CLI.
What you get back is prioritized — the reviewer surfaces the things that matter most first (correctness and security issues ahead of style nits), so you can triage instead of wading through a flat list.
Two related commands round out the review flow:
/review— ask Codex to review your working tree and report findings over a selected diff./approve— approve one retry of a recent auto-review denial. (Auto-review is an optional posture where a reviewer agent gates risky actions like exfiltration or destructive commands;/approvelets you override a single denial when you've judged it safe.)
A practical rhythm: let Codex finish a unit of work → /diff to see the shape of it → /review to pressure-test it → fix what the reviewer flags → commit. You're using the agent against itself, which is cheaper and faster than waiting for a human reviewer on every small change.
Example
A focused review pass
After Codex adds an auth check, run /review. The reviewer reads the diff and reports, in priority order: a P0 missing-null-check that throws on logged-out users, then a P1 unhandled error path, then a low-priority naming nit. You fix the first two, wave off the nit, and commit — having caught a real bug before it ever reached a human.
Rollback is git — there is no /undo
This is the rule that surprises people coming from other agents: Codex has no built-in /undo command. Rollback happens through your normal Git workflow. That's not a missing feature — it's a deliberate design choice. Codex leaves all its changes in your working tree and surfaces every action in the transcript precisely so that Git, the tool you already trust for versioning, is your single source of truth for undoing.
The discipline that makes this painless:
# 1. Commit (or stash) BEFORE you let Codex make big changes — your clean baseline
git add -A && git commit -m "baseline before Codex refactor"
# 2. Let Codex work, then review
# /diff → see what changed (incl. new files)
# /review → get prioritized findings
# 3a. Happy? Commit the result
git add -A && git commit -m "refactor: extract auth middleware"
# 3b. Unhappy? Roll back to your clean baseline
git restore . # discard tracked-file edits
git clean -fd # remove new (untracked) files Codex created
# or, if you already committed something you want gone:
git reset --hard HEAD~1 # nuke the last commit and its changesNotice that git restore . alone is not enough to fully undo a Codex turn — it leaves the new files behind. You need git clean -fd to remove untracked files too. (This is the same blind spot /diff saves you from: untracked files are easy to forget.)
The takeaway: commit early and often. A clean commit before a risky task is a one-command rollback after it. Without that baseline, you're reconstructing the old state by hand from the transcript — possible, but tedious.
Watch out
No /undo — and restore doesn't catch new files
There is no /undo in Codex; roll back with Git. And remember git restore . only reverts tracked edits — Codex's newly created files survive it. Use git clean -fd to clear those, or you'll think you rolled back when you only half did.
Pair review with self-verification — and share it
Human review catches what you can see; self-verification catches what a machine can confirm. The most reliable Codex workflow combines both: you read the diff, and Codex runs the checks. Don't make yourself the only verification step when the agent can run the test suite itself.
The lever is simple — tell Codex, as part of the task, to verify its own work and report results:
"...then run
npm testandnpm run lint, and show me the output. If anything fails, fix it and re-run until both pass."
Because Codex can execute commands, it will run the suite, read the failures, fix them, and re-run — closing its own loop. The transcript shows you the actual test output, so you're not taking its word for "tests pass"; you can see the green run. This is the single highest-leverage habit in agentic coding: a runnable check turns "looks done" into "is done."
When the review or run is finished and you want to share it — paste findings into a PR description, send a teammate the failing-test summary, or save the reviewer's output — use /copy (or Ctrl+O) to copy the latest completed Codex output to your clipboard. One keystroke, no mouse-selecting a scrolling terminal.
| Action | How | When |
|---|---|---|
| See all changes | /diff | After any editing turn |
| Get a critique | /review | Before committing non-trivial work |
| Read the transcript | Ctrl+T | To audit edits/commands; before approving |
| Run tests / lint | Ask Codex in the prompt | Every task with a verifiable outcome |
| Copy last output | /copy or Ctrl+O | To share a review or paste into a PR |
| Roll back | git restore / clean / reset | When a change is wrong (no /undo) |
Tip
Make the verifier part of the prompt
Add a "done-when" line to your task: "done when npm test and npm run lint both pass." Codex will run them, fix failures, and re-run — and the transcript shows you the real output, so success is something you can see rather than something you hope for.
Try it: Review a Codex change end to end
Goal: build the review reflex on a change you can safely throw away.
1) Commit a clean baseline. In a small repo with a test command, run git add -A && git commit -m "baseline before Codex". This is your one-command rollback point.
2) Give Codex a real, verifiable task. Start codex and ask for something that adds a file and edits one, with a done-when check, e.g. "Add a src/utils/slugify.ts helper and use it in the existing title-rendering code. When done, run the test suite and lint and show me the output; fix any failures and re-run until both pass."
3) Watch the transcript. As Codex works, note where it pauses for approval. Before approving anything that runs a command, read it. Open the transcript overlay with Ctrl+T and scroll the history.
4) Inspect with /diff. Run /diff and confirm it shows BOTH the modified file and the brand-new slugify.ts. Now run a plain git diff in another terminal and notice the new file is missing there — that's the untracked-file blind spot /diff fixes.
5) Get a second opinion with /review. Run /review and read the prioritized findings. Did it catch anything you missed? Fix what's worth fixing.
6) Confirm self-verification. In the transcript, find the actual test/lint output. You should see a real run, not just a claim that it passed.
7) Practice rollback. Decide to throw the change away. Run git restore . and then git status — notice slugify.ts is still there because it's untracked. Now run git clean -fd and confirm you're back to your clean baseline.
8) Share it. Re-run the task (or /review), then press /copy (or Ctrl+O) and paste the output somewhere — that's how you'd drop a review into a PR.
Write three sentences: what did /diff show that git diff didn't, what did /review flag, and what surprised you about rolling back with git?
Key takeaways
- 1You are the merge gate: Codex surfaces every edit and command in a transcript so you can review before approving destructive steps — read it, don't reflex-approve.
- 2/diff shows the full working-tree change set including untracked (new) files that a plain `git diff` would miss, and it scrolls right inside the TUI.
- 3/review launches a dedicated reviewer over a selected diff and returns prioritized, actionable findings — the generator–critic pattern built into the CLI.
- 4There is no /undo: roll back with your normal Git workflow. Commit early; remember `git restore .` leaves new files, so use `git clean -fd` to fully revert a turn.
- 5Pair human review with self-verification — have Codex run tests and lint and report results in the transcript, turning "looks done" into "is done."
- 6Interrupt is Ctrl+C (not Esc); copy the latest completed output to share with /copy or Ctrl+O.
Quiz
Lock in what you learned
Check your understanding
0 / 4 answered
1.Codex just finished a task that modified two existing files and created one brand-new file. You run `git diff` in another terminal and see only the two modified files. Why is the new file missing, and what shows it?
2.What does the `/review` command do, and why is it more valuable than just re-reading the diff yourself with the same agent?
3.Codex made a refactor you've decided is wrong. It edited several tracked files and created two new files. You run `git restore .` to undo it. What's the problem?
4.You want Codex's work to be verified, not just to look correct, and then you want to paste the result into a PR. What's the right combination?
Go deeper
Hand-picked sources to keep learning
Official source for the agent loop, the transcript, /review, image attachment, and the Ctrl+C / Esc / Tab shortcuts.
Verbatim descriptions of /diff, /review, /approve, /copy and the rest. The roster evolves — treat this page as the source of truth.
How Codex reads your repo, makes edits, runs commands, and surfaces a transcript you review with your normal git workflow.
Reference for CLI flags and the approval/sandbox values that decide when Codex pauses to ask before acting.
Track CLI versions and behavior changes — keyboard shortcuts and the slash roster shift between releases.
Where new commands, shortcut tweaks, and behavior changes land — check it when a shortcut or command behaves differently than expected.