#!/bin/sh # Claude Code status line: model, directory, git branch, context usage. # Session JSON arrives on stdin; see # https://code.claude.com/docs/en/statusline#available-data tab=$(printf '\t') IFS="$tab" read -r model dir pct </dev/null) EOF pct=${pct:-0} branch='' if [ -n "$dir" ] && cd "$dir" 2>/dev/null; then branch=$(git branch --show-current 2>/dev/null) if [ -n "$branch" ] && [ -n "$(git status --porcelain 2>/dev/null)" ]; then branch="$branch*" fi fi if [ "$pct" -ge 80 ]; then ctx=31 elif [ "$pct" -ge 50 ]; then ctx=33 else ctx=32 fi sep='\033[2m·\033[0m' printf "\033[35m%s\033[0m $sep \033[36m%s\033[0m" "$model" "${dir##*/}" [ -n "$branch" ] && printf " $sep \033[33m%s\033[0m" "$branch" printf " $sep \033[%dm%d%%\033[0m\n" "$ctx" "$pct"