Skip to content
CCAR-FAcademy
Domain 1 · Statement 1.7 7 of 7
1.7

Manage session state, resumption, and forking

  • Use --resume <session-name> with meaningful names to continue a specific named investigation across work sessions.
  • Use fork_session to branch independently from a shared analysis baseline so each branch inherits the expensive exploration without contaminating the others.
  • Staleness of the tool results, not elapsed time, is what makes a fresh session with an injected summary beat --resume.
  • Stale tool results are worse than no context — the agent reasons confidently from file contents and test output that no longer reflect reality.
  • When resuming after code changes, tell the agent exactly which files changed so it re-analyzes those targets instead of trusting cache or re-exploring everything.
  • Writing a structured summary (findings, decisions, open questions, files touched) at the end of a session makes both resumption and clean restart cheap.

Long-running agent work spans days and branches. This statement covers the three levers the certification grades: resume, fork, and deliberate restart. The CLI has a fourth that the guide does not test — --continue (-c), which reopens the most recent conversation in the current directory without naming anything.17 If it shows up as an option on a named investigation stem, it is not the credited answer: the guide's whole point in 1.7 is the deliberate choice of which prior session, and --continue makes that choice for you.

Lever Reach for it when What the next session starts from
--resume <session-name> Prior context is still substantially valid The whole prior conversation, cached tool results included
fork_session Two approaches should diverge from one expensive baseline The shared baseline, inherited — no branch sees another's work18
Start fresh with a structured summary Prior tool results are stale A short summary of conclusions that you inject; no raw tool output

Named resumption with --resume

--resume <session-name> continues a specific prior conversation, with its accumulated exploration, findings and decisions intact. Naming sessions is what makes this usable: --resume payment-refactor is a reliable handle for the investigation you were running yesterday, whereas an opaque identifier is not. Use it when picking up an investigation whose prior context is still substantially valid.

The CLI accepts either form — --resume <name> or --resume <id> — and --resume with no argument opens a picker of recent sessions. The guide teaches the named form because a name is the handle you can put in a runbook or a ticket; that is the habit being graded.

fork_session for divergent exploration

fork_session creates an independent branch from a shared baseline.9 The value is that the expensive part — mapping the codebase, understanding the data model, reading the existing tests — is done once, and each branch inherits it. You then explore genuinely divergent approaches in parallel without contaminating each other. Fork A pursues integration tests through the public API while fork B pursues unit tests with dependency injection; or fork A tries the incremental refactor and fork B the rewrite. Compare outcomes and keep one. Without forking you either re-derive the baseline per branch or let one branch's dead ends pollute the other's context.

One terminology warning, because nothing else in the guide flags it: "fork" means two unrelated things. fork_session here creates a branch that inherits a shared analysis baseline. context: fork in skill frontmatter (Domain 3, §3.2) isolates a skill's working context, so its file reads and intermediate notes never enter the main conversation — only its final result does. Same word, opposite concern — inheritance versus isolation — and the two share no mechanism.

Resume versus start fresh

The important judgment call. Resume when prior context is mostly valid. Start a new session with an injected structured summary when prior tool results are stale.

Staleness is the crux. A resumed session's history contains tool results — file contents, test output, grep matches — captured at a point in time. If the code has since changed, those results are now confidently wrong, and the agent will reason from them: editing a function that no longer exists, citing a line number that moved, assuming a test still fails. A resumed session with stale tool results is more dangerous than a fresh one, because the errors look grounded.

So if files changed since the last session, you have two options. The more reliable one is to start fresh with a structured summary of the conclusions, not the raw tool output. The other is to resume and explicitly inform the agent which files changed, so it re-reads exactly those instead of trusting cached content or re-exploring the entire codebase. Targeted re-analysis is the middle path: cheaper than a full re-exploration, safer than blind trust.

A useful habit: end each work session by having the agent write a structured summary — findings, decisions, open questions, files touched. That artifact makes both resume-with-updates and fresh-start-with-summary cheap.

