Codex CLI slash commands
Slash commands are typed into the TUI composer. Type / to open the command popup; pressing Tab while Codex is working queues a command for the next turn.
For terminal-level commands like codex exec, see Codex CLI terminal commands. For composer shortcuts (@, !, Esc Esc, etc.), see the notes at the bottom of this page.
Full command reference
| Command | What it does | When to use it |
|---|---|---|
/init | Generate an AGENTS.md scaffold in the current directory | First session in a new repo |
/status | Show session config and token usage (model, approval policy, writable roots, context left) | Checking what Codex can see/do right now |
/permissions | Set what Codex can do without asking (approval presets, custom permission profiles) | Changing autonomy mid-session |
/model | Choose model and reasoning effort | Harder task needs more reasoning; cheaper model for routine work |
/review | Review the working tree (uses session model unless review_model is set) | Before committing local changes |
/new | Start a new chat in the same CLI session (/new <name> to name it) | Switching to an unrelated task |
/clear | Clear the terminal and start a fresh chat | Full reset (unlike Ctrl+L, which only clears the view) |
/compact | Summarize the chat to free context | Long session approaching the context limit |
/diff | Show the Git diff, including untracked files | Reviewing what Codex changed |
/mention | Attach a file to the chat | Pointing Codex at a specific file |
/mcp | List configured MCP tools; /mcp verbose for server diagnostics | Verifying MCP servers are connected |
/logout | Sign out and clear local credentials | Switching accounts |
/quit, /exit | Exit the CLI | Done for the day |
/feedback | Send logs/diagnostics to the maintainers | Reporting a bug |
/ps | Show background terminals and recent output (requires unified_exec) | Checking on long-running commands |
/stop | Stop all background terminals (/clean is an alias) | Killing stuck background processes |
/plan | Switch to plan mode, optionally with an inline prompt | Want a plan before any edits |
/goal | Set/edit/pause/resume/view/clear a persistent task goal (max 4,000 chars) | Multi-step objectives with automatic continuation |
/resume | Resume a saved chat from the picker | Returning to earlier work |
/fork | Fork the current chat into a new chat | Trying an alternative approach without losing the transcript |
/agent, /subagents | Switch the active agent thread | Inspecting or continuing spawned subagent work |
/skills | Browse and use skills | Running a packaged workflow |
/apps | Browse apps (connectors), insert as $app-slug | Pulling in a connected app |
/plugins | Browse installed/discoverable plugins (Space toggles enabled) | Managing plugins |
/hooks | View/manage lifecycle hooks | Debugging or editing hooks |
/ide | Include IDE context (open files, selection) | Using what you have open in the editor |
/keymap | Remap TUI keyboard shortcuts (persists to tui.keymap) | Customizing key bindings |
/vim | Toggle composer Vim mode | Prefer modal editing in the composer |
/personality | Set communication style (friendly, pragmatic, none) | Adjusting response tone |
/fast | Toggle the Fast service tier | Only shown if the model catalog advertises one |
/copy | Copy the latest completed output (also Ctrl+O) | Pasting a result elsewhere |
/raw | Toggle raw scrollback mode (also Alt+R; tui.raw_output_mode) | Selecting/copying unformatted output |
/rename | Rename the current chat | Organizing saved sessions |
/archive | Archive the current session and exit | Hiding finished work |
/delete | Permanently delete the current session and exit | Removing a session entirely |
/side, /btw | Ephemeral side chat | Quick question without polluting the main chat |
/app | Continue the session in the ChatGPT desktop app (macOS/Windows) | Moving to the desktop UI |
/experimental | Toggle experimental features | Trying preview functionality |
/approve | Approve one retry of a recent auto-review denial | Overriding a single auto-review decision |
/memories | Configure memory use/generation | Managing what Codex remembers |
/import | Import Claude Code or Cursor setup/projects/chats (up to 50 chats from the last 30 days) | Migrating from another tool |
/usage | Account token usage / rate-limit resets (/usage daily|weekly|cumulative) | Checking quota |
/debug-config | Config layer and requirements diagnostics | Figuring out where a setting comes from |
/statusline | Configure the TUI footer status line | Customizing the footer |
/title | Configure terminal title items | Customizing the window title |
/theme | Syntax-highlighting theme | Changing colors |
/pets, /pet | Terminal pet | Fun |
/setup-default-sandbox, /sandbox-add-read-dir | Windows-only sandbox helpers | Configuring the Windows sandbox |
Renamed/removed commands: older guides mention
/approvals(the current docs list/permissionsinstead) and/rollout(not in the current built-in list). A/recapcommand andtui.auto_recapsetting appear in the 0.153.0 changelog but were not in the captured slash-command table.
/init
What it does
Generates an AGENTS.md scaffold in the current directory — the project-instructions file Codex reads at startup.
When to use it
First session in a repository, or when your existing instructions are stale and you want a fresh scaffold to edit.
Example
> /init
Notes
- Edit the generated file rather than accepting it verbatim; specific build/test commands beat generic advice.
- For Codex code review in GitHub, add a
## Code Review Rulessection to theAGENTS.mdclosest to the code. - See Codex CLI project instructions (AGENTS.md) for discovery order and limits.
Official source
- https://developers.openai.com/codex/cli/slash-commands
- https://developers.openai.com/codex/guides/agents-md
/new
What it does
Starts a new chat in the same CLI session. /new <name> gives the chat a name.
When to use it
When switching to an unrelated task so the new conversation is not weighed down by old context.
Example
> /new payment-retry-bug
Notes
- The previous chat is saved and can be reopened with
/resume. /clearalso starts a fresh chat but additionally clears the terminal view.
Official source
/compact
What it does
Summarizes the visible chat history to free up context tokens.
When to use it
During long sessions, when /status shows little context remaining, or before starting a new subtask in the same chat.
Example
> /compact
Notes
- Auto-compaction triggers at
model_auto_compact_token_limit; the summarization prompt is customizable viacompact_prompt/experimental_compact_prompt_fileinconfig.toml.
Official source
- https://developers.openai.com/codex/cli/slash-commands
- https://developers.openai.com/codex/config-reference
/model
What it does
Opens the model picker to choose the model and reasoning effort for the session.
When to use it
Switch to a stronger model (or higher reasoning effort) for hard problems, or a faster/cheaper one for routine edits.
Example
> /model
Notes
- The configured default comes from the
modelandmodel_reasoning_effortkeys inconfig.toml;-m/--modeloverrides it per launch. - Model availability changes quickly — treat specific model names in docs as fast-moving.
Official source
/review
What it does
Reviews the working tree. Uses the session model unless review_model is set in config.toml.
When to use it
Before committing, to catch bugs in local changes — whether written by you or by Codex.
Example
> /review
Notes
- Review does not modify the working tree.
- For non-interactive review of branches or commits, use
codex review --base mainorcodex review --commit <SHA>(see Codex CLI terminal commands).
Official source
/plan
What it does
Switches the active chat into plan mode, optionally with an inline prompt. Codex proposes a plan instead of editing immediately.
When to use it
For multi-file or risky changes where you want to approve an approach before any edits happen.
Example
> /plan Propose a migration plan for this service
Notes
- Unavailable while Codex is already working.
plan_mode_reasoning_effortinconfig.tomlsets a plan-mode-specific reasoning override.
Official source
/diff
What it does
Shows the Git diff of the working tree, including untracked files.
When to use it
After Codex makes edits, to see exactly what changed before you commit or continue.
Example
> /diff
Notes
- Untracked files are included, so newly created files show up too.
Official source
/mention
What it does
Attaches a file to the chat so Codex has its contents as context.
When to use it
When the task concerns a specific file and you want to be sure Codex is looking at it.
Example
> /mention src/payments/retry.ts
Notes
- Typing
@in the composer also opens file search/attach.
Official source
/permissions
What it does
Sets what Codex can do without asking: approval presets (e.g. Auto, Read Only) and custom permission profiles.
When to use it
To raise or lower Codex’s autonomy mid-session — for example dropping to Read Only while you explore, or raising it for a bulk refactor.
Example
> /permissions
Notes
- This is the current command for what older docs called
/approvals; treat/approvalsas renamed. - The equivalent launch-time flags are
--sandboxand--ask-for-approval; see Codex CLI permissions, sandbox, and approvals.
Official source
/status
What it does
Shows session configuration and token usage: model, approval policy, writable roots, and context remaining.
When to use it
Any time you are unsure which model, sandbox mode, or writable directories are active — especially after resuming a session.
Example
> /status
Notes
- For where a config value came from, use
/debug-config.
Official source
Composer shortcuts
Verified from the official slash-commands page:
| Shortcut | Effect |
|---|---|
@ | File search / attach |
! prefix | Run a local shell command under the current sandbox/approval |
| Up / Down | Draft history |
| Ctrl+R | Search prompt history |
| Tab (while Codex works) | Queue a follow-up for the next turn |
| Enter (while Codex works) | Inject into the current turn |
| Esc Esc (empty composer) | Edit the previous message and fork |
| Ctrl+C | Close the session |
Last verified: 2026-09-07
Official sources:
- https://developers.openai.com/codex/cli/slash-commands
- https://developers.openai.com/codex/guides/agents-md
- https://developers.openai.com/codex/config-reference
- https://developers.openai.com/codex/sandbox
- https://github.com/openai/codex/releases
AI coding tools evolve quickly. If you find outdated information, please open an issue or pull request.