What is the Status Line in Claude Code
The status line is a customizable area at the bottom of the Claude Code interface that displays contextual information about your session. You can configure it to show details like the current AI model, working directory, Git branch, and more, similar to a custom terminal prompt (PS1).
How to Create a Custom Status Line
You can either ask Claude Code to help you set it up by running /statusline
, or you can manually add a statusLine
command to your .claude/settings.json
file.
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh",
"padding": 0
}
}
How It Works
Your status line command receives a JSON object via stdin with information about the current session. The first line of your script's stdout is then displayed as the status line. It supports ANSI color codes for styling.
Python Example
Here is an example of a Python script that creates a status line showing the current model, directory, and Git branch.
#!/usr/bin/env python3
import json
import sys
import os
# Read JSON from stdin
data = json.load(sys.stdin)
# Extract values
model = data['model']['display_name']
current_dir = os.path.basename(data['workspace']['current_dir'])
# Check for git branch
git_branch = ""
if os.path.exists('.git'):
try:
with open('.git/HEAD', 'r') as f:
ref = f.read().strip()
if ref.startswith('ref: refs/heads/'):
git_branch = f" | 🌿 {ref.replace('ref: refs/heads/', '')}"
except:
pass
print(f"[{model}] 📁 {current_dir}{git_branch}")
See Also: Configuration|Slash Commands