Coding agent workflows

Claude Code Session Management: Context, Handoffs, and Review

Claude Code session management becomes an engineering problem when work spans several days or several terminal windows. A saved conversation helps you recover intent, but successful continuation also depends on the current branch, surviving processes, permissions, and review evidence. This guide develops a practical workflow around an illustrative billing retry task, with explicit boundaries between remembered conversation and verified software state.

AI-assisted technical guide with linked primary sources. Examples are illustrative unless stated otherwise. How these guides are made.

Separate conversation, repository, and process state

A useful session inventory has three independent columns: what the conversation believes, what exists in the repository, and what is currently running. Imagine Claude reported that it started a migration test yesterday. Today the transcript contains that intention, the working tree contains the migration, and the test process has disappeared. Treating any one column as proof of the other two creates false confidence.

Before continuing, inspect the branch and changed files, identify the last verified result, and decide whether another live process still owns the task. Record that decision in a short handoff. This is an operational convention: the point is to make the next action explicit rather than ask a model to infer it from a long conversation.

Choose the right resume entry point

Anthropic’s session documentation distinguishes claude --continue, which reopens the most recent eligible session in the current directory, from claude --resume, which opens a picker. A named session can be resumed directly. Name important work with /rename so that a vague generated title is not your only retrieval handle.

# Run from the intended project directory.
claude --resume

# After choosing a conversation, name it inside Claude Code:
/rename billing-retry-review

# Return to that named conversation later:
claude --resume billing-retry-review

Use the picker whenever you are unsure which conversation was most recent. In our billing example, a quick documentation question could have become the latest session after implementation ended. The correct choice is the session that owns the billing task, not whichever terminal tab happens to be visible.

Keep context useful with a compact decision record

The context controls include /context for usage and /compact for a focused summary. Keep important decisions outside that summary too.

For a billing retry fix, keep a small decision record: retries apply only to network failures before a response; the idempotency key must remain stable across attempts; a declined payment must never be retried automatically. Ask a compacting session to preserve those invariants and the exact verification still required. Move durable project rules into the repository’s instruction files when they apply beyond this task.

Anthropic’s memory guide distinguishes instructions you maintain from notes Claude accumulates. Both guide a model; neither is an enforcement boundary. Keep permission restrictions in the actual tool or sandbox configuration. Review remembered assumptions when the code changes, especially anything describing an old API or deployment process.

Write a handoff someone can act on

The following is an illustrative handoff format, not a report of a real benchmark or completed fix. Store an equivalent note in your normal task system or a repository location your team agrees to maintain.

Task: billing retry policy
Branch: fix/billing-network-retry
Goal: retry transport failures without duplicate charges
Changed: retry policy and focused unit tests
Verified: focused tests passed at the recorded commit
Still required: integration test with simulated gateway timeout
Invariant: decline responses must not trigger retries
Decision needed: maximum retry window
Next action: inspect gateway mock, then add timeout coverage
Do not: change production payment settings

Replace generic language such as “tests look good” with the actual command, result, and commit or working-tree state. If the verification command is unknown, say that. If a human decision blocks implementation, put the question ahead of the next coding step. A handoff that hides the blocker merely transfers confusion to another session.

At resume time, ask Claude to compare this note with the current files before editing. A teammate may have merged a conflicting change overnight. The note preserves intent; the repository determines what needs doing now. See the dedicated agent handoff guide for a broader artifact contract.

Branch conversations and isolate code separately

Use --fork-session for a conversation copy. The branching documentation warns that two terminals sharing one session interleave their messages.

Our recommendation is one owner per implementation lane. If you want another agent to explore a different retry algorithm, give it a separate branch and working directory as well as a distinct conversation. A conversation fork does not, by itself, separate filesystem writes. Agree on an interface before parallel editing begins, then give one person responsibility for integrating the chosen result.

