S

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.

HookCommunityautomationv1.0.0MIT
0 views0 copies

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

{ "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:

  1. The Stop hook fires and spawns a subagent (or runs a command)
  2. The agent analyzes the conversation to extract key information
  3. Generates a structured markdown summary
  4. Saves it to .claude/session-context.md
  5. On the next session start, the Session Context Loader reads this file
  6. Claude picks up exactly where you left off
Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates