Claude Code

Session management

Name, resume, branch, export, and store Claude Code sessions, including /clear, /resume, /branch, /cd, --continue, and --resume.

A Claude Code session is a saved conversation associated with a project directory. It continually writes a local transcript so you can resume after exiting, branch from an intermediate point, or switch between tasks.

#Resume entry points

Entry pointPurpose
claude --continue / claude -cResume the most recent session in the current directory
claude --resume / claude -rOpen the session picker
claude --resume <name>Resume by a name you assigned
claude --resume <session-id>Resume by ID
/resumeSwitch to another session from the current one
/resume <name>Switch by name
claude --from-pr <number>Find the session associated with a PR

Non-interactive sessions from claude -p or the Agent SDK usually do not appear in the picker, but can be resumed by ID. See Headless automation.

#Name a session

WhenAction
At startupclaude -n auth-refactor
During a session/rename auth-refactor
In the pickerHighlight a session and press Ctrl+R
After accepting a planClaude Code may name it from the plan

Names help with parallel tasks. Do not rely on an automatically displayed name as a stable resume handle; assign one yourself.

#Session picker shortcuts

ShortcutAction
↑ / ↓Move up/down
→ / ←Expand/collapse groups
EnterResume the selected session
SpacePreview the conversation
Ctrl+RRename
/Search
Ctrl+AInclude all projects on this machine
Ctrl+WInclude all worktrees of this repository
Ctrl+BFilter by the current Git branch
EscExit the picker or search

For a session in an unrelated project, the picker may copy a cd && claude --resume ... command instead of switching directly.

#Branch and fork

/branch [name] copies the current conversation and switches to the new branch. The original stays intact and can be resumed.

/branch try-streaming-approach

Fork from the CLI with:

claude --continue --fork-session
ConsiderationDetail
PermissionsApprovals limited to this session do not automatically carry into the branch
Two terminals on one sessionMessages share a transcript and can interleave
Undoing a small detourPrefer /rewind over branching
Isolating file changesUse --worktree or /batch

#/cd and /add-dir

CommandPurpose
/cd <path>Move the current session to another working directory
/add-dir <path>Add an accessible directory without moving the session
--add-dir <path>Grant additional directory access at startup

The official documentation describes /cd as preserving the conversation cache where possible. The new directory's CLAUDE.md is appended as a message rather than rebuilding the system prompt. The session then appears in the new directory's picker. See Worktrees for isolated multi-directory development.

#Export and transcripts

NeedRecommended approach
Share a full conversation with a person/export
Get one run's result in a scriptclaude -p --output-format json
Follow up on an existing session as JSONclaude -p --resume <session-id> --output-format json "..."
Archive a conversation in a hookRead transcript_path from hook input
Manage sessions in a productUse the Agent SDK

Default transcript path:

~/.claude/projects/<project>/<session-id>.jsonl

JSONL transcripts are an internal format that can change. Prefer /export, JSON print output, or the Agent SDK rather than depending on internal fields.

#Cleanup and retention

SettingPurpose
CLAUDE_CONFIG_DIRChange the configuration and transcript root
cleanupPeriodDaysSet local session retention in days
CLAUDE_CODE_SKIP_PROMPT_HISTORYDisable writing prompt history
--no-session-persistenceDo not save a session for this claude -p run
claude project purge [path]Remove a project's local Claude Code state

#Official references

Support

Need help?

For setup, billing, or model issues, email us. Check the status page for uptime.

WeChat / QQ support is available at the bottom right.