Add SessionRename hook event

Resolved 💬 2 comments Opened Feb 22, 2026 by ronit111 Closed Mar 22, 2026

Feature Request

Problem

When a user runs /rename to set a custom session name, there's no hook event that fires. This makes it impossible to programmatically react to session renames — for example, syncing the session name to a tmux session name.

Current Workaround

The only way to detect a rename is by polling the JSONL transcript file for "type":"custom-title" entries via the statusLine command. This works but is architecturally backwards — polling for a rare, discrete event.

Proposed Solution

Add a SessionRename hook event that fires when /rename is executed. The hook input should include:

{
  "session_id": "...",
  "old_name": "...",
  "new_name": "...",
  "transcript_path": "..."
}

Context

  • /rename already writes a custom-title entry to the transcript JSONL
  • Since v2.1.47, /rename emits OSC escape sequences to update the terminal tab title
  • The hook system already covers session lifecycle events (SessionStart, SessionEnd) — SessionRename is a natural addition
  • Other recent hook additions (ConfigChange, WorktreeCreate, WorktreeRemove) set precedent for hooking into local CLI actions

Use Case

Syncing Claude Code session names to tmux session names, so tmux list-sessions shows meaningful names instead of claude-XXXXX. This also enables cleanup of stale tmux sessions when a session is resumed in a new terminal.

View original on GitHub ↗

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