Mechanics

Claude Code Sessions: Resume, Continue, and Fork

Understand Claude Code sessions, including --continue, --resume, /resume, session names, local transcripts, branching, and context management.

Claude Code Sessions

A Claude Code session is a saved conversation tied to a project directory. Sessions matter because real coding work often spans restarts, branches, compaction, and multiple attempts at the same problem.

Last checked on July 8, 2026. This page focuses on Claude Code CLI sessions. Claude Code on the web, the desktop app, and the VS Code extension maintain their own session histories.

Quick Answer

Use claude --continue to resume the most recent session in the current directory. Use claude --resume or /resume when you need to pick a specific saved session. Use session naming and branching when you are comparing approaches or need a handoff trail.

Do not keep every task in one endless conversation. A saved session helps continuation; it does not make unrelated context cheaper or clearer.

Session Commands

CommandWhat it doesUse when
claude --continueResumes the most recent session in the current project.You just closed the terminal and want to continue.
claude --resumeOpens the session picker.You have multiple saved sessions.
claude --resume <name>Resumes a named session directly.You named sessions by task or branch.
claude --resume <session-id>Resumes by ID when available.Automation or transcript lookup gives you the ID.
/resumeSwitches from inside an active session.You realize the current conversation is the wrong one.
/renameGives the session a useful title.The default title is vague.
/clearStarts fresh context while preserving the ability to resume old sessions.You are switching tasks.
/compactSummarizes a long session to keep it usable.Same task, too much history.

Resume vs Compact vs Clear

SituationBest moveWhy
Same task, same repo, terminal was closedclaude --continueKeeps the prior working context.
Same task, but context is bloated/compact with instructionsPreserves decisions while dropping noise.
Different task in the same repo/clear or a new sessionAvoids dragging unrelated files and logs forward.
Testing a second approachBranch or fork the sessionKeeps the original trail intact.
Need to find an older threadclaude --resumeUses the picker instead of guessing.

Naming Convention

Name sessions by outcome, not emotion:

/rename pricing-page-seo-refresh
/rename auth-timeout-debug
/rename release-2026-07-08

Good names make claude --resume useful. Bad names like test, new idea, or fix stuff collapse into noise after a week.

Cost And Context Rules

  1. A saved session is not free context. Long history still affects focus and usage.
  2. Use /clear for unrelated tasks, even if they are in the same repository.
  3. Use /compact only with focus instructions, such as changed files, decisions, unresolved risks, and verification commands.
  4. Do not resume a stale session for production edits until you re-check git status, current branch, and changed files.
  5. For API-billed work, run /status and /usage before resuming a long or automated session.

Common Failure Modes

SymptomLikely causeFix
No conversation found for a session IDSession lookup is scoped to the project directory or worktrees.Run the command from the original project directory.
The resumed session talks about old filesContext was carried forward from a stale task.Use /clear, then restate the current file paths.
The session picker is crowdedSessions were never renamed or cleared.Rename active work and close dead threads.
Claude repeats outdated assumptionsRepo changed after the session was saved.Ask it to re-read current files and git status.
Usage climbs after resumingOld context and logs are still present.Compact or start fresh.

Official Sources