AI News

OpenAI Codex Commands: CLI, App & IDE Cheat Sheet (2026)

1. Install, launch, and update

CommandWhat it does
npm i -g @openai/codexInstalls Codex CLI globally.
codexLaunches the interactive Codex CLI/TUI.
npm i -g @openai/codex@latestUpdates Codex CLI to the latest published version.

OpenAI’s CLI docs say Codex runs on macOS, Windows, and Linux, and that first launch prompts you to sign in.


2. Documented desktop slash commands

Type / in the ChatGPT desktop app to see the commands available in your current environment. OpenAI notes that availability varies by environment and access.

Slash commandDocumented purpose
/approveApprove one retry of a recent automatic-review denial, when automatic review is active.
/cloudRun the chat in the cloud, when available.
/cloud-environmentChoose the cloud environment for the chat.
/compactCompact the current chat’s context.
/fastTurn a catalog-provided Fast service tier on or off, when available.
/feedbackOpen the feedback dialog.
/forkCopy a local chat into a new local chat or worktree.
/goalSet a persistent goal; use /plan first when the outcome needs shaping.
/ide-contextTurn shared IDE context on or off.
/initGenerate an AGENTS.md scaffold for the current project.
/localRun the chat in the selected local project.
/mcpOpen MCP status to view connected servers.
/memoriesConfigure memory behavior, when available.
/modelChoose the model for the current chat.
/petWake or tuck away the desktop pet.
/personalityChoose a response personality, when supported.
/planToggle plan mode for multi-step planning.
/projectChoose a project for new chats.
/reasoningChoose the reasoning effort for the current chat.
/reviewStart code review mode.
/sideStart a temporary side chat without interrupting the main chat.
/statusShow chat ID, context usage, and rate limits.
/taskStart a chat without a project.
/worktreeRun the chat in a new Git worktree.

This table follows the public desktop-app reference captured on August 29, 2026. It intentionally excludes internal, debug-build, legacy, and source-only commands that are not in that public reference. The Codex CLI has a separate top-level command surface; verify it with codex --help for the installed version.

3. High-value slash command patterns

/goal

Use /goal for a persistent objective that Codex should continue working toward until the result is verified, the goal is paused, or more input is required.

/goal Complete the migration to TypeScript, preserve behavior, and keep going until the full test suite passes.

OpenAI’s current guidance recommends defining the outcome, constraints, and verification criteria. In the desktop app, use the progress row to pause, resume, edit, or clear the goal; continue the same CLI or IDE session to steer it. Start with /plan when the objective still needs refinement.


/side

Use /side to open a temporary side conversation without permanently derailing the main thread.

/side explain why this test is failing

Typical uses:

/side summarize the current plan
/side what are the risks in this migration?
/side explain this error without changing files

OpenAI describes /side as an ephemeral fork of the conversation. It is not available inside nested side or review modes.


/mcp

Use /mcp to inspect MCP tools and resources available to Codex.

/mcp
/mcp verbose

/mcp verbose shows expanded MCP details.


/fast

/fast on
/fast off
/fast status

Fast mode toggles faster behavior where supported.


/personality

/personality friendly
/personality pragmatic
/personality none

OpenAI’s docs list those three personality modes.


4. CLI keyboard and input shortcuts

Shortcut or prefixWhat it does
/Open slash-command menu.
@Fuzzy-search files; use Tab or Enter to insert a path.
!<command>Run a local shell command.
Enter while Codex is runningInject instructions into the current turn.
Tab while Codex is runningQueue a follow-up instruction or command for the next turn.
Ctrl+GOpen the prompt composer in your external editor using VISUAL or EDITOR.
Ctrl+LClear the terminal view only.
/clearClear the conversation and start a new chat.
Esc twice with an empty composerEdit the previous user message; continuing to press Esc walks backward.
Enter after editing a previous messageFork from that point.

OpenAI’s CLI tips document the @, !, Enter, Tab, Ctrl+G, and Esc behaviors. The slash docs distinguish /clear from Ctrl+L.


5. Top-level Codex CLI commands

CommandAliasWhat it does
codex—Launches the interactive TUI.
codex app—Opens the Codex desktop app.
codex app-server—Runs the experimental app server.
codex applycodex aApplies a patch generated by Codex.
codex cloudcodex cloud-tasksWorks with cloud tasks.
codex completion—Generates shell completion scripts.
codex debug app-server send-message-v2—Debug app-server message command.
codex debug models—Debug model listing.
codex execcodex eRuns Codex non-interactively.
codex execpolicy—Tests command policy behavior.
codex features—Lists, enables, or disables feature flags.
codex fork—Forks a saved session.
codex login—Logs in.
codex logout—Logs out.
codex mcp—Manages MCP servers.
codex mcp-server—Deprecated; use codex app-server.
codex plugin marketplace—Manages plugin marketplaces.
codex resume—Resumes a saved session.
codex sandbox—Runs a command under Codex sandboxing helpers.
codex update—Updates Codex.

OpenAI’s CLI reference lists these command groups. The August 24 changelog deprecates codex mcp-server and directs integrations to the Codex app server.


6. Global CLI flags

These can be used with top-level codex where applicable.

FlagValues / shapeWhat it does
--add-dirpathAdds a directory as writable or readable context.
--ask-for-approval, -auntrusted, on-request, neverSets approval policy.
--cd, -CpathSets working directory.
--config, -ckey=valueOverrides a config value.
--dangerously-bypass-approvals-and-sandboxbooleanDisables approvals and sandboxing.
--yolobooleanAlias for bypassing approvals and sandboxing.
--disablefeatureDisables a feature flag.
--enablefeatureEnables a feature flag.
--image, -ipath or comma-separated pathsAdds image input.
--model, -mmodel nameSelects model.
--no-alt-screenbooleanAvoids alternate screen behavior.
--ossbooleanUses the local open-source model provider.
--profile, -pprofile nameUses a config profile.
--remotews://... or wss://...Connects to a remote endpoint.
--remote-auth-token-envenv var nameReads remote auth token from an environment variable.
--sandbox, -sread-only, workspace-write, danger-full-accessSets sandbox policy.
--searchbooleanEnables web search where supported.
PROMPTstringStarts Codex with an initial prompt.

OpenAI’s CLI reference lists these global options.


7. Important subcommand details

codex exec

Use this for non-interactive automation.

codex exec "fix the failing tests"
codex exec -m gpt-5.1-codex --sandbox workspace-write "review this repo"

Common options include:

OptionWhat it does
--cdSet working directory.
--coloralways, never, or auto.
--dangerously-bypass-approvals-and-sandbox, --yoloDisable approvals and sandboxing.
--ephemeralRun without saving the session.
--full-autoDeprecated full-auto behavior.
--ignore-rulesIgnore rules.
--ignore-user-configIgnore user config.
--imageInclude images.
--json, --experimental-jsonEmit JSON events.
--modelSelect model.
--ossUse local OSS provider.
--output-last-message, -oSave last message to a file.
--output-schemaConstrain output to a schema.
--profileUse config profile.
--sandboxSet sandbox.
--skip-git-repo-checkSkip Git repo check.
-c, --configOverride config.
PROMPT or -Prompt string or stdin.

OpenAI’s CLI reference documents these codex exec flags, plus codex exec resume.


codex cloud

Common forms:

codex cloud "investigate this issue"
codex cloud list

Useful options:

OptionWhat it does
--attemptsSets 1–4 attempts.
--envSelects environment ID.
--cursorPagination cursor for listing.
--jsonJSON output.
--limitNumber of cloud tasks to list.

OpenAI’s reference documents codex cloud, codex cloud exec, and codex cloud list.


codex features

codex features list
codex features enable <feature>
codex features disable <feature>

Use this to inspect or change feature flags.


codex mcp

CommandWhat it does
codex mcp add <name> -- <command...>Adds a stdio MCP server.
codex mcp add <name> --url <url>Adds a URL-based MCP server.
codex mcp get <name>Shows one MCP server.
codex mcp listLists MCP servers.
codex mcp login <name>Authenticates an MCP server.
codex mcp logout <name>Logs out of an MCP server.
codex mcp remove <name>Removes an MCP server.

Useful options include --env, --bearer-token-env-var, --json, and --scopes.


codex plugin marketplace

CommandWhat it does
codex plugin marketplace add <source>Adds a plugin marketplace.
codex plugin marketplace remove <marketplace-name>Removes a marketplace.
codex plugin marketplace upgrade [marketplace-name]Upgrades one or all marketplaces.

Options include --ref and --sparse for marketplace add.


codex resume and codex fork

codex resume
codex resume --last
codex resume --all
codex resume <SESSION_ID>

codex fork
codex fork --last
codex fork --all
codex fork <SESSION_ID>

These resume or fork previous sessions.


codex sandbox

codex sandbox runs a command inside Codex’s sandbox helper. Subcommands vary by platform, including macOS seatbelt and Linux/Windows modes.

Common options include:

OptionWhat it does
--cdSets working directory.
--configOverrides config.
--include-managed-configIncludes managed config.
--permissions-profileSelects permissions profile.
--allow-unix-socketmacOS seatbelt option.
--log-denialsmacOS seatbelt option.
COMMAND...Command to run in the sandbox.

OpenAI’s reference documents platform-specific sandbox helper options and warns that bypassing sandboxing should be used carefully.


8. Codex app commands

App command source boundary

The public desktop slash-command table is maintained in section 2. Commands vary by environment and access, so the in-app / menu is the final check for a particular installation.

App keyboard shortcuts

ShortcutAction
Cmd+Shift+P or Cmd+KCommand menu.
Cmd+,Settings.
Cmd+OOpen folder.
Cmd+[Navigate back.
Cmd+]Navigate forward.
Cmd++ or Cmd+=Increase font size.
Cmd+- or Cmd+_Decrease font size.
Cmd+BToggle sidebar.
Cmd+Option+BToggle diff panel.
Cmd+JToggle terminal.
Ctrl+LClear terminal.
Cmd+N or Cmd+Shift+ONew thread.
Cmd+FFind in thread.
Cmd+Shift+[Previous thread.
Cmd+Shift+]Next thread.
Ctrl+MDictation.

OpenAI’s app docs list these shortcuts for macOS.

App deeplinks

DeeplinkWhat it opens
codex://settingsSettings.
codex://skillsSkills.
codex://automationsAutomations.
codex://threads/<thread-id>Specific thread.
codex://newNew thread.

codex://new supports query parameters such as prompt, originUrl, and path.


9. IDE extension commands

IDE slash commands

Slash commandWhat it does
/auto-contextConfigure automatic context.
/cloudUse cloud behavior.
/cloud-environmentSelect or configure cloud environment.
/feedbackSend feedback.
/localUse local behavior.
/reviewReview changes.
/statusShow status.

OpenAI’s IDE docs say typing / in the Codex chat input shows available IDE slash commands.

VS Code command IDs

Command IDWhat it does
chatgpt.addToThreadAdd current selection to thread.
chatgpt.addFileToThreadAdd file to thread.
chatgpt.newChatNew chat; default shortcut Cmd+N on macOS and Ctrl+N on Windows/Linux.
chatgpt.implementTodoImplement a TODO.
chatgpt.newCodexPanelOpen a new Codex panel.
chatgpt.openSidebarOpen the Codex sidebar.

OpenAI documents these as VS Code command-palette commands that can be bound to shortcuts.


10. Custom slash commands and reusable prompts

OpenAI says custom prompts are deprecated in favor of skills, but existing custom prompts can still expose slash commands in the CLI and IDE.

Create a custom prompt slash command

Directory:

~/.codex/prompts

Example file:

~/.codex/prompts/draftpr.md

Example contents:

---
description: Draft a pull request description
argument-hint: FILES=<files> PR_TITLE=<title>
---

Review the following files and draft a concise PR description.

Files: $FILES
Title: $PR_TITLE
All arguments: $ARGUMENTS

After restarting Codex, it appears as:

/prompts:draftpr

Custom prompt files support front matter such as description and argument-hint, positional placeholders like $1 through $9, $ARGUMENTS, named placeholders such as KEY=value, and $$ for a literal dollar sign.


11. Safety defaults for a practical guide

For a user-facing Codex guide, I’d include this rule of thumb:

SituationRecommended setting
Normal repo work--sandbox workspace-write
Read-only investigation--sandbox read-only
Trusted automation in isolated environmentConsider stricter explicit approvals first.
Dangerous local bypassAvoid --dangerously-bypass-approvals-and-sandbox / --yolo unless inside a disposable or isolated environment.

OpenAI’s CLI reference includes safety guidance around sandboxing and warns about bypassing approvals and sandbox restrictions.

Related setup: Use the full OpenAI Codex guide for installation and workflows, then add durable repository instructions with the AGENTS.md setup and examples guide.