Back to Claude Code hub
INTERMEDIATEsnapshot-basedVerified 2026-03-31core

Sessions, Resume, and Compaction

How Claude Code persists work across long conversations

A guide to transcript storage, session resume behavior, cross-project boundaries, and why long-lived conversations need compaction.

Sessions are file-backed, not just in-memory chat threads

Claude Code persists transcript data to project-scoped files and uses explicit path logic for transcripts, session directories, and sub-agent logs.

This lets long-running work survive beyond a single terminal view.

  • Transcript paths are derived from the project/session context.
  • Sub-agents can write their own transcript files beneath the session.
  • The storage layer is careful about message chain integrity.

Resume is selective and project-aware

The resume flow is not a naive list of every conversation. It filters resumable sessions, supports worktree-aware lookup, and warns when a conversation belongs to a different directory.

That protects users from resuming context in the wrong project and making confusing edits.

  • Same-repo worktrees are treated differently from unrelated projects.
  • Cross-project resumes can produce a command instead of directly reopening the conversation.
  • Lite logs can be expanded into full logs when needed.

Compaction is the price of long-lived agentic work

Transcript persistence alone is not enough. The active prompt still needs to fit within model limits, which is why compaction and budget handling sit next to session logic in the broader system.

In practice, sessions and compaction are two halves of the same durability story.

Learn next

These guides are adjacent to the current topic and make the learning path easier to follow.