Back to Workflow & Productivity

session-handoff

AI agentcontext managementsession statecoding workflowdeveloper toolshandoffAI productivitylong-running tasks
⭐ 2.0kπŸ“„ MITπŸ•’ 2026-03-05Source β†—

Install this skill

npx skills add softaworks/agent-toolkit

Works across Claude Code, Cursor, Codex, Copilot & Antigravity

The session-handoff skill provides a structured framework for transferring context between autonomous agents. By generating standardized Markdown documents within the .claude/handoffs/ directory, this tool prevents information loss caused by memory exhaustion. It relies on a specific workflow to capture state, project paths, git branch status, and critical decision rationale. When resuming work, the tool offers mechanisms to audit the freshness of a handoff, ensuring that an incoming agent understands existing blockers or environmental changes. This systemic approach to state preservation allows complex, multi-stage development tasks to span multiple sessions without requiring manual re-summarization or risking the abandonment of long-term project conventions. It effectively creates a technical breadcrumb trail that maintains project velocity and keeps technical documentation aligned with current agent activity.

When to Use This Skill

  • β€’Pausing complex debugging sessions that span multiple days
  • β€’Handing off a task to a different AI agent instance
  • β€’Documenting architectural decisions during long-term feature development
  • β€’Capturing current work progress before switching git branches

How to Invoke This Skill

Example prompts that trigger this skill in Claude Code, Cursor, or Antigravity:

  • β€œcreate a handoff document for my current work
  • β€œhow do I resume the session from yesterday?
  • β€œsave my progress so I can stop working now
  • β€œcheck if my handoff is still relevant
  • β€œI need to continue where the previous agent left off

Pro Tips

  • πŸ’‘Integrate handoff document creation with your version control system, committing the handoff alongside relevant code changes to maintain a clear historical record.
  • πŸ’‘Customize the `create_handoff.py` script to automatically include project-specific details, diagnostic outputs, or links to external documentation.
  • πŸ’‘Proactively initiate a handoff before requesting the AI agent to undertake a context-shifting task, such as a major refactor or starting work on an entirely new module.
  • πŸ’‘Use specific, descriptive task slugs (e.g., 'implement-user-auth-part1') for handoff documents to make them easily searchable and understandable later.

What this skill does

  • β€’Generates standardized, timestamped Markdown state summaries
  • β€’Links sequential work sessions via handoff chains
  • β€’Validates documents for security leaks and completeness
  • β€’Calculates context staleness based on git history and time
  • β€’Provides automated checklists for safe session resumption

When not to use it

  • βœ•Short, simple tasks that can be completed in a single prompt
  • βœ•Projects lacking git version control integration
  • βœ•When you only need to store a simple code snippet or file patch

Example workflow

  1. Run the scaffold script using a descriptive task slug
  2. Manually populate the TODO sections with current state and rationale
  3. Execute the validation tool to ensure no secrets remain and score is high
  4. Notify the next user or agent of the specific file location
  5. List existing handoffs upon session start to select the latest version
  6. Run the staleness check before applying any code modifications

Prerequisites

  • –softaworks/agent-toolkit installed
  • –A project managed with Git
  • –Write access to the .claude/ directory

Pitfalls & limitations

  • !Failing to chain handoffs results in isolated context islands
  • !Resuming from a stale handoff without verification can cause integration bugs
  • !Including sensitive information in the document risks security exposure
  • !Low-scoring handoffs may lack the necessary detail to be useful

FAQ

Where are the handoff files stored?
All handoff files are saved in the .claude/handoffs/ directory within your project root.
What happens if a handoff is marked as stale?
A stale status indicates that significant changes have occurred since the handoff was created. You should manually review recent commits and file updates before continuing.
How do I connect multiple work sessions?
Use the --continues-from flag when generating a new handoff to create a permanent link to your previous session document.

How it compares

Unlike manual summary prompts which are often inconsistent, this tool forces structured metadata collection and validates the output against quality and security criteria.

Source & trust

⭐ 2.0k starsπŸ“„ MITπŸ•’ Updated 2026-03-05
πŸ“„ Full skill instructions β€” original source: softaworks/agent-toolkit
# Handoff

Creates comprehensive handoff documents that enable fresh AI agents to seamlessly continue work with zero ambiguity. Solves the long-running agent context exhaustion problem.

## Mode Selection

Determine which mode applies:

**Creating a handoff?** User wants to save current state, pause work, or context is getting full.
- Follow: CREATE Workflow below

**Resuming from a handoff?** User wants to continue previous work, load context, or mentions an existing handoff.
- Follow: RESUME Workflow below

**Proactive suggestion?** After substantial work (5+ file edits, complex debugging, major decisions), suggest:
> "We've made significant progress. Consider creating a handoff document to preserve this context for future sessions. Say 'create handoff' when ready."

## CREATE Workflow

### Step 1: Generate Scaffold

Run the smart scaffold script to create a pre-filled handoff document:

python scripts/create_handoff.py [task-slug]


Example: python scripts/create_handoff.py implementing-user-auth

**For continuation handoffs** (linking to previous work):
python scripts/create_handoff.py "auth-part-2" --continues-from 2024-01-15-auth.md


The script will:
- Create .claude/handoffs/ directory if needed
- Generate timestamped filename
- Pre-fill: timestamp, project path, git branch, recent commits, modified files
- Add handoff chain links if continuing from previous
- Output file path for editing

### Step 2: Complete the Handoff Document

Open the generated file and fill in all [TODO: ...] sections. Prioritize these sections:

