• AI News
  • Blog
  • Kingy AI – Clients And Sponsors
  • Contact
Tuesday, May 12, 2026
Kingy AI
  • AI News
  • Blog
  • Kingy AI – Clients And Sponsors
  • Contact
No Result
View All Result
  • AI News
  • Blog
  • Kingy AI – Clients And Sponsors
  • Contact
No Result
View All Result
Kingy AI
No Result
View All Result
Home AI

OpenAI Codex Command Guide

Curtis Pyke by Curtis Pyke
May 12, 2026
in AI, Blog
Reading Time: 24 mins read
A A

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. CLI slash commands

In the interactive CLI, type / to open slash commands. While Codex is working, you can also queue commands with Tab.

Main slash commands

Slash commandWhat it doesNotes
/agentSwitch the active agent thread.Used for multi-agent workflows.
/appsManage apps.Current-source command.
/approveApprove one retry of the latest auto-review denial.Current-source command.
/approvalsLegacy alias for permissions.Docs say it still works, but /permissions is preferred.
/clearClear the conversation and start a new one.Different from Ctrl+L, which only clears the terminal view.
/cleanAlias for /stop.Current-source alias.
/collabChange collaboration mode.Experimental/current-source command.
/compactSummarize conversation context to save tokens.Useful before long sessions.
/copyCopy the last assistant response as Markdown.Not available on every platform.
/debug-configShow configuration layers and the source of each effective value.Useful when config behavior is confusing.
/debug-m-dropMemory debug command.Internal/debug; avoid for normal guide users.
/debug-m-updateMemory debug command.Internal/debug; avoid for normal guide users.
/diffShow Git diff, including untracked files.Good before review or commit prep.
/exitExit Codex.Alias of /quit.
/experimentalToggle experimental features.Used for things like goals.
/fastToggle Fast mode.Supports /fast on, /fast off, /fast status.
/feedbackSend feedback and logs to maintainers.CLI/app/IDE surfaces include this.
/forkFork the current conversation into a new thread.Useful for alternate solution paths.
/goalSet, view, pause, resume, or clear a long-running goal.Experimental; details below.
/hooksView and manage lifecycle hooks.Current-source command.
/ideInclude current IDE selection, open files, or IDE context.Current-source command.
/initCreate an AGENTS.md instruction file.Common first command in a repo.
/keymapConfigure TUI keyboard shortcuts.Supports inline arguments.
/logoutLog out of Codex.CLI command also exists.
/mcpList MCP tools and resources./mcp verbose shows details.
/memoriesConfigure memory use and memory generation.Current-source command.
/mentionMention a file.Alternative to @ file search.
/modelSelect model and reasoning effort.Also available via CLI flags.
/newStart a new chat during the current session.Current-source command.
/permissionsChoose what Codex is allowed to do.Preferred over legacy /approvals.
/personalitySet communication style.Docs list friendly, pragmatic, and none.
/planSwitch to Plan mode.Useful before coding or making changes.
/pluginsBrowse or manage plugins.Current-source command.
/psList background terminals.Pair with /stop.
/quitExit Codex.Same as /exit.
/rawToggle raw scrollback mode.Useful for copy-friendly terminal selection.
/realtimeToggle realtime voice mode.Experimental/current-source command.
/renameRename the current thread.Supports inline arguments.
/resumeResume a saved chat.CLI command also exists.
/reviewReview current changes and identify issues.Can be used inline, for example /review staged changes.
/rolloutPrint rollout file path.Debug-build/current-source command.
/sandbox-add-read-dirAllow the sandbox to read an additional directory.Platform-gated; docs note Windows usage.
/settingsConfigure realtime microphone/speaker settings.Current-source command.
/setup-default-sandboxSet up an elevated agent sandbox.Specialized/current-source command.
/sideStart a side conversation as an ephemeral fork.Details below.
/skillsUse skills.Current-source command; skills are replacing older custom prompts.
/statusShow current session config and token usage.CLI/app/IDE surfaces include this.
/statuslineConfigure status-line items.Useful for persistent session info.
/stopStop running background terminals./clean aliases to this.
/subagentsSwitch active subagent thread.Current-source sibling/alias for multi-agent use.
/test-approvalTest approval request behavior.Debug-build/current-source command.
/themeChoose syntax highlighting theme.Current-source command.
/titleConfigure terminal title items.Useful when many sessions are open.
/vimToggle Vim mode.Current-source command.

