Feature: Allow programmatic session rename from skills/commands
Problem
The /rename command (added in v2.1.76) is a great feature for naming sessions, but it cannot be automated within custom workflows. This creates friction for users who have slash commands that already have the perfect session name available programmatically.
Concrete use case: I have a /start TICKET-XXX command that fetches a Linear ticket title, creates a feature branch, and begins work. At Step 4, it already has the ticket ID and title (e.g., "IOS-21: Build new platform app command"). This is the ideal session name — but there is no way to set it automatically.
Current limitations
| Method | Limitation |
|--------|-----------|
| /rename "name" | Interactive only — AI cannot invoke built-in commands |
| claude -n "name" | Requires knowing the name before session start |
| Hooks | Receive session_id but explicitly cannot rename sessions |
| Bash tool | No claude session rename CLI subcommand exists |
Proposed solution (any of these would work)
- AI-accessible tool — A
SessionRenametool that the AI can call from within skills/commands, similar to howTaskCreate/TaskUpdatework for task management.
- Hook capability — Allow hooks to rename the session. Hooks already receive
session_idin their input JSON; adding a rename capability via stdout or a response field would be natural.
- CLI subcommand —
claude session rename <session-id> <name>callable from Bash, with the session ID available via environment variable (e.g.,$CLAUDE_SESSION_ID).
Option 1 is the most ergonomic — it would let any custom command set a meaningful session name as part of its workflow.
Impact
This would make /resume significantly more useful for power users who work across many tickets/sessions. Currently, sessions show up as unnamed entries; with automation, every /start session would be instantly identifiable by ticket ID and title.
This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