Skip to content

Slash Commands and Shortcuts: The TUI Remote Control

📚 Series Navigation: The previous article [11 · Project Instructions File AGENTS.md] taught you how to write rules into a file, ensuring Codex reads them before starting every run. That was "setting rules in advance"; this article covers "toggling settings mid-session"—once inside a conversation, typing / lets you switch models, clear context, check status, and review diffs. Combined with a few handy shortcuts, this doubles your efficiency. The next article [13 · How to Write Prompts] returns to "how to explain requirements clearly."

I counted the slash commands listed in the official Codex documentation.

The CLI table lists over 40 commands; the Desktop App lists 6 commands; the IDE extension lists 8 commands. The first time I saw the CLI list, I was overwhelmed—there are so many settings you can adjust mid-session in a terminal, whereas the commands I actually used numbered fewer than five.

What's worse is what happened next. For a while, whenever I wanted to clear a conversation and start fresh, I would run Ctrl+C to exit and run codex to restart, waiting for it to reload the project—taking about ten seconds every time. I did this for nearly two weeks until I came across /clear in the docs, which explained: "clears the terminal and starts a brand-new conversation." I only had to type six characters in the input box; those restarts were a complete waste of time.

I share this so you can avoid my mistakes: slash commands are not "advanced tricks"; they are the core control console for your Codex sessions. If you want to configure Codex itself—not write code, but adjust the active session—the entry point is almost always behind /. This article compiles the slash commands and common shortcuts for the CLI, Desktop App, and IDE extensions into a single cheat sheet.

After reading this article, you will get:

  • A clear explanation of what slash commands are and why the number of commands varies across the three entries
  • A quick lookup table of common CLI slash commands grouped by workflow step (/model, /status, /diff, /compact, /review, /init...)
  • The specific slash commands available in the Desktop App and IDE extensions—avoiding using the CLI list where it doesn't apply
  • A cheat sheet of the most important CLI keyboard shortcuts (Ctrl+L, Ctrl+O, Tab, Ctrl+G, the ! prefix...), verified against official docs
  • How to customize keymaps (/keymap) and why beginners should avoid doing so early on
  • A minimal verification flow to follow with expected outputs

⚠️ All specific commands, shortcuts, and default behaviors mentioned below are based on the Codex official documentation; model names, versions, and exit keys are subject to change and should match what is actually displayed on your local system. The official Desktop App shortcuts are only labeled for macOS; Windows shortcuts should be verified in your local settings panel, as highlighted below.


01 Understand First: What Slash Commands Are and Why They Work Only at the Beginning of a Message

First, the conclusion: slash commands are control instructions you send to the Codex application—not prompts for the model to write code, but direct commands to Codex: switch models, clear context, check status, or run a pipeline.

If you recall the previous articles, our interactions with Codex split into two categories. One is code requirements: "refactor this function," "explain this error"—these are prompts for the model. The other is meta-operations: "clear the chat and start fresh," "switch to a cheaper model," "show the active configurations"—these should not be "discussed" with the model but controlled via direct switches. Slash commands are the unified interface for these switches. The official docs state: "slash commands let you perform quick, keyboard-first actions to control Codex."

Analogy: An extension directory at a reception desk. When you walk into an office building to conduct business, you don't explain to the receptionist: "I need to find the person on the third floor handling expenses"—you scan the directory on the wall: Finance is 8101, HR is 8102, IT is 8105, and dial directly. Each extension connects to a specific department, running a set action without misunderstanding. Slash commands are this directory for Codex: /model connects to "switch models," /status connects to "view status," and /diff connects to "review changes"—typing them executes a hardcoded program action, which is separate from prompting the model.

Here is a common trap for beginners: slash commands only work when / is the first character of your message. Type / in the input box, and the menu pops up immediately; type more characters, and the menu filters the commands. The docs for all three entries share the same instruction: "Type / in the input box, select from the list, or continue typing to filter (like /status)."

Here are real scenarios where you would run these switches:

  • Finding the model is struggling mid-session—instead of restarting, type /model in the TUI to switch to a stronger model, preserving the active conversation.
  • Verifying active configurations—type /status to review the active model, approval policy, and remaining context window.
  • Starting a new task after completing one—type /clear in the TUI to clear the workspace and start fresh.

These tasks share one detail: they configure the session itself rather than prompting Codex to write code—which is the main purpose of slash commands.

