Post

Resume Claude Code Sessions After Restart

Restart Claude Code CLI and resume previous sessions with --continue or --resume commands instead of losing context.

Resume Claude Code Sessions After Restart

Close your terminal mid-session? Claude Code saves conversation history automatically. Resume the exact session instead of starting fresh.

Continue Most Recent Session

Restart Claude Code and pick up where you left off:

1
claude --continue

This loads your most recent conversation with full context—messages, code changes, and checkpoint history.

Resume Specific Session

List all saved sessions and choose one:

1
claude --resume

Interactive menu appears with session timestamps and first message. Navigate with arrow keys and press Enter.

Resume by ID

If you know the session ID:

1
2
3
claude --resume <sessionId>
# or short form
claude -r "<sessionId>"

Session IDs are UUIDs shown in the session list or stored in ~/.claude/sessions/.

Handle Stuck Sessions

Claude hangs but you want to keep the context? Interrupt and resume:

1
2
3
# Press Ctrl+C to interrupt
# Then immediately continue
claude --continue

This retries the last request in the same session without losing conversation history.

Session Resumption vs Rewind

Resume restores a conversation. Rewind rolls back changes within a session.

When to Resume

  • After closing the terminal
  • When switching between projects
  • After system restart
  • To continue from different machine (if syncing session files)

When to Rewind

  • Undo recent code changes
  • Return to earlier conversation state
  • Test different approaches from same checkpoint

Press Esc twice or type /rewind to open the checkpoint menu. Choose “conversation only”, “code only”, or both.

Session Persistence

Sessions persist across restarts. Checkpoints remain accessible after resuming.

1
2
3
4
5
6
7
# Create checkpoint mid-session
/checkpoint

# Later, after restart
claude --continue
# Then rewind to that checkpoint
/rewind

Checkpoint names sync with resumed sessions, so you can restore specific states even after closing Claude Code.

Environment Differences

Terminal CLI

  • claude --continue and claude --resume work out of the box
  • Sessions stored in ~/.claude/sessions/
  • Full checkpoint history available after resume

VS Code Extension

  • Conversations auto-save to workspace
  • Reopen workspace to continue previous session
  • Use Command Palette → “Claude Code: Manage Conversations” to switch sessions

Terminal CLI offers more explicit session control. VS Code binds sessions to workspaces.

Common Scenarios

Long-running task with context limit approaching:

1
2
3
4
# Before hitting limit, create checkpoint
/checkpoint
# Exit and continue in fresh instance
claude --continue

Working on multiple projects:

1
2
3
4
5
6
7
8
9
# Project A
claude
# ... work ...
# Exit, switch to Project B
claude
# ... work ...
# Back to Project A
claude --resume
# Select Project A session from list

System crash recovery:

1
2
3
# After unexpected shutdown
claude --continue
# Picks up from last auto-saved state

Important Notes

  • Sessions auto-save after every message exchange
  • --continue always loads the most recent session
  • --resume without ID shows interactive picker
  • Ctrl+C doesn’t corrupt sessions—safe to interrupt and resume
  • Checkpoint metadata persists across resumed sessions
  • Session files are plain text JSON (for manual inspection/backup)

Configuration location: ~/.claude/sessions/

☕ Support My Work

If you found this post helpful and want to support more content like this, you can buy me a coffee!

Your support helps me continue creating useful articles and tips for fellow developers. Thank you! 🙏

This post is licensed under CC BY 4.0 by the author.