AI agents

Codex CLI

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

CommandWhat it doesWhen to use it
/initGenerate an AGENTS.md scaffold in the current directoryFirst session in a new repo
/statusShow session config and token usage (model, approval policy, writable roots, context left)Checking what Codex can see/do right now
/permissionsSet what Codex can do without asking (approval presets, custom permission profiles)Changing autonomy mid-session
/modelChoose model and reasoning effortHarder task needs more reasoning; cheaper model for routine work
/reviewReview the working tree (uses session model unless review_model is set)Before committing local changes
/newStart a new chat in the same CLI session (/new <name> to name it)Switching to an unrelated task
/clearClear the terminal and start a fresh chatFull reset (unlike Ctrl+L, which only clears the view)
/compactSummarize the chat to free contextLong session approaching the context limit
/diffShow the Git diff, including untracked filesReviewing what Codex changed
/mentionAttach a file to the chatPointing Codex at a specific file
/mcpList configured MCP tools; /mcp verbose for server diagnosticsVerifying MCP servers are connected
/logoutSign out and clear local credentialsSwitching accounts
/quit, /exitExit the CLIDone for the day
/feedbackSend logs/diagnostics to the maintainersReporting a bug
/psShow background terminals and recent output (requires unified_exec)Checking on long-running commands
/stopStop all background terminals (/clean is an alias)Killing stuck background processes
/planSwitch to plan mode, optionally with an inline promptWant a plan before any edits
/goalSet/edit/pause/resume/view/clear a persistent task goal (max 4,000 chars)Multi-step objectives with automatic continuation
/resumeResume a saved chat from the pickerReturning to earlier work
/forkFork the current chat into a new chatTrying an alternative approach without losing the transcript
/agent, /subagentsSwitch the active agent threadInspecting or continuing spawned subagent work
/skillsBrowse and use skillsRunning a packaged workflow
/appsBrowse apps (connectors), insert as $app-slugPulling in a connected app
/pluginsBrowse installed/discoverable plugins (Space toggles enabled)Managing plugins
/hooksView/manage lifecycle hooksDebugging or editing hooks
/ideInclude IDE context (open files, selection)Using what you have open in the editor
/keymapRemap TUI keyboard shortcuts (persists to tui.keymap)Customizing key bindings
/vimToggle composer Vim modePrefer modal editing in the composer
/personalitySet communication style (friendly, pragmatic, none)Adjusting response tone
/fastToggle the Fast service tierOnly shown if the model catalog advertises one
/copyCopy the latest completed output (also Ctrl+O)Pasting a result elsewhere
/rawToggle raw scrollback mode (also Alt+R; tui.raw_output_mode)Selecting/copying unformatted output
/renameRename the current chatOrganizing saved sessions
/archiveArchive the current session and exitHiding finished work
/deletePermanently delete the current session and exitRemoving a session entirely
/side, /btwEphemeral side chatQuick question without polluting the main chat
/appContinue the session in the ChatGPT desktop app (macOS/Windows)Moving to the desktop UI
/experimentalToggle experimental featuresTrying preview functionality
/approveApprove one retry of a recent auto-review denialOverriding a single auto-review decision
/memoriesConfigure memory use/generationManaging what Codex remembers
/importImport Claude Code or Cursor setup/projects/chats (up to 50 chats from the last 30 days)Migrating from another tool
/usageAccount token usage / rate-limit resets (/usage daily|weekly|cumulative)Checking quota
/debug-configConfig layer and requirements diagnosticsFiguring out where a setting comes from
/statuslineConfigure the TUI footer status lineCustomizing the footer
/titleConfigure terminal title itemsCustomizing the window title
/themeSyntax-highlighting themeChanging colors
/pets, /petTerminal petFun
/setup-default-sandbox, /sandbox-add-read-dirWindows-only sandbox helpersConfiguring the Windows sandbox

Renamed/removed commands: older guides mention /approvals (the current docs list /permissions instead) and /rollout (not in the current built-in list). A /recap command and tui.auto_recap setting 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 Rules section to the AGENTS.md closest to the code.
  • See Codex CLI project instructions (AGENTS.md) for discovery order and limits.

Official source


/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.
  • /clear also 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 via compact_prompt / experimental_compact_prompt_file in config.toml.

Official source


/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 model and model_reasoning_effort keys in config.toml; -m/--model overrides 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 main or codex 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_effort in config.toml sets 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

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:

ShortcutEffect
@File search / attach
! prefixRun a local shell command under the current sandbox/approval
Up / DownDraft history
Ctrl+RSearch 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+CClose the session

Last verified: 2026-09-07

Official sources:

AI coding tools evolve quickly. If you find outdated information, please open an issue or pull request.