SessionEnd hook does not fire with /clear as documentation states.

Status Closed — not planned
Maintainer reply None cached
Activity 7 comments · opened Aug 24, 2025 · closed May 28, 2026

Docs say:
SessionEnd

Runs when a Claude Code session ends. Useful for cleanup tasks, logging session statistics, or saving session state.

The reason field in the hook input will be one of:

clear - Session cleared with /clear command
logout - User logged out
prompt_input_exit - User exited while prompt input was visible
other - Other exit reasons

However, I spent a long time testing with --debug and couldn't make SessionEnd fire on /clear command. The SessionStart does fire of course since its a new session after clearing. I'd expect /clear to fire SessionEnd and then SessionStart in succession.

View original on GitHub ↗

This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