Agentic AI AcademyAgentic AI Academy

Cheat Sheet: Slash Commands & Shortcuts

The full in-session command and keyboard reference

Intermediate 11 minBuilder
What you'll be able to do
  • Recall the workflow slash commands (/init, /model, /permissions, /review, /diff, /status, /compact, /clear, /new, /resume, /fork, /plan, /goal) and what each one does
  • Use the extension and cosmetic slashes (/mcp, /skills, /plugins, /hooks, /apps, /agent, /memories, /ide, /mention, /copy, /theme, /vim, /keymap) to reach Codex's surrounding systems
  • Apply the correct TUI keyboard shortcut for cancelling, exiting, clearing, searching history, copying, opening an editor, queueing, and editing a prior message
  • Use the @ fuzzy-file, ! shell, and image-paste composer modifiers plus the Ctrl+T transcript overlay
  • Avoid the two classic cheat-sheet traps: reaching for /approvals (use /permissions) or /undo (roll back with git)
  • Remap any shortcut with /keymap and verify the live roster at developers.openai.com/codex/cli/slash-commands
At a glance

A scannable reference for everything you drive a Codex CLI session with: the slash commands grouped by purpose, the TUI keyboard shortcuts, and the three composer modifiers (@, !, paste image). It also flags the renamed and missing commands — /approvals is now /permissions, and there is no /undo — so older cheat sheets don't lead you astray, and it points you at the live slash-commands page because the roster changes constantly.

  1. 1The mental model: two keyboards, one composer
  2. 2Workflow slash commands
  3. 3Extension & cosmetic slash commands
  4. 4The traps: renamed and absent commands
  5. 5TUI keyboard shortcuts
  6. 6Composer modifiers: @, !, and images
  7. 7Remapping shortcuts with /keymap

The mental model: two keyboards, one composer

Once you launch codex in a project directory, everything you do happens through one text composer — but that composer speaks two different keyboards at once, and keeping them straight is the whole game.

  • Slash commands (/…) drive Codex the system — switch models, set permissions, review a diff, compact the conversation, browse skills. Type / to open a filterable popup of everything available right now.
  • Keyboard shortcuts (Ctrl+…, Esc, Tab) drive the session itself — cancel a turn, search history, queue a follow-up, edit your last message. These never appear in the popup; you have to know them.
  • Composer modifiers (@, !, image paste) are a third, smaller set that shape a single message before you send it — pull in a file path, run a shell command inline, drop in a screenshot.

The reason this lesson exists as a reference is that the slash roster is large and changes often — new commands land, others get renamed. So treat the tables below as a map of what categories exist and what they're for, and treat the live page — developers.openai.com/codex/cli/slash-commands — as the source of truth for the exact current set. Learn the shape; verify the specifics.

Key insight

Slash = the system, keys = the session

If you want to change what Codex is allowed to do or which model it runs, that's a slash command. If you want to change what's happening in the conversation right now — cancel, queue, edit, search — that's a keyboard shortcut. The popup only shows you the first kind.

Workflow slash commands

These are the commands you'll reach for many times a day — the core loop of starting, steering, reviewing, and managing a session. Type / and start typing to filter.

CommandWhat it does
/initGenerate an AGENTS.md scaffold in the current directory
/modelChoose the active model (and reasoning effort, when available)
/permissionsSet what Codex can do without asking first (this replaced /approvals)
/approveApprove one retry of a recent auto-review denial
/reviewAsk Codex to review your working tree and report prioritized findings
/diffShow the Git diff, including untracked files (scrollable)
/statusDisplay session configuration and token/usage info
/compactSummarize the visible conversation to free up tokens
/clearClear the terminal and start a fresh chat
/newStart a new conversation inside the same CLI session
/resumeResume a saved conversation from your session list
/forkFork the current conversation into a new thread (keeps the transcript)
/planSwitch to plan mode and optionally send a prompt
/goalSet, pause, resume, view, or clear a task goal (doubles as a completion criterion)

