Codex's CLI interface is the sum of global flags, commands and their own options, and the full set is always wider than any static table. The most accurate source is codex --help and the --help of a specific command: it reflects exactly your version, whereas a recorded list goes stale. This reference gives a map of the most-used flags and commands by group; the exact semantics and maturity of each item are set by the official CLI reference page, checked before building a workflow on a flag.
Global flags set the boundaries and context of a run. The key ones have already appeared in the book: --sandbox chooses the sandbox mode, --ask-for-approval the approval policy, --profile applies a named profile, --add-dir extends access to a directory, --cd sets the working directory, -c gives a one-off config override. It is these flags that most often determine what the agent can do and how it behaves, so they are understood first rather than memorizing rare options.
Commands cover different work modes. exec is a non-interactive run for scripts and CI; review is a review of changes; mcp add and mcp list manage MCP servers; mcp-server and app-server are Codex's role as a server; login and logout are sign-in; execpolicy check verifies rules; remote-control is experimental remote control. Each command is a separate mode with its own set of options, and its behavior is refined via its own --help.
It helps to gather the key flags and commands into a table once, to choose by purpose. Below is a map by group. It is worth using with the reference's general caveat: a flag's presence here does not guarantee its presence in your version, and rare and experimental options are especially worth checking against the official documentation. Fast-changing flags are verified by a command, not from memory, before building them into automation.
| Group | Flag / command | Purpose |
|---|---|---|
| Boundaries | --sandbox / --ask-for-approval | Sandbox mode / approval policy |
| --add-dir / --cd | Extra directory / working directory | |
| Config | --profile / -c key=value / --strict-config | Profile / one-off override / strict check |
| Input | --search / --image | Live web search / image in the prompt |
|---|
| Non-interactive | exec / --json / --output-schema | Run without TUI / events / structured output |
|---|
| Review | review / review --uncommitted | Review of changes / uncommitted |
|---|
| MCP | mcp add / mcp list / mcp-server | MCP client / list / Codex as a server |
|---|
| Server | app-server / --ws-auth | Protocol host / transport auth |
|---|
| Sign-in/diagnostics | login / logout / doctor | Sign-in management / install check |
|---|
| Remote | --remote / remote-control | Remote host / experimental control |
|---|