← Blog
explainx / blog

Codex Slash Commands: Complete CLI Reference (2026)

Every OpenAI Codex slash command—/model, /goal, /plan, /permissions, /compact, and 40+ more. Workflow guide plus full reference from official docs.

15 min readYash Thakker
OpenAI CodexSlash CommandsAI CodingDeveloper ToolsCodex CLI

MDX restores the committed source plus an HTML comment attribution; plain text bundles the rendered markdown body with the explainx.ai attribution footer.

Codex Slash Commands: Complete CLI Reference (2026)

OpenAI Codex is OpenAI's agentic CLI for reading, editing, and running code in your repo—available in the terminal, desktop app, and cloud. Beyond natural-language prompts, it exposes 40+ built-in slash commands that switch models, adjust permissions, attach IDE context, spawn subagent threads, compact long conversations, and review your working tree without leaving the TUI.

This article is a complete slash-command reference, organized from the official Slash commands documentation. It is not a replacement for upstream docs: command availability, experimental flags, and catalog-driven features like /fast change with each release. Use this as a map of the surface area and a workflow guide; verify behavior against developers.openai.com/codex before you ship team runbooks.

For the Anthropic and Google equivalents, see Claude Code commands and Gemini CLI slash commands. For open-source multi-provider TUI, see OpenCode slash commands. For editor-parity terminal agent, see Cursor CLI slash commands.

TL;DR

QuestionAnswer
How do I see all commands?Type / in the Codex composer; filter by typing more letters.
Task already running?Type a slash command and press Tab to queue it for the next turn.
First session in a repo?/init/permissions/mcp/skills/hooks.
Long conversation?/status for token usage; /compact to summarize and free context.
Parallel exploration?/fork for a new thread; /side for ephemeral detours; /agent to switch subagents.
Before merge?/diff/review.
Project memory file?AGENTS.md via /init (Codex) vs CLAUDE.md (Claude Code) vs GEMINI.md (Gemini CLI).
Sister guides?Claude Code · Gemini CLI · OpenCode · Cursor CLI

How slash commands fit a typical workflow

OpenAI groups slash commands around session control—steering an active run without restarting Codex. The lifecycle below is the fastest way to learn the table.

flowchart LR
  A[Setup /init /permissions /mcp] --> B[Work /model /plan /goal]
  B --> C[Context /ide /mention /skills]
  C --> D[Parallel /agent /fork /side]
  D --> E[Ship /diff /review]
  E --> F[Sessions /new /clear /resume /archive]

First session in a repo

StepCommandWhat it does
1/initGenerate an AGENTS.md scaffold for persistent instructions
2/permissionsSet approval preset (Auto, Read Only, or custom profiles)
3/mcpList configured MCP tools; add verbose for server diagnostics
4/skillsBrowse and attach local skills for task-specific behavior
5/hooksReview lifecycle hooks; trust, disable, or inspect managed hooks

During a task

CommandPurpose
/modelChoose active model and reasoning effort when available
/fast [on|off|status]Toggle Fast service tier (catalog-driven; hidden if model has no Fast tier)
/personalityCommunication style: friendly, pragmatic, or none
/plan [prompt]Enter plan mode; optional inline prompt as first planning request
/goal <objective>Set persistent task target; pause, resume, or clear with subcommands
/compactSummarize conversation to free tokens
/statusActive model, approval policy, writable roots, token usage
/side or /btwEphemeral side conversation without disrupting main thread

Context and attachments

CommandPurpose
/ide [text]Include open files, selection, and IDE context in next prompt
/mention <path>Attach a specific file or folder to the conversation
/appsBrowse connectors; insert as $app-slug in composer
/memoriesToggle memory injection and generation

Parallel work and subagents

CommandPurpose
/agentSwitch active subagent thread
/forkClone conversation into new thread; original untouched
/sideEphemeral fork; parent thread status stays visible
/psList background terminals and recent output
/stopStop all background terminals (alias: /clean)
/experimentalToggle subagents, Apps, Smart Approvals, etc.

See our goal mode guide for /goal patterns across Codex, Claude Code, and Hermes Agent.

Before you ship

CommandPurpose
/diffGit diff including untracked files
/reviewWorking-tree review; uses review_model from config if set
/approveRetry once after auto reviewer denied an action

Between sessions

CommandPurpose
/newFresh conversation in same CLI session (terminal not cleared)
/clearClear terminal and start fresh chat (unlike Ctrl+L)
/resumeContinue from saved session picker
/archiveArchive current session and exit; restore with codex unarchive <SESSION>
/fork (terminal)Run codex fork to fork a saved session from picker
/quit or /exitExit immediately
Live Bootcamp6 weeks

