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
| Question | Answer |
|---|---|
| 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
| 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 |
Complete AI Builder Bootcamp
Claude, Python automation & full-stack — 12 live sessions with Yash Thakker.
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:
- 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 |
/debug-config | Print 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
| 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.
For multi-agent orchestration patterns, see Claude Code dynamic workflows and OpenAI Codex plugins.
Review, diff, and shipping
| Command | Purpose |
|---|---|
/diff | Git diff: staged, unstaged, and untracked files |
/review | Codex summarizes issues in working tree |
/approve | Retry 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
| Command | Purpose |
|---|---|
/skills | Browse and select local skills for next request |
/mcp | List MCP tools Codex can call |
/mcp verbose | Include detailed server diagnostics |
/apps | Browse connectors; insert $app-slug mention |
/plugins | Browse installed and discoverable plugins; Space toggles enabled state |
/hooks | Inspect 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
| Command | Purpose |
|---|---|
/ide [text] | Pull IDE context (open files, selection) into next prompt |
/mention <path> | Attach file or folder via popup picker |
/vim | Toggle Vim mode for composer |
/keymap | Inspect and persist TUI shortcut bindings to config.toml |
/statusline | Configure footer items (model, context, git, tokens, session, etc.) |
/title | Configure terminal window/tab title fields |
/theme | Choose and persist syntax-highlighting theme |
/raw | Toggle raw scrollback mode |
Persist defaults in config.toml:
| Setting | Config key |
|---|---|
| Vim mode default | tui.vim_mode_default = true |
| Raw output default | tui.raw_output_mode = true |
| Status line items | tui.status_line |
| Terminal title items | tui.terminal_title |
| Theme | tui.theme |
| Key bindings | tui.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
| Command | Purpose |
|---|---|
/status | Session summary: model, policy, writable roots, tokens, remote address |
/debug-config | Config layer precedence, approval policies, sandbox modes, MCP, rules |
/feedback | Submit 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.
| Command | Purpose | When to use it |
|---|---|---|
/permissions | Set approval policy without asking first | Switch Auto ↔ Read Only mid-session |
/ide [text] | Include IDE context in next prompt | Open files/selection without re-explaining |
/keymap | Remap TUI keyboard shortcuts | Persist custom bindings in config.toml |
/vim | Toggle Vim mode for composer | Normal/insert editing in composer |
/sandbox-add-read-dir <path> | Grant sandbox read to extra directory | Windows only; absolute existing path |
/agent | Switch active agent thread | Continue or inspect subagent work |
/apps | Browse connectors | Insert $app-slug before asking Codex to use app |
/plugins | Browse installed/discoverable plugins | Inspect tools; toggle enabled with Space |
/hooks | Review lifecycle hooks | Trust, disable non-managed hooks |
/clear | Clear terminal and start fresh chat | Reset UI + conversation (not just Ctrl+L) |
/archive | Archive session and exit | Remove from active list; transcript kept locally |
/compact | Summarize conversation | Free tokens after long runs |
/copy | Copy latest completed output | Also Ctrl+O; unavailable before first output |
/diff | Show Git diff incl. untracked | Review edits before commit |
/exit | Exit CLI | Same as /quit |
/experimental | Toggle experimental features | Subagents, Apps, Smart Approvals |
/approve | Approve one retry of denied action | After auto reviewer blocks a command |
/memories | Configure memory injection/generation | Turn memory on/off for future sessions |
/skills | Browse and use local skills | Task-specific behavior via skill context |
/feedback | Send logs to maintainers | Report issues with diagnostics |
/init | Generate AGENTS.md scaffold | Persistent repo instructions |
/logout | Sign out of Codex | Shared machines |
/mcp [verbose] | List MCP tools | Confirm external tool availability |
/mention <path> | Attach file to conversation | Point Codex at specific paths |
/model | Choose active model (+ reasoning) | Switch before running a task |
/fast [on|off|status] | Toggle Fast service tier | When model catalog exposes Fast |
/plan [prompt] | Enter plan mode | Propose execution plan before coding |
/goal [subcommand] | Set/view/pause/resume/clear goal | Persistent target for larger tasks |
/personality | Choose communication style | friendly, pragmatic, or none |
/ps | Show background terminals | Check long-running commands |
/stop | Stop all background terminals | Alias: /clean |
/fork | Fork conversation to new thread | Explore alternative without losing original |
/side, /btw | Ephemeral side conversation | Focused detour; parent keeps running |
/raw [on|off] | Toggle raw scrollback | Easier copy/select of long output |
/resume | Resume saved conversation | Continue previous CLI session |
/new | New conversation, same CLI | Switch tasks without exiting terminal |
/quit | Exit CLI | Same as /exit |
/review | Review working tree | Second pass on local changes |
/status | Session config and token usage | Confirm model, policy, capacity |
/debug-config | Config layer diagnostics | Debug precedence and policy sources |
/statusline | Configure footer interactively | Persist to tui.status_line |
/title | Configure terminal title | Persist to tui.terminal_title |
/theme | Choose syntax theme | Persist 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:
| Task | Codex | Claude Code |
|---|---|---|
| Project memory | /init → AGENTS.md | /init → CLAUDE.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
- Claude Code commands reference — Anthropic CLI counterpart
- Gemini CLI slash commands reference — Google CLI counterpart
- OpenCode slash commands reference — open-source TUI counterpart
- Cursor CLI slash commands reference — Cursor terminal counterpart
- Goal mode complete guide —
/goalacross Codex, Claude Code, Hermes - Loop engineering — verification loops and guardrails
- What is MCP? —
/mcpand external tools - What are agent skills? —
/skillsauthoring patterns - OpenAI Codex plugins — plugin architecture
- Codex pets guide — desktop TUI extras
- Claude Code vs Codex — platform comparison
- AI coding plugins ecosystem — OpenAI vs Anthropic plugin stacks
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 (/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.