Feature: Programmatic session/thread renaming via hooks or tools

Open 💬 6 comments Opened Mar 28, 2026 by stevestencil

Summary

Add the ability to programmatically rename a Claude Code session/thread mid-conversation via a hook event or tool, rather than requiring manual /rename input.

Use Case

When working with GitHub issues and PRs, I want the session name to automatically reflect what I'm working on:

  1. Start work on an issue → session name becomes #42 - Fix auth bug
  2. Create a PR from that work → session name changes to PR #123 - Fix auth bug

This enables at-a-glance tracking of which conversation maps to which issue/PR, especially when juggling multiple sessions.

Current Behavior

  • claude -n "name" sets the name at startup (manual, one-time)
  • /rename changes the name mid-session (manual, interactive-only)
  • Hooks (e.g., SessionStart) cannot modify session metadata
  • No tool or API exists to set the session name programmatically

Proposed Solutions (any of these would work)

  1. New hook event — e.g., RenameSession that allows hooks or tools to set the session name
  2. Scriptable /rename — allow /rename to be called from within tool execution or hook scripts
  3. New built-in tool — a SetSessionName tool that Claude can call during a conversation (e.g., after creating a PR via gh pr create)

Example Workflow

User: Work on issue #42
Claude: [reads issue, starts work, sets session name to "#42 - Fix auth bug"]
... development happens ...
Claude: [creates PR #123, sets session name to "PR #123 - Fix auth bug"]

Environment

  • Claude Code CLI + Desktop App
  • macOS

View original on GitHub ↗

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