anthropics / anthropics/claude-code

Feature Request: Allow Claude/agents to programmatically rename sessions

Open
#94,528 1 comment 0 reactions 0 assignees View on GitHub
duplicate enhancement
Dominant language
Python
Stars
145k
Forks
23.1k
PR merge metrics
PR metrics pending

Description

### Preflight Checklist

- [x] I have searched [existing requests](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20label%3Aenhancement) and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)

### Problem Statement

### **Summary**

Claude Code now supports manually renaming sessions via `/rename`, addressing the core request from [#38173](https://github.com/anthropics/claude-code/issues/38173).

However, session renaming currently appears to be limited to an explicit user invocation of the `/rename` command. Claude itself cannot rename the current session based on instructions, CLAUDE.md, agent prompts, hooks, or other automated workflows.

It would be useful to expose session renaming as an action/tool that Claude can invoke programmatically.

### **Problem**

I would like to be able to provide instructions such as:

At the beginning of a session, rename the session to a short descriptive name based on the task being worked on.

Or define behavior in CLAUDE.md such as:

When beginning work on a GitHub issue, rename the session to [issue-number] - [short-description].

Currently, Claude can understand and follow the instruction conceptually, but it cannot actually execute `/rename`. The user must manually run the slash command.

This becomes especially limiting when using Claude Code with agents, automated workflows, or multiple concurrent sessions/worktrees. Session names are most valuable in these scenarios, but these are also the scenarios where manually naming every session becomes cumbersome.

### **Proposed Solution**

Expose session renaming as something Claude itself can invoke, for example through an internal tool/action:

`rename_session(name)`

This would allow Claude to rename the current session when explicitly instructed to do so.

It could then be used from:
- CLAUDE.md instructions
- Agent prompts
- Custom agents
- Automated workflows
- User prompts during a session

For example:

Work on issue #1234. Rename this session using the issue number and a short description before beginning.

Claude could then automatically set the session name to something like:

`1234 - Fix authentication timeout`

### **Why This Matters**

The addition of `/rename` solves the underlying session-naming problem, but requiring manual invocation prevents session naming from becoming part of automated Claude Code workflows.

As Claude Code increasingly supports agents, parallel work, worktrees, and automated development workflows, being able to automatically assign meaningful session names would make `/resume` and session management significantly easier.

This would be particularly useful when orchestrating multiple Claude Code sessions where each agent/session is working on a different issue or task.

### **Related**

This builds on #38173, which requested the original session rename capability. `/rename` now exists; this request is specifically about allowing Claude itself to invoke that functionality programmatically when instructed.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the existing /rename command and session-management behavior described in the issue, then examine how Claude Code exposes actions to agents and automated workflows. Done means Claude can invoke a session-rename action when instructed, while preserving the current manual /rename behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.