Session anatomy
Every Claude Code session stores a specific set of state: your conversation history, every tool use and its result, the contents of CLAUDE.md, auto memory (the first 200 lines), any loaded skills, and the system instructions. Each session has a unique ID and is stored locally.
Crucially, a brand-new session starts with a completely fresh context — it has no memory of previous sessions unless something durable captured it, namely auto memory or CLAUDE.md. Everything else lives and dies with the session.
Resume vs. fork
Resume — claude --continue
Pick up exactly where you left off: same session ID, same history. Session-scoped permissions reset and need re-approving, but the conversation itself is intact.
Fork — --continue --fork-session
A new session ID that starts with all history up to the fork point. The original is untouched — perfect for trying a different approach or running parallel experiments.
Reach for fork whenever you want to explore an alternative solution without losing the path you were on. It branches the conversation the same way git branches code.
Naming sessions
Long-running work is far easier to find and resume when the session has a meaningful name. Name by feature plus date:
claude --session-name "auth-refactor-2026-05-29"
Context window management
Run /context at any time to see what's consuming space. The usual suspects are: CLAUDE.md (keep it focused), MCP tool definitions (defer them with tool search), conversation history (compact aggressively), and file contents (loaded on read, not at session start).
When history gets heavy, compact it manually and tell Claude what matters so the summary keeps the right details:
/compact focus on the authentication changes we discussed
The context cost hierarchy
Not all context is equally expensive. From cheapest to most expensive:
- Auto memory references — tiny
- Skill descriptions — small; full content is deferred until invoked
- CLAUDE.md — moderate; loads fully on every session
- MCP tool definitions — moderate; deferrable with tool search
- Conversation history — grows unbounded without compaction
- File contents read during the session — a cost per read
The takeaway: the things that quietly balloon are conversation history and file reads. Compact often, and don't re-read files you already have in context.
Parallel sessions with worktrees
Each Claude session is tied to a directory. Git worktrees create separate directories for separate branches, which means you can run genuinely parallel sessions with zero context collision between them:
# Create worktrees for parallel feature work
git worktree add .worktrees/feature-auth feature/auth-refactor
git worktree add .worktrees/feature-payments feature/payment-system
# Run Claude in each worktree simultaneously
cd .worktrees/feature-auth && claude &
cd .worktrees/feature-payments && claude &
Auto memory
Claude builds auto memory automatically — ~/.claude/memory.md at user scope or .claude/memory.md at project scope. It captures durable facts like build commands, debugging insights, your naming preferences, and recurring patterns, so future sessions start a little smarter.
Audit it with the /memory command and edit or delete entries that are wrong or outdated — stale memory is worse than no memory.
Try it: Start a large feature, compact at the halfway point, and resume the next day. Notice how much context survived and how well Claude remembered where you left off.
Hands-on exercise
Start a large feature, run /compact at the halfway point with a focus instruction, then close the session. Resume it the next day with claude --continue and evaluate how much context was preserved and how well Claude remembered where you left off.
Sessions & Context FAQ
What is the difference between resuming and forking a Claude Code session?
Resuming with claude --continue picks up exactly where you left off using the same session ID and history, though session-scoped permissions reset and need re-approving. Forking with --continue --fork-session creates a new session ID that starts with all history up to the fork point while leaving the original untouched — ideal for trying a different approach or running parallel experiments.
How do you manage the Claude Code context window?
Run /context at any time to see what is consuming space — usually CLAUDE.md, MCP tool definitions, conversation history, and file contents. When history gets heavy, run /compact with a focus instruction so the summary keeps the right details, and avoid re-reading files you already have in context.
What is auto memory in Claude Code?
Auto memory is a file Claude builds automatically — ~/.claude/memory.md at user scope or .claude/memory.md at project scope — that captures durable facts like build commands, debugging insights, naming preferences, and recurring patterns so future sessions start smarter. Audit it with the /memory command and delete entries that are wrong or outdated, since stale memory is worse than no memory.
How do you run parallel Claude Code sessions?
Each Claude session is tied to a directory, so use git worktrees to create separate directories for separate branches and run genuinely parallel sessions with zero context collision. Add a worktree per feature branch and launch Claude in each directory simultaneously.
Why should you name Claude Code sessions?
Long-running work is far easier to find and resume when a session has a meaningful name. Naming by feature plus date — for example claude --session-name "auth-refactor-2026-05-29" — makes it simple to locate the right session days later instead of scrolling through unnamed IDs.
Quick summary
- Resume continues a session as-is; fork branches it without touching the original
- Name long-running sessions by feature and date so they're easy to find and resume
- Use
/contextto inspect cost and/compactto preserve what matters - Git worktrees give true parallel sessions;
/memoryaudits durable auto memory