Why does the number of commands vary so much across the three entries (over 40 in the CLI, 6 in the App, and 8 in the IDE)? Simply: the CLI is Codex's most feature-rich interface (as discussed in Article 08), exposing many low-level and debugging switches in the terminal; the Desktop App and IDE extensions use graphical interfaces, leaving settings, menus, and buttons to handle tasks that would otherwise clog the slash command menu. Do not copy the CLI command list to the App or IDE extension; they support different commands, detailed below.

💡 Summary in one sentence: Slash commands are control instructions for the Codex program (switching models, clearing context, checking status), not code prompts for the model; they only work at the start of a message, and typing / reveals the list of commands available in your current interface.


02 Common CLI Slash Commands: Grouped by Workflow Step

Memorizing all 40+ CLI slash commands is unnecessary. Instead, group them by the steps of a typical session—choose the commands you need based on what you are doing. I have organized the common commands into four groups, allowing you to look up what you need based on your task, all verified against the official cli/slash-commands.

Note: Article 08 introduced the CLI interactive interface and critical rescue commands. This section expands and groups that list rather than repeating it, providing a complete overview.

Group 1: Setting Up and Configuring Rules

CommandWhat It DoesWhen to Use
/initGenerates a skeleton AGENTS.md file in the working directorySetting up project rules for the first time (Article 11)
/permissionsSets what actions Codex can execute without approvalTightening or loosening permissions (Auto vs. Read Only)
/mcpLists configured MCP servers (use verbose for details)Connecting external services or troubleshooting connections
/skillsViews and enables local SkillsHaving a specific Skill manage the next run
/statusDisplays session details and token usageVerifying active model, approval settings, writable directories, and remaining context

When starting a new project, follow this setup sequence: run /init to let Codex scan the code and generate an AGENTS.md draft (Article 11 covers how to write it), then run /permissions to adjust edit permissions to your liking.

Group 2: Adjusting Settings Mid-Session

CommandWhat It DoesWhen to Use
/modelSwitches models (and reasoning intensity)Switching to a stronger or faster model
/compactCompresses the conversation history to free up token spaceWhen the session is long and context is filling up
/clearClears the TUI screen and starts a new conversationStarting a new task with a clean slate
/newStarts a new conversation within the active CLI sessionStarting a new task without clearing the screen
/planSwitches to plan mode, optionally accepting a promptHaving the model draft a plan before modifying code

Let's clarify three easily confused commands; the differences are sourced from the official docs:

/clear and /new both start new conversations, but differ in "whether they clear the screen." The official docs state: /new does not clear the active terminal screen. Use /clear to clear the screen and start fresh; use /new to keep the logs visible while starting a new conversation context.

/clear and /compact serve different purposes—one erases, and the other compresses. Use /clear when switching to an unrelated new task; use /compact when working on the same task but the conversation is long (compressing the conversation history into summary points to continue). The restart loop I got stuck in was due to mixing up "restart" and "clear conversation"—/clear handles it in one step.

Group 3: Reviewing Before Committing

CommandWhat It Does
/diffDisplays the Git diff, including untracked files
/reviewHas Codex review your workspace changes (checking behavioral changes and missing tests)
/copyCopies Codex's last completed output (equivalent to Ctrl+O)

I run /diff before almost every commit—it lists untracked files that haven't been added to Git via git add, providing a more complete overview than git status + git diff. The docs state that it displays staged, unstaged, and untracked changes.

⚠️ /diff assumes your project is a Git repository—it wraps Git diff comparisons. If the directory has not been initialized with Git (git init), /diff will have nothing to display. Run git status to verify the repository before editing; if it is not a Git repository, run git init and make an initial commit before letting Codex edit code.

Group 4: Miscellaneous Useful Commands

CommandWhat It Does
/keymapViews and edits TUI keyboard shortcuts, saving changes to config.toml (Section 05)
/statuslineSelects and sorts fields displayed in the status bar (footer)
/themeSelects and saves a syntax highlighting theme
/resumeRestores a saved conversation from the session history
/side (alias /btw)Starts a "side chat" branch without polluting the main conversation
/forkForks the active conversation into a new thread, leaving the original active
/quit (alias /exit)Exits the CLI (save or commit changes before exiting)

This list is not exhaustive (the official list is 40+ lines long; check cli/slash-commands for the complete list), but it covers 90% of daily scenarios. For other tasks, type / followed by a few letters to filter, which is much more practical than memorizing tables.

A helpful detail from the docs: while a task is running, you can type a slash command and press Tab to queue it. Codex will process it once the active run finishes—menus and messages will appear after the current turn ends. I often queue /review using Tab while a test suite is running, starting the review automatically once the tests finish.

