1.7 — Session State and Resumption
CCAR-F Domain 1 · Task 1.7
What You Need to Know
A session is one conversation with an agent that you can come back to. Session management determines how an agent keeps continuity across work sessions.
Three Session Management Options
| Option | Purpose | When to use |
|---|---|---|
| --resume | Continue the same session | Prior context is mostly still valid; files have not changed significantly |
| fork_session | Create independent branch from shared baseline | Exploring divergent approaches after initial analysis |
| Fresh start + summary injection | Clean baseline with preserved knowledge | Prior tool results are stale (files changed) or context is degraded |
Key Concept: Resume for continuation, fork for divergent exploration, fresh start with summary for stale tool results.
The Stale Context Problem
Occurs when an agent resumes a session after files have been modified. The history still contains old tool results. The model reasons from stale data and gives contradictory advice.
Simply resuming and asking the agent to re-read changed files is incomplete — the stale results remain in history. The correct fix is a fresh session with a structured summary of prior findings, plus targeted re-analysis of only the changed files.
Decision Matrix
| Scenario | Best Option |
|---|---|
| Continuing work, no files changed | --resume |
| Comparing two approaches | fork_session |
| Resuming after core files changed | Fresh start + summary |
| Long session with cluttered history | Fresh start + summary |
| Dependency updates | Fresh start + summary |
Exam Traps
- Suggesting full re-exploration when only a few files changed
- Resuming when most earlier tool results describe files that have since changed
- Using fork_session to continue a single line of investigation
- Using fork_session to handle stale context
Check your understanding
Practice Scenario
A developer resumes a session after modifying 3 files in a 50-file codebase. The 3 files are the core modules. The agent gives contradictory advice because of stale tool results. The other 47 files are untouched. What is the correct approach?
Log in to save your progress.
Sources
- Work with sessions, Claude Code Docs
- Manage sessions, Claude Code Docs
- Effective harnesses for long-running agents, Anthropic
- Compaction overview, Claude Platform Docs
You've finished the free part of CCAR-F
The lessons stay free. Pro unlocks the other 23 CCAR-F practice scenarios and the 60-question timed mock exam, plus everything for every other exam.
Cancel anytime. Or €199 a year, which saves 17%.
Not sure yet? Try 10 free mock exam questions.