Session Management in AI

From the Claude Code cheat sheet ยท Essential Commands ยท verified Jul 2026

Session Management

Control your Claude Code session

bash
# Authentication
/login          # Log in to your account
/logout         # Sign out completely

# Session control
/exit           # Exit Claude Code (also: exit, Ctrl+C)
/clear          # Clear conversation history
/help           # Show available commands

# Context management
/compact        # Reduce context size when near limit
bash
// EXAMPLE: Managing a long session
> "Help me build a REST API"
[... extensive work ...]
> /compact  // Reduce context when getting full
> "Now add authentication"

// EXAMPLE: Starting fresh
> /clear
> "Let's work on a different feature"
๐Ÿ“Œ Use /clear to start fresh
๐Ÿ“Œ /compact helps with long sessions
๐Ÿ“Œ Multiple ways to exit
commandssession

More AI tasks

Back to the full Claude Code cheat sheet