Feature Request: Add session_name to statusline JSON data
Feature Request
Description
Currently, the statusline script receives JSON data that includes session_id (UUID) but does not include the user-defined session name set via the /rename command.
Current Behavior
The JSON passed to the statusline script contains:
{
"session_id": "e8939c9b-3a20-46d3-8803-cda5e658ecdf",
"model": {...},
"cost": {...},
"workspace": {...},
...
}
Requested Behavior
Please add a session_name field to the JSON data:
{
"session_id": "e8939c9b-3a20-46d3-8803-cda5e658ecdf",
"session_name": "my-project-session", // <-- Add this field
"model": {...},
"cost": {...},
"workspace": {...},
...
}
Use Case
Users who rename their sessions with /rename would like to display the friendly session name in their custom statusline. This helps identify different sessions when working on multiple projects.
Example Usage in statusline.sh
SESSION_NAME=$(echo "$input" | jq -r '.session_name // .session_id')
echo "📝 $SESSION_NAME | 🤖 $MODEL_DISPLAY | ..."
Environment
- Claude Code version: 2.0.75
- OS: macOS
Thank you for considering this feature!
{ "session_id": "e8939c9b-3a20-46d3-8803-cda5e658ecdf", "model": { "name": "example-model", "version": "1.0" }, "cost": { "total": 0.05, "currency": "USD" }, "workspace": { "id": "ws-12345", "name": "My Workspace" } }
+1 (opened a similar request, i will close it)
+1 went to open a similar feature request, and found this one!
+1 was about to open a request as well
+1, very useful to have this for multi-claude sessions
Same, very useful when managing multiple sessions
+1 would love this feature
Would love this, feels like a straightforward implementation! Much more friendly to the eyes than a UUID.
It's implemented in 2.1.39! I haven't checked if it's in the statusline metadata, but it shows up in Claude Code when you rename the session :)
+1 I cannot stress how important it is to implement this feature. CC has a way to set the session name, but no way to read it. As a minimum there should be a /name command in addition to the /rename command. It is so easy to get lost when having multiple sessions open. This feature would bring back some sanity. I would be surprised if this was difficult to implement compared to all the other awesome features we have.
It's implemented in
2.1.39! I haven't checked if it's in the statusline metadata, but it shows up in Claude Code when you rename the session :)![]()
I cannot see it. Running CC from PowerShell:
I confirmed that in v2.1.42 the session_name key appears when a session becomes named though not documented yet in https://code.claude.com/docs/en/statusline#available-data.
I confirmed that in v2.1.42 the
session_namekey appears when a session becomes named though not documented yet in https://code.claude.com/docs/en/statusline#available-data.
Also not in https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#2142
I confirmed that in v2.1.42 the
session_namekey appears when a session becomes named though not documented yet in https://code.claude.com/docs/en/statusline#available-data.
Currently on 2.1.72, can't find session_name anywhere.
I confirmed that in v2.1.42 the
session_namekey appears when a session becomes named though not documented yet in https://code.claude.com/docs/en/statusline#available-data.Currently on 2.1.72, can't find
session_nameanywhere.
It works though, try and just echo the input you get in your statusline after running /rename and you'll see it.
Docs aren't updated.
+1 — would use this in a custom statusline script to identify sessions at a glance.
@jeremych1000 and @zzJinux are correct. session_name is in the JSON, but only if your session is explicitly named, and it is not documented. So I think the ask here would just be to document it.
This issue was fixed as of version 2.1.42.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.