Session Backup on Stop
Session Backup on Stop hooks into the stop event to create a comprehensive backup before a session terminates. It captures the list of all files modified during the session, creates a git stash if there are uncommitted changes, generates a brief summary of what was accomplished, and saves everything to a timestamped directory. This ensures no work is lost between sessions and makes it easy to resume where you left off. Backups can be pruned after a configurable retention period.
Hook Code
Add this hook to your Claude Code settings or .claude/settings.json to activate.
Terminal Preview
About Session Backup on Stop
Claude Code hooks let you run custom shell commands automatically in response to specific events during Claude's operation. Session Backup on Stop is a Stop hook at the Intermediate level that automates tasks at key moments in your development workflow, reducing manual steps and enforcing consistency across your team.