A few distinctions worth burning in, because they look similar but aren't:

  • /clear vs /new/clear wipes the terminal and starts a fresh chat; /new starts a new conversation but stays inside the same running CLI session. (And neither is the same as the Ctrl+L key, which only repaints the screen — more on that below.)
  • /compact vs /clear/compact summarizes the current conversation to reclaim context tokens while keeping continuity; /clear throws the conversation away.
  • /resume vs /fork/resume continues an existing thread (it appends to the same session); /fork branches a new thread that preserves the original transcript, so you can explore without disturbing the original.

Tip

Review before you trust a diff

/diff shows you exactly what changed (untracked files included); /review spins up a dedicated reviewer that reads the diff and reports prioritized findings. Use /diff to eyeball, /review for a second opinion before you commit.

Extension & cosmetic slash commands

Beyond the core loop, a second tier of slashes reaches Codex's surrounding systems — MCP tools, skills, plugins, hooks, connectors, memory, IDE context — plus a handful of purely cosmetic ones.

Extension / systems:

CommandWhat it does
/mcpList configured MCP (Model Context Protocol) tools
/skillsBrowse and use skills
/pluginsBrowse installed and discoverable plugins
/hooksReview lifecycle hooks
/appsBrowse apps (connectors) and insert them into a prompt
/agentSwitch the active agent thread
/memoriesConfigure memory use and generation
/ideInclude open files, current selection, and other IDE context
/mentionAttach a file to the conversation (menu-based alternative to typing @)
/copyCopy the latest completed Codex output

Cosmetic / personalization:

CommandWhat it does
/themeChoose a syntax-highlighting theme
/vimToggle Vim mode for the composer
/keymapRemap TUI keyboard shortcuts
/statusline /title /personalityConfigure the status line, window title, and response style

There are more — /experimental, /raw, /side (alias /btw), /ps, /stop, /feedback, /debug-config, /logout, /exit//quit, and Windows-only /sandbox-add-read-dir. Don't memorize the long tail; just remember that if a capability has a home in Codex, there's probably a slash for it, and the popup will surface it.

Note

/mention is just the slow lane for @

/mention opens a menu to attach a file, but in practice typing @ in the composer is faster — it opens a fuzzy file search and you press Tab/Enter to insert the path. Reach for /mention only when you'd rather browse than type.

The traps: renamed and absent commands

Codex moves fast, and the internet is full of stale cheat sheets. Two specific gotchas trip up nearly everyone coming from an older guide or from Claude Code.

1. /approvals is gone — it's /permissions now. Older docs and muscle memory say /approvals to change what Codex can do without asking. The current command is /permissions ("Set what Codex can do without asking first"). /approvals no longer appears in the slash popup as its own entry. Just use /permissions.

2. There is no /undo. This is the big one. Codex deliberately does not ship an /undo slash command. Instead, rollback happens through your normal git workflow — Codex always surfaces a transcript of every action it took, so you can see exactly what changed and revert it with git.

bash
# Codex made changes you want to back out — use git, not a slash command
git status            # see what changed
git diff              # inspect the changes
git restore .         # discard unstaged edits to tracked files
git checkout -- path  # revert a specific file

The practical takeaway: work in a clean git tree so that "undo" is always one git restore away. The transcript tells you what happened; git is how you reverse it.

This is a real difference from Claude Code, which has session checkpoints you reach with Esc Esc / /rewind. In Codex, Esc Esc does something else entirely (it edits your previous message — see the keys section), and there's no built-in checkpoint stack. Git is your safety net.

Watch out

Don't go hunting for /undo

There is no /undo and no built-in checkpoint rewind in Codex. If you type it expecting Claude-Code-style behavior, nothing useful happens. Rely on git (git status / git diff / git restore) and the transcript instead — keep your tree clean before a risky task.

TUI keyboard shortcuts

Shortcuts drive the session, never show up in the slash popup, and are where the Codex-specific reflexes live. The single most important one to get right: interrupt is Ctrl+C, not Esc.

