memelord runs hookSessionEnd on Claude Code's SessionEnd hook (docs), which runs for the following reasons:
| Reason |
Description |
clear |
Session cleared with /clear command |
logout |
User logged out |
prompt_input_exit |
User exited while prompt input was visible |
bypass_permissions_disabled |
Bypass permissions mode was disabled |
other |
Other exit reasons |
These are different conditions compared to OpenCode's session.deleted, currently leveraged by this repo, which corresponds to the "Delete session" user input.
AFAIK there isn't a good corollary to SessionEnd in OpenCode. The (admittedly less-than-ideal) approach I went for in my PR is to spawn a process on session.idle that runs the SessionEnd behavior after 90 seconds of idling. Sort of a best approximation of the user ending the session entirely.