Coding agent workflows

AI Agent Handoffs: What the Next Session Needs to Know

An AI agent handoff should let another session continue a task without reconstructing the entire conversation. The useful deliverable is a compact, verifiable account of the work: what the user wants, which artifacts changed, what evidence exists, and what decision comes next. This guide proposes a handoff contract for coding tasks that cross sessions, models, or people.

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

Treat the handoff as an artifact contract

A conversation transcript records what was said. A handoff records what another worker needs to do. Those overlap, but a long transcript can bury a critical restriction beneath exploratory commands and abandoned ideas. Put the handoff in a durable, access-controlled project artifact and give it an explicit owner.

Anthropic describes structured note-taking outside the context window as one technique for maintaining continuity across extended work. Its context engineering article also explains that compaction selects which information survives. The contract below is a proposed engineering practice built on that principle, rather than a guarantee supplied by any particular agent.

A useful acceptance test is straightforward: can a fresh session identify the correct checkout, explain the remaining requirement, and choose its first read-only inspection without asking the previous worker? If it cannot, add the missing evidence or clarify the task boundary.

Include seven fields that answer operational questions

FieldWhat to recordWhy it matters
Goal and constraintsExpected behavior, exclusions, user decisionsPrevents a plausible but unwanted solution
Workspace identityRepository, worktree, branch, HEADLocates the actual artifacts
Change mapFiles, ownership, purpose, unfinished editsSeparates completed work from intentions
EvidenceCommands, results, revision, environmentMakes verification inspectable
Decisions and assumptionsReason, source, confidence, unresolved pointsPreserves the reasoning needed to continue
Next actionOne bounded step and its stop conditionTurns history into executable work
AuthorityAllowed actions and pending approvalsPrevents scope expansion

Keep factual observations separate from hypotheses. “The integration test exited 1 because the database was unavailable” is an observation. “The implementation probably works” is a hypothesis. Record both only when useful, and label them clearly. A future worker must not mistake an optimistic interpretation for passing evidence.

Capture repository state before writing the summary

Gather identity and changes with read-only commands appropriate to your repository:

git rev-parse --show-toplevel
git branch --show-current
git rev-parse HEAD
git status --short --untracked-files=all
git diff --stat
git diff
git diff --cached

The Git rev-parse reference documents the worktree-root and revision inspection commands. If the branch name is empty, explicitly record that HEAD is detached instead of inventing a branch.

Git status can expose untracked paths that would otherwise disappear from a changes summary. Do not assume every listed file belongs to your task: annotate existing user edits and work owned by other agents.

The Git diff reference distinguishes unstaged changes from the staged changes shown by --cached. Plain diff output does not include the contents of ordinary untracked files. Inspect relevant new files separately before describing them as complete. A commit identifier alone therefore cannot describe a dirty checkout.

Worked example: transfer an unfinished export change

Suppose one session has added a CSV export endpoint and another must finish validation. A proposed handoff could look like this; the filenames and results are illustrative, not measurements from a tested application.

Task: CSV export for the current workspace only.
Constraint: keep the existing authorization middleware.
Workspace: billing-export worktree, branch feat/csv-export.
Revision: attach the full output of git rev-parse HEAD.
Changes: export.ts streams rows; export.test.ts adds scope checks.
Ownership: do not edit the unrelated pricing.ts user change.
Evidence: unit command exited 0 on the recorded revision.
Limit: database integration test was not run.
Open question: product has not approved the maximum row count.
Next: inspect workspace filter and run integration tests with fixtures.
Stop: request a decision before choosing a production row limit.
Authority: local implementation and checks; no deployment approval.

The next session should inspect the filter before extending the feature. If it discovers the endpoint applies the workspace restriction after fetching rows, the handoff has supplied the right review question without claiming the authorization design is already correct.

Attach the actual test command, fixture setup, and a stable result location when using this pattern. “Unit tests passed” leaves the recipient guessing which package ran and whether the relevant test was included.

Have the receiving agent reconcile the note with reality

