SessionStart Hook
Runs when a new Claude session starts. Loads the most recent session summary into Claude’s context.What It Does
Load Previous Session Context
Load Previous Session Context
Searches for recent session files (last 7 days) and injects the most recent session summary into Claude’s context via stdout.
Report Learned Skills
Report Learned Skills
Checks for learned skills in the learned skills directory and reports how many are available.
List Session Aliases
List Session Aliases
Reports available session aliases that can be loaded with
/sessions load <alias>.Detect Package Manager
Detect Package Manager
Automatically detects the package manager (npm, pnpm, yarn, bun) and reports it to Claude.
Detect Project Type
Detect Project Type
Identifies project languages and frameworks (TypeScript, React, Next.js, Python, Go, etc.).
Hook Configuration
hooks.json
SessionEnd Hook
Runs when a Claude session ends. Persists session state for the next session.What It Does
Persist Session State
Persist Session State
Saves the current session summary, including tasks completed, decisions made, and context to preserve.
Evaluate Session for Patterns
Evaluate Session for Patterns
Analyzes the session to identify extractable patterns and learnings that can be saved as skills.This enables continuous learning—the system gets smarter over time by capturing recurring patterns.
Hook Configuration
hooks.json
Session Persistence Flow
Session Storage
Session files are stored in:- Sessions directory:
~/.claude/sessions/ - Session files:
YYYY-MM-DD-session.tmp - Learned skills:
~/.claude/learned-skills/ - Compaction log:
~/.claude/sessions/compaction-log.txt
Benefits
Continuity
Pick up where you left off without repeating context
Learning
System learns from patterns and improves over time
Configuration
Automatic detection of package manager and project type
History
Track compaction events and session evolution
Related
- PreCompact Hook — Save state before context compaction
- Custom Hooks — Create your own lifecycle hooks