CDX-101 · Module 2
Plan Mode & Prompting
3 min read
The /plan command switches Codex into planning mode, where it analyzes your request and proposes an approach before writing any code. This is invaluable for non-trivial tasks — refactors, new features, architecture changes — where you want to verify the approach before committing to implementation.
In plan mode, Codex reads relevant files, considers the task requirements, and outputs a structured plan: which files it will modify, what changes it will make, and in what order. You can iterate on the plan — asking it to adjust scope, change approach, or add steps — before giving the go-ahead to execute.
Good prompts are the highest-leverage skill in any AI coding tool. The Codex Prompting Guide (published by OpenAI) emphasizes treating the agent like a configured teammate — give it context, constraints, and success criteria. A prompt like "fix the bug" forces the agent to guess what bug, where, and what "fixed" means. A prompt like "the /users endpoint returns 500 when email contains a plus sign — add URL encoding in the validation layer and add a test case" gives Codex everything it needs.
Do This
- State what is broken, where it is, and what success looks like
- Reference specific files and functions when you know them
- Use /plan before executing on multi-file changes
- Iterate on the plan before approving — "also update the tests" is cheaper here than after execution
Avoid This
- Write one-word prompts like "fix it" or "refactor"
- Assume Codex remembers context from a previous session (it does not unless you /resume)
- Skip planning for complex tasks to "save time" — you will spend more time reverting
Treat the agent like a new hire who is brilliant but has never seen your codebase. The more context you give upfront, the less you correct later.
— OpenAI Codex Prompting Guide
One powerful pattern is the brain-dump prompt. Instead of carefully structuring your request, dump everything you know about the problem — symptoms, suspected causes, relevant files, constraints — and ask Codex to summarize it back before proceeding. This works because Codex is excellent at extracting signal from noisy input, and the summarization step catches misunderstandings before they become wrong code.