Session Summary Saver Hook
Automatically saves a session summary when Claude stops working, capturing current task state, progress, decisions, and next steps. Creates persistent memory that the Session Context Loader hook reads on next session start.
Hook Type
Stop -- Fires when Claude finishes working, saves session state.
Description
This hook uses an agent-based Stop hook to automatically generate and save a summary of the current session before Claude stops. The summary captures what was accomplished, what's in progress, key decisions made, and next steps. The saved file is then loaded by the Session Context Loader hook in the next session, creating seamless continuity.
Patterns/Rules
- Triggers every time Claude stops (Stop event)
- Uses an agent-type hook to analyze the conversation and generate a summary
- Saves to
.claude/session-context.md - Keeps the summary concise and actionable
- Overwrites the previous context file (not append)
- Works best paired with the Session Context Loader hook
Configuration
Agent-Based Version (Recommended)
{ "hooks": { "Stop": [ { "hooks": [ { "type": "agent", "prompt": "Generate a concise session summary and save it to .claude/session-context.md. Include these sections: ## Current Task (what we're working on), ## Branch (current git branch), ## Progress (checklist of done/remaining items), ## Key Decisions (important choices made this session), ## Next Steps (what to do next session). Keep it under 40 lines. Base it on what actually happened in this conversation. $ARGUMENTS", "timeout": 30 } ] } ] } }
Command-Based Version (Lightweight)
{ "hooks": { "Stop": [ { "hooks": [ { "type": "command", "command": "bash -c 'mkdir -p .claude && BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo \"unknown\"); STATUS=$(git status --short 2>/dev/null | head -10); echo \"# Session Context - Updated $(date +%Y-%m-%d\\ %H:%M)\" > .claude/session-context.md; echo \"\" >> .claude/session-context.md; echo \"## Branch\" >> .claude/session-context.md; echo \"$BRANCH\" >> .claude/session-context.md; echo \"\" >> .claude/session-context.md; echo \"## Modified Files\" >> .claude/session-context.md; echo \"\\\`\\\`\\\`\" >> .claude/session-context.md; echo \"$STATUS\" >> .claude/session-context.md; echo \"\\\`\\\`\\\`\" >> .claude/session-context.md'" } ] } ] } }
Action
When Claude stops working:
- The Stop hook fires and spawns a subagent (or runs a command)
- The agent analyzes the conversation to extract key information
- Generates a structured markdown summary
- Saves it to
.claude/session-context.md - On the next session start, the Session Context Loader reads this file
- Claude picks up exactly where you left off
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
Pre-Commit Security Scanner
Pre-commit hook that scans staged files for hardcoded secrets, API keys, passwords, and sensitive data patterns before allowing commits.
Agents Md Watcher
Streamline your workflow with this automatically, loads, agents, configuration. Includes structured workflows, validation checks, and reusable patterns for automation.
Automated Build Inspector
Boost productivity using this automatically, trigger, build, processes. Includes structured workflows, validation checks, and reusable patterns for automation.