Complete AI Builder Bootcamp

Claude, Python automation & full-stack — 12 live sessions with Yash Thakker.

View bootcamp

The Complete AI Builder Bootcamp is the best AI development course for learning Claude AI, prompt engineering, Python automation, and full-stack web development. This intensive 6-week live bootcamp teaches you how to build AI-powered applications using Claude Projects, Claude Artifacts, Claude Code, and the complete Claude ecosystem. You'll master prompt engineering techniques, learn to create custom Claude connectors and MCP integrations, build Python automation workflows, develop full-stack websites with AI assistance, and create AI marketing agents.

The bootcamp includes 12 live Zoom sessions with Yash Thakker, founder of AISOLO Technologies and instructor to 350,000+ students. You'll build 8+ portfolio projects including AI playbooks, full-stack note-taking applications, Python automation scripts, marketing agents, and personal portfolio websites. The curriculum covers AI fundamentals, Claude Projects and Artifacts, Claude Co-work, Claude plugins and skills, Claude Code for Python development, full-stack development, AI marketing, and capstone projects.

Students receive 1-year access to all recordings, permanent Discord community access, a certificate of completion, and personalized career guidance. All enrollments include a 7-day money-back guarantee. This is the most comprehensive Claude AI bootcamp available, taking students from zero AI knowledge to expert AI builder in 6 weeks.


Queuing commands during active tasks

When Codex is already working on a turn, slash commands behave differently than at idle:

  1. Type the command and press Tab to queue it for the next turn.
  2. Codex parses queued slash commands when they execute—menus and errors appear after the current turn finishes.
  3. Slash completion still works before you queue the command.

Some commands are unavailable while a task runs: /plan, /archive, /copy (uses last completed output), and /side (also unavailable in review mode).


Setup, permissions, and project memory

CommandPurpose
/initGenerate AGENTS.md scaffold in current directory
/permissionsSet approval preset mid-session (Auto, Read Only, custom profiles)
/approveOne-time retry of a recent auto-review denial
/experimentalToggle optional features; may require restart
/memoriesConfigure memory use and generation for future sessions
/sandbox-add-read-dir <path>Grant sandbox read access to absolute directory (Windows only)
/logoutClear local credentials on shared machines

/permissions vs /approve: /permissions changes the ongoing policy for what Codex can do without asking. /approve is a one-shot retry when the automatic reviewer denied a specific recent action.

Project memory: Codex uses AGENTS.md (via /init). Claude Code uses CLAUDE.md. Both solve the same problem—persistent repo instructions—under different filenames. See What is CLAUDE.md? for the Anthropic pattern and What is MEMORY.md? for the broader agent-memory hierarchy.


Model, speed, and communication style

CommandPurpose
/modelChoose model (e.g. gpt-4.1-mini, gpt-4.1) and reasoning effort when available
/fast [on|off|status]Toggle Fast service tier for current model/thread
/personalitySet friendly, pragmatic, or none communication style
/statusConfirm model, approval policy, writable roots, token usage, remote info
/debug-configPrint config layer order, policy sources, MCP servers, rules

/fast is catalog-driven. If the active model does not advertise a Fast tier, Codex will not expose /fast. Persist Fast settings when Codex offers to save them. Show Fast status in the footer via /statusline.

/personality is model-gated. If the active model does not support personality-specific instructions, Codex hides the command. Use none to disable personality instructions.


Planning, goals, and review mode

CommandPurpose
/plan [prompt]Switch to plan mode; optional inline prompt (supports pasted content and images)
/goal <objective>Set task goal (non-empty, max 4,000 chars)
/goalView current goal
/goal pausePause goal tracking
/goal resumeResume paused goal
/goal clearRemove goal
/reviewReview working tree for behavior changes and missing tests

Goal length: Objectives must be non-empty and at most 4,000 characters. For longer instructions, put details in a file and point the goal at that file.

Plan mode: While a task is running, /plan is temporarily unavailable. For longer autonomous runs, pair /goal with verification loops—see loop engineering for cross-platform guardrails.

Review model: /review uses the current session model unless you set review_model in config.toml.


Session, context, and conversation control

CommandPurpose
/newFresh conversation; terminal view preserved
/clearClear terminal and reset transcript (new chat)
/compactSummarize earlier turns to free context
/resumeReload saved session from picker
/archiveArchive session and exit TUI
/forkClone current conversation to new thread ID
/side, /btwEphemeral side conversation; parent status stays visible
/copyCopy latest completed output (also Ctrl+O)
/raw [on|off]Toggle raw scrollback for easier terminal selection (also Alt+R)
/quit, /exitExit CLI immediately

