Skip to content

Instantly share code, notes, and snippets.

@jessebond2
Last active May 27, 2026 19:14
Show Gist options
  • Select an option

  • Save jessebond2/a8f3d7b5d8d0138d047e73a62d0cdbf1 to your computer and use it in GitHub Desktop.

Select an option

Save jessebond2/a8f3d7b5d8d0138d047e73a62d0cdbf1 to your computer and use it in GitHub Desktop.
Claude Code: custom status line (model | branch | ctx% with severity zones) + notification settings

Claude Code: status line + notification settings

Drop these into ~/.claude/settings.json (merging with anything already there).

Status line

Renders as: <model> | <branch> | ctx: NN% with the context-usage percentage colored by severity zone:

ctx % Color Label
< 20 green ctx: N%
20-29 yellow ctx: N%
30-39 orange ctx: N% ! dumb zone !
40-49 red ctx: N% !! dumber zone !!
>= 50 bright red (bold) ctx: N% !!! idiot zone !!!

Requires jq and git on PATH. The branch lookup uses --no-optional-locks so it's safe to run while another git command holds a lock.

Implementation notes:

  • One jq invocation per render (emits model<TAB>workspace_dir<TAB>cwd<TAB>ctx and splits with POSIX parameter expansion).
  • Falls back to cwd when workspace.current_dir is empty.
  • Detached HEAD shows a short sha instead of the literal string HEAD.

Notifications

  • preferredNotifChannel: "terminal_bell" - ring the terminal bell when Claude needs attention. Other valid values: auto (default), iterm2, iterm2_with_bell, kitty, ghostty, notifications_disabled. iTerm2 users: swap in "iterm2" for a native desktop notification, or "iterm2_with_bell" to keep the audible bell on top of it.
  • agentPushNotifEnabled: true - enable push notifications for background agent completions.
{
"statusLine": {
"type": "command",
"command": "input=$(cat); parsed=$(printf '%s' \"$input\" | jq -r '[.model.display_name // \"\", .workspace.current_dir // \"\", .cwd // \"\", (.context_window.used_percentage // \"\" | tostring)] | @tsv'); model=\"${parsed%%\t*}\"; rest=\"${parsed#*\t}\"; dir=\"${rest%%\t*}\"; rest=\"${rest#*\t}\"; cwd=\"${rest%%\t*}\"; ctx=\"${rest#*\t}\"; work_dir=\"${dir:-$cwd}\"; branch=\"\"; if [ -n \"$work_dir\" ]; then branch=$(git -C \"$work_dir\" --no-optional-locks rev-parse --abbrev-ref HEAD 2>/dev/null); [ \"$branch\" = \"HEAD\" ] && branch=$(git -C \"$work_dir\" --no-optional-locks rev-parse --short HEAD 2>/dev/null); fi; out=\"\"; [ -n \"$model\" ] && out=\"$model\"; [ -n \"$branch\" ] && out=\"$out | $branch\"; if [ -n \"$ctx\" ]; then pct=$(printf '%.0f' \"$ctx\"); if [ \"$pct\" -ge 50 ]; then ctx_str=$(printf '\\033[1;31mctx: %s%% !!! idiot zone !!!\\033[0m' \"$pct\"); elif [ \"$pct\" -ge 40 ]; then ctx_str=$(printf '\\033[31mctx: %s%% !! dumber zone !!\\033[0m' \"$pct\"); elif [ \"$pct\" -ge 30 ]; then ctx_str=$(printf '\\033[38;5;208mctx: %s%% ! dumb zone !\\033[0m' \"$pct\"); elif [ \"$pct\" -ge 20 ]; then ctx_str=$(printf '\\033[33mctx: %s%%\\033[0m' \"$pct\"); else ctx_str=$(printf '\\033[32mctx: %s%%\\033[0m' \"$pct\"); fi; out=\"$out | $ctx_str\"; fi; printf '%s\\n' \"$out\""
},
"preferredNotifChannel": "terminal_bell",
"agentPushNotifEnabled": true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment