cli/slash-commands.md +86 −27
1# Slash commands in Codex CLI1# Slash commands in Codex CLI
2 2
33Slash commands give you fast, keyboard-first control over Codex. Type `/` in the composer to open the slash popup, choose a command, and Codex will perform actions such as switching models, adjusting permissions, or summarizing long conversations without leaving the terminal.Slash commands give you fast, keyboard-first control over Codex. Type `/` in
4the composer to open the slash popup, choose a command, and Codex will perform
5actions such as switching models, adjusting permissions, or summarizing long
6conversations without leaving the terminal.
4 7
5This guide shows you how to:8This guide shows you how to:
6 9
7- Find the right built-in slash command for a task10- Find the right built-in slash command for a task
811- Steer an active session with commands like `/model`, `/personality`, `/permissions`, `/experimental`, `/agent`, and `/status`- Steer an active session with commands like `/model`, `/personality`,
12 `/permissions`, `/experimental`, `/agent`, and `/status`
9 13
10## Built-in slash commands14## Built-in slash commands
11 15
1216Codex ships with the following commands. Open the slash popup and start typing the command name to filter the list.Codex ships with the following commands. Open the slash popup and start typing
17the command name to filter the list.
13 18
14| Command | Purpose | When to use it |19| Command | Purpose | When to use it |
15| ------------------------------------------------------------------------------- | --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |20| ------------------------------------------------------------------------------- | --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
17| [`/sandbox-add-read-dir`](#grant-sandbox-read-access-with-sandbox-add-read-dir) | Grant sandbox read access to an extra directory (Windows only). | Unblock commands that need to read an absolute directory path outside the current readable roots. |22| [`/sandbox-add-read-dir`](#grant-sandbox-read-access-with-sandbox-add-read-dir) | Grant sandbox read access to an extra directory (Windows only). | Unblock commands that need to read an absolute directory path outside the current readable roots. |
18| [`/agent`](#switch-agent-threads-with-agent) | Switch the active agent thread. | Inspect or continue work in a spawned sub-agent thread. |23| [`/agent`](#switch-agent-threads-with-agent) | Switch the active agent thread. | Inspect or continue work in a spawned sub-agent thread. |
19| [`/apps`](#browse-apps-with-apps) | Browse apps (connectors) and insert them into your prompt. | Attach an app as `$app-slug` before asking Codex to use it. |24| [`/apps`](#browse-apps-with-apps) | Browse apps (connectors) and insert them into your prompt. | Attach an app as `$app-slug` before asking Codex to use it. |
25| [`/clear`](#clear-the-terminal-and-start-a-new-chat-with-clear) | Clear the terminal and start a fresh chat. | Reset the visible UI and conversation together when you want a clean slate. |
20| [`/compact`](#keep-transcripts-lean-with-compact) | Summarize the visible conversation to free tokens. | Use after long runs so Codex retains key points without blowing the context window. |26| [`/compact`](#keep-transcripts-lean-with-compact) | Summarize the visible conversation to free tokens. | Use after long runs so Codex retains key points without blowing the context window. |
27| [`/copy`](#copy-the-latest-response-with-copy) | Copy the latest completed Codex output. | Grab the latest finished response or plan text without manually selecting it. |
21| [`/diff`](#review-changes-with-diff) | Show the Git diff, including files Git isn't tracking yet. | Review Codex's edits before you commit or run tests. |28| [`/diff`](#review-changes-with-diff) | Show the Git diff, including files Git isn't tracking yet. | Review Codex's edits before you commit or run tests. |
22| [`/exit`](#exit-the-cli-with-quit-or-exit) | Exit the CLI (same as `/quit`). | Alternative spelling; both commands exit the session. |29| [`/exit`](#exit-the-cli-with-quit-or-exit) | Exit the CLI (same as `/quit`). | Alternative spelling; both commands exit the session. |
23| [`/experimental`](#toggle-experimental-features-with-experimental) | Toggle experimental features. | Enable optional features such as sub-agents from the CLI. |30| [`/experimental`](#toggle-experimental-features-with-experimental) | Toggle experimental features. | Enable optional features such as sub-agents from the CLI. |
39| [`/debug-config`](#inspect-config-layers-with-debug-config) | Print config layer and requirements diagnostics. | Debug precedence and policy requirements, including experimental network constraints. |46| [`/debug-config`](#inspect-config-layers-with-debug-config) | Print config layer and requirements diagnostics. | Debug precedence and policy requirements, including experimental network constraints. |
40| [`/statusline`](#configure-footer-items-with-statusline) | Configure TUI status-line fields interactively. | Pick and reorder footer items (model/context/limits/git/tokens/session) and persist in config.toml. |47| [`/statusline`](#configure-footer-items-with-statusline) | Configure TUI status-line fields interactively. | Pick and reorder footer items (model/context/limits/git/tokens/session) and persist in config.toml. |
41 48
4249`/quit` and `/exit` both exit the CLI. Use them only after you have saved or committed any important work.`/quit` and `/exit` both exit the CLI. Use them only after you have saved or
50committed any important work.
43 51
44The `/approvals` command still works as an alias, but it no longer appears in the slash popup list.52The `/approvals` command still works as an alias, but it no longer appears in the slash popup list.
45 53
621. In an active conversation, type `/personality` and press Enter.701. In an active conversation, type `/personality` and press Enter.
632. Choose a style from the popup.712. Choose a style from the popup.
64 72
6573Expected: Codex confirms the new style in the transcript and uses it for later responses in the thread.Expected: Codex confirms the new style in the transcript and uses it for later
74responses in the thread.
66 75
6776Codex supports `friendly`, `pragmatic`, and `none` personalities. Use `none` to disable personality instructions.Codex supports `friendly`, `pragmatic`, and `none` personalities. Use `none`
77to disable personality instructions.
68 78
69If the active model doesn't support personality-specific instructions, Codex hides this command.79If the active model doesn't support personality-specific instructions, Codex hides this command.
70 80
71### Switch to plan mode with `/plan`81### Switch to plan mode with `/plan`
72 82
73831. Type `/plan` and press Enter to switch the active conversation into plan mode.1. Type `/plan` and press Enter to switch the active conversation into plan
84 mode.
742. Optional: provide inline prompt text (for example, `/plan Propose a migration plan for this service`).852. Optional: provide inline prompt text (for example, `/plan Propose a migration plan for this service`).
753. You can paste content or attach images while using inline `/plan` arguments.863. You can paste content or attach images while using inline `/plan` arguments.
76 87
85 96
86Expected: Codex saves your feature choices to config and applies them on restart.97Expected: Codex saves your feature choices to config and applies them on restart.
87 98
99### Clear the terminal and start a new chat with `/clear`
100
1011. Type `/clear` and press Enter.
102
103Expected: Codex clears the terminal, resets the visible transcript, and starts
104a fresh chat in the same CLI session.
105
106Unlike <kbd>Ctrl</kbd>+<kbd>L</kbd>, `/clear` starts a new conversation.
107
108<kbd>Ctrl</kbd>+<kbd>L</kbd> only clears the terminal view and keeps the current
109chat. Codex disables both actions while a task is in progress.
110
88### Update permissions with `/permissions`111### Update permissions with `/permissions`
89 112
901. Type `/permissions` and press Enter.1131. Type `/permissions` and press Enter.
911142. Select the approval preset that matches your comfort level, for example `Auto` for hands-off runs or `Read Only` to review edits.2. Select the approval preset that matches your comfort level, for example
115 `Auto` for hands-off runs or `Read Only` to review edits.
92 116
93117Expected: Codex announces the updated policy. Future actions respect the new approval mode until you change it again.Expected: Codex announces the updated policy. Future actions respect the
118updated approval mode until you change it again.
119
120### Copy the latest response with `/copy`
121
1221. Type `/copy` and press Enter.
123
124Expected: Codex copies the latest completed Codex output to your clipboard.
125
126If a turn is still running, `/copy` uses the latest completed output instead of
127the in-progress response. The command is unavailable before the first completed
128Codex output and immediately after a rollback.
94 129
95### Grant sandbox read access with `/sandbox-add-read-dir`130### Grant sandbox read access with `/sandbox-add-read-dir`
96 131
991. Type `/sandbox-add-read-dir C:\absolute\directory\path` and press Enter.1341. Type `/sandbox-add-read-dir C:\absolute\directory\path` and press Enter.
1002. Confirm the path is an existing absolute directory.1352. Confirm the path is an existing absolute directory.
101 136
102137Expected: Codex refreshes the Windows sandbox policy and grants read access to that directory for later commands that run in the sandbox.Expected: Codex refreshes the Windows sandbox policy and grants read access to
138that directory for later commands that run in the sandbox.
103 139
104### Inspect the session with `/status`140### Inspect the session with `/status`
105 141
1061. In any conversation, type `/status`.1421. In any conversation, type `/status`.
1072. Review the output for the active model, approval policy, writable roots, and current token usage.1432. Review the output for the active model, approval policy, writable roots, and current token usage.
108 144
109145Expected: You see a summary like what `codex status` prints in the shell, confirming Codex is operating where you expect.Expected: You see a summary like what `codex status` prints in the shell,
146confirming Codex is operating where you expect.
110 147
111### Inspect config layers with `/debug-config`148### Inspect config layers with `/debug-config`
112 149
1131. Type `/debug-config`.1501. Type `/debug-config`.
1141512. Review the output for config layer order (lowest precedence first), on/off state, and policy sources.2. Review the output for config layer order (lowest precedence first), on/off
152 state, and policy sources.
115 153
116154Expected: Codex prints layer diagnostics plus policy details such as `allowed_approval_policies`, `allowed_sandbox_modes`, `mcp_servers`, `rules`, `enforce_residency`, and `experimental_network` when configured.Expected: Codex prints layer diagnostics plus policy details such as
155`allowed_approval_policies`, `allowed_sandbox_modes`, `mcp_servers`, `rules`,
156`enforce_residency`, and `experimental_network` when configured.
117 157
118Use this output to debug why an effective setting differs from `config.toml`.158Use this output to debug why an effective setting differs from `config.toml`.
119 159
1221. Type `/statusline`.1621. Type `/statusline`.
1232. Use the picker to toggle and reorder items, then confirm.1632. Use the picker to toggle and reorder items, then confirm.
124 164
125165Expected: The footer status line updates immediately and persists to `tui.status_line` in `config.toml`.Expected: The footer status line updates immediately and persists to
166`tui.status_line` in `config.toml`.
126 167
127168Available status-line items include model, model+reasoning, context stats, rate limits, git branch, token counters, session id, current directory/project root, and Codex version.Available status-line items include model, model+reasoning, context stats, rate
169limits, git branch, token counters, session id, current directory/project root,
170and Codex version.
128 171
129### Check background terminals with `/ps`172### Check background terminals with `/ps`
130 173
1311. Type `/ps`.1741. Type `/ps`.
1322. Review the list of background terminals and their status.1752. Review the list of background terminals and their status.
133 176
134177Expected: Codex shows each background terminal’s command plus up to three recent, non-empty output lines so you can gauge progress at a glance.Expected: Codex shows each background terminal's command plus up to three
178recent, non-empty output lines so you can gauge progress at a glance.
135 179
136Background terminals appear when `unified_exec` is in use; otherwise, the list may be empty.180Background terminals appear when `unified_exec` is in use; otherwise, the list may be empty.
137 181
1401. After a long exchange, type `/compact`.1841. After a long exchange, type `/compact`.
1412. Confirm when Codex offers to summarize the conversation so far.1852. Confirm when Codex offers to summarize the conversation so far.
142 186
143187Expected: Codex replaces earlier turns with a concise summary, freeing context while keeping critical details.Expected: Codex replaces earlier turns with a concise summary, freeing context
188while keeping critical details.
144 189
145### Review changes with `/diff`190### Review changes with `/diff`
146 191
1471. Type `/diff` to inspect the Git diff.1921. Type `/diff` to inspect the Git diff.
1482. Scroll through the output inside the CLI to review edits and added files.1932. Scroll through the output inside the CLI to review edits and added files.
149 194
150195Expected: Codex shows changes you’ve staged, changes you haven’t staged yet, and files Git hasn’t started tracking, so you can decide what to keep.Expected: Codex shows changes you've staged, changes you haven't staged yet,
196and files Git hasn't started tracking, so you can decide what to keep.
151 197
152### Highlight files with `/mention`198### Highlight files with `/mention`
153 199
160 206
1611. Type `/new` and press Enter.2071. Type `/new` and press Enter.
162 208
163209Expected: Codex starts a fresh conversation in the same CLI session, so you can switch tasks without leaving your terminal.Expected: Codex starts a fresh conversation in the same CLI session, so you
210can switch tasks without leaving your terminal.
211
212Unlike `/clear`, `/new` does not clear the current terminal view first.
164 213
165### Resume a saved conversation with `/resume`214### Resume a saved conversation with `/resume`
166 215
1671. Type `/resume` and press Enter.2161. Type `/resume` and press Enter.
1682. Choose the session you want from the saved-session picker.2172. Choose the session you want from the saved-session picker.
169 218
170219Expected: Codex reloads the selected conversation’s transcript so you can pick up where you left off, keeping the original history intact.Expected: Codex reloads the selected conversation's transcript so you can pick
220up where you left off, keeping the original history intact.
171 221
172### Fork the current conversation with `/fork`222### Fork the current conversation with `/fork`
173 223
1741. Type `/fork` and press Enter.2241. Type `/fork` and press Enter.
175 225
176226Expected: Codex clones the current conversation into a new thread with a fresh ID, leaving the original transcript untouched so you can explore an alternative approach in parallel.Expected: Codex clones the current conversation into a new thread with a fresh
227ID, leaving the original transcript untouched so you can explore an alternative
228approach in parallel.
177 229
178230If you need to fork a saved session instead of the current one, run `codex fork` in your terminal to open the session picker.If you need to fork a saved session instead of the current one, run
231`codex fork` in your terminal to open the session picker.
179 232
180### Generate `AGENTS.md` with `/init`233### Generate `AGENTS.md` with `/init`
181 234
1821. Run `/init` in the directory where you want Codex to look for persistent instructions.2351. Run `/init` in the directory where you want Codex to look for persistent instructions.
1832. Review the generated `AGENTS.md`, then edit it to match your repository conventions.2362. Review the generated `AGENTS.md`, then edit it to match your repository conventions.
184 237
185238Expected: Codex creates an `AGENTS.md` scaffold you can refine and commit for future sessions.Expected: Codex creates an `AGENTS.md` scaffold you can refine and commit for
239future sessions.
186 240
187### Ask for a working tree review with `/review`241### Ask for a working tree review with `/review`
188 242
1891. Type `/review`.2431. Type `/review`.
1902. Follow up with `/diff` if you want to inspect the exact file changes.2442. Follow up with `/diff` if you want to inspect the exact file changes.
191 245
192246Expected: Codex summarizes issues it finds in your working tree, focusing on behavior changes and missing tests. It uses the current session model unless you set `review_model` in `config.toml`.Expected: Codex summarizes issues it finds in your working tree, focusing on
247behavior changes and missing tests. It uses the current session model unless
248you set `review_model` in `config.toml`.
193 249
194### List MCP tools with `/mcp`250### List MCP tools with `/mcp`
195 251
2031. Type `/apps`.2591. Type `/apps`.
2042. Pick an app from the list.2602. Pick an app from the list.
205 261
206262Expected: Codex inserts the app mention into the composer as `$app-slug`, so you can immediately ask Codex to use it.Expected: Codex inserts the app mention into the composer as `$app-slug`, so
263you can immediately ask Codex to use it.
207 264
208### Switch agent threads with `/agent`265### Switch agent threads with `/agent`
209 266
2101. Type `/agent` and press Enter.2671. Type `/agent` and press Enter.
2112. Select the thread you want from the picker.2682. Select the thread you want from the picker.
212 269
213270Expected: Codex switches the active thread so you can inspect or continue that agent’s work.Expected: Codex switches the active thread so you can inspect or continue that
271agent's work.
214 272
215### Send feedback with `/feedback`273### Send feedback with `/feedback`
216 274
2171. Type `/feedback` and press Enter.2751. Type `/feedback` and press Enter.
2182. Follow the prompts to include logs or diagnostics.2762. Follow the prompts to include logs or diagnostics.
219 277
220278Expected: Codex collects the requested diagnostics and submits them to the maintainers.Expected: Codex collects the requested diagnostics and submits them to the
279maintainers.
221 280
222### Sign out with `/logout`281### Sign out with `/logout`
223 282