⌥+⌃AltPlusCtrl

Codex CLI Session Control Shortcuts

Session control in Codex CLI spans two mechanisms that look similar and are not — genuine terminal key bindings such as Ctrl+C and Ctrl+L, and slash commands such as /clear and /compact. The pairs that sound equivalent generally are not.

ActionWindowsMacDescription
Cancel the current operationCtrl+CCtrl+CStops whatever the agent is doing and returns control to the composer, leaving the conversation intact. Pressing it a second time quits the session — so a reflexive double tap ends more than you meant.
Exit the sessionCtrl+DCtrl+DLeaves Codex CLI, with a second press forcing the exit if something is still winding down. The /exit and /quit slash commands do the same thing from the composer if your hands are already there.
Clear the terminal screenCtrl+LCtrl+LWipes the visible scrollback without touching the conversation — the model still remembers everything. This is the key difference from /clear, which resets the transcript and starts a fresh chat inside the same session.
Reset the conversation/clear/clearClears the visible transcript and starts a fresh chat, discarding the context the model was carrying. /new does the same without leaving the terminal, and both are what you want when the conversation has drifted rather than merely got long.
Summarise the conversation to free context/compact/compactReplaces the accumulated conversation with a summary, reclaiming context window while keeping the thread of what you were doing. The middle option between carrying on and starting over, and the right one when a long session is still going somewhere.
Resume or fork a previous conversation/resume, /fork/resume, /fork/resume picks a saved conversation back up where it stopped; /fork branches the current one into a new thread while leaving the original intact. Forking is the safe way to try a different approach without losing the path you were on.
Ctrl+C cancels whatever the agent is currently doing and hands control back to the composer with the conversation intact. Pressing it twice quits the session entirely. That second press catches people, because a double tap on Ctrl+C is a deeply ingrained terminal reflex from years of killing runaway processes — here it ends a session you probably wanted to keep. One press, then a pause to see whether the agent actually stopped, is the habit worth building. Ctrl+D exits, with a second press forcing the matter if something is still shutting down. /exit and /quit do the same from the composer, which is genuinely more convenient when your hands are already typing. There is no meaningful difference between the routes; it is purely about where your fingers happen to be. The pair most worth separating clearly is Ctrl+L and /clear. Ctrl+L clears the visible terminal scrollback and nothing else — the model retains the entire conversation and will answer as though the screen was never touched. /clear resets the transcript and starts a fresh chat inside the same session, genuinely discarding the accumulated context. The screen looks identical after either one, which is exactly why the distinction is worth knowing before you need it. Wanting a tidy display is Ctrl+L; wanting the agent to forget a line of reasoning that went wrong is /clear. /compact sits between those two. Rather than discarding the conversation or carrying all of it, it replaces the accumulated history with a summary, reclaiming context window while preserving the thread of what you were working on. This is the right command for a long session that is still going somewhere — the point where you notice responses becoming less precise as the context fills, but starting over would mean re-establishing everything the agent has already learned about the codebase. /resume and /fork handle continuity across sessions. /resume lists saved conversations and picks one back up where it stopped, so closing a terminal is not the end of a piece of work. /fork branches the current conversation into a new thread while leaving the original untouched, which is the safe route for trying a different approach — you keep the path that got you here and can return to it if the branch does not work out. Both sound like housekeeping and are genuinely valuable the first time a long session goes wrong near the end. /new is the lighter-weight sibling of /clear, starting a fresh conversation inside the same session without leaving the terminal. In practice the choice between them rarely matters; both give you a clean context in the same place. One behaviour deserves emphasis because it is invisible until it bites. Context accumulates continuously — every file you attach, every command output the agent reads, every exchange — and its effects degrade gradually rather than failing outright. Responses grow vaguer, earlier instructions get less weight, and nothing announces that this is happening. /status reports how much context is in use, and checking it occasionally during a long session is how you catch the drift before it becomes confusing. When it is filling, /compact is usually the right answer and /clear is the heavier one. Worth remembering across all of this: Codex acts on real files. A session that has become confused is not merely producing worse text, it is producing worse edits to a working tree. That is the argument for resetting context sooner than feels necessary rather than later. One practical wrinkle in how sessions end. Closing the terminal window does not lose the conversation — Codex saves sessions, and /resume will list it again later. What closing the window does lose is anything the agent was midway through, which on a turn involving several file edits can leave a working tree in a partial state. Ctrl+C to stop cleanly, then /diff to see where things actually stand, is the orderly way out of a session you want to abandon; closing the terminal is the abrupt one, and the difference shows up in the files rather than in the transcript. It is also worth knowing that these commands operate at different scopes, which is the source of most confusion between them. Ctrl+L acts on your terminal. /clear, /new and /compact act on the conversation the model can see. /resume and /fork act on the stored session as an object that outlives the terminal entirely. Three layers, and a command that seems not to have worked has usually acted correctly on a different layer from the one you had in mind. Finally, a word on when to end a session rather than manage it. Codex sessions are cheap to start and the stored history means nothing is really lost, so the instinct to preserve a long-running conversation is usually misplaced. If the agent has misunderstood something structural about the task, no amount of compacting will remove that misunderstanding from the summary it produces — the wrong idea gets carried forward in condensed form. Starting fresh with a better-framed opening prompt is frequently faster than correcting a session that began badly, and /fork exists precisely so that abandoning a direction does not mean abandoning the work that preceded it.