Allow hooks or tools to set session title programmatically
Resolved 💬 3 comments Opened Apr 12, 2026 by hazeliel Closed Apr 12, 2026
Problem
There's no way to programmatically rename a session from within a conversation. The /rename command exists for manual use, but hooks and tool calls have no access to session metadata.
Use case
When resuming work on a specific project mid-session (e.g., picking from a list of active projects), the session title should reflect what's being worked on — making it easier to find and resume later. Today this requires the user to manually type /rename <project name> every time.
What I've explored
- Hooks:
SessionStart,PostToolUse, etc. can run scripts and addadditionalContext, but none can modify the session title. - CLI flags:
claude -n "name"works at startup but isn't available in the Desktop app or mid-session. - SDK:
renameSession()exists in the Agent SDK but isn't available from within a running session.
Proposed solution (any of these would work)
- A tool Claude can call (e.g.,
SetSessionTitle) to rename the current session from within a response. - A hook output field (e.g.,
sessionTitle) that lets hook scripts set the session name. - Expose
/renameas something hooks can trigger programmatically.
Environment
- Claude Code Desktop app (macOS)
- Also relevant to CLI users who want automated naming via hooks
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