Session state, resumption, and forking
What this covers
- Resume a named session and know when resuming is the wrong call
- Fork from a shared baseline to compare approaches
- Tell a resumed session what changed underneath it
- Describe what resuming restores, and that none of its tool results are re-checked
- Pair a fork with a checkpoint or worktree, because a fork isolates conversation state and not the filesystem
- Distinguish forking from spawning a subagent by who drives the branch and where results land
Key terms
- Command line (CLI)
- A text-based way to run programs and work with files.
- Context window
- The amount of information a model can consider in one request.
- Subagent
- A separate agent given a limited task and its own context.
Long work doesn't fit in one sitting, and how you carry state across the gap changes the answers you get.
Resuming
--resume <session-name> continues a specific prior conversation with its context intact. For investigation work spanning days, this is the default.
Resuming picks up where the session stopped. It cannot return to an earlier turn or remove later reasoning from the conversation. If you need to preserve an earlier state, create a fork before continuing in a new direction.
The staleness problem
A resumed session carries old tool results. If files changed while you were away, the agent is reasoning over a snapshot of a codebase that no longer exists, and it has no way to know that.
You photographed the bulletin board last week and you're still reading the photo. Everything in it is exactly what was posted then, and nothing in it can tell you a notice came down on Tuesday.
Choose based on how much of the saved context is still reliable:
- Prior context is mostly still valid — resume, and explicitly tell the agent which files changed so it re-reads those rather than everything.
- Prior tool results are stale — start fresh and provide a structured summary of what was learned. This avoids carrying outdated results into the new work.
Forking
fork_session creates independent branches from a shared baseline. Analyze a codebase once, then fork to explore two refactoring strategies without either branch contaminating the other, and without paying for the analysis twice.
The branches have independent conversation state, but normally still see the same filesystem. If an experiment may edit files, pair the fork with a checkpoint, worktree, or other isolated workspace. A conversation fork isn't a file rollback.
Resumption continues one line of work. Forking splits one into several. They aren't alternatives.
Forking is also not delegation. A fork gives you a second conversation to carry on yourself, and whatever it produces stays in that branch. A subagent spawned with the Agent tool runs its own task and returns a result to the coordinator. Fan-out that has to be gathered into one report is delegation.
--resumefork_sessionsession summaries
Field note — common misconceptions
- MythThat resuming is always cheaper than starting fresh
- ActuallyWhen prior tool results are stale, a fresh session plus a structured summary is the better trade.
- MythThat a resumed agent notices files changed while it was away
- ActuallyIt carries old tool results, so name the changed files and have it re-read those specifically.
- MythThat forking and resuming solve the same problem
- ActuallyResumption continues one line of work;
fork_sessionsplits one baseline into several.
Guided review
Review this lesson as a study deck
Review the lesson's main ideas in five guided slides, then test yourself with three flashcards.
Open Task 1.7 study deckCross-domain reasoning
Connect this idea
Project settings control coding work
Sessions, built-in tools, project instructions, skills, path rules, and execution mode determine what Claude knows and what it can do during a code change.
- 2.5 · Select and apply built-in tools (Read, Write, Edit, Bash, Grep, Glob)
- 3.1 · Configure CLAUDE.md files with appropriate hierarchy, scoping, and organization
- 3.2 · Create and configure custom slash commands and skills
- 3.3 · Apply path-specific rules for conditional convention loading
- 3.4 · Determine when to use plan mode vs direct execution
Applied practice
Practice this lesson in a lab
Use a related lab to create a decision, implementation or diagram, evidence record, and review.
- Lab 4 · Resume versus fork
Compare continuation and branching while keeping conversation state distinct from workspace state.