Command reference Β· Claude Code
/rename
Renames the current session and shows the name in the prompt bar.
Assigns the currently running session a name that then appears in the prompt bar and makes the session easier to find later in the /resume picker. /rename <name> sets the name immediately; without an argument, Claude Code automatically generates a name from the conversation so far.
The command can be called again at any time during the running session, so a name can also be changed later without ending the session. Since version 2.1.205, /rename also works non-interactively via the -p flag, with the name passed as an argument instead of being requested through a dialog β useful for naming sessions consistently right at startup in a script.
Distinct from /clear [name], which stores a name for the then-old conversation in the /resume picker when the current session ends. /rename, by contrast, renames the still-running, current session directly, regardless of whether and when it is ended later.
π THE SAME TASK (βRENAME SESSIONβ) ON OTHER PLATFORMS
β WHEN TO USE IT?
Make a long session easy to find again
Name a multi-hour debugging session with /rename Login-Bug-Session so it can be found later via /resume.
Set the name automatically via script
In a non-interactive (-p) setup from v2.1.205 onward, name sessions consistently right at startup with /rename <name> as an argument, instead of keeping the auto-generated name.
Rename later when the topic has changed
In the middle of a session that evolved from a bugfix into a larger refactor, call /rename again and adjust the name.
β WHEN NOT TO?
Short throwaway question
For a session that will be ended with /clear right afterward, a dedicated name isn't worth it.
Better: Leave it unnamed β the automatically generated name is enough for brief use.
Naming the previous conversation on restart
/rename only names the currently running session; to name the just-ended old conversation in the /resume picker, this is the wrong command.
Better: Use /clear <name>, which names the old conversation before the restart.
SOURCES
- Claude Code docs (official) β code.claude.com