When you run Claude Code in a few repos at once, it's easy to lose track of which branch you're on and which model is answering. Claude Code has a configurable status line for exactly this: a small script whose output shows up under the prompt.
How it works
You point statusLine in your settings at a command. Claude Code runs it, passes session details as JSON on stdin, and shows the first line the script prints.
In ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh"
}
}
The script
~/.claude/statusline.sh:
#!/usr/bin/env bash
input=$(cat)
model=$(echo "$input" | jq -r '.model.display_name')
dir=$(echo "$input" | jq -r '.workspace.current_dir')
branch=$(git -C "$dir" branch --show-current 2>/dev/null)
echo "[$model] ${dir##*/}${branch:+ on $branch}"
Make it executable with chmod +x ~/.claude/statusline.sh, and you'll see something like [Sonnet] api on fix/login-timeout under the prompt.
Tips
- Keep it fast. It runs often, so avoid network calls or slow git commands.
- It needs
jq. If you'd rather not install it, the same script works in a few lines of Python readingsys.stdin. - Put it in your user settings, not the project file, since it's a personal preference rather than a team rule.
- Type
/statuslinein Claude Code if you'd like it to draft a script for you.
The team-side setup that goes with this (a short CLAUDE.md, shared permissions, a risky-git hook and a read-only reviewer subagent) ships in Vildanden Agent Config. The free sample is enough to get started today.
Top comments (0)