claude-code - 💡(How to fix) Fix [FEATURE] SessionStart hook should expose model and support programmatic session theming (color + name) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46189Fetched 2026-04-11 06:26:49
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
labeled ×5commented ×1unlabeled ×1

Fix Action

Fix / Workaround

There is currently no workaround that is fully automatic. Manual /color and /rename per session, or a wrapper shell function that uses --name for the name half but cannot set color.

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

Power users running multiple concurrent Claude Code sessions across different models (Sonnet, Opus, Haiku) have no way to visually distinguish them at a glance. The /color and /rename commands exist but require manual invocation every session. When switching contexts frequently — e.g., Opus for architecture, Sonnet for implementation, Haiku for quick lookups — the cognitive overhead of manual theming defeats the purpose.

There is currently no workaround that is fully automatic. Manual /color and /rename per session, or a wrapper shell function that uses --name for the name half but cannot set color.

Proposed Solution

Two complementary changes:

  1. Expose model in SessionStart hook output (already done — confirmed via testing)

The SessionStart hook already receives "model": "claude-sonnet-4-6" in its stdin JSON. This is the right foundation. No change needed here.

  1. Add sessionColor and sessionName to hook output JSON

Allow SessionStart hooks to return a JSON response that sets session display properties:

{ "sessionColor": "purple", "sessionName": "SONNET — my-project" }

Supported colors would mirror the existing /color command palette.

  1. Add --color CLI flag (parallel to existing --name) The --name / -n flag already exists for setting session name at startup. Add a --color flag for parity: claude --model claude-sonnet-4-6 --name "SONNET" --color purple

What this unlocks With these two additions, users can write a SessionStart hook that fully automates session theming:

#!/bin/bash

~/.claude/hooks/session-theme.sh

INPUT=$(cat) MODEL=$(echo "$INPUT" | jq -r '.model // "unknown"') case "$MODEL" in sonnet) COLOR="purple"; PREFIX="SONNET" ;; opus) COLOR="yellow"; PREFIX="OPUS" ;; haiku) COLOR="green"; PREFIX="HAIKU" ;; *) COLOR="blue"; PREFIX="CLAUDE" ;; esac

echo "{"sessionColor": "$COLOR", "sessionName": "$PREFIX"}"

And register it in ~/.claude/settings.json:

{ "hooks": { "SessionStart": [ { "type": "command", "command": "~/.claude/hooks/session-theme.sh" } ] } }

Alternative Solutions

No response

Priority

Critical - Blocking my work

Feature Category

CLI commands and flags

Use Case Example

Power users running multiple concurrent Claude Code sessions across different models (Sonnet, Opus, Haiku) have no way to visually distinguish them at a glance. The /color and /rename commands exist but require manual invocation every session. When switching contexts frequently — e.g., Opus for architecture, Sonnet for implementation, Haiku for quick lookups — the cognitive overhead of manual theming defeats the purpose.

Additional Context

  • /color and /rename already work mid-session via slash commands — this request is purely about automating them at session start based on model
  • The model field is already present in SessionStart hook stdin (confirmed), so the detection half is solved — only the response half is missing
  • The --name flag precedent already exists, making --color a natural extension
  • Session color is currently a transient UI-only property with no programmatic interface; making it hookable would also enable team-wide consistent theming via shared hook configs
  • Relevant to users running worktree-based multi-session workflows where visual distinction is critical for avoiding context switches to the wrong session

extent analysis

TL;DR

To automate session theming in Claude Code, add a --color CLI flag and modify the SessionStart hook to return a JSON response that sets session display properties.

Guidance

  • Implement the proposed solution by adding sessionColor and sessionName to the hook output JSON, allowing SessionStart hooks to automate session theming.
  • Create a SessionStart hook script (e.g., session-theme.sh) that parses the model from the input JSON and sets the corresponding color and prefix.
  • Register the hook script in the ~/.claude/settings.json file to enable automated theming.
  • Use the --color flag when starting a new session to set the session color, similar to the existing --name flag.

Example

#!/bin/bash
# ~/.claude/hooks/session-theme.sh
INPUT=$(cat)
MODEL=$(echo "$INPUT" | jq -r '.model // "unknown"')
case "$MODEL" in
  *sonnet*) COLOR="purple"; PREFIX="SONNET" ;;
  *opus*)   COLOR="yellow"; PREFIX="OPUS"   ;;
  *haiku*)  COLOR="green";  PREFIX="HAIKU"  ;;
  *)        COLOR="blue";   PREFIX="CLAUDE" ;;
esac

echo "{\"sessionColor\": \"$COLOR\", \"sessionName\": \"$PREFIX\"}"

Notes

The proposed solution relies on the existing SessionStart hook and the presence of the model field in the hook input JSON. The addition of the --color flag and the modification of the hook output JSON are necessary to automate session theming.

Recommendation

Apply the proposed workaround by implementing the SessionStart hook script and registering it in the ~/.claude/settings.json file, as this provides a functional solution to automate session theming based on the model.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING