SessionEnd/Stop hooks should fire on /exit command
Resolved 💬 4 comments Opened Mar 18, 2026 by DarkCatharsis013 Closed Apr 18, 2026
Description
Hooks configured for session end events do not fire when the user exits via the /exit slash command. The hardcoded "Goodbye!" message always displays with no way to customize or extend the exit behavior.
Related to #17885 (closed as stale) and #12755.
Use Case
I want to display a custom farewell message when exiting Claude Code. I configured a Stop hook in ~/.claude/settings.json:
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "echo '{\"systemMessage\": \"Hasta la vista, baby! 🤖\"}'",
"timeout": 5
}
]
}
]
}
}
This never fires on /exit. The hardcoded "Goodbye!" always appears instead.
Expected Behavior
At minimum, one of the following should work:
Stophook fires before the goodbye message on/exitSessionEndhook fires and its output is displayed before process termination- A new
ExitorPreSessionEndhook event that runs before the process exits and can output to the terminal
Current Behavior
/exit→ prints hardcoded "Goodbye!" → process terminates immediately- No hook event fires
Ctrl+Dreportedly firesSessionEndbut/exitdoes not (#17885)
Environment
- Windows 11
- Claude Code CLI (latest)
🤖 Generated with Claude Code
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