Expose a tool/hook to set the current session title (programmatic rename)

Open ๐Ÿ’ฌ 0 comments Opened Jun 30, 2026 by bcx

๐Ÿค– bot authored (Claude Opus 4.8)

Summary

There is currently no programmatic way for a skill or hook to set (or read) the current session's title. /rename works interactively, but nothing exposes that capability to automation.

Use case

I have a "capture learnings to notes" skill. When it finishes, I'd like it to mark the session with a visual prefix (e.g. ๐Ÿ“ <title>) so I can spot in the session list which sessions have had their notes captured โ€” and ideally have that marker removed automatically once the session continues with new work.

More generally: skills/hooks frequently want to reflect state in the session title (โœ… done, ๐Ÿ”ด failing, ๐Ÿ“ notes-captured, branch/PR status, etc.). Today that's impossible to automate.

What I found (Claude Code 2.1.187, desktop)

  • The displayed title is held by the desktop app in memory. The {"type":"ai-title","aiTitle":...} records in the session transcript .jsonl are written by the app as a side-effect โ€” they are not a live input. Appending one externally did not update the UI, and the app re-emitted its own unprefixed entry over it on the next turn.
  • /rename works because it signals the app through its internal channel โ€” unreachable from a shell command or file write.
  • The session-management MCP tools (list_sessions, archive_session, send_message) only operate on other sessions, never the current session's title.
  • No hook event can issue a slash command, so a hook can't get there either.

Request

One or more of:

  1. A tool to get/set the current session's title, e.g. set_session_title(title) / get_session_title(). Idempotent set so automation can add/strip a prefix cleanly.
  2. A hook-accessible way to rename the current session (e.g. a documented stdout directive a hook can emit, or a claude CLI subcommand that targets the current session).
  3. Optionally, a way for skills to emit a rename directive as part of their output.

Why a file-based workaround isn't enough

Writing ai-title to the transcript is unofficial, doesn't update the live UI, and gets clobbered by the app's own re-emission โ€” so there's no reliable path today.

View original on GitHub โ†—