Hook before Exit
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
[FEATURE] I have a /wrap command that records a session summary. I'd like to have a hook that I can use to prompt me when I fail to /wrap before I /quit. Needs to preserve context before quitting.
Proposed Solution
Make a hook that fires when claude is preparing to exit and prior to losing the session context. I think that suffices. I could use that hook to fire my /wrap command.
I suspect it would be generally useful to have a hook at such a point in the processing anyway: What is the last thing you want claude to do before losing context built up during the session.
Alternative Solutions
I asked claude if there was any way to warn me if I fail to /wrap before /exit, and it said there was no hook at a point where context was still preserved. I'm not sure what other feature or capability is available to catch this oversight in session management.
For my purposes, the only solution I am aware of is to remember to /wrap before I /exit. That still leaves other interruptions unresolved, though.
Priority
Medium - Would be very helpful
Feature Category
Interactive mode (TUI)
Use Case Example
I am trying to keep a comprehensive log of the session i have with claude. I created the /wrap instruction to make a summary of the session events - both for the individual project and for a collective memory project. If my session is interrupted for any reason, I lose the opportunity to keep a summary for that session. I am occasionally able to reconstruct some of the session information, but it is limited even in the best of circumstances. This request covers uncontrollable interruptions such as a dropped ssh session - or just my failure to issue the /wrap instruction before I /quit.
Additional Context
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