#!/usr/bin/env bash # SessionEnd hook: prompts for modules worked on, then appends a session record # to ~/.claude-howto-progress.json for persistent learning progress tracking. # # Fires once when the Claude Code session terminates — not after every response. # Uses /dev/tty for interactive input since stdin carries the hook's JSON payload. # # Install: add to .claude/settings.json under the "SessionEnd" event (see below). PROGRESS_FILE="$HOME/.claude-howto-progress.json" # Guard: only run inside this repo if [[ "$CLAUDE_PROJECT_DIR" != *"claude-howto"* ]] && [[ "$PWD" != *"claude-howto"* ]]; then exit 0 fi # Create progress file if it doesn't exist if [ ! -f "$PROGRESS_FILE" ]; then echo '{"sessions":[]}' > "$PROGRESS_FILE" fi DATE=$(date +"%Y-%m-%d") TIME=$(date +"%H:%M") echo "" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo " Claude Code — Learning Session End" echo " $DATE $TIME" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "" echo " Which modules did you work on? (e.g. 06,07 or press Enter to skip)" echo " 01=Slash 02=Memory 03=Skills 04=Subagents 05=MCP" echo " 06=Hooks 07=Plugins 08=Checkpoints 09=Advanced 10=CLI" echo "" printf " > " read -r INPUT