Codex CLI Plan Mode: Plan, Review, and Start Work

Plan mode shows you what Codex CLI intends to do before it does anything. This guide covers how to enter and leave plan mode, how to review and refine a plan, and how to keep the approved plan beyond the session.

Updated 6 min read

In Codex CLI plan mode, the agent reads your goal and produces a written plan of the steps it will take before it changes anything. You review the plan, ask questions or request corrections, and then decide whether to proceed. No file is written and no command is run until you give the go-ahead.

The plan itself is a short-lived thing: it lives in the session and disappears when you close the terminal. Tools like fenbs keep the task plan and the decisions you made during review outside the session, so the next session on the same task starts from the agreed approach rather than from scratch.

When plan mode is useful

Plan mode is the right starting point for any task where you are not sure exactly what the agent will do. It lets you verify the approach before it touches your codebase, and it forces the agent to think through the full sequence of steps before committing to the first one.

It is also useful for sharing the plan with a teammate before acting. Paste the plan into a comment or a task note, get a second opinion, and then return to the session to execute the confirmed version. This is especially valuable for changes with broad scope or significant side effects.

The Gemini CLI has a comparable feature; the gemini cli plan mode guide covers that version if you want to compare approaches.

Enter plan mode

Start a Codex CLI session with the --plan flag to enter plan mode immediately:

Start in plan mode
codex --plan "Refactor the user authentication module to use the new token service"

The agent reads your goal and returns a numbered list of the steps it plans to take: which files it will read, what changes it will make, which tests it will run, and in what order. No action is taken yet.

You can also enter plan mode interactively from within a session. The exact command depends on your CLI version; check the OpenAI Codex documentation (opens in a new tab) for the current syntax.

Review and refine the plan

Read through each step and ask yourself: is this what I intended? Check for scope creep, meaning steps that go beyond the task you defined. Check for missing steps, like tests or build checks that should follow the changes. Check for assumptions, such as a file path or a function name the agent inferred that you should confirm.

You can ask the agent to revise the plan by typing corrections in the session. "Do not modify the test files; only change the implementation." "Add a step to run the linter before the final commit." "The function is called createSession, not initSession."

Repeat until the plan reflects exactly what you want. A plan that looks right before execution is worth the five minutes of review; a plan that looks right but has one wrong assumption can produce a diff that takes longer to fix than the original task.

Approve and execute

Once the plan looks correct, approve it and the agent begins executing. In suggest mode (the default), it still pauses for confirmation before each individual step. In auto-edit or full-auto, it works through the plan without pausing. See codex cli auto mode for the approval policy options.

You can exit plan mode without executing at any time. If the plan revealed that the task is more complex than expected, exit, break the work into smaller tasks, and plan each one separately.

Exit plan mode without executing

To leave plan mode without running the plan, type exit or close the session. The plan disappears with the session; nothing has changed in your codebase. If you want to save the plan for later, copy the steps from the terminal before you exit.

Exiting early is not a failure. A plan that reveals the task is too broad, needs a different approach, or requires a decision you are not ready to make is useful information. Recording that finding on the task prevents the next session from repeating the same planning step.

Keep the approved plan beyond the session

The session holds the plan in context. When you close the terminal, it is gone. If you execute the plan and then come back to finish the task in a later session, the new session does not know what the previous one intended.

Copy the approved plan into the task record before executing. Even a brief summary is better than nothing: "The plan is to extract the token validation logic into a separate module, update all callers, and run the full test suite." A new session that reads that note can continue the work without re-planning from scratch.

How fenbs helps

Keep the plan and the decisions behind it

Add the approved plan to the fenbs task before you execute it. Record any corrections you made during review as Decisions: why the original step was wrong, what the right approach is. The next session reads the plan and the decisions instead of re-planning. Create a free account and add your project.

Create a free account

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

How to do this with fenbs

  1. Create a free account and add the task you are planning. The task's plan field holds the current approach.
  2. Run codex --plan "your goal". Review the agent's proposed steps. Refine until the plan is correct.
  3. Copy the approved steps into the fenbs task plan. Add a note about any corrections you made and why.
  4. Connect Codex CLI from Integrations. Future sessions read the task plan and any Decisions before they start.
  5. After execution, update the task with what was done, what was checked, and the next step. Mark corrections as Decisions if they should apply to future similar tasks.

For tasks where you need to run the plan on a separate branch, the codex cli worktree guide explains how to keep each planned task in its own isolated directory.

Questions people ask.

What does Codex CLI plan mode do?

Plan mode makes the agent produce a written list of the steps it intends to take before it changes any file or runs any command. You review, refine, and approve the plan, then decide whether to execute it. No action happens until you give the go-ahead.

How do I exit plan mode without running the plan?

Type exit or close the session. Nothing has changed in your codebase. If the plan revealed the task needs a different approach, record that finding on the task before you exit, so the next session does not repeat the same planning step.

Does plan mode change which approval policy is used during execution?

No. Plan mode controls the planning phase. Once you approve the plan, execution uses whatever approval policy you have set: suggest, auto-edit, or full-auto. Set the execution policy with the --approval-policy flag.

How do I save a plan from one session to use in the next?

Copy the approved steps into a task note or plan field in a shared record before you execute. The session holds the plan in context; closing the terminal removes it. A task record that holds the plan lets the next session continue without re-planning.

More in Agent harness (for developers)

All Agent harness (for developers) articles

Start with one thing.

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

There is nothing to set up first. Write one line and you’ve started.