> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open4rena.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Sessions

> Resume, fork, rename, export, and delete saved conversations.

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:

```text theme={null}
o4 session ended
Title: Fix the flaky login test
Session: 3f2b9c1e-8a4d-4c2e-9f1a-7b6d5e4c3a21
Model: anthropic:claude-sonnet-4-6
Runtime: 12m 4s
Usage: 48210 input / 6120 output tokens, cache 102400 read / 8800 write, $0.4213
Resume: o4 resume 3f2b9c1e-8a4d-4c2e-9f1a-7b6d5e4c3a21
```

The `Title:` line appears only once the session has a title.

There are three ways to resume:

| Command | What it does |
| - | - |
| `o4 resume` | Opens the session picker. |
| `o4 resume <id>` | Resumes that session directly. |
| `/resume` | Opens the same picker from inside o4. `/resume <id>` switches to that session. |

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](/models/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.

| Key | Action |
| - | - |
| `Enter` | Resume the selected session. |
| `Up` / `Down`, `PageUp` / `PageDown` | Move through the list. |
| Any text | Filter the list by title, preview, session ID, model or directory. `Backspace` deletes a character and `Ctrl+U` clears the filter. |
| `Tab` | Switch between sessions from this checkout and sessions from every directory. |
| `Ctrl+S` | Sort by last update or by creation time. |
| `A` | Open the actions menu for the selected session. |
| `R` | Rename the selected session. |
| `P` | Pin or unpin the selected session. Pinned sessions stay at the top. |
| `Esc` | Close the picker. |

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:

```toml theme={null}
[resume]
cwd = "session"
```

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:

| Path | Contents |
| - | - |
| `~/.o4/sessions/<id>/journal.jsonl` | The full record of one session. o4 rebuilds a session from this file when you resume it. |
| `~/.o4/sessions.db` | An index of all sessions, with titles, models, directories and pins. The picker and `o4 sessions list` read it. |

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](/guides/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:

```bash theme={null}
o4 sessions list
```

```text theme={null}
ID                                     Model                Title                          Directory                      Updated
---------------------------------------------------------------------------------------------------------------------------------
3f2b9c1e-8a4d-4c2e-9f1a-7b6d5e4c3a21   anthropic:claude-... Fix the flaky login test       ~/code/api                     2026-09-24 14:02:11
```

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:

```bash theme={null}
o4 sessions delete 3f2b9c1e-8a4d-4c2e-9f1a-7b6d5e4c3a21
```

You can also delete from the picker with `A`, then `Delete…`.

<Warning>
  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>`.
</Warning>

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.

```text theme={null}
/fork try-sqlite
```

`/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](/guides/interface#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](/guides/checkpoints).

## Rename a session

```text theme={null}
/rename Migrate auth to OAuth
```

`/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

| Command | What it does |
| - | - |
| `/export <path>` | Writes the whole conversation to a Markdown file. |
| `/export clipboard` | Copies the same Markdown to the clipboard. |
| `/copy` or `/copy last` | Copies the model's last reply. |
| `/copy all` | Copies the whole conversation as Markdown. |

```text theme={null}
/export notes/login-fix.md
```

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.

<Note>
  An export contains everything in the conversation, including file contents and command output the agent saw. Check it before you share it.
</Note>

## 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](/guides/interface#session-tabs) for all the keys.

## Related pages

* [Undo and rewind](/guides/checkpoints): go back to an earlier point in a session.
* [Context and cost](/guides/context-and-cost): keep a long session within the model's context window.
* [CLI reference](/reference/cli): every `o4` command and flag.