Use an independent reviewer session when you want a fresh assessment. Supply the task specification, diff, and verification evidence rather than the author’s persuasive narrative. This costs another context setup, but makes it easier to ask whether the implementation actually satisfies the original requirement.

Recover from interruptions without assuming rollback

Claude Code’s checkpoint documentation describes /rewind options for restoring tracked code, conversation, or both. A conversation-only rewind leaves files as they are. File tracking has limits: files changed only through shell commands are not covered in the same way as files touched through Claude’s editing tools. External side effects also require their own recovery plan.

Before rewinding a shared working directory, inspect uncommitted edits and establish who created them. For our billing example, reverting source files would not reverse a payment API request. Keep experiments on disposable test data, and document any external action that might already have happened.

After an interrupted run, verify whether a tool finished, partially completed, or never started. Resuming a transcript is not a reason to rerun a migration or write request blindly. Preserve operation identifiers where relevant and inspect the target system before repeating side effects.

Close the session with evidence

Anthropic’s best-practices guidance emphasizes giving Claude a check it can run. Define the acceptance check before implementation so that the final message has a concrete claim to establish. For billing retries, test both the permitted retry and the forbidden decline retry, then inspect the resulting diff for accidental configuration changes.

git diff --stat
git diff
git diff --cached

These Git diff commands inspect unstaged and staged changes; they do not show every possible repository artifact or prove behavior. Also check untracked files, generated outputs, and the actual test result. Ask the session to report remaining uncertainty explicitly. “Implementation complete, integration check pending” is more useful than an unsupported “done.”

Make waiting sessions visible

Several well-named sessions can still disappear behind terminal windows. Purrvio adds local visibility for supported Mac coding sessions, with the richest support for Claude Code and Codex. It reads local session records and processes without installing agent hooks, and helps you return to the session that needs attention. That complements the handoff and review process described here.

The free Mac preview supports macOS 13 or newer on Apple silicon and Intel. Navigation supports Ghostty and Terminal.app; direct replies require Ghostty and Automation permission. The preview is locally signed and not Apple-notarized. Read the Purrvio download and installation notes before installing.

  • Give each substantial task a recognizable session name and code owner.
  • Record the next action and unresolved decision before stopping.
  • Recheck repository and process state when returning.
  • Separate parallel implementation directories.
  • Inspect verification evidence before accepting completion.
  • Keep external side effects in the recovery record.

Frequently asked questions

Should I resume an old session or start a new one?

Resume when the same task and decisions remain relevant. Start a fresh session for a different task or independent review, and provide a short verified handoff rather than importing unrelated history.

Does compacting a session save the repository state?

Compaction summarizes conversation context. Preserve repository state through your normal source-control and backup workflow, and record what was actually tested.

Can Purrvio replace session checkpoints or code review?

Purrvio helps you see supported local coding sessions and return to them. Checkpoints, source control, acceptance tests, and human review still perform their own jobs.

Sources and further reading

Primary references checked for this guide on 10 November 2026. Documentation can change; confirm version-specific behavior before using commands in a production workflow.

  1. Anthropic: Manage sessions

    Verified CLI resume, naming, context controls, session forks, and the risk of sharing one transcript across terminals.

  2. Anthropic: Checkpointing

    Verified rewind modes and file-tracking limitations; distinguishes conversation recovery from external side effects.

  3. Anthropic: Best practices for Claude Code

    Supports explicit verification checks and distinguishing model instructions from enforced controls.

  4. Anthropic: How Claude remembers your project

    Supports persistent project instructions, auto memory, and their limits as enforcement mechanisms.

  5. Git: git-diff documentation

    Verified the unstaged, staged, and summary diff commands used in the review example.

Download Purrvio.

Free Mac preview. No account or API keys.

This locally signed preview isn’t Apple-notarized. macOS may block the first launch.

Download free preview ↗

3.2 MB ZIP · Apple silicon and Intel · macOS 13.0+

Read installation steps

One email before you go.

I’ll send a short setup note and reply if you hit a snag. No spam, unsubscribe anytime.