# Claude Code session management: IDs, resume, restart, many at once

Everything about managing Claude Code sessions in one place: find a session ID, name, resume and restart sessions, run several at once and keep them going.

Source: https://hivemux.dev/guides/claude-code-session-management/

> A Claude Code session is one conversation, saved as ~/.claude/projects/<project>/<session-id>.jsonl. Name it with claude -n or /rename, reopen it with claude --continue, claude --resume or /resume, and after an update use /restart. /clear starts a new session; /compact keeps the same one. To run several at once, give each its own folder or worktree and terminal or tmux pane.

Claude Code keeps every conversation as a session you can name, reopen, restart and run alongside others. The commands for each are spread across Claude Code's docs; this page puts them in one place and links to a detailed guide for each.

## The session at a glance

| You want to | Do this | More |
|---|---|---|
| Know which session you are in | `echo $CLAUDE_CODE_SESSION_ID`, or `session_id` in the status line | [Session ID](/guides/claude-code-session-id/) |
| Find a past session | `claude --resume` (picker), or the files in `~/.claude/projects/<project>/` | [Session ID](/guides/claude-code-session-id/) |
| Give it a name | `claude -n login-bug`, or `/rename login-bug` inside it | [Resume](/guides/resume-claude-code-sessions/) |
| Reopen the last one | `claude --continue` (`-c`) in the same folder | [Resume](/guides/resume-claude-code-sessions/) |
| Reopen a specific one | `claude --resume <id or name>`, or `/resume` inside a session | [Resume](/guides/resume-claude-code-sessions/) |
| Try two directions from one point | `claude --resume <id> --fork-session` | [Resume](/guides/resume-claude-code-sessions/) |
| Restart after an update | `/restart`, or `/exit` then `claude --continue` | [Restart](/guides/restart-claude-code/) |
| Start fresh, or shrink a long one | `/clear` (new session) or `/compact` (same session) | [/clear vs /compact](/guides/claude-code-clear-vs-compact/) |
| Run several at once | one folder or worktree and one pane each | [Multiple sessions](/guides/run-multiple-claude-code-sessions/) |
| Keep it going when the terminal closes | run it inside tmux | [Keep it running](/guides/keep-claude-code-running/) |
| Hear when one needs you | Claude Code's notification setting or its Notification hook | [Notifications](/guides/claude-code-notifications/) |

## 1. What a session is

A session is one conversation. Claude Code gives it a session ID, a UUID such as `550e8400-e29b-41d4-a716-446655440000`, and saves every message and tool call as it goes to a JSON Lines file:

```
~/.claude/projects/<project>/<session-id>.jsonl
```

`<project>` is the folder you started in, with every character that is not a letter or digit replaced by `-`. Transcripts are kept for 30 days by default (`cleanupPeriodDays` in settings). Because the whole conversation is on disk, closing Claude Code never loses it. How to read the current ID, and find old ones: [How to get the Claude Code session ID](/guides/claude-code-session-id/).

## 2. Name it, so you can find it again

IDs are hard to remember. Start a session with `claude -n login-bug`, or type `/rename login-bug` inside it (`/rename` alone makes up a name). The name shows in the prompt bar, the terminal title and the resume picker, and `claude --resume login-bug` opens it directly. Sessions without a name show a generated title instead.

## 3. Resume and continue

In the folder you worked in:

```sh
claude --continue          # the latest conversation in this folder
claude --resume            # a picker: type to search, Space to preview
claude --resume login-bug  # by name or ID
```

Inside a running session, `/resume` switches to another one. In the picker, `Ctrl+A` shows every project, `Ctrl+B` filters by git branch, and pasting a pull request URL finds the session that made it. A resumed session brings back its history, model and permission mode; launch flags such as `--mcp-config` are not restored. Details: [How to resume a Claude Code session](/guides/resume-claude-code-sessions/).

## 4. Restart without losing the chat

After Claude Code installs an update, `/restart` restarts into the new version and resumes the same session (Pro, Max and Ultra plans, native install on macOS or Linux). Otherwise `/exit` and `claude --continue` take a few seconds. Most configuration does not need a restart at all: settings and hooks reload while Claude runs, and plugins, skills and MCP servers have their own reload commands. The full table: [How to restart Claude Code](/guides/restart-claude-code/).

## 5. New session or the same one: /clear and /compact

`/clear` starts a new conversation with a new session ID; the old one stays on disk and `/resume` can bring it back. `/compact` summarizes what came before and goes on in the same session. Which to use when a session gets long: [/clear vs /compact](/guides/claude-code-clear-vs-compact/).

## 6. Many sessions at once

Running two or more sessions is normal once you trust Claude with separate tasks. Three rules keep them apart:

- **One folder or git worktree each**, so two sessions never edit the same files.
- **One terminal tab or tmux pane each**, so you can see and reach each one.
- **A name each**, so the resume picker stays readable.

How to set that up, and what goes wrong without it: [How to run multiple Claude Code sessions](/guides/run-multiple-claude-code-sessions/). For one goal split across roles that hand work to each other, see [a team of agents](/guides/claude-code-team-of-agents/).

## 7. Keep them running, and know which one needs you

A session started in a plain terminal ends when the window closes. Started inside tmux, it keeps running and you can attach to it again, even from another computer: [Keep Claude Code running](/guides/keep-claude-code-running/) and [Claude Code with tmux](/guides/claude-code-tmux/).

With several running, the hard part is noticing the one that is waiting for an approval or an answer. Claude Code can tell you itself, or through its Notification hook: [Claude Code notifications](/guides/claude-code-notifications/), and for the prompts themselves, [approving permission prompts](/guides/approve-claude-code-permission-prompts/). When the weekly limit stops the work, see [Claude Code usage limits](/guides/claude-code-usage-limit/).

## Tools that manage sessions for you

Several open-source tools put all your sessions on one screen. They differ in approach (tmux, a terminal UI, a desktop app), in whether they create worktrees, and in which agents they support: [Claude Code session managers compared](/guides/session-managers/).

hivemux is ours: a tmux sidebar that shows every Claude Code session (running, waiting for you, or done) and lets you jump to the one that needs you. It records each session's ID from a hook, so after a reboot every pane comes back in its own conversation.

```sh
curl -fsSL https://hivemux.dev/install.sh | bash   # macOS or Linux
```

## FAQ

### What is a Claude Code session?

One conversation with Claude Code. It has a session ID (a UUID) and is saved as a JSON Lines transcript under `~/.claude/projects/`, in a folder for the directory it was started in. Transcripts are kept for 30 days by default (`cleanupPeriodDays`).

### How do I see all my Claude Code sessions?

Run `claude --resume` (or `/resume` inside a session) to open the picker. It shows the current worktree by default; `Ctrl+W` widens it to all worktrees and `Ctrl+A` to all projects. On disk, each `.jsonl` file under `~/.claude/projects/<project>/` is one session.

### Does /clear delete my session?

No. `/clear` starts a new conversation with a new session ID and leaves the old one on disk, where `/resume` can bring it back. `/compact` summarizes the conversation and keeps the same session.

### How do I run several Claude Code sessions without them getting in each other's way?

Give each one its own folder or git worktree so they do not edit the same files, run each in its own terminal tab or tmux pane, and name them (`claude -n`) so you can find them in the resume picker.

### Is there a tool to manage many Claude Code sessions?

Yes, several open-source ones: tmux tools such as hivemux, Claude Squad and Agent Deck, a terminal UI (CCManager), a terminal app (cmux) and desktop or web apps. They are compared in Claude Code session managers compared.
