Skip to main content

Session & Memory Management

Session Lifecycle

0:00
LearnStep 1/3

Understanding Sessions

The Session Lifecycle

Claude Code maintains a stateful session from the moment you run claude. This session tracks:

  • Conversation history
  • Files you've read
  • Tools that have been executed

Unlike standard chat interfaces, the CLI is designed for long-running interactions.

Session Persistence

Claude Code can resume sessions. When you exit and come back, you may be able to continue where you left off (depending on configuration).

When to Clear

As sessions grow, context can become cluttered. Use /clear when:

  • Switching to a completely different task
  • Claude seems confused by old context
  • You want to reduce token usage