💡 Summary in one sentence: Do not memorize CLI commands; look them up by workflow step—setup (/init /permissions /mcp), execution (/model /compact /clear), review (/diff /review), and misc (/keymap /resume /fork). Differentiate /clear (clear screen + new context), /new (keep screen + new context), and /compact (compress context and continue).


03 Desktop App and IDE Extensions: A Shorter List of Commands

As noted in Article 08, do not expect the 40+ CLI commands to work in the Desktop App or IDE extensions. This section lists the commands supported by each to avoid confusion.

Why are there fewer commands? As mentioned, graphical interfaces use buttons, menus, and settings panels to handle tasks, reducing the need for slash commands. Analogy: Mobile banking apps vs. bank branches. A bank branch (CLI) handles any transaction, including rare ones; the mobile app (Desktop App / IDE) places high-frequency actions as buttons on the homepage, routing others to settings. The app is not restricted; it simply prioritizes common actions and moves others elsewhere.

Desktop App: The 6 Supported Commands

Slash CommandWhat It Does
/statusViews thread ID, context usage, and quota limits
/reviewStarts code review mode, reviewing uncommitted changes or comparing branches
/planSwitches to plan mode for multi-step planning
/goalSets a goal for Codex to achieve (use /plan to outline it first)
/mcpChecks the status of connected MCP servers
/feedbackOpens the feedback dialog to submit feedback (optionally attaching logs)

Two details from the docs: (1) typing $ in the input box invokes Skills, and active Skills appear in the slash command list; (2) if /goal is missing from the list, enable it via features.goals = true in config.toml or run codex features enable goals.

In the Desktop App, shortcuts handle navigation and UI control—clearing conversations, starting threads, and switching panels use Cmd shortcut keys rather than slash commands (covered in Article 07). Therefore, in the App, slash commands manage action instructions (reviews, plans, status), and shortcuts manage UI actions (windows, panels, search history).

IDE Extensions (VS Code, etc.): The 8 Supported Commands

Slash CommandWhat It Does
/statusViews thread ID, context usage, and rate limits
/reviewStarts code review mode, reviewing uncommitted changes or comparing branches
/goalSets a persistent goal for Codex to work towards
/auto-contextToggles Auto Context, automatically including recent files and editor context
/localSwitches to Local mode, running tasks in your workspace
/cloudSwitches to Cloud mode, delegating tasks to run in the cloud (requires cloud access)
/cloud-environmentSelects which cloud environment to use (Cloud mode only)
/feedbackOpens the feedback dialog to submit feedback (optionally attaching logs)

The most IDE-specific commands are /local and /cloudswitching the active task execution between "my computer" and "the cloud" in one command (covered in Articles 09 and 10). When debugging a long refactoring task in VS Code, I often run /local to verify the approach, and then run /cloud to offload the execution, freeing up my machine.

Compare the slash commands supported by the three entries:

EntrySlash Command CountUnique CommandsWhere Other Operations Live
CLI40+ commands/keymap /fork /side /statusline, etc.Keyboard shortcuts (Section 05)
Desktop App6 commands/goal /planCmd shortcuts + buttons (Article 07)
IDE Extension8 commands/local /cloud /auto-contextVS Code command panel + shortcuts (Article 09)

⚠️ The command counts are subject to change. Type / in your active interface to review the commands actually supported on your system; do not rely on static lists.

💡 Summary in one sentence: The Desktop App supports 6 commands and the IDE extension supports 8, which is much shorter than the CLI list—graphical interfaces move common actions to buttons and UI controls to shortcuts, reserving slash commands for action instructions; the IDE extension includes /local and /cloud to switch execution locations; type / to review the active list.


04 Editor Actions: Codex Commands in the VS Code Command Panel

The previous section covered slash commands typed in the chat box. However, the IDE extension includes another set of commands—Codex actions in the VS Code Command Palette—which are different from slash commands.

These actions manage editor-level tasks outside the chat box: such as adding selected code to the active thread as context, or implementing a selected // TODO comment. These cannot be triggered via slash commands (which are restricted to the chat box) and run via the command panel or shortcuts.

Analogy: Context menus vs. chat windows. Slash commands in the chat box are like typing instructions; Codex actions in the command panel are like right-clicking code and selecting "Send to Codex"—one is "speaking," and the other is "pointing at code." Use both to speed up workflows.

The official docs list these editor commands (with command IDs for binding shortcuts):

