Skip to main content
o4 saves every interactive conversation as a session, so you can close the terminal and pick up where you left off later. This page covers how to resume a session, branch it with a fork, rename it, export or copy the transcript, and delete sessions you no longer need.

Resume a session

When you quit o4, it prints a summary with the command that resumes the session:
The Title: line appears only once the session has a title. There are three ways to resume: When you resume, the transcript comes back, the model continues with the full conversation, and you can go on typing. /resume <id> ends the current session first, the same way quitting does (it stays saved), then restarts o4 on the other session. o4 resume <id> with an ID that doesn’t exist fails with Error: Session '<id>' not found. A resumed session runs on the model you’d get when starting o4 now: the one you pass with -m, or your default model. It doesn’t switch back to the model the session last used; with the model router set up, the router can pick it. To pick a model, pass it when you resume, for example o4 -m anthropic:claude-sonnet-4-6 resume <id>, or use Resume with model… in the picker. o4 has no flag that resumes the most recent session. Run o4 resume in the project instead: the picker lists that project’s sessions with the most recently updated at the top, after any pinned ones. If you run o4 resume with no terminal attached, for example in a script, it prints the session list from every directory instead of opening the picker.

The session picker

The picker shows one card per session with its title, model and directory. It opens with only the sessions from the current checkout: your git repository and its linked worktrees, or just the current directory outside git. Press Tab to see sessions from every directory. Pinned sessions come first, then the most recently updated. The actions menu offers Resume, Resume with model…, Fork, Rename, Pin/Unpin and Delete…. Use Resume with model… to continue a session on a different model. Delete… asks you to confirm with y. While the model is working, /sessions still opens the picker, and renaming and pinning work, but resuming, forking and deleting a session are refused until the turn finishes. For a resume or a fork, o4 shows Wait for the current turn to finish before resuming, forking or rewinding. For a delete, it closes the picker and shows Wait for the current turn to finish before making this change. /resume typed during a turn waits until the turn finishes. Because typed letters go into the filter, the lowercase a, r and p filter the list. The shortcuts are uppercase.

Resuming in a different directory

A session remembers the directory it started in. If you resume it from somewhere else, o4 asks where to run it:
  • the session’s directory
  • the current directory
  • always use the session’s directory
  • always use the current directory
The two “always” choices save your answer in ~/.o4/config.toml, and o4 stops asking:
Set cwd = "current" to always stay where you are. Delete the [resume] section to be asked again. If the session’s directory no longer exists, o4 offers only the current directory.

Where sessions are stored

Sessions are stored under ~/.o4, for every project: o4 names a new session after your first prompt: its first line, up to 60 characters. Use /rename to change the name. Runs in print mode (o4 -p "...") aren’t saved as sessions.

List and delete sessions from the shell

o4 sessions list prints the sessions from the current checkout:
Each column is cut to fit, and long directories keep their end, such as …/code/api. The Updated time is in UTC. If the current checkout has no sessions but other directories do, o4 says how many exist elsewhere and suggests --all. Add --all to include sessions from every directory. Sessions saved by older o4 versions that didn’t record a directory only appear with --all. To delete a session, pass its ID:
You can also delete from the picker with A, then Delete….
Deleting a session removes it from the index, so it no longer appears in lists or the picker. The session’s folder under ~/.o4/sessions/ stays on disk, and o4 sessions delete reports success even when the ID doesn’t exist. To remove the transcript completely, also delete ~/.o4/sessions/<id>.
o4 doesn’t delete old sessions on its own. Sessions stay until you delete them.

Fork a session

A fork is a copy of the conversation up to now that you can take in another direction. The original session is left as it is.
/fork <name> creates the fork, named <name>, and opens it in a new tab next to the current one, so you can switch between the two (see Session tabs). The fork also appears in the session picker. Each fork of a session needs its own name: reusing one fails with Fork failed: a fork named '<name>' already exists. If you type /fork while the agent is working, it waits until the turn finishes. You can’t fork while background tasks are running (Finish or stop background tasks before forking). /fork with no name opens the Forks switcher. It lists the session with its forks nested under it, with each one’s message count. The first row, + new fork from here, creates a fork with the next free name, such as fork-1. Press Enter on another session to switch to it, which works like /resume <id>. In the session picker, A then Fork copies the whole selected session. From o4 resume, o4 then resumes the copy. From /resume, the copy is added to the list and you stay where you are. To branch from an earlier turn instead of the latest one, use the Time Machine. See Undo and rewind.

Rename a session

/rename with no title puts /rename and the current title in the prompt box, so you can edit the title and press Enter. You can also press R in the session picker.

Export and copy the transcript

The export has a ## User, ## Assistant or ## Tool Result heading for each message, with a timestamp, followed by the complete message as a JSON block. It includes tool calls and their results, so you can see exactly what happened. /export overwrites an existing file and makes the file readable only by you. Copying uses pbcopy on macOS and wl-copy, xclip or xsel on Linux. If none of them works, for example over SSH, o4 sends the text to your terminal’s clipboard with an OSC 52 escape sequence, which most modern terminals support. Set O4_CLIPBOARD_OSC52=0 to turn that off.
An export contains everything in the conversation, including file contents and command output the agent saw. Check it before you share it.

Start over

/clear clears the conversation in the current session, so the model starts with no history. To start a new session instead, press Alt+N to open one in a new tab, or quit and run o4 again.

Sessions in tabs

Each tab is its own saved session, with its own history, and it shows up in the session picker like any other. Alt+N opens a new tab, Alt+W closes the current one, and Alt+J / Alt+K switch between them. A fork made with /fork <name> opens in a tab too. See Session tabs for all the keys.