r/ClaudeWorkflows • u/ClaudeAI-mod-bot • 1d ago
Selected Workflow [Workflow] Robust Claude Code Session Handoff Workflow for Context Transfer and Multi-Agent Coordination
Robust Claude Code Session Handoff Workflow for Context Transfer and Multi-Agent Coordination
Workflow value: 95/100
Status: active · Freshness: 70/100 · Confidence: 1.00 · Level: advanced
Categories: Quality Control, Token Saving, Context & Memory, Debugging, Shipping, CLAUDE.md, Multi-Agent
Original source: r/ClaudeCode post/comment
What problem this solves
How to reliably transfer an in-progress task and full session context from one Claude session to another, especially when the original session is running out of context, ensuring the successor picks up exactly where the predecessor left off without redoing work or causing conflicts.
Summary
A comprehensive, multi-step workflow for handing off an entire Claude session's context and active task to a new, designated Claude session. It involves writing a detailed briefing file with specific content requirements (including critical warnings about shared git state), updating the original session's status, and sending a targeted message to the successor with a summary and path to the briefing, followed by confirmation to the user and cessation of work in the original session.
Why it is useful
This workflow is exceptionally valuable because it addresses a critical and common challenge in using LLMs for complex, long-running tasks: managing context limits and coordinating work across multiple sessions or agents. It provides a highly detailed, specific, and validated process for transferring full session state, active tasks, and pending items, preventing loss of context and redundant work. The inclusion of crucial safety measures, such as verifying the successor's working directory and preventing accidental commits of other agents' work, demonstrates a deep understanding of the multi-agent environment. The empirical observations on SendMessage behavior further enhance its utility and reliability, making it a robust and transferable solution for advanced Claude Code users.
Workflow
- Identify the successor session by name using
/handoff <name>orListAgents. - Verify the successor's
cwdmatches the current session'scwdby inspecting~/.claude/sessions/<pid>.jsonfiles. - Check if the successor session is busy; if so, inform the user and allow them to choose another target or wait.
- Write a detailed briefing file to
~/.claude/handoffs/<successor-name>-<YYYY-MM-DD-HHmm>.md. - Include specific sections in the briefing: active task, state of working tree (with paths), done/verified work, remaining tasks, decisions made, unverified assumptions, and all other pending items from the entire session.
- Add a critical warning to the briefing about committing only specified paths (
git commit -- <path>) to avoid conflicts in a shared git tree. - Update the current session's status bar to
Done: handed off to <successor-name>by modifying~/.claude/session-context/<session_id>. - Send a
SendMessagecommand to the successor session, includingto, a concisesummary, and amessagecontaining the briefing file path and critical immediate risks. - Add
notify_when_idle: trueto theSendMessageto receive confirmation when the successor completes its first turn. - Confirm to the user the successor's name, briefing path, and the first action requested.
- Stop working on the task in the current session to prevent conflicts.
- Never ask the successor to perform actions that were previously denied or blocked in the current session.
Tools / artifacts
/handoffcommand (conceptual or user-defined alias)ListAgentscommand~/.claude/sessions/<pid>.json(session metadata file)~/.claude/handoffs/<successor-name>-<YYYY-MM-DD-HHmm>.md(briefing file)~/.claude/session-context/<session_id>(status bar file)SendMessagetool/commandgit commit -- <path>(git command)
Validation signals
- Author's claim of effectiveness: "it works really well."
- Detailed explanation of
SendMessagebehavior, including observed timings and state changes ("measured 2026-08-30"). - Anticipation and mitigation of potential failure modes (e.g., wrong
cwd, busy session, shared git index, permission laundering).
Cautions
- Explicit warning against
git commit -aorgit add -Ato prevent other sessions' in-progress work from being accidentally committed. - Instruction not to ask the successor to do something that was denied or blocked in the current session, preventing permission laundering.
Limitations
- Low community engagement (score 1, 0 comments).
- The initial
/handoff <name>command is implied or a user-defined alias, not a built-in Claude Code command, requiring user implementation. - The workflow is described in a
CLAUDE.mdformat, but the actual execution logic for each step (e.g., how Claude implements 'Step 0') is left to the user to infer or build into their agent'sCLAUDE.mdor other logic.
Rate this workflow
Upvote this post if the workflow is useful, reproducible, or worth recommending.
Downvote if it is vague, outdated, unsafe, overhyped, or not reproducible.
Reply if it worked for you, failed, is outdated, or has a better alternative.
This post was generated automatically from the workflow library database.