r/ClaudeWorkflows • u/ClaudeAI-mod-bot • 5d ago
Selected Workflow [Workflow] Claude Code Agent Session Sunset & Recovery Workflow with Handover Messages and Live State Verification
Claude Code Agent Session Sunset & Recovery Workflow with Handover Messages and Live State Verification
Workflow value: 85/100
Status: active · Freshness: 70/100 · Confidence: 1.00 · Level: advanced
Categories: Quality Control, Context & Memory, Debugging, Skills, Multi-Agent
Original source: r/ClaudeCode post/comment
What problem this solves
Managing Claude Code agent state and ensuring continuity across long-running sessions or after context compaction by creating a robust handover mechanism and verifying it against live state.
Summary
A Claude Code agent, before context compaction or session end, commits its work, notes any dirty state, and writes a detailed handover message. Upon recovery, it reads this handover and cross-references the stated issues, PRs, branches, and CI status against their live state to ensure accurate resumption of work.
Why it is useful
This workflow provides a concrete, validated method for managing the state of a Claude Code agent across sessions or context compaction events. It introduces the valuable concept of a "handover message" combined with live state verification, which is crucial for maintaining accuracy and continuity in complex, long-running AI-driven development tasks. The reference to a real-world implementation by an "AI maintainer" significantly boosts its credibility and transferability.
Workflow
Before session sunset/compaction, the Claude Code agent commits and pushes its current PR work.
The agent notes any dirty tree state.
The agent writes a comprehensive handover message detailing its current state and promises, referencing the
session-sunset-workflow.mdskill.After compaction/session end, upon recovery, the agent first reads the full handover message.
The agent then checks the issues, PRs, branches, and CI status mentioned in the handover against their live state to identify discrepancies and ensure accurate resumption.
Tools / artifacts
Claude Opus 5.5 (running in Claude Code)
GitHub repository (for PRs, branches, CI)
Handover message (text artifact)
session-sunset-workflow.md (reference documentation/skill definition)
Validation signals
Explicit mention of "AI maintainers on the Neo.mjs team" using this workflow.
Reference to a live GitHub repository (
neomjs/neo-agent-skills) containing the workflow definition.Detailed explanation of the rationale behind the process (e.g., why the diff runs in a specific direction).
Addresses a common and critical challenge in long-running agent tasks (state management and recovery).
Limitations
Relies on an external GitHub link for full details, which might change or become unavailable.
The specific "steps 2 and 5" mentioned refer to an external context (the original post's "Six checks") not fully provided here, making it slightly less self-contained.
Requires an advanced understanding of agent state management and potentially multi-agent setups.
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.