[FEATURE] Add a PreSessionEnd hook

Open 💬 0 comments Opened Jun 10, 2026 by codehead-pl

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

I'm using CLAUDE.md for retrospective logging when developing. What it instructs Claude to do is to write a short entry in today's log - what the prompt was and what were the consequences.
After I finish a session, so I'm done with the part I was working on, I usually run the /clear command. This clears the session, and that makes Claude log consecutive entries to another log for that day.
After I finish each session, I'd like Claude to summarize what has changed in this session.
Right now I have to issue a command like "wrap up the session", and Claude will pick it up from an entry in CLAUDE.md and do the summary. I do often times forget about it.

Proposed Solution

What I'm missing is a hook that runs before the session ends - either by /clear or by manually closing Claude - and KEEP the context. I could then use this hook to make Claude write the summary without me having to remember to issue a prompt myself.
The SessionEnd hook unfortunately is only after the session is already gone, so I propose a new hook - PreSessionEnd.

Alternative Solutions

_No response_

Priority

Medium - Would be very helpful

Feature Category

Other

Use Case Example

_No response_

Additional Context

_No response_

View original on GitHub ↗