1. **Current State Summary** - What's happening right now
2. **Important Context** - Critical info the next agent MUST know
3. **Immediate Next Steps** - Clear, actionable first steps
4. **Decisions Made** - Choices with rationale (not just outcomes)

Use the template structure in [references/handoff-template.md](references/handoff-template.md) for guidance.

### Step 3: Validate the Handoff

Run the validation script to check completeness and security:

python scripts/validate_handoff.py <handoff-file>


The validator checks:
- [ ] No [TODO: ...] placeholders remaining
- [ ] Required sections present and populated
- [ ] No potential secrets detected (API keys, passwords, tokens)
- [ ] Referenced files exist
- [ ] Quality score (0-100)

**Do not finalize a handoff with secrets detected or score below 70.**

### Step 4: Confirm Handoff

Report to user:
- Handoff file location
- Validation score and any warnings
- Summary of captured context
- First action item for next session

## RESUME Workflow

### Step 1: Find Available Handoffs

List handoffs in the current project:

python scripts/list_handoffs.py


This shows all handoffs with dates, titles, and completion status.

### Step 2: Check Staleness

Before loading, check how current the handoff is:

python scripts/check_staleness.py <handoff-file>


Staleness levels:
- **FRESH**: Safe to resume - minimal changes since handoff
- **SLIGHTLY_STALE**: Review changes, then resume
- **STALE**: Verify context carefully before resuming
- **VERY_STALE**: Consider creating a fresh handoff

The script checks:
- Time since handoff was created
- Git commits since handoff
- Files changed since handoff
- Branch divergence
- Missing referenced files

### Step 3: Load the Handoff

Read the relevant handoff document completely before taking any action.

If handoff is part of a chain (has "Continues from" link), also read the linked previous handoff for full context.

### Step 4: Verify Context

Follow the checklist in [references/resume-checklist.md](references/resume-checklist.md):

1. Verify project directory and git branch match
2. Check if blockers have been resolved
3. Validate assumptions still hold
4. Review modified files for conflicts
5. Check environment state

### Step 5: Begin Work

Start with "Immediate Next Steps" item #1 from the handoff document.

Reference these sections as you work:
- "Critical Files" for important locations
- "Key Patterns Discovered" for conventions to follow
- "Potential Gotchas" to avoid known issues

### Step 6: Update or Chain Handoffs

As you work:
- Mark completed items in "Pending Work"
- Add new discoveries to relevant sections
- For long sessions: create a new handoff with --continues-from to chain them

## Handoff Chaining

For long-running projects, chain handoffs together to maintain context lineage:

handoff-1.md (initial work)
↓
handoff-2.md --continues-from handoff-1.md
↓
handoff-3.md --continues-from handoff-2.md


Each handoff in the chain:
- Links to its predecessor
- Can mark older handoffs as superseded
- Provides context breadcrumbs for new agents

When resuming from a chain, read the most recent handoff first, then reference predecessors as needed.

## Storage Location

Handoffs are stored in: .claude/handoffs/

Naming convention: YYYY-MM-DD-HHMMSS-[slug].md

Example: 2024-01-15-143022-implementing-auth.md

## Resources

### scripts/

| Script | Purpose |
|--------|---------|
| create_handoff.py [slug] [--continues-from <file>] | Generate new handoff with smart scaffolding |
| list_handoffs.py [path] | List available handoffs in a project |
| validate_handoff.py <file> | Check completeness, quality, and security |
| check_staleness.py <file> | Assess if handoff context is still current |

### references/

- [handoff-template.md](references/handoff-template.md) - Complete template structure with guidance
- [resume-checklist.md](references/resume-checklist.md) - Verification checklist for resuming agents

How to Use This Skill Unit

Option A: Project-Specific (Recommended)

  1. Click "Download" above
  2. In your project, create the directory: .agent/skills/session-handoff/
  3. Save the file as SKILL.md
  4. The agent will automatically discover the skill based on its description.

Option B: Global Installation (All Agents)

Save the file to these locations to make it available across all projects:

  • Claude Code: ~/.claude/skills/softaworks/agent-toolkit/session-handoff/SKILL.md
  • Cursor: ~/.cursor/skills/softaworks/agent-toolkit/session-handoff/SKILL.md
  • Antigravity: ~/.gemini/antigravity/skills/softaworks/agent-toolkit/session-handoff/SKILL.md

πŸš€ Install with CLI:
npx skills add softaworks/agent-toolkit

Read the Master Guide: Mastering Agent Skills β†’

Recommended Rules

View more rules β†’

Recommended Workflows

View more workflows β†’

Recommended MCP Servers

View more MCP servers β†’

Take It Further

Maximize your productivity with these powerful resources

πŸ“‹

Define Your Standards

Set up coding standards to ensure this workflow produces consistent, high-quality results.

Browse Rules Library
πŸ“–

Master Workflows

Learn how to create custom workflows, use Turbo Mode, and build your automation library.

Complete Guide

How to use this Skill in Claude Code & Cursor

For Claude Code (CLI)

To use this skill in Claude Code, copy the rule content into your project's custom instructions or follow our Add-Skill CLI guide. This ensures Claude follows your standards during every code generation.

For Cursor & Windsurf

For Cursor or Windsurf, individual skills are best used in the "Rules for AI" section. This specific unit helps the agent avoid workflow & productivity issues, leading to cleaner, more efficient code.

Why the skill format matters: the standardized Agent Skills format lets your AI agent load detailed instructions only when they are relevant, keeping your prompt clean while improving results.

Source & attribution

This skill is categorized under Workflow & Productivity and is published by Softaworks, maintained in softaworks/agent-toolkit.

← Browse All Agent Skills
Sponsored AI assistant. Recommendations may be paid.