KeyAction
Ctrl+CCancel the current turn / close the session (this is interrupt — not Esc)
Ctrl+DExit the CLI
Ctrl+LClear the screen without starting a new conversation (distinct from /clear)
Ctrl+RReverse-search prompt history from the composer
Ctrl+OCopy the latest completed Codex response (same as /copy)
Ctrl+GOpen external editor (uses $VISUAL, falls back to $EDITOR)
Ctrl+TOpen/close the transcript overlay (keymap action open_transcript)
TabQueue follow-up text, slash, or ! commands for the next turn (while Codex runs)
Enter (while running)Inject new instructions into the current turn
Esc Esc(Composer empty) edit your previous message; keep pressing Esc to walk back, Enter to fork
Up / DownNavigate composer draft / prompt history

The pairs that confuse people:

  • Ctrl+C vs Esc Esc. Ctrl+C interrupts the running turn. Esc Esc (when the composer is empty) edits your previous message and lets you walk back through the transcript — pressing Enter from an earlier point forks the conversation. They are not interchangeable.
  • Ctrl+L vs /clear. Ctrl+L just repaints the screen; the conversation is intact. /clear actually starts a fresh chat. Use Ctrl+L when scrollback is messy but you want to keep going.
  • Tab vs Enter while Codex runs. Tab queues input for after the current turn; Enter injects it into the current turn immediately. Queue when you want it to finish first; inject when you need to course-correct now.

Watch out

Interrupt is Ctrl+C — Esc does not stop a turn

Coming from other agent tools, you may reflexively hit Esc to interrupt. In Codex, Ctrl+C cancels the current turn. A lone Esc does nothing useful mid-turn, and Esc Esc on an empty composer edits your prior message — the opposite of what you wanted if you were trying to stop a runaway action.

Composer modifiers: @, !, and images

Three modifiers shape a single message before you send it. They're how you feed Codex context without leaving the composer.

@ — fuzzy file search. Type @ to open a fuzzy search over the workspace root. Start typing a filename, then press Tab or Enter to drop the highlighted path into your message. This is the fast way to point Codex at a specific file.

text
Fix the validation bug in @src/auth/login.ts and update @tests/login.test.ts

! — inline shell command. Prefix a line with ! to run a local shell command and feed its output into the conversation as context. Great for showing Codex the current state without describing it.

text
!ls src/components
!git log --oneline -5

Image paste. Paste a screenshot or design spec directly into the composer — useful for a stack trace, a failing UI, or a mockup. (From outside the session you can also attach images at launch with codex -i screenshot.png "Explain this error"; -i/--image takes comma-separated or repeated files.)

Ctrl+T — transcript overlay. Not a composer modifier exactly, but it lives in the same flow: Ctrl+T opens (and closes) the transcript overlay, the scrollable record of everything Codex did this session. Its keymap action is open_transcript, default binding ctrl-t. This is also where you confirm what happened before you reach for git to undo it.

bash
# Attach images when launching, not just by pasting:
codex -i error.png,mockup.png "Make the page match the mockup and fix this error"

Example

A realistic composed message

Combine modifiers in one prompt: paste a screenshot of a failing test, then type — Here's the failure. The relevant code is @src/api/users.ts. Run !npm test to confirm before and after your fix. One message gives Codex the image, the file path, and a verification command.

Remapping shortcuts with /keymap

None of these bindings are fixed. /keymap remaps TUI shortcuts interactively and persists your choices to the [tui.keymap] section of config.toml (under CODEX_HOME, default ~/.codex/). That means your remaps survive restarts and travel with your config.

The config is grouped by where a binding applies — global, composer, chat:

toml
[tui.keymap.global]
open_transcript = "ctrl-t"

[tui.keymap.composer]
submit = ["enter", "ctrl-m"]   # a binding can have multiple keys

[tui.keymap.chat]
interrupt_turn = "f12"          # e.g. move interrupt off Ctrl+C

A binding can map to a list of keys (any of them triggers the action), as submit shows above. So if Ctrl+C for interrupt fights with your terminal habits, you can rebind interrupt_turn — but do it deliberately, since interrupt is the one shortcut you most need to find in a hurry.

