Configuration
Status line configuration
Create a custom status line for Claude Code to display contextual information
Make Claude Code your own with a custom status line that displays at the bottom of the Claude Code interface, similar to how terminal prompts (PS1) work in shells like Oh-my-zsh.
Create a custom status line
You can either:
-
Run
/statusline
to ask Claude Code to help you set up a custom status line. By default, it will try to reproduce your terminal’s prompt, but you can provide additional instructions about the behavior you want to Claude Code, such as/statusline show the model name in orange
-
Directly add a
statusLine
command to your.claude/settings.json
:
How it Works
- The status line is updated when the conversation messages update
- Updates run at most every 300ms
- The first line of stdout from your command becomes the status line text
- ANSI color codes are supported for styling your status line
- Claude Code passes contextual information about the current session (model, directories, etc.) as JSON to your script via stdin
JSON Input Structure
Your status line command receives structured data via stdin in JSON format:
Example Scripts
Simple Status Line
Git-Aware Status Line
Python Example
Node.js Example
Helper Function Approach
For more complex bash scripts, you can create helper functions:
Tips
- Keep your status line concise - it should fit on one line
- Use emojis (if your terminal supports them) and colors to make information scannable
- Use
jq
for JSON parsing in Bash (see examples above) - Test your script by running it manually with mock JSON input:
echo '{"model":{"display_name":"Test"},"workspace":{"current_dir":"/test"}}' | ./statusline.sh
- Consider caching expensive operations (like git status) if needed
Troubleshooting
- If your status line doesn’t appear, check that your script is executable (
chmod +x
) - Ensure your script outputs to stdout (not stderr)