claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Feature Request: Add session_name to statusline JSON data

Open darioluanne770968-prog opened this issue 11 months ago • 4 comments

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!

darioluanne770968-prog avatar Dec 22 '25 03:12 darioluanne770968-prog

{ "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" } }

geetashinde0084-crypto avatar Dec 22 '25 04:12 geetashinde0084-crypto

+1 (opened a similar request, i will close it)

okets avatar Dec 24 '25 11:12 okets

+1 went to open a similar feature request, and found this one!

idarthjedi avatar Jan 07 '26 16:01 idarthjedi

+1 was about to open a request as well

benjamin-benz-42 avatar Jan 10 '26 18:01 benjamin-benz-42

+1, very useful to have this for multi-claude sessions

adamcbrewer avatar Jan 23 '26 08:01 adamcbrewer

Same, very useful when managing multiple sessions

not-an-llm avatar Jan 25 '26 19:01 not-an-llm

+1 would love this feature

litanli avatar Feb 09 '26 20:02 litanli

Would love this, feels like a straightforward implementation! Much more friendly to the eyes than a UUID.

jeremych1000 avatar Feb 10 '26 12:02 jeremych1000

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 :)

Image

yulonglin avatar Feb 11 '26 04:02 yulonglin

+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.

Niels-LNS-Research avatar Feb 12 '26 16:02 Niels-LNS-Research

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 :)

Image

I cannot see it. Running CC from PowerShell:

Image

Niels-LNS-Research avatar Feb 12 '26 17:02 Niels-LNS-Research

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.

zzJinux avatar Feb 15 '26 15:02 zzJinux

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.

Also not in https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#2142

jeremych1000 avatar Feb 16 '26 12:02 jeremych1000

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.

Currently on 2.1.72, can't find session_name anywhere.

tomarshall avatar Mar 10 '26 15:03 tomarshall

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.

Currently on 2.1.72, can't find session_name anywhere.

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.

jeremych1000 avatar Mar 10 '26 15:03 jeremych1000

+1 — would use this in a custom statusline script to identify sessions at a glance.

speti4 avatar Mar 13 '26 21:03 speti4

@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.

rcorre avatar Mar 26 '26 21:03 rcorre

This issue was fixed as of version 2.1.42.

claude[bot] avatar May 18 '26 15:05 claude[bot]

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.

github-actions[bot] avatar Jul 08 '26 14:07 github-actions[bot]