Finally, the standing reminder for this whole lesson: the slash roster and some bindings are volatile. When a command in an old cheat sheet doesn't appear in your popup, don't assume you're wrong — assume the roster moved. Check the live page.

text
Live source of truth (bookmark it):
https://developers.openai.com/codex/cli/slash-commands

Tip

Let the popup teach you

You never need to memorize the full slash list. Type /, then a few letters — the popup filters live. The fastest way to learn the current roster is to open the popup and skim it in your own version of Codex, then confirm anything surprising against the docs page.

Try it: Build your own muscle memory for slashes, keys, and modifiers

Goal: turn this reference into reflexes in one short session. 1) Open the popup. In a small git repo, run codex, type /, and skim the live slash list — note any command here that's missing or renamed in your version, then open https://developers.openai.com/codex/cli/slash-commands and reconcile the difference. 2) Drill the workflow slashes. Run /status (read your config/usage), /model (see options, then cancel), and /diff on a repo with uncommitted changes. 3) Practice the review pair. Make a tiny edit, then run /diff to eyeball it and /review to get prioritized findings. 4) Prove there's no /undo. Let Codex make a small change, open the transcript with Ctrl+T to confirm what it did, then roll it back with git restore (NOT a slash). Write down why a clean tree matters before risky work. 5) Retrain interrupt. Start a longer task and stop it with Ctrl+C — confirm that Esc does not interrupt. Then on an empty composer press Esc Esc and watch it edit your previous message instead. 6) Queue vs inject. While Codex runs, press Tab to queue a follow-up and notice it waits; in a separate turn, press Enter mid-run to inject. 7) Use the modifiers. Compose one message that uses @ to insert a file path and a ! line to run a shell command, and paste a screenshot. 8) Remap one key. Run /keymap, rebind something harmless (e.g. add a second submit key), then open ~/.codex/config.toml and find the new [tui.keymap] entry. Deliverable: a five-line cheat note of the commands/keys you'll actually use, plus the one trap (/permissions, no /undo, Ctrl+C interrupt, Esc Esc edits, Tab queues) you were most likely to get wrong before this lab.

Key takeaways

  1. 1The composer speaks three keyboards: slash commands drive the system, keyboard shortcuts drive the session, and @/!/image modifiers shape a single message.
  2. 2Workflow slashes (/init, /model, /permissions, /review, /diff, /status, /compact, /clear, /new, /resume, /fork, /plan, /goal) cover the daily loop; a second tier (/mcp, /skills, /plugins, /hooks, /apps, /agent, /memories, /ide, /mention, /copy, plus cosmetics) reaches the surrounding systems.
  3. 3Two classic traps: /approvals is now /permissions, and there is no /undo — roll back with git (git status / git diff / git restore), guided by the transcript.
  4. 4Interrupt is Ctrl+C, not Esc. Esc Esc edits your previous message; Ctrl+L only clears the screen; Tab queues input for the next turn while Enter injects into the current one.
  5. 5@ opens fuzzy file search, ! runs an inline shell command, images paste directly, and Ctrl+T opens the transcript overlay (open_transcript).
  6. 6/keymap remaps any binding and persists it to [tui.keymap] in config.toml; because the roster is volatile, treat developers.openai.com/codex/cli/slash-commands as the live source of truth.

Quiz

Lock in what you learned

Check your understanding

0 / 4 answered

1.You're following an older Codex cheat sheet that tells you to type /approvals to change what Codex can do without asking, but it doesn't appear in the slash popup. What's going on, and what should you use?

2.Codex just edited several files and you want to back the changes out. You reach for an /undo command. What actually happens, and what's the right approach?

3.Codex is in the middle of a long action and is clearly heading the wrong way. Which key stops the current turn?

4.While Codex is still working, you want to add an instruction that runs only AFTER it finishes the current turn — not interrupt it. Which key does that, and how does it differ from Enter?

Go deeper

Hand-picked sources to keep learning