Resume, fork, or start fresh?Give the learner a decision path keyed on whether prior tool results are still valid and whether divergent branches are needed.Prior session existsPriorsessionexistsAre prior tool results still valid?Are prior toolresults stillvalid?Resume with --resume session-nameResume with--resumesession-nameInform agent which files changedInform agentwhich fileschangedStart fresh with structured summaryStart freshwithstructuredsummaryNeed divergent approaches?Needdivergentapproaches?fork_session from shared baselinefork_sessionfrom sharedbaselineContinue in the one sessionContinue inthe onesessionassess stalenessmostly validresults are stalesome filesmodifiedcontext re-groundednothing changedyes, comparealternativesno, single line ofwork
Resume, fork, or start fresh?

Give the learner a decision path keyed on whether prior tool results are still valid and whether divergent branches are needed.

one transition at a time

Click a decision node to highlight the branch it selects.

fork_session branches from a shared analysis baselineShow that one expensive baseline is inherited by independent branches whose contexts never mix, and that only one branch is carried forward.Shared analysis baselineSharedanalysisbaselineFork A integration testsFork AintegrationtestsFork B unit tests with injectionFork B unittests withinjectionCompare measured outcomesComparemeasuredoutcomesChosen approach carried forwardChosenapproachcarriedforwardfork_session,inherits baselinefork_session,inherits baselinecoverage, runtime,refactor costcoverage, runtime,refactor costkeep one branch
fork_session branches from a shared analysis baseline

Show that one expensive baseline is inherited by independent branches whose contexts never mix, and that only one branch is carried forward.

one transition at a time

Named resumption with targeted re-analysis

Scenario 4 · Developer Productivity with Claude

Yesterday's session named payment-refactor mapped the payments module and identified three seams to extract. Overnight, a colleague merged changes to billing/invoice.ts and payments/gateway.ts.

Resuming blind means the agent still believes the old contents of both files. Resuming with an explicit change notice keeps the valuable architectural understanding and invalidates only what actually moved — far cheaper than a full re-exploration and far safer than trusting the cached reads.

bash
# Continue the specific named investigation from yesterday.
claude --resume payment-refactor

# First message of the resumed session — invalidate only the stale reads:
# "Since our last session, two files changed on main:
#    - billing/invoice.ts
#    - payments/gateway.ts
#  Re-read both before continuing. Your earlier reads of these files are stale;
#  everything else from our analysis still holds. Then confirm whether the three
#  seams we identified are still the right extraction points."
Resume a named session and scope re-analysis to what changed

Forking a shared baseline to compare two testing strategies

Scenario 4 · Developer Productivity with Claude

An agent has spent significant effort building a baseline: module map, dependency graph, existing coverage report, test tooling conventions. Now the team wants to compare two strategies for the payments module — integration tests through the public API versus unit tests behind injected dependencies.

Forking gives each branch that baseline for free and keeps their contexts independent, so one branch's abandoned attempts do not confuse the other. The branches run in parallel and are compared on concrete outcomes (coverage achieved, execution time, refactor cost), and only the winner is carried forward. Re-running the baseline analysis twice would cost the same expensive exploration twice; continuing in one session would interleave two incompatible lines of reasoning.

typescript
// ILLUSTRATIVE PSEUDOCODE. The shape of the flow is the point; the field and
// function names below are not an SDK signature. The guide's term for the
// mechanism is fork_session.

// One expensive baseline: module map, dependency graph, coverage, conventions.
const baseline = await runSession({
  sessionName: 'payments-baseline',
  prompt: 'Map the payments module: dependencies, entry points, existing coverage, test conventions.',
});

// Two divergent branches, each inheriting the baseline, neither polluting the other.
const [integrationBranch, unitBranch] = await Promise.all([
  runSession({
    resume: baseline.sessionId,
    fork_session: true, // independent branch from the shared baseline
    prompt: 'Strategy A: integration tests through the public API. Report coverage, runtime, refactor cost.',
  }),
  runSession({
    resume: baseline.sessionId,
    fork_session: true,
    prompt: 'Strategy B: unit tests with injected dependencies. Report coverage, runtime, refactor cost.',
  }),
]);

