# #21: Naming and Resuming Sessions 📼

> How Claude Code sessions work: naming them, getting back to them, and branching off to try something different.

Published 2026-11-23 by Jake Marsh on Little Cups of Claude. Canonical: https://littlecupsofclaude.com/21
Topics: [Context](https://littlecupsofclaude.com/topics/context), [Claude Code CLI](https://littlecupsofclaude.com/topics/claude-code-cli)

Today we'll look at how **Claude Code** sessions work: naming them, getting back to them, and branching off to try something different.

A **session** is a saved conversation tied to a project directory. **Claude Code** saves it continuously as we work, so closing the terminal (or running `/clear`) doesn't lose anything. Let's dive in.

## Picking Up Where We Left Off

There are a few ways back in:

```bash
claude --continue          # most recent session in this directory
claude --resume            # open the session picker
claude --resume auth-fix   # jump straight to a named session
claude --from-pr 128       # sessions linked to a pull request
```

Inside a running session, `/resume` switches to a different conversation without quitting.

A resumed session brings back the conversation, the model it was using, and usually its permission mode. Flags like `--mcp-config`, `--settings`, and `--add-dir` aren't restored, so we pass those again if the session needed them.

## Naming Sessions

Unnamed sessions get a generated title from our first prompt, but a real name is much easier to find again:

```bash
claude -n hal-auth-refactor
```

```text
/rename hal-auth-refactor
```

The name also shows up on the prompt bar. Once it's named, `claude --resume hal-auth-refactor` takes us right back. This matters most when we've got a few tasks going in parallel.

## The Session Picker

`claude --resume` with no name opens a picker. A few keys worth knowing:

```text
Space     preview a session
Ctrl+R    rename the highlighted session
Ctrl+B    only sessions from the current git branch
Ctrl+W    widen to every worktree of this repo
Ctrl+A    widen to every project on this machine
```

Typing almost anything else searches. We can even paste a pull request URL to find the session that created it. Neat!

## Branching A Session

Sometimes we want to try a different approach without losing the path we're on. `/branch` copies the conversation so far and switches us into the copy:

```text
/branch try-streaming-approach
```

The original stays untouched in the picker. From the shell, the same thing is `--fork-session`:

```bash
claude --continue --fork-session
```

## Getting Data Out

`/export` copies the conversation to our clipboard or saves it as a readable text file. For scripts, it's better to ask a session directly:

```bash
claude -p --resume <session-id> --output-format json \
  "summarize what we changed" | jq -r '.result'
```

Under the hood, transcripts live as **JSONL** in `~/.claude/projects/<project>/<session-id>.jsonl`. The format is internal and changes between versions, so scripts that parse those files directly can break on any release.

## Watch Out

Resuming the same session in two terminals without forking makes the messages from both interleave into one transcript. Branch first if we want two lines of work.

Sessions started with `claude -p` or the **Agent SDK** don't show up in the picker or in `--continue`. We can still resume them by passing the session ID to `--resume`.

More info about **sessions** can be found at [the Claude Code docs](https://code.claude.com/docs/en/sessions).
