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.
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.
mermaid
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
Step
Command
What it does
1
/init
Generate an AGENTS.md scaffold for persistent instructions
2
/permissions
Set approval preset (Auto, Read Only, or custom profiles)
3
/mcp
List configured MCP tools; add verbose for server diagnostics
4
/skills
Browse and attach local skills for task-specific behavior
5
/hooks
Review lifecycle hooks; trust, disable, or inspect managed hooks
During a task
Command
Purpose
/model
Choose active model and reasoning effort when available
/fast [on|off|status]
Toggle Fast service tier (catalog-driven; hidden if model has no Fast tier)
/personality
Communication 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
/compact
Summarize conversation to free tokens
/status
Active model, approval policy, writable roots, token usage
/side or /btw
Ephemeral side conversation without disrupting main thread
Context and attachments
Command
Purpose
/ide [text]
Include open files, selection, and IDE context in next prompt
/mention <path>
Attach a specific file or folder to the conversation
/apps
Browse connectors; insert as $app-slug in composer
/memories
Toggle memory injection and generation
Parallel work and subagents
Command
Purpose
/agent
Switch active subagent thread
/fork
Clone conversation into new thread; original untouched
/side
Ephemeral fork; parent thread status stays visible
/ps
List background terminals and recent output
/stop
Stop all background terminals (alias: /clean)
/experimental
Toggle subagents, Apps, Smart Approvals, etc.
See our goal mode guide for /goal patterns across Codex, Claude Code, and Hermes Agent.
Before you ship
Command
Purpose
/diff
Git diff including untracked files
/review
Working-tree review; uses review_model from config if set
/approve
Retry once after auto reviewer denied an action
Between sessions
Command
Purpose
/new
Fresh conversation in same CLI session (terminal not cleared)
/clear
Clear terminal and start fresh chat (unlike Ctrl+L)
/resume
Continue from saved session picker
/archive
Archive current session and exit; restore with codex unarchive <SESSION>
/fork (terminal)
Run codex fork to fork a saved session from picker
/quit or /exit
Exit immediately
Queuing commands during active tasks
When Codex is already working on a turn, slash commands behave differently than at idle:
Type the command and press Tab to queue it for the next turn.
Codex parses queued slash commands when they execute—menus and errors appear after the current turn finishes.
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
Command
Purpose
/init
Generate AGENTS.md scaffold in current directory
/permissions
Set approval preset mid-session (Auto, Read Only, custom profiles)
/approve
One-time retry of a recent auto-review denial
/experimental
Toggle optional features; may require restart
/memories
Configure memory use and generation for future sessions
/sandbox-add-read-dir <path>
Grant sandbox read access to absolute directory (Windows only)
/logout
Clear 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
Command
Purpose
/model
Choose 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
/personality
Set friendly, pragmatic, or none communication style
/status
Confirm model, approval policy, writable roots, token usage, remote info
/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
Command
Purpose
/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)
/goal
View current goal
/goal pause
Pause goal tracking
/goal resume
Resume paused goal
/goal clear
Remove goal
/review
Review 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
Command
Purpose
/new
Fresh conversation; terminal view preserved
/clear
Clear terminal and reset transcript (new chat)
/compact
Summarize earlier turns to free context
/resume
Reload saved session from picker
/archive
Archive session and exit TUI
/fork
Clone current conversation to new thread ID
/side, /btw
Ephemeral side conversation; parent status stays visible
/copy
Copy latest completed output (also Ctrl+O)
/raw [on|off]
Toggle raw scrollback for easier terminal selection (also Alt+R)
/quit, /exit
Exit 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
Command
Purpose
/agent
Switch active agent/subagent thread
/experimental
Enable subagents and related experimental features
/ps
List background terminals with status and up to 3 recent output lines
/stop
Stop 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.
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.
Codex slash commands are the control plane for agentic coding in the terminal: they set trust (/permissions), project memory (/init → AGENTS.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.