Sessions & resumption
A session in Claude Code is a persistent conversation thread that records every prompt, agent reasoning step, tool call, tool result, and file interaction to disk. The SDK writes this transcript automatically so you can pause work and return to it later without losing context. Each session is tied to a specific project directory and stored locally under ~/.claude/projects/ as a transcript file (JSONL format).
Resuming a session means the agent has full context from before: files it already read, analysis it already performed, decisions it already made. You can ask follow-up questions, recover from interruptions, or branch off to try a different approach without re-explaining your codebase or repeating prior work.
The SDK exposes three distinct patterns: 'continue' (automatically picks up the most recent session in the current directory), 'resume' (targets a specific session by ID, required for multi-user or multi-session workflows), and 'fork' (creates a new independent session that starts with a copy of an existing session's history, leaving the original unchanged). These patterns cover the full spectrum from simple day-to-day continuity to advanced parallel experimentation.
When you’d use it
- ◆Daily work continuity — A developer reaches the end of their workday mid-task. Instead of summarizing progress or restarting, they close the terminal. The next morning they run 'claude -c' or query() with continue: true and pick up exactly where they left off, with all prior file reads, decisions, and partial output preserved.
- ◆Iterative code refinement — A developer asks Claude to analyze a module for security issues in one session. In a follow-up query they ask for fixes. Because the session carries the prior analysis, Claude applies changes without re-reading all the files, reducing token usage and latency.
- ◆Multi-turn debugging — A long debugging session accumulates stack traces, error logs, and hypothesis notes across many turns. The developer pauses to inspect results offline, then resumes with all accumulated context intact, continuing the investigation without re-pasting logs.
- ◆Parallel strategy comparison (forking) — During a database migration design, a developer forks the session at the decision point and tries a NoSQL approach in one fork and a SQL approach in another. Both timelines are preserved independently; the developer compares outcomes and resumes the winning fork without losing either path.
- ◆Multi-user application state management — A web application stores a unique session ID per user in a database. Each incoming request resumes that user's specific session using the explicit resume option, ensuring independent agent conversation histories with no cross-contamination between users.
What changed recently
- ◆2026-03-26 — A change was shipped to clear older thinking sections from sessions that had been idle for over an hour, intended to reduce latency on resume. A bug caused this pruning to repeat on every subsequent turn for the rest of the session instead of just once, making Claude appear forgetful and repetitive in resumed sessions.
- ◆2026-04-10 — The thinking-pruning bug was fixed in v2.1.101. Sessions idle over one hour now have older thinking pruned only once on resume, restoring full reasoning continuity for all subsequent turns.
- ◆2026-06-15 — Claude Managed Agents SDK monthly credit rollout; Agent SDK sessions are billed on two dimensions: tokens consumed (at standard model pricing) and session runtime.
- ◆2026 — Version 2.1.116 optimized the /resume picker's transcript ingestion algorithms, improving load speed by up to 67% for large (40MB+) transcript files and improving garbage collection of dead-fork entries. Background sessions can now be pinned to survive idle periods, memory pressure, and automatic Claude Code updates.
This is the short version
The full chapter has three worked examples, the common pitfalls, and the workflow that makes it pay — plus the other 84 features, kept current.
Get Claude Master — $97 →