OpenAI’s public slash-command docs list the primary CLI commands, while the current CLI source enumerates additional commands such as /theme, /skills, /memories, /rename, /vim, /hooks, /raw, and debug/platform-gated items.


3. High-value slash command patterns

/goal

Use /goal for a long-running objective that Codex should continue working toward.

/goal Complete the migration to TypeScript and keep going until tests pass.

Useful forms:

/goal <objective>
/goal
/goal pause
/goal resume
/goal clear

OpenAI documents /goal as experimental and notes it requires the goals feature to be enabled. The docs also recommend clear goals with an objective, done condition, scope, and constraints.


/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—Runs Codex MCP 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 and marks several as stable or experimental.


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 slash commands

Slash commandWhat it does
/feedbackSend feedback.
/mcpShow MCP information.
/plan-modeToggle or use plan mode.
/reviewReview changes.
/statusShow status.

The Codex app also exposes enabled skills in the slash-command list and supports $ for skills.

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.

Curtis Pyke

Curtis Pyke

A.I. enthusiast with multiple certificates and accreditations from Deep Learning AI, Coursera, and more. I am interested in machine learning, LLM's, and all things AI.

Related Posts

AI Video Cost Calculator: Estimate The Real Cost Of An AI-Generated Video
AI

AI Video Cost Calculator: Estimate The Real Cost Of An AI-Generated Video

May 12, 2026
Interaction Models Explained: How Thinking Machines’ 200ms Micro-Turns End Turn-Based AI
AI

Interaction Models Explained: How Thinking Machines’ 200ms Micro-Turns End Turn-Based AI

May 11, 2026
OpenAI Daybreak Explained: Inside GPT‑5.5‑Cyber, Codex Security, and the New Frontier of AI Cyber Defense
AI

OpenAI Daybreak Explained: Inside GPT‑5.5‑Cyber, Codex Security, and the New Frontier of AI Cyber Defense

May 11, 2026

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

I agree to the Terms & Conditions and Privacy Policy.

Recent News

OpenAI Codex Command Guide

OpenAI Codex Command Guide

May 12, 2026
AI Video Cost Calculator: Estimate The Real Cost Of An AI-Generated Video

AI Video Cost Calculator: Estimate The Real Cost Of An AI-Generated Video

May 12, 2026
Interaction Models Explained: How Thinking Machines’ 200ms Micro-Turns End Turn-Based AI

Interaction Models Explained: How Thinking Machines’ 200ms Micro-Turns End Turn-Based AI

May 11, 2026
OpenAI Daybreak Explained: Inside GPT‑5.5‑Cyber, Codex Security, and the New Frontier of AI Cyber Defense

OpenAI Daybreak Explained: Inside GPT‑5.5‑Cyber, Codex Security, and the New Frontier of AI Cyber Defense

May 11, 2026

The Best in A.I.

Kingy AI

We feature the best AI apps, tools, and platforms across the web. If you are an AI app creator and would like to be featured here, feel free to contact us.

Recent Posts

  • OpenAI Codex Command Guide
  • AI Video Cost Calculator: Estimate The Real Cost Of An AI-Generated Video
  • Interaction Models Explained: How Thinking Machines’ 200ms Micro-Turns End Turn-Based AI

Recent News

OpenAI Codex Command Guide

OpenAI Codex Command Guide

May 12, 2026
AI Video Cost Calculator: Estimate The Real Cost Of An AI-Generated Video

AI Video Cost Calculator: Estimate The Real Cost Of An AI-Generated Video

May 12, 2026
  • About
  • Advertise
  • Privacy & Policy
  • Contact

© 2024 Kingy AI

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
No Result
View All Result
  • AI News
  • Blog
  • Kingy AI – Clients And Sponsors
  • Contact

© 2024 Kingy AI

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.