#!/bin/bash
# SessionStart(compact) hook — restores context after auto-compaction.

LOG_DIR="$CLAUDE_PROJECT_DIR/.claude/logs"
MARKER="$LOG_DIR/.compaction-occurred"

if [ ! -f "$MARKER" ]; then
  exit 0
fi

rm -f "$LOG_DIR/.tool-call-count" "$LOG_DIR/.quality-gate-active" 2>/dev/null

COMPACT_TIME=$(cat "$MARKER" 2>/dev/null || echo "unknown")
rm -f "$MARKER"

echo "POST-COMPACTION RESUME: Context was auto-compacted at $COMPACT_TIME. Session state was preserved in memory.md and daily note. Read .claude/memory.md and the latest Daily Note to reload context, then continue working on whatever task was in progress. Do not ask the user what to do — just resume seamlessly."

exit 0
