Use at the end of a session to capture context for the next session. Generates session handoff document with state, decisions, and next steps.
From claude-code-handbooknpx claudepluginhub lioartoil/claude-code-handbook/session-handoffGenerate a concise HANDOVER.md so the next Claude session can resume without losing context — uses lazy references, not loaded content
Captures and preserves important session context for seamless handoff between Claude sessions across any project.
/session-handoff
This global command intelligently creates or updates a project's CLAUDE.md file to capture the current session's critical context, decisions, and next steps. It ensures seamless handoff between sessions while maintaining token-efficient documentation.
Think carefully about the current session's work, then create or update the project's CLAUDE.md file to preserve important context for the next session. Follow these steps:
Run these commands and capture the output:
git remote get-url origin 2>/dev/null # detect org
git branch --show-current # current branch
git status --short # dirty files
git rev-list --left-right --count origin/$(git branch --show-current)...HEAD 2>/dev/null # ahead/behind
git stash list # stash entries
Detect the org from the remote URL and apply the matching commit strategy:
| Remote contains | Org | Commit Strategy |
|---|---|---|
chanakan-art | Personal meta-projects | git fetch origin && git merge --ff-only, then commit handoff files, push |
centraldigital | Org production repos | git fetch origin && git rebase origin/develop (or main), then amend the handoff commit, force push the claude/session-handoff branch |
lioartoil | Personal repos | Write to ~/.claude/projects/<project-path>/ local memory ONLY — do NOT modify repo CLAUDE.md or push |
Display detected org + strategy to the user before proceeding with the handoff content.
Include a Git State section in the handoff output:
## Git State
- **Branch**: `<branch>` (ahead N, behind N)
- **Worktree**: clean | N uncommitted (M staged, N unstaged)
- **Stash**: N entries
- **Org**: chanakan-art | centraldigital | lioartoil
- **Strategy**: fetch+ff+push | rebase+amend+force-push | local-only
After writing the handoff content, execute the commit strategy for the detected org.
If creating new CLAUDE.md, use this template:
# CLAUDE.md
> **Project Context** | Updated: [Current Date] | Session: [Main Focus]
## Project Overview
[Brief description of the project based on session work]
## Recent Work ([Current Date])
### Session Summary
[What was accomplished in this session]
### Key Technical Decisions
[Important choices made during the session]
### Implementation Details
[Critical technical details, code patterns, or architecture decisions]
### Current State
- [x] Completed: [List completed items]
- [ ] In Progress: [List ongoing work]
- [ ] Blocked: [List blockers]
### Git State
- **Branch**: `[branch]` (ahead N, behind N)
- **Worktree**: [clean | N uncommitted]
- **Org**: [detected org] → [strategy]
### Next Session Priorities
1. [First priority action]
2. [Second priority action]
3. [Additional tasks]
### Important Files/Locations
- [Key file 1]: [Brief description]
- [Key file 2]: [Brief description]
- [Configuration/setup notes]
### Questions/Considerations
- [Open questions for next session]
- [Technical considerations to explore]
---
_Session handoff created: [Current Date and Time]_
If updating existing CLAUDE.md:
Additional guidelines:
The goal is to enable any Claude instance (or the same instance in a new session) to quickly understand the project state and continue work effectively.