Claude Code를 사용하다 보면 하단 상태 표시줄(status line)이 기본적으로 제공되는데, 여기에 모델명·컨텍스트 사용률·비용·Git 브랜치 같은 정보를 직접 구성할 수 있습니다. 이 글에서는 statusline이 어떻게 동작하는지 개념을 설명하고, 설정 방법 두 가지를 비교한 뒤, 제가 실제로 사용 중인 커스텀 구성을 소개합니다.
statusline 설정은 ~/.claude/settings.json의 statusLine 필드로 합니다. 중요한 점은 type은 항상 "command" 하나뿐이라는 것입니다. “직접 작성 모드”와 “스크립트 모드”가 별도로 있는 게 아니라, command 필드에 무엇을 쓰느냐의 차이입니다.
git_branch=$(git -C "$cwd" -c core.hooksPath=/dev/null \ symbolic-ref --short HEAD 2>/dev/null)
-c core.hooksPath=/dev/null을 추가해 git 훅 실행을 차단합니다. statusline은 자주 호출되는데, 훅이 실행되면 의도치 않은 부작용이 생길 수 있습니다. detached HEAD 상태면 rev-parse --short HEAD로 커밋 해시를 대신 표시합니다. git 저장소가 아닌 디렉토리라면 섹션 자체를 생략합니다.
사용률 색상은 컨텍스트 바와 동일한 60/80% 기준을 usage_color 함수로 공유해 일관성을 유지합니다. rate_limits 필드 자체가 없을 수 있으므로(API 키 직접 사용 시 등) // empty로 처리하고 필드가 없으면 rate limit 섹션을 통째로 생략합니다.
# Build abbreviated name: extract family + version number # Examples: claude-sonnet-4-5 → sonnet-4.5, claude-opus-4-6 → opus-4.6 abbr=$(echo"$model_id" | sed -E \ 's/claude-([a-z]+)-([0-9]+)-([0-9]+).*/\1-\2.\3/; \ s/claude-([a-z]+-[a-z]+)-([0-9]+)-([0-9]+).*/\1-\2.\3/')
# Fallback to display name if abbr didn't change or is empty if [ -z "$abbr" ] || [ "$abbr" = "$model_id" ]; then abbr=$(echo"$model_display" | sed -E \ 's/Claude //; s/ ([0-9]+)\.([0-9]+).*/\1.\2/' | \ tr'[:upper:]''[:lower:]') fi [ -z "$abbr" ] && abbr="unknown"
# ── 2. Path (fish shell style: last 2 full, rest first-char only) ───────────── cwd=$(echo"$input" | jq -r '.workspace.current_dir // .cwd // ""') if [ -n "$cwd" ]; then home="$HOME" cwd_display="${cwd#$home}" if [ "$cwd_display" != "$cwd" ]; then cwd_display="~$cwd_display" fi
abbreviated=$(echo"$cwd_display" | awk ' { n = split($0, segs, "/") # Identify prefix and actual segments prefix = "" start = 1 if (segs[1] == "") { prefix = "/"; start = 2 } # Collect non-empty segments count = 0 for (i = start; i <= n; i++) { if (segs[i] != "") { count++ parts[count] = segs[i] } } out = prefix for (i = 1; i <= count; i++) { # Keep last 2 segments full; abbreviate the rest to first char if (count - i >= 2) { seg = substr(parts[i], 1, 1) } else { seg = parts[i] } if (out == "" || out == "/") out = out seg else out = out "/" seg } print out }')
path_part=$(printf" ${C_YELLOW}%s${C_RESET}""$abbreviated") else path_part="" fi
# ── 3. Git branch ──────────────────────────────────────────────────────────── git_branch="" if [ -n "$cwd" ]; then git_root=$(git -C "$cwd" -c core.hooksPath=/dev/null \ rev-parse --show-toplevel 2>/dev/null) if [ -n "$git_root" ]; then git_branch=$(git -C "$cwd" -c core.hooksPath=/dev/null \ symbolic-ref --short HEAD 2>/dev/null) if [ -z "$git_branch" ]; then git_branch=$(git -C "$cwd" -c core.hooksPath=/dev/null \ rev-parse --short HEAD 2>/dev/null) fi if [ -n "$git_branch" ]; then GIT_ICON=$(printf'\xe2\x8e\x87') branch_part=$(printf" ${C_GREEN}%s %s${C_RESET}""$GIT_ICON""$git_branch") fi fi fi [ -z "$git_branch" ] && branch_part=""
statusline 커스텀의 핵심 효용은 컨텍스트·비용·rate limit을 Claude와 대화하면서 항상 시야에 두는 것입니다. 컨텍스트가 80%를 넘으면 바 색깔이 노란색으로 바뀌고, 90%를 넘으면 빨간색이 됩니다. /compact를 언제 해야 할지 판단하거나, 요금이 얼마나 나왔는지 확인하거나, rate limit 소진 속도를 체크하는 데 유용합니다.