Command (search Codex or command ID)Default ShortcutWhat It Does
chatgpt.newChatMac Cmd+N / Win·Linux Ctrl+NStarts a new thread
chatgpt.addToThreadNone (customizable)Adds the selected code block to the active thread as context
chatgpt.addFileToThreadNone (customizable)Adds the entire file to the active thread as context
chatgpt.implementTodoNone (customizable)Prompts Codex to implement the selected TODO comment
chatgpt.newCodexPanelNone (customizable)Opens a new Codex panel
chatgpt.openSidebarNone (customizable)Opens the Codex sidebar panel

To bind shortcuts to these commands, follow the official steps:

  1. Open the command panel (Mac Cmd+Shift+P, Windows / Linux Ctrl+Shift+P).
  2. Run Preferences: Open Keyboard Shortcuts.
  3. Search for Codex or the specific command ID (like chatgpt.newChat).
  4. Click the pencil icon, and press your desired shortcut keys.

I bind chatgpt.addToThread to a shortcut—selecting a block of code and pressing it adds it to the sidebar thread instantly, which is much faster than copy-pasting or switching windows. These editor actions are a unique convenience of the IDE extension, as plain terminals cannot support right-click code selections.

💡 Summary in one sentence: The IDE extension has two interfaces—slash commands in the chat box (instructions) and Codex actions in the command panel (chatgpt.addToThread, implementTodo, etc. to act on code); bind shortcuts to the actions using the four-step Keyboard Shortcuts process.


05 CLI Keyboard Shortcuts: Faster Than Slash Commands

Slash commands are fast, but some high-frequency tasks are even faster with a single keypress. This section compiles the CLI keyboard shortcuts, merging TUI actions with shortcuts scattered in the official cli/slash-commands.

Analogy: Keyboard shortcuts vs. slash commands is like double-clicking vs. "right-click → open." Right-click menus (slash commands) list all options, but for common tasks, you use double-clicks or Ctrl+C / Ctrl+V out of habit—your fingers move faster than your eyes.

Configure these shortcuts into your muscle memory:

Keyboard ShortcutWhat It DoesEquivalent Slash Command
Ctrl+LClears TUI screen, keeping the active conversation (redraws UI)None (different from /clear, see below)
Ctrl+OCopies Codex's last completed outputEquivalent to /copy
Tab (during runs)Queues the next prompt / slash command / ! commandNone
Ctrl+GWrites long prompts in an external editor, returning text to input box (editor set by VISUAL or EDITOR env; defaults to vi—run export VISUAL=code to use VS Code)None
Alt+RToggles raw scroll mode (for easier terminal text copying)Equivalent to /raw
! prefix (line start)Runs a shell command directly, bypassing CodexNone

Three details emphasized in the docs that are easily missed:

Ctrl+L is not /clear. This is a common mix-up. The docs state: Ctrl+L redraws the terminal screen, keeping the active conversation context; /clear clears the screen and starts a brand-new conversation (erasing context). One is "cleaning the blackboard," and the other is "switching to a new blackboard." Both are disabled while a task is running. When my remote TUI scrambled due to a network hiccup, pressing Ctrl+L restored the layout instantly, preserving my active conversation context. A restart would have erased it.

The ! prefix—run commands and feed results to Codex. Typing ! at the start of the input box followed by a command (like !git status) runs it directly in your shell. Codex collects the command output into the conversation context, respecting sandbox and approval settings. Why use it? To check the repository state without invoking Codex to "explain" it (burning tokens)—!git status gets it instantly, and Codex can reference it in subsequent prompts.

text
!git status

Ctrl+O copy rules. The docs note: if a turn is running, Ctrl+O copies the last completed output (not the one in progress); it is unavailable before the first output is generated or immediately after a rollback. Keep this in mind if it doesn't respond.

Customizing Keymaps with /keymap

If default keys feel awkward, modify them. The CLI provides /keymap to view, edit, and save custom bindings to tui.keymap in config.toml. The official steps: run /keymap → select the target shortcut context and action → press new keys or clear old ones. Key names look like: ctrl-a, shift-enter, page-down.

However, master the defaults first. Modifying keymaps early on will make your configuration mismatch tutorials and documentation, creating unnecessary troubleshooting steps.

💡 Summary in one sentence: The most common TUI shortcuts are Ctrl+L (redraw screen without losing conversation, different from /clear), Ctrl+O (copy output), Tab (queue commands), Ctrl+G (external editor for long prompts), and ! (run shell commands). Master the defaults before using /keymap.


06 Hands-on: Verifying Slash Commands in Each Entry

