Statusline Setup
Overview
Install and configure a Starship-style status line for Claude Code that displays project context, git branch, model info, session cost, token usage, and context window utilization with Nerd Font icons and ANSI colors.
Status Line Format
The installed status line renders as:
ProjectName on branch using Model · $cost spent on input output context%
| Segment | Color | Description |
|---|---|---|
| Project | Blue | Current workspace directory name |
| Git Branch | Cyan | Active branch from workspace directory (shows worktree indicator when in a git worktree) |
| Model | Magenta | Shortened model name (e.g., "Opus 4.6", "Sonnet 4.6") |
| Cost | White | Cumulative session cost reported by Claude Code (survives /clear and compaction) |
| Tokens | Green | Input/output token counts (formatted as k/M) |
| Context | Yellow | Context window usage percentage |
Separator words ("on", "using", "spent on") render in light gray, Starship-style.
Prerequisites
jq- JSON processor (parses Claude's status JSON input)bc- Basic calculator (cost and token formatting)- A Nerd Font installed in the terminal for icon rendering
Installation
To install the status line:
- Copy
scripts/statusline.shto~/.claude/statusline.sh - Make it executable:
chmod +x ~/.claude/statusline.sh - Read
~/.claude/settings.jsonto check for existing settings - Merge a
statusLineentry into the existing settings JSON:
{
"statusLine": {
"type": "command",
"command": "<HOME>/.claude/statusline.sh"
}
}
Replace <HOME> with the user's actual home directory path (use $HOME to resolve it). Do not use ~ in the command value -- Claude Code requires an absolute path.
📌 Important: Read
~/.claude/settings.jsonbefore editing. Merge thestatusLinekey into the existing JSON structure -- do not overwrite the file.
After installation, restart Claude Code for the status line to take effect.
Uninstallation
To remove the status line:
- Remove the
statusLinekey from~/.claude/settings.json - Delete
~/.claude/statusline.sh
Customization
Cost Reporting
Cost is read directly from cost.total_cost_usd in Claude's status JSON input. This value is cumulative for the entire session and survives /clear and context compaction.
💡 Note: Earlier versions of this script computed cost from token counts and hardcoded per-million-token pricing. That approach undercounted after compaction (since
context_window.*fields reflect only the current context) and reset to zero on/clear. Pulling fromcost.total_cost_usdavoids both issues and stays accurate as Anthropic updates pricing.
Icons
Icons use Nerd Font Material Design glyphs. To swap icons, modify the icon variables near the top of the script:
ICON_FOLDER=""
ICON_MODEL=""
ICON_INPUT=""
ICON_OUTPUT=""
ICON_CONTEXT=""
ICON_BRANCH=""
ICON_COST=""
ICON_WORKTREE=""
Colors
ANSI color codes control segment colors. Modify the color variables in statusline.sh to match a preferred terminal theme.
JetBrains IDE
The script automatically disables itself in JetBrains terminals where the status line breaks the Claude TUI. No configuration needed.