/exit in Claude Code CLI has a hook that automatically writes the decision records, memory, etc.

Resolved 💬 3 comments Opened May 15, 2026 by TheSnickerz Closed May 18, 2026

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

There is currently no way to run logic when a Claude Code session ends. Hooks only fire on tool use events (PreToolUse / PostToolUse), not on session close. This means things like updating documentation, writing memory files, summarizing what shipped, or flagging uncommitted changes must be triggered manually by the user before exiting.

Proposed Solution

Add a session-end hook (e.g. SessionEnd) that fires when the user runs /exit or closes the terminal session. It should support the same shell command interface as existing hooks, so users can chain it into scripts or trigger follow-up Claude runs.

Alternative Solutions

  • Wrapping /exit in a shell alias — doesn't work reliably across terminals
  • Using PostToolUse hooks — fires too frequently, not scoped to session end
  • Manual user prompting — works but puts the burden on the user

Priority

High - Significant impact on productivity

Feature Category

CLI commands and flags

Use Case Example

Many teams use CLAUDE.md and memory files to maintain context across
sessions. A session-end hook would allow these to be updated automatically
— without the user having to remember to ask before closing. It would also
enable auto-commit of uncommitted work, session summaries, and CI triggers.

Additional Context

_No response_

View original on GitHub ↗

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