// Compare on measured outcomes; carry exactly one forward.
Illustrative pseudocode — two branches from one analysis baseline via fork_session

When a structured summary beats resuming

Scenario 2 · Code Generation with Claude Code

An investigation session from two weeks ago contains hundreds of tool results: file reads, grep output, test runs. Since then the module was substantially rewritten. Resuming loads all of that stale evidence into context, where it competes with reality — and the agent will happily cite a function signature that no longer exists.

The reliable move is a fresh session seeded with a structured summary of the conclusions, not the raw tool output. The summary is small, current in its claims, and explicitly marks what must be re-verified. The agent starts clean and re-reads the code as it is now.

markdown
## Prior investigation summary — checkout double-charge (2 weeks ago)

### Conclusions reached
- Double charges correlate with client retries during gateway timeouts.
- The idempotency key is derived from the cart hash, which changes on retry.

### Decisions taken
- Key idempotency on a client-generated request ID instead of the cart hash.

### Open questions
- Does the gateway honor idempotency keys on the refund path too?

### Must be re-verified (code has changed since)
- checkout/service.ts and payments/gateway.ts were rewritten. Re-read both.
- The failing test named in the old session may no longer exist. Re-run the suite.

Do not rely on any file contents or test output from the previous session.
Injected summary for a fresh session (conclusions, not stale tool output)
  • Resuming a session after significant code changes without telling the agent which files changed because it reasons from stale cached tool results that look authoritative and produces confidently wrong edits.
  • Resuming a long-stale session instead of starting fresh with a structured summary because stale raw tool output competes with current reality and a summary of conclusions is more reliable.
  • Re-running the full baseline analysis for each alternative approach instead of using fork_session from a shared baseline because you pay for the same expensive exploration repeatedly.
  • Exploring two divergent approaches in one continuing session instead of separate forks because each branch's dead ends contaminate the other's reasoning.
  • Leaving long-running investigations unnamed and expecting to identify them later from auto-generated identifiers because a name is the handle you can put in a runbook or hand to a colleague. Reaching for the picker (--resume with no argument) is a fine recovery when you already forgot — the anti-pattern is having no name to look for, not using the picker.
  • For resume-versus-restart items, the discriminator in the stem is always whether prior tool results are still accurate — not how long ago the session ran or how much context it holds.
  • When a stem describes comparing two approaches from the same understanding of a codebase, the answer names fork_session; options that re-analyze per branch or that continue in one session are the distractors.
  • Options offering "resume and let the agent re-explore everything" are inefficient but not wrong-by-mechanism; prefer the option that scopes re-analysis to the specific files that changed.
References — 3 sources
  1. Work with sessions (Agent SDK) Anthropic The actual fork contract — `resume` plus `forkSession` — and the warning that forking branches history, not the filesystem.
  2. Manage sessions Anthropic The full resume surface — by name, by id, and the interactive picker — plus the caveat that an auto-generated title is not a resume handle.
  3. Checkpointing Anthropic Forking branches conversation history but not the filesystem; checkpointing is what rewinds file edits — the missing half of "no branch sees another’s work".
All sources verified ·

Live product docs — where they differ from the exam guide, answer from the guide. All references

Exam guide, verbatim — what is measured

Knowledge of

  • Named session resumption using --resume to continue a specific prior conversation
  • fork_session for creating independent branches from a shared analysis baseline to explore divergent approaches
  • The importance of informing the agent about changes to previously analyzed files when resuming sessions after code modifications
  • Why starting a new session with a structured summary is more reliable than resuming with stale tool results

Skills in

  • Using --resume with session names to continue named investigation sessions across work sessions
  • Using fork_session to create parallel exploration branches (e.g., comparing two testing strategies or refactoring approaches from a shared codebase analysis)
  • Choosing between session resumption (when prior context is mostly valid) and starting fresh with injected summaries (when prior tool results are stale)
  • Informing a resumed session about specific file changes for targeted re-analysis rather than requiring full re-exploration
Back to top