Let's run a minimal flow to verify slash commands. It does not require a complex project; just create an empty folder for the CLI portion, and open the App/IDE for the other checks.

Platform Note: The mkdir command below works on Mac / Linux; on Windows PowerShell, replace mkdir -p with mkdir or create the folder manually in File Explorer. Verify your CLI installation with codex --version.

CLI Section (5 Steps in Terminal)

Step 1: Create an empty directory, enter it, and launch TUI

bash
mkdir -p ~/codex-slash-demo && cd ~/codex-slash-demo && git init
codex

Expected behavior: The TUI launches, displaying the input box at the bottom and the status bar text below it.

Step 2: Type / to review the active command list

Type a single slash in the input box (do not press Enter):

text
/

Expected behavior: A menu listing available slash commands and descriptions appears. This is the complete list supported by your active version—it is longer than the tables in this article (as commands are regularly added). Type a few letters (like /st) to filter the list to /status.

Step 3: View configurations with /status

text
/status

Expected behavior: Codex prints the active model, approval policy, writable directories, and remaining context. Verify your active settings here.

Step 4: Test Ctrl+L and ! shortcuts

Run a shell command (like !ls) and then press Ctrl+L:

text
!ls

Expected behavior: !ls lists the directory contents (empty for now) and collects the output into the context. Pressing Ctrl+L clears the terminal screen and redraws the TUI, preserving your conversation history (scrolling up displays it), showing how it differs from /clear.

Step 5: Run /diff (and let it edit a file), then exit

Ask it to perform a small file edit:

text
Create a file hi.txt with the text: hello from codex

Approve the action if prompted by your approval settings. Once done, run:

text
/diff

Expected behavior: Codex lists the Git diff, including the untracked new file hi.txt—proving /diff is more comprehensive than plain Git status commands. Exit when done:

text
/exit

Expected behavior: Exits back to your regular terminal (equivalent to /quit or pressing Ctrl+C).

Desktop App / IDE Section (Verify Command Differences)

Desktop App: Open the App, and type / in the input box of a thread.

Expected behavior: The menu is much shorter, listing /status, /review, /plan, /goal, /mcp, and /feedback (local display may vary). Confirm that it differs from the CLI list. Type $ to review the callable Skills list.

IDE Extension (VS Code, etc.): Type / in the Codex chat input box.

Expected behavior: The menu displays /local, /cloud, and /auto-contextcommands unavailable in the CLI and App. This confirms that each entry supports its own set of slash commands.

Running these checks verifies the core rules: "type / to see the active menu," "each entry has its own commands," "Ctrl+L is not /clear," and "/diff lists untracked files."

  • Troubleshooting note: if Step 5 executes without prompting, your approval policy is set to allow workspace edits automatically. To test prompts, run /permissions to switch to Read Only and try creating a file again.

💡 Summary in one sentence: Run through TUI checks (/ menu → /status configurations → Ctrl+L / ! shortcuts → /diff reviews → /exit exit) and compare command lists in the App and IDE to lock the differences into your muscle memory.


07 Summary

This article explored slash commands and keyboard shortcuts:

GoalTool / CommandNotes
Slash CommandsSession control instructionsConfigures the program, not code prompts; must start a message
CLI CommandsGrouped by workflow stepSetup / Mid-session / Review / Misc; type / to view the active list
Clear vs. Compact/clear vs. /new vs. /compact/clear clears screen + new context; /new keeps screen + new context; /compact compresses history
Desktop App list6 commands/status /review /plan /goal /mcp /feedback
IDE Extension list8 commandsIncludes /local, /cloud, and /auto-context
IDE Editor ActionsCommand panel actionschatgpt.addToThread, implementTodo, etc. Custom shortcuts recommended
CLI ShortcutsCtrl+L Ctrl+O Tab Ctrl+G !Ctrl+L redraws TUI without losing conversation (different from /clear)
Custom Keymaps/keymap or editor shortcut settingsMaster the default settings first

You should now understand what slash commands are and how they vary across entries, group CLI commands by workflow step, differentiate clearing vs. compressing conversations, and bind shortcuts to editor-level actions.

If you find yourself wanting to configure Codex's behavior mid-session, type / to review the active switches. Using these shortcuts will save you significant time.


The next article [13 · How to Write Prompts]: slash commands adjust settings, but how you write your prompts determines the quality of Codex's output. Writing a vague prompt vs. an accurate one results in completely different outcomes. The next article covers how to prompt Codex effectively to get the code you need on the first run. Think about this: you used /plan to let it draft a plan—what makes a prompt clear, saving it from rewriting code multiple times?