BMAD-METHOD/bmad/core/workflows/handoff
Sallvainian 30e7e99c6a feat: add BMAD handoff workflows for agent context preservation
Add two new BMAD Core workflows for preserving context between agent sessions:

- `/handoff` - Creates comprehensive handoff memory and saves to Serena
- `/handoff-receive` - Loads and displays handoff from previous agent

Features:
- Timestamped memory naming (YYYY-MM-DD-HHmmss) prevents collisions
- Workflow status file validation and field extraction
- Intelligent handoff selection (newest first, with fallbacks)
- Structured handoff format with work completed, task, context, files, success criteria
- Error recovery and graceful degradation
- Backward compatible with legacy date-only format

Files:
- bmad/core/workflows/handoff/ - Handoff creation workflow
- bmad/core/workflows/handoff-receive/ - Handoff receive workflow
- .claude/commands/bmad/core/workflows/ - Original standalone commands (for reference)
- bmad/_cfg/workflow-manifest.csv - Workflow registration
- .gitignore - Allow .claude/commands/ distribution

Integration:
- Works with BMAD /workflow-status command
- Requires Serena MCP for memory persistence
- Tested with BMAD v6.x

Note: Original hardened slash commands are included in .claude/commands/
for reference. If the BMAD workflow versions need adjustment, the original
standalone commands can be used as a fallback or reference implementation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 21:09:04 -04:00
..
README.md feat: add BMAD handoff workflows for agent context preservation 2025-10-20 21:09:04 -04:00
instructions.md feat: add BMAD handoff workflows for agent context preservation 2025-10-20 21:09:04 -04:00
workflow.yaml feat: add BMAD handoff workflows for agent context preservation 2025-10-20 21:09:04 -04:00

README.md

Agent Handoff Workflow

Purpose: Create comprehensive handoff memory for the next agent and save it to Serena.

Overview

The handoff workflow enables seamless context preservation between AI agent sessions by creating structured handoff memories. It reads the current workflow status, validates required fields, generates a comprehensive handoff document, and saves it to Serena with collision-proof timestamped naming.

Features

  • Automatic workflow status reading - Extracts project state and next agent info
  • Field validation - Ensures all required fields are present before proceeding
  • Comprehensive context capture - Includes work completed, files to review, success criteria
  • Timestamped naming - Prevents collisions with format: [agent]-handoff-YYYY-MM-DD-HHmmss
  • Serena integration - Persistent storage across sessions
  • BMAD integration - Complements /workflow-status command
  • Error recovery - Graceful handling of missing files or fields

How to Invoke

From any BMAD-enabled session:

workflow handoff

Or if using the compiled command:

/handoff

Requirements

Dependencies:

  • Serena MCP - Must be installed and configured
    • mcp__serena__activate_project
    • mcp__serena__write_memory
  • Workflow status file - docs/bmm-workflow-status.md must exist

Required Workflow Status Fields:

  • PROJECT_NAME (required)
  • CURRENT_PHASE (required)
  • NEXT_AGENT (required)
  • NEXT_COMMAND (optional - defaults to "Begin next phase")

Workflow Steps

  1. Validate workflow status file - Ensures file exists and has required fields
  2. Read workflow status - Extract project metadata and next agent info
  3. Extract completed work - From status file or infer from context
  4. Activate Serena project - Prepare for memory storage
  5. Validate required fields - Confirm all critical data is present
  6. Generate handoff memory - Create structured handoff document
  7. Save to Serena - Store with timestamped collision-proof name
  8. Output next agent prompt - Ready-to-use prompt for next session

Expected Inputs

  • Workflow status file: {output_folder}/bmm-workflow-status.md
  • Current conversation context: Used to infer completed work

Generated Outputs

Serena Memory:

  • Name pattern: [next-agent]-handoff-YYYY-MM-DD-HHmmss
  • Example: dev-handoff-2025-10-20-143530

Handoff Memory Contains:

  • Header metadata (date, from, to, command)
  • Work just completed summary
  • Current project state
  • Task for next agent
  • Key context (3-5 critical items)
  • Files to review (categorized)
  • Success criteria (measurable)
  • Next steps
  • Important reminders

Terminal Output:

  • Confirmation message with memory name
  • Ready-to-use prompt for next session
  • Quick version command suggestion

Integration with BMAD

This workflow complements the BMAD /workflow-status command:

  • /workflow-status - Check current state and next recommended action
  • /handoff - Save detailed context for next agent (this workflow)
  • /handoff-receive - Load handoff and display actionable summary

Together they enable seamless agent-to-agent context preservation throughout the BMAD workflow lifecycle.

Example Usage

Step 1: Current agent completes their work

User: /handoff

Step 2: Workflow executes automatically

  • Reads workflow status
  • Validates fields
  • Generates comprehensive handoff
  • Saves to Serena

Step 3: Agent outputs prompt

✅ Handoff memory saved to Serena: dev-handoff-2025-10-20-143530

📋 Copy/paste this prompt for the next session:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Read Serena memory: dev-handoff-2025-10-20-143530

Then execute the handoff.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Quick version: /handoff-receive

Step 4: Next agent receives the handoff

In a new session:

User: /handoff-receive

Error Handling

Missing workflow status file:

⚠️ Workflow status file not found or invalid.
Suggestion: Run workflow initialization command or create the file manually

Missing required fields:

⚠️ Missing required field: PROJECT_NAME
Continue with placeholder value or cancel? (continue/cancel)

Serena MCP unavailable:

⚠️ Failed to activate Serena project.
Troubleshooting: Check Serena MCP server status and configuration

Version Information

  • Version: 1.0.0
  • BMAD Version: 6.0.0-alpha.0
  • Author: BMad Core
  • Requires: Serena MCP
  • Type: Action workflow (no document generation)

Files in This Workflow

bmad/core/workflows/handoff/
├── workflow.yaml       # Workflow configuration
├── instructions.md     # Step-by-step execution guide
└── README.md          # This file
  • handoff-receive - Companion workflow for loading handoffs
  • workflow-status - Check current BMAD workflow state

Troubleshooting

Handoff not saving:

  1. Verify Serena MCP is installed and running
  2. Check project activation status
  3. Ensure write permissions to memory store

Fields not found:

  1. Verify workflow status file format
  2. Check field names match exactly
  3. Update workflow status file with required fields

Naming collisions:

  • Impossible with timestamped format (HHmmss precision)
  • If using legacy format, upgrade to timestamped version

Next Steps After Creating Workflow

  1. Test the workflow - Run in a real session
  2. Verify Serena integration - Confirm memories are saved
  3. Test with handoff-receive - Ensure full round-trip works
  4. Update documentation - Add project-specific context if needed

Ready to preserve context and enable seamless agent handoffs! 🚀