The receiving worker should read repository instructions, inspect current state, and compare it with the note before changing files. Repository state may have advanced after the handoff was written. Another developer might have rebased the branch, fixed the reported failure, or replaced the design.

  1. Confirm the repository, worktree, branch, and current revision.
  2. Read the requested behavior and constraints in the original issue or brief.
  3. Inspect relevant diffs and check that ownership still matches the note.
  4. Review evidence for the recorded code state; rerun checks when changes invalidate it.
  5. State the first bounded action and any unresolved dependency.

When the note and code disagree, preserve both observations and resolve the discrepancy. Do not overwrite newer changes merely to make the checkout match the handoff. For a larger interruption, use the recovery procedure in resuming long-running agent tasks.

Avoid stale evidence, hidden assumptions, and excess detail

A handoff can fail by saying too little or by saying too much. A terse “continue implementation” discards intent. A copied transcript hides it. Prefer a short index of decisions and artifacts, with links to detailed logs when they are necessary and safe to retain.

Evidence becomes stale after code, dependencies, configuration, or fixtures change. Record when a check ran and the code state it covered. A passing check is evidence about that run; it does not automatically certify later edits or a different execution environment.

Permission is another common ambiguity. A predecessor’s suggestion to deploy is not proof that deployment was authorized. Preserve the actual user instruction or approval scope where available, and route new decisions through the workflow’s authority rules. Exclude credentials, private customer payloads, and unnecessary raw terminal output from the note.

Maintaining a detailed artifact costs time. Use more structure for risky migrations and multi-person work, and less for a small isolated fix. Keep the seven operational questions answerable at either scale.

Keep the handoff connected to the right local session

When several coding agents are active, finding the session associated with a handoff becomes its own problem. Purrvio provides visibility into supported local sessions on Mac, with the richest session support for Claude Code and Codex. It helps you see which session needs attention and return to the relevant terminal.

Store the engineering handoff in your project workflow; Purrvio does not create a durable task contract or verify completion for you. Navigation supports Ghostty and Terminal.app, while direct replies require Ghostty and Automation permission.

If session switching is interrupting your review loop, download the free Purrvio Mac preview. It supports macOS 13 or later on Apple silicon and Intel Macs. The locally signed preview is not Apple-notarized; read its installation notes before the first launch.

Use this checklist before transferring ownership

  • Name the goal, acceptance criteria, and exclusions.
  • Identify the exact checkout and record the current revision.
  • List changed and untracked files, with ownership boundaries.
  • Link test evidence and state what was not verified.
  • Explain decisions and label unresolved assumptions.
  • Choose the next action, dependencies, and stop condition.
  • Record authority limits without copying secrets.
  • Have the recipient reconcile the note with the current code.

Finish the transfer by assigning an owner. A technically complete note sitting in an unmonitored folder can still leave work abandoned. For workflows involving several workers, pair the contract with explicit supervisor and worker ownership so responsibility remains clear after the context changes.

Frequently asked questions

Is an AI agent handoff the same as conversation memory?

No. Conversation memory can retain useful history, while a handoff specifies current task state, evidence, ownership, and the next action. A durable handoff should remain understandable even when the original conversation is unavailable.

Should every handoff include a commit?

Record a commit identifier when the repository has one, but also describe staged, unstaged, and untracked work. Do not create a commit merely to hide incomplete or unrelated changes. The recipient needs an accurate account of the checkout.

How much detail should a handoff contain?

Include enough detail to locate artifacts, verify relevant claims, and choose the next bounded step. Link supporting logs instead of duplicating them. Expand the decision and evidence sections when the task carries greater operational risk.

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: Effective context engineering for AI agents

    Explains compaction and structured notes outside the context window; supports the continuity principle, not the proposed seven-field contract.

  2. Git rev-parse documentation

    Documents worktree root and revision inspection used to identify a checkout.

  3. Git status documentation

    Documents reporting changed and untracked files, including the all mode for untracked paths.

  4. Git diff documentation

    Documents working-tree and index comparisons and the meaning of --cached.

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.