/clear vs Ctrl+L: Ctrl+L clears the terminal view but keeps the current chat. /clear resets both the visible UI and the conversation. Codex disables both while a task is in progress.

/fork vs /side: /fork creates a durable parallel thread you can switch to via /agent or session management. /side is a temporary detour—you return to the parent thread when done. /side cannot nest inside another side conversation.

Archive restore: After /archive, run codex unarchive <SESSION> to restore. To fork a saved session (not the current one), use codex fork in the terminal.


Parallel agents and background terminals

CommandPurpose
/agentSwitch active agent/subagent thread
/experimentalEnable subagents and related experimental features
/psList background terminals with status and up to 3 recent output lines
/stopStop all background terminals for current session (alias: /clean)

Background terminals appear when unified_exec is in use; otherwise /ps may return an empty list. Enable subagents via /experimental if the feature picker includes them—restart when prompted.

For multi-agent orchestration patterns, see Claude Code dynamic workflows and OpenAI Codex plugins.


Review, diff, and shipping

CommandPurpose
/diffGit diff: staged, unstaged, and untracked files
/reviewCodex summarizes issues in working tree
/approveRetry a denied action once under current policy

Typical pre-commit flow:

/review
/diff

Codex focuses on behavior changes and missing tests. Follow /review with /diff when you need line-level inspection inside the CLI.


Skills, MCP, apps, plugins, and hooks

CommandPurpose
/skillsBrowse and select local skills for next request
/mcpList MCP tools Codex can call
/mcp verboseInclude detailed server diagnostics
/appsBrowse connectors; insert $app-slug mention
/pluginsBrowse installed and discoverable plugins; Space toggles enabled state
/hooksInspect lifecycle hooks; trust, disable, or review managed hooks

MCP: Use /mcp to confirm which external tools are available. Pass only verbose as an argument—anything else shows usage help.

Plugins vs apps: /plugins manages Codex plugin packages (tools, skills, MCP configs). /apps inserts connector mentions into the composer for immediate use.

For MCP fundamentals, see What is MCP?. For Codex plugin architecture, see OpenAI Codex plugins repository.


IDE, editor, and TUI customization

CommandPurpose
/ide [text]Pull IDE context (open files, selection) into next prompt
/mention <path>Attach file or folder via popup picker
/vimToggle Vim mode for composer
/keymapInspect and persist TUI shortcut bindings to config.toml
/statuslineConfigure footer items (model, context, git, tokens, session, etc.)
/titleConfigure terminal window/tab title fields
/themeChoose and persist syntax-highlighting theme
/rawToggle raw scrollback mode

Persist defaults in config.toml:

SettingConfig key
Vim mode defaulttui.vim_mode_default = true
Raw output defaulttui.raw_output_mode = true
Status line itemstui.status_line
Terminal title itemstui.terminal_title
Themetui.theme
Key bindingstui.keymap (context-specific overrides tui.keymap.global)

Status-line items include model, model+reasoning, context stats, rate limits, git branch, token counters, session id, current directory, and Codex version.

Title items include app name, project, spinner, status, thread, git branch, model, and task progress.

Keymap bindings use names like ctrl-a, shift-enter, and page-down. Empty binding list unbinds an action.


Diagnostics and feedback

CommandPurpose
/statusSession summary: model, policy, writable roots, tokens, remote address
/debug-configConfig layer precedence, approval policies, sandbox modes, MCP, rules
/feedbackSubmit logs and diagnostics to Codex maintainers

Use /debug-config when an effective setting differs from what you expect in config.toml. Output includes allowed_approval_policies, allowed_sandbox_modes, mcp_servers, rules, enforce_residency, and experimental_network when configured.


Complete command reference table

Every built-in slash command from the official Slash commands page as of June 2026.

