[Feature Request] Allow statusline scripts to set session color and name via JSON control messages
Bug Description
Title: Allow statusline scripts to set session color and name
Description:
The statusline system receives rich session data via JSON stdin (model, context, rate limits, session_id, etc.) but communication is one-way — the script can only output display text.
Request: Allow statusline scripts to output structured signals that control session UI properties, specifically:
- sessionColor — set the input line border color (same values as /color: red, blue, green, yellow, purple, orange, pink, cyan, default)
- sessionName — set the session name (same as /rename)
Proposed protocol: If the statusline script's first output line is valid JSON with recognized keys, treat it as a control message. Otherwise, treat output as display text (current
behavior — fully backwards compatible).
{"sessionColor": "cyan", "sessionName": "MIN-1234"}
Remaining output after the JSON line would still be rendered as the status bar text.
Use cases:
- Auto-name sessions based on detected Jira ticket / git branch / workspace
- Color-code sessions by project, environment (red for prod, green for dev), or context usage
- Visual differentiation when running multiple Claude Code sessions
- Cycling accent colors for fun / accessibility
Current workaround: /color and /rename work but are manual and must be re-entered each session. Terminal tab titles can be set via OSC escape sequences from the statusline, but the Claude Code input line has no equivalent.
Environment Info
- Platform: win32
- Terminal: windows-terminal
- Version: 2.1.92
- Feedback ID: 0d727a40-99a2-40ad-a4b9-61e5b822e3de
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