session_save_handoff
Persist current session context for the next session to load. Merges concurrent changes via CRDT or enforces optimistic concurrency control to prevent data loss.
Instructions
Upsert the latest project handoff state for the next session to consume on boot. This is the 'live context' that gets loaded when a new session starts. Calling this replaces the previous handoff for the same project (upsert on project).
v5.4 CRDT Merge: On version conflict, a CRDT OR-Map engine automatically merges your changes with concurrent work (Add-Wins OR-Set for arrays, Last-Writer-Wins for scalars). Pass expected_version to enable concurrency control.
v0.4.0 OCC: If you received a version number from session_load_context, /resume_session prompt, or memory resource attachment, you MUST pass it as expected_version to prevent overwriting another session's changes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| role | No | Optional. Agent role for Hivemind scoping (e.g., 'dev', 'qa', 'pm'). Omit to let the server auto-resolve from dashboard settings. | |
| project | Yes | Project identifier — must match the project used in session_save_ledger. | |
| open_todos | No | Current open TODO items that need attention in the next session. | |
| key_context | No | Free-form critical context the next session needs to know. | |
| last_summary | No | Summary of the most recent session — used for quick context recovery. | |
| active_branch | No | Git branch or context the next session should resume on. | |
| disable_merge | No | Set to true to disable automatic CRDT merging and fail strictly on version conflict (original OCC behavior). Default: false. | |
| conversation_id | No | Optional. Session key for this conversation (same id used in session_load_context). When provided, the server verifies that session_load_context was called for this conversation before accepting the write. | |
| expected_version | No | v0.4.0: The version number you received when loading context. Pass this to enable optimistic concurrency control. If omitted, version check is skipped (backward compatible). |