CommandPurposeWhen to use it
/permissionsSet approval policy without asking firstSwitch Auto ↔ Read Only mid-session
/ide [text]Include IDE context in next promptOpen files/selection without re-explaining
/keymapRemap TUI keyboard shortcutsPersist custom bindings in config.toml
/vimToggle Vim mode for composerNormal/insert editing in composer
/sandbox-add-read-dir <path>Grant sandbox read to extra directoryWindows only; absolute existing path
/agentSwitch active agent threadContinue or inspect subagent work
/appsBrowse connectorsInsert $app-slug before asking Codex to use app
/pluginsBrowse installed/discoverable pluginsInspect tools; toggle enabled with Space
/hooksReview lifecycle hooksTrust, disable non-managed hooks
/clearClear terminal and start fresh chatReset UI + conversation (not just Ctrl+L)
/archiveArchive session and exitRemove from active list; transcript kept locally
/compactSummarize conversationFree tokens after long runs
/copyCopy latest completed outputAlso Ctrl+O; unavailable before first output
/diffShow Git diff incl. untrackedReview edits before commit
/exitExit CLISame as /quit
/experimentalToggle experimental featuresSubagents, Apps, Smart Approvals
/approveApprove one retry of denied actionAfter auto reviewer blocks a command
/memoriesConfigure memory injection/generationTurn memory on/off for future sessions
/skillsBrowse and use local skillsTask-specific behavior via skill context
/feedbackSend logs to maintainersReport issues with diagnostics
/initGenerate AGENTS.md scaffoldPersistent repo instructions
/logoutSign out of CodexShared machines
/mcp [verbose]List MCP toolsConfirm external tool availability
/mention <path>Attach file to conversationPoint Codex at specific paths
/modelChoose active model (+ reasoning)Switch before running a task
/fast [on|off|status]Toggle Fast service tierWhen model catalog exposes Fast
/plan [prompt]Enter plan modePropose execution plan before coding
/goal [subcommand]Set/view/pause/resume/clear goalPersistent target for larger tasks
/personalityChoose communication stylefriendly, pragmatic, or none
/psShow background terminalsCheck long-running commands
/stopStop all background terminalsAlias: /clean
/forkFork conversation to new threadExplore alternative without losing original
/side, /btwEphemeral side conversationFocused detour; parent keeps running
/raw [on|off]Toggle raw scrollbackEasier copy/select of long output
/resumeResume saved conversationContinue previous CLI session
/newNew conversation, same CLISwitch tasks without exiting terminal
/quitExit CLISame as /exit
/reviewReview working treeSecond pass on local changes
/statusSession config and token usageConfirm model, policy, capacity
/debug-configConfig layer diagnosticsDebug precedence and policy sources
/statuslineConfigure footer interactivelyPersist to tui.status_line
/titleConfigure terminal titlePersist to tui.terminal_title
/themeChoose syntax themePersist to tui.theme

Codex vs Claude Code: shared command patterns

Both agentic CLIs converged on a similar slash-command vocabulary in 2026. This table maps the most common equivalents:

TaskCodexClaude Code
Project memory/initAGENTS.md/initCLAUDE.md
Permissions/permissions/permissions
Plan before coding/plan/plan
Autonomous target/goal/goal
Free context/compact/compact
Switch model/model/model + /effort
Fast tier/fast/fast
Git diff/diff/diff
Working tree review/review/code-review, /review
MCP tools/mcp/mcp
Skills/skills/skills
Subagent threads/agent/agents, /tasks
Fork conversation/fork/branch, /fork
Side question/side, /btw/btw
Fresh chat/new, /clear/clear
Resume session/resume/resume
IDE context/ide/ide
Hooks/hooks/hooks
Status / usage/status/status, /usage, /context

Claude Code adds cloud orchestration (/batch, /background, /ultrareview), scheduled loops (/loop), and a larger settings surface. Codex adds /personality, /apps, /approve, /memories, and tighter TUI customization via /statusline and /title. Gemini CLI adds custom .toml slash commands, @ file injection, and ! shell passthrough.

Full references: Claude Code · Codex · Gemini CLI · OpenCode · Cursor CLI (five-way comparison in Cursor guide)


Commands worth memorizing first

Minimum viable slash stack for new Codex users:

/init                          # AGENTS.md scaffold
/permissions                   # trust boundaries
/model                         # pick the right model
/plan Propose a migration plan # think before large edits
/goal tests pass               # persistent target
/compact                       # free context mid-session
/diff                          # inspect edits
/review                        # second pass before commit
/resume                        # pick up yesterday's thread

For Codex desktop features beyond the CLI—pets, skills reload, MCP—see Codex pets complete guide and Codex plugins repository.


Related ExplainX guides

Primary source: Slash commands — Codex Docs · Codex overview


Summary

Codex slash commands are the control plane for agentic coding in the terminal: they set trust (/permissions), project memory (/initAGENTS.md), model and speed (/model, /fast), planning and goals (/plan, /goal), parallelism (/agent, /fork, /side), and quality gates (/diff, /review) without leaving the composer.

Type / to discover what your build exposes—availability varies by version, model catalog, and experimental flags. Treat the official Slash commands page as source of truth; bookmark this guide alongside Claude Code, Gemini CLI, OpenCode, and Cursor CLI command references.


Command names, aliases, and availability reflect OpenAI's documentation as of June 11, 2026. Re-check developers.openai.com/codex and the Codex changelog before documenting internal runbooks—OpenAI ships CLI updates frequently.

Related posts