Codex Commands and Shortcuts¶
This page lists the commands of Codex, OpenAI's artificial intelligence (AI) agent for software and technical work, and then keyboard shortcuts and symbols, for Codex and for ChatGPT. In Codex you type a command starting with a slash, such as /plan, in the same box as your requests; a few, such as codex doctor, are typed in the terminal instead. Many commands work both in the Codex command-line interface (CLI) and in the Codex view of the ChatGPT desktop app; where a command works in only one place, or differs between them, its description says so. Every command a student, faculty member, or staff member is likely to use has a worked example below, grouped by what it helps with: a small, realistic situation, what you type, and what you then see, drawn from OpenAI's documentation. Commands that only a software developer would need are listed under More Commands, Mostly for Developers, without examples.
Plans and models are on the ChatGPT (OpenAI) page, with how Codex asks before acting. A listing here is not an endorsement, and for work at the American University of Antigua, the AI Responsible Use Policy applies.
Starting and Ending a Session¶
codex Starts Codex in the terminal, in the folder you are in; the first run asks you to sign in.
A faculty member has installed the Codex CLI and wants help tidying a copy of a folder of microbiology lecture notes.
codex
- The first time, a choice of sign-in methods that includes Sign in with ChatGPT
- The Codex composer, ready for a first request such as: Tell me about this project
OpenAI suggests a Git checkpoint before and after a task, so changes can be undone; working on a copy of the notes keeps the originals untouched.
/init Drafts an AGENTS.md file, the standing instructions Codex reads before any work in that folder.
A block director keeps a folder of cardiovascular study guides and wants every session to follow the same house rules: US English, objectives that start with a measurable verb, Word formatting left alone.
/init
- Codex writes an AGENTS.md scaffold in the current folder
Review the draft and add your own rules; Codex reads the file at the start of each session.
/status Shows the session's model, approval policy, writable folders, and context use (in the desktop app, the chat ID, context use, and rate limits).
Before asking Codex to rename files in a copied anatomy lab folder, a faculty member checks which folders it can write to.
/status
- A summary of the active model, the approval policy, the folders Codex can write to, and current token usage
Run it again after /model or /permissions to confirm the change took effect.
/app Moves the current terminal session into the ChatGPT desktop app on Windows or macOS (CLI).
A course coordinator started reorganizing a reading list in the terminal and would rather review the results in the desktop app.
/app
- The desktop app opens the same saved chat, ready to continue
If the app is not installed or running, Codex shows an error asking you to install or launch it; codex app, typed in the terminal, opens the app or its installer.
/logout Signs out of Codex and clears the saved sign-in on this computer (CLI).
A student used Codex on a shared computer in a library study room and is about to leave.
/logout
- Codex clears the local credentials for this user
From the terminal, codex logout does the same.
/quit Leaves Codex (also /exit, or Ctrl+C; CLI).
A faculty member has finished drafting tutorial questions with Codex and wants to close the terminal.
/quit
- Codex exits immediately
OpenAI's reference advises saving or committing important work first.
Staying in Control¶
/permissions Sets what Codex may do without asking first, such as switching between Auto and Read Only (CLI; the desktop app and editors use the control below the composer).
A course director opens Codex in a folder of exam-item drafts and wants it to read and report, changing nothing yet.
/permissions
- A picker of approval presets, such as Auto and Read Only, plus any custom permission profiles
- Codex announces the updated policy; later actions follow it until you change it
In the desktop app and editors, the same choice is the permissions control below the composer, with Ask for approval, Approve for me, and Full access.
/plan Switches the chat into plan mode, so Codex proposes a plan before doing anything; you can add your first request on the same line.
A pathology course coordinator wants 40 renal case files sorted into weekly folders, but wants to see the plan first.
/plan Propose how to sort the renal case files into weekly folders without changing any file's contents
- Codex enters plan mode and treats the text as the first planning request
/plan is unavailable while Codex is already working. In the desktop app, /plan turns plan mode on or off.
/approve Retries, once, an action that automatic review recently denied.
With automatic review on, a faculty member asked Codex to download a public dataset of vaccination schedules, and the reviewer blocked the download.
/approve
- Codex shows the denied action and asks you to confirm the retry
- Codex retries that action once, under the current session policy
Automatic review is the Approve for me mode (Auto-review in the CLI), in which a reviewer checks requests in your place within the same boundary.
/setup-default-sandbox On Windows, sets up the elevated sandbox when Codex is using the degraded one it falls back to (CLI).
On a faculty member's Windows laptop, Codex reports that it is using a degraded sandbox and offers the elevated setup.
/setup-default-sandbox
- An administrator setup flow for the elevated Windows sandbox
- Codex configures it and selects the matching automatic approval preset
The command appears only on Windows, when Codex is using the degraded restricted-token sandbox. OpenAI says the elevated sandbox needs administrator-approved setup, so on a university-managed laptop IT may need to approve it. On Windows 11 devices that support Microsoft's built-in process isolation (MXC), Codex can use that instead, without administrator setup.
/delete Permanently deletes the current session's transcript, and any sessions spawned from it (CLI); Codex then returns to its list of chats, or exits if it is not using its shared background server.
A faculty member ran a one-off session on a borrowed skills-lab computer and does not want its transcript left there.
/delete
- Codex asks you to confirm deleting the current session
- The transcript is deleted; Codex returns to its list of chats, or closes
/archive hides a session and keeps its transcript instead. From the terminal, codex delete removes a saved session by name or ID.
/worktree Runs the chat in a new Git worktree, keeping its changes apart from your current checkout (desktop app, editors, and CLI).
A curriculum office keeps its clerkship guide in a Git-tracked folder and wants Codex's restructuring kept apart from the version colleagues use until it has been reviewed.
/worktree
- A choice: start a new chat in a new worktree, or continue this conversation in one
- Codex creates a managed Git worktree and continues the chat there
It needs a local Git repository and cannot start while a task is running; Browse worktrees lists the existing ones and the chats they belong to.
Checking the Work¶
/diff Shows the folder's uncommitted Git changes, including new files Git is not yet tracking (CLI).
A course coordinator keeps the module handbook in a Git-tracked folder, as OpenAI suggests, and checks exactly what Codex changed before sharing it.
/diff
- Staged changes, unstaged changes, and new untracked files, which you scroll through in the terminal
In the desktop app, the review pane (Ctrl+Shift+G on Windows) shows the folder's Git changes, opening on the unstaged ones.
/review Asks Codex to review changes in a Git folder and report problems without changing any file (in the desktop app and editors, uncommitted changes or a base branch).
A course coordinator keeps lecture handouts in a Git repository and has just had Codex revise 30 of them; they want a second look before committing.
/review
- A menu of review presets
- Review against a base branch
- Review uncommitted changes
- Review a commit
- Custom review instructions
- Codex reads the selected changes and reports prioritized findings in the transcript, without changing the files
Review uncommitted changes covers staged, unstaged, and new files. Custom review instructions focuses the review on criteria you give, such as the department's item-writing rules; read each change with /diff as well.
/copy Copies a response, a code block, or a quote to the clipboard, chosen from a menu (CLI; Ctrl+O copies the latest finished response directly).
Codex has summarized its changes to the year-two course materials folder, and the faculty member wants to paste the summary into an email to the curriculum committee.
/copy
- A choice of the whole response, a code block, or a quote from the latest completed response; the one you pick is copied to the clipboard
Ctrl+O copies the whole latest completed response without the menu.
Managing Context¶
/compact Summarizes the chat so far to free space in a long session.
After two hours restructuring a clinical skills handbook, a faculty member wants to keep going in the same chat.
/compact
- Codex offers to summarize the chat so far, and you confirm
- Earlier turns are replaced with a concise summary that keeps the critical details
/new Starts a fresh chat in the same session and folder, optionally named.
Having finished editing anatomy quiz items, a student wants a clean start on pharmacology flashcards in the same folder.
/new pharmacology flashcards
- A fresh chat starts in the same session, named by the text you typed
Unlike /clear, /new leaves the terminal view as it is.
/clear Clears the terminal and starts a fresh chat (CLI).
A teaching assistant's terminal is full of output from a long file-renaming job, and the next task is unrelated.
/clear
- The terminal clears, the visible transcript resets, and a fresh chat starts in the same session
Ctrl+L only clears the view and keeps the current chat. Codex disables both while a task is in progress.
/side Opens a temporary side chat for a quick question without disturbing the main chat (also /btw in the CLI).
While Codex rewrites a module's learning objectives, a faculty member wants a quick check on one of them.
/side Does "understand the renin-angiotensin system" use a measurable verb?
- A side chat opens, with a transcript separate from the main chat
- The main chat's status stays visible, so you can see whether it is still running
/fork Copies the current chat into a new one, optionally in a new Git worktree, so you can try another approach and keep the original.
Codex has proposed a plan for a case library organized by organ system, and the instructor wants to explore a plan organized by presenting complaint without losing the first.
/fork
- Codex copies the chat into a new chat with a fresh ID, leaving the original transcript untouched
To fork an earlier saved session instead, run codex fork in the terminal.
/memories Sets whether this chat can use Codex's saved memories, and whether it can add to them.
A faculty member has Codex memories turned on and is about to try an unusual layout for a single handout that should not shape later sessions.
/memories
- Choices for whether this chat can use existing memories, and whether it can feed future ones
Codex memories are off until you turn them on (in the desktop app, Settings, Personalization). The choice applies to this chat and leaves your overall setting alone.
Finding and Organizing Chats¶
/resume Reopens a saved chat from your session list (CLI).
Yesterday a faculty member started reorganizing a folder of teaching cases; today they want to continue.
/resume
- A picker of saved sessions
- Codex reloads the chosen chat's transcript, with its history intact
From the terminal, codex resume --last reopens the most recent chat in the current folder.
/rename Renames the current chat.
A course director has several Codex chats with similar names and wants this one easy to find next week.
/rename Year 2 renal block question review
- Codex updates the saved chat name without changing the transcript
/pin Pins or unpins the current chat, where available (desktop app).
In the desktop app, a clerkship coordinator returns to the same rotation-schedule chat every week.
/pin
- The chat is pinned, or unpinned if it already was
Pinning changes only where the chat appears in the sidebar, not what Codex can reach. Ctrl+Alt+P does the same on Windows.
/project Chooses the project that new chats start in (desktop app and editors).
A faculty member keeps a separate project for each course and is about to start work on the neuroscience block.
/project
- A picker of projects; new chats start in the one you choose
Ctrl+Alt+Shift+O opens the same project picker in the desktop app on Windows.
/chat Starts the next new chat without a project (desktop app).
In the middle of course work, a faculty member has a quick, unrelated question that should not sit inside the course project.
/chat
- The next new chat is set to start without a project
/archive Archives the current chat and keeps its transcript; in the CLI, Codex then returns to its list of chats, or exits if it is not using its shared background server.
At the end of the semester, a course director wants last term's Codex chats out of the session list without losing them.
/archive
- In the CLI, Codex asks you to confirm archiving the session
- The session leaves the active list; its transcript stays on the computer
To bring it back in the CLI, run codex unarchive with the session's name or ID (codex archive works from the terminal too); in the desktop app, restore it from Settings, Archived chats.
Model, Effort, and Usage¶
/model Chooses the model for the current chat (in the CLI, its reasoning effort too).
A student wants a quick, low-cost model to reformat a reference list for a pharmacology assignment.
/model
- A picker listing only the models available to your account, such as gpt-6-luna or gpt-6.1-sol
- Codex confirms the new model in the transcript
In the CLI, More reasoning… in the picker shows a model's Max or Ultra options. Run /status to confirm the change.
/reasoning Chooses how hard the model reasons in the current chat (desktop app and editors).
In the desktop app, a curriculum lead asks Codex to reconcile two versions of the year-one curriculum map and wants more careful reasoning than usual.
/reasoning
- A choice of reasoning efforts for this chat, from Light to Extra High, with Max or Ultra where your model and settings allow
Beneath the composer, the Power setting offers presets of model and effort; move toward Smarter or Faster, or open Advanced to choose a model, effort, or speed. Ultra splits a task across helpers working in parallel; GPT-6 Luna goes up to Max, not Ultra. If Ultra is missing from the slider, turn it on under Settings, then Configuration.
/fast Turns the current model's Fast speed on or off, when the model offers one.
A staff member needs Codex to reformat a long event schedule before a meeting starts and wants quicker replies.
/fast
- Codex turns the Fast tier on and saves the choice; /fast again turns it off
Fast draws on your allowance faster than Standard speed (2.5 times, by OpenAI's help article on Pro plans). If the model has no Fast tier, /fast does not appear.
/usage Shows your account's token use (daily, weekly, or overall) or redeems an earned reset; in the desktop app, it opens usage and billing settings.
A student on Plus wants to know how much of this week's allowance is left before starting a big reorganization of study notes.
/usage weekly
- Your account's token activity for the week
Plain /usage opens a menu to show activity or redeem an available earned reset.
/statusline Chooses and orders the items in the terminal's footer, such as model, context, limits, and Git branch (CLI).
A researcher running long Codex sessions wants the model and the remaining usage limits in view at the bottom of the terminal.
/statusline
- A list of footer items to pick and reorder: model, context, limits, Git branch, tokens, and session
- The chosen items appear in the footer
The choice is saved in Codex's settings file (config.toml), so later sessions keep it.
codex update Checks for a newer Codex CLI and installs it, when your installed release supports updating itself (typed in the terminal).
GPT-6.2 Astra is missing from a faculty member's model picker, and OpenAI's help says to update Codex CLI to the latest version for the GPT-6.2 models.
codex update
- Codex checks for an update and applies it
Running the install command you first used again (from OpenAI's Codex CLI page, or npm) also updates Codex.
Files, Skills, and Connections¶
/mention Attaches a file or folder to the chat so follow-up requests refer to it directly (CLI; typing @ does the same).
A course director wants Codex to check one syllabus against the block calendar.
/mention syllabus/MED201-syllabus.docx
- A popup of matching paths, from which you select the file
- Codex adds the file to the chat, so follow-up turns refer to it directly
/import Brings a Claude Code or Cursor setup, project files, and recent chats into Codex (CLI).
A faculty member has used Claude Code for a semester, with a file of course rules, and is trying Codex on the same folder.
/import
- An import picker
- Claude Code
- Cursor
- You select the setup, project files, or recent chats to bring over, and Codex imports them into its own configuration and files
It looks back at up to 50 chats from the last 30 days, and is unavailable while a task is running.
/skills Lists skills and applies one to your next request (CLI; in the desktop app, skills appear in the slash list and on the Skills page).
A department has written a skill that formats new exam items in its house style (a hypothetical skill, for illustration).
/skills
- A list of skills to choose from
- Codex inserts the chosen skill's context, so the next request follows its instructions
Typing $ and the skill's name before a request does the same. OpenAI bundles a few skills, such as skill-creator for writing your own.
/apps Browses connected apps and inserts one into your request as a $ mention (CLI).
A course coordinator wants Codex to work from the current timetable in a connected Google Drive before updating a schedule.
/apps
- A list of apps
- Codex inserts the chosen app into the composer as $ and its name, ready for your request
/plugins Browses installed and available plugins (CLI).
Before starting a course-materials task, a faculty member wants to see which plugins are installed and what each one can do.
/plugins
- The plugin browser, with installed plugins, plugins your configuration lets you discover, and each one's state
Press Space on an installed plugin to turn it on or off.
/mcp Lists the outside tools (Model Context Protocol, or MCP, servers) Codex can call in this session; in the desktop app and editors, it opens MCP status.
An instructor's IT team has connected a documentation server, and the instructor wants to confirm Codex can use it.
/mcp
- The configured MCP servers and tools Codex can call in this session
/mcp verbose adds detailed diagnostics for each server.
Long Jobs and Troubleshooting¶
/goal Sets a goal Codex keeps working toward across turns; you can view, edit, pause, resume, or clear it.
A faculty member wants all twelve weekly study guides moved onto the new departmental template, with a list of any guide that has no learning objectives.
/goal Convert all 12 weekly study guides to the new template and list any guide with no learning objectives
- Codex keeps the goal attached to the chat while the work continues
In the desktop app, goal progress appears above the composer, with buttons to pause, resume, edit, or clear it. A goal can be up to 4,000 characters; for longer instructions, point it at a file.
/subagents Switches between Codex's helper (subagent) threads so you can inspect or continue one (CLI). The similar /agents opens the agent command center, a list of all chats on Codex's shared background server.
A faculty member asked Codex to split a check of 200 practice questions across helpers, one per organ system, and wants to see how the cardiology helper is doing.
/subagents
- A picker of agent threads
- Codex switches to the chosen thread, showing that helper's work
Helpers use more of your allowance than a single agent, since each does its own work.
/ps Shows the commands Codex is running in the background, with their latest output (CLI).
Codex started a long conversion of lecture slides to PDF in the background, and the faculty member wants to know how far it has got.
/ps
- Each background terminal's command, with up to three recent lines of its output
The list may be empty, depending on how Codex runs commands on your computer.
/stop Stops every background command started in this session (also /clean; CLI).
The slide conversion is no longer needed, because a colleague has already sent the PDFs.
/stop
- Codex may ask you to confirm, then stops all background terminals for this session
/feedback Sends feedback, and optionally logs, to the Codex team at OpenAI (in the desktop app and editors, through a feedback dialog).
Codex keeps failing at the same step on a faculty member's laptop, and they want to report it.
/feedback
- Prompts to describe the problem and to choose whether to include logs or diagnostics
- Codex collects what you chose and submits it
codex doctor Writes a diagnostic report on the Codex installation, settings, sign-in, and connections (typed in the terminal).
After a Windows update, Codex will not start properly on a faculty laptop.
codex doctor
- A local report checking installation, configuration, sign-in, runtime, Git, the terminal, and other parts
OpenAI's help suggests it on Windows for startup, connection, and performance problems.
More Commands, Mostly for Developers¶
/ide Adds open files, the current selection, and other editor context to the next request (CLI).
/ide-context Turns shared editor context on or off (desktop app and editors).
/local Runs the chat in the selected local project, rather than in the cloud (desktop app and editors).
/cloud Runs the chat in Codex Cloud, when cloud execution is available (desktop app and editors).
/cloud-environment Chooses the Codex Cloud environment for the chat (desktop app and editors).
/hooks Shows lifecycle hooks, and trusts, turns off, or turns back on the ones you manage (CLI).
/debug-config Prints the configuration layers and policy requirements, to explain why a setting differs from your configuration file (CLI).
/experimental Turns experimental features on or off, such as Network proxy or Prevent sleep while running (CLI).
/keymap Remaps the terminal interface's keyboard shortcuts and saves them (CLI).
/vim Turns Vim-style editing in the composer on or off (CLI).
/raw Turns raw scrollback on or off, for plainer selecting and copying of long output; Alt+R does the same (CLI).
/theme Chooses a syntax-highlighting theme for code and diffs in the terminal (CLI).
/title Chooses the items shown in the terminal window or tab title (CLI).
/pets Chooses or hides a terminal pet (also /pet; in the desktop app, /pet wakes or tucks away the desktop pet).
codex login Signs in from the terminal with a ChatGPT account, a device code, an API (application programming interface) key, or an access token; Codex also asks you to sign in on first run.
codex exec Runs a task without interaction, for scripts and automated pipelines (short form codex e).
codex review Runs a code review without interaction, against uncommitted changes, a base branch, a commit, or your own instructions.
codex cloud Browses or starts Codex Cloud tasks from the terminal (codex cloud exec submits one, codex cloud list lists recent ones; also codex cloud-tasks); experimental.
codex apply Applies the latest changes from a Codex Cloud task to your local working copy (short form codex a).
codex mcp Lists, adds, removes, and signs in to MCP servers in Codex's configuration file.
codex plugin Installs, lists, and removes plugins; codex plugin marketplace manages the sources they come from.
codex sandbox Runs any command inside the same sandbox Codex uses, on macOS, Linux, or Windows.
codex execpolicy Checks command-rule files and shows whether a command would be allowed, prompted, or blocked (experimental).
codex features Lists feature flags and turns them on or off in Codex's configuration file.
codex completion Generates tab-completion scripts for Bash, the Z shell, Fish, or PowerShell.
codex app-server Starts Codex's app server, for local development and debugging (experimental).
codex remote-control Runs or manages remote control for the local app server, or creates a short-lived pairing code (experimental).
codex debug Debugging tools that send a test message through the app server, print the model catalog Codex sees, or show the exact input the model receives (experimental).
chatgpt.newChat In VS Code and similar editors, starts a new Codex chat (Ctrl+N on Windows); chatgpt.openSidebar, chatgpt.newCodexPanel, and chatgpt.openCommandMenu open the sidebar, a new panel, or the command menu.
chatgpt.addToThread In VS Code and similar editors, adds the selected text to the current Codex chat; chatgpt.addFileToThread adds the whole file.
OpenAI's own complete references: Every Codex CLI command, Slash commands in the desktop app, Desktop app keyboard shortcuts, Codex editor extension commands, Permission modes.
Shortcuts and Symbols¶
| Keys | What They Do |
|---|---|
| Enter | While Codex is working in the CLI, sends new instructions into the current turn. |
| Tab | While Codex is working in the CLI, queues a message, slash command, or shell command for the next turn. |
| Esc Esc | On an empty prompt in the CLI, edits your previous message and forks the chat from that point. |
| Ctrl+R | Searches your earlier prompts in the CLI. |
| Ctrl+O | Copies the latest finished response in the CLI, without the /copy menu. |
| Ctrl+G | Opens your text editor for writing a long prompt in the CLI. |
| Ctrl+L | Clears the terminal view in the CLI but keeps the current chat. |
| Alt+1, Alt+2, Alt+3 | In the desktop app on Windows, switches to Chat, Work, or Codex (Control+1 to 3 on a Mac). |
| Enter or Esc | In the desktop app, approves or declines an open approval request. |
| Ctrl+Shift+N | In the desktop app, starts a temporary chat (Command+Shift+N on a Mac). |
| Ctrl+Alt+N | In the desktop app, opens a quick chat for a short question (Command+Option+N on a Mac). |
| Ctrl+Shift+M | In the desktop app, opens the model picker (Control+Shift+M on a Mac). |
| Ctrl+Shift+G | In the desktop app, opens Codex's review tab to inspect changes (Control+Shift+G on a Mac). |
| Ctrl+K | In the desktop app, opens the command menu (Command+K on a Mac). |
| Ctrl+/ | In the desktop app, lists the keyboard shortcuts (Command+/ on a Mac); change them under Settings, Keyboard Shortcuts. |
| Type | What It Does |
|---|---|
| @ | In the Codex CLI, searches for a file in the folder and adds its path to your request. |
| ! | At the start of a line in the Codex CLI, runs a shell command yourself, under the current approval and sandbox settings. |
| $ | In Codex, names a skill to use, such as $skill-creator; /apps inserts apps the same way. |
| @ | In ChatGPT Chat and Work, points to a plugin or skill, such as @Google Drive or @skill-creator. |
| /Deepresearch | Typed in a ChatGPT message, starts a deep research task. |
More in This Section
Color key: Tool
- Tools & Prompts Section overview
- ChatGPT (OpenAI) Plans, models, Codex, and its commands
- Claude (Anthropic) Plans, models, Claude Code, and its commands
- Gemini (Google) Plans, models, Antigravity, and its commands
- Grok (xAI) Plans, models, Grok Build, and its commands
Browse Tools & Prompts21 pages
Find a Tool1 page
Use a Prompt2 pages
Work with Sources2 guides
Work with AgentsOptional, after the basics6 guides
Related Lesson in Learn
The Guides
- AI Agents What an agent is, and what it can do
- Choosing Your Interface Chat, work, or code
- Your First Agent Session Run one, once, on a safe folder
- Standing Setups: Assistants That Remember Assistants that remember your work
- Agent Skills Give an agent a playbook
- Always-On Agents: Study Help That Comes to You Reminders, practice, and a weekly check, sent to you
Run Models Locally2 guides
By Company4 company guides
Compare Models3 leaderboards
Color key: ToolPromptGuideLessonBenchmark