Skip to main content

ccr statusline

Display a customizable status bar showing real-time information about your Claude Code session, including workspace, Git branch, model, token usage, and more.

Overview

The ccr statusline command reads JSON data from stdin and renders a beautifully formatted status bar in your terminal. It's designed to integrate with Claude Code's hook system to display real-time session information.

Usage

Basic Usage

ccr statusline

The command expects JSON data via stdin, typically piped from a Claude Code hook:

echo '{"hook_event_name":"...","session_id":"...","..."}' | ccr statusline

Hook Integration

Configure in your Claude Code settings:

{
"hooks": {
"postResponse": {
"command": "ccr statusline",
"input": "json"
}
}
}

Available Themes

Default Theme

A clean, minimal theme with Nerd Font icons and colored text:

 󰉋 my-project   main  󰚩 claude-3-5-sonnet-20241022  ↑ 12.3k  ↓ 5.2k

Powerline Theme

A vim-powerline inspired style with colored backgrounds and arrow separators:

 󰉋 my-project   main  󰚩 claude-3-5-sonnet-20241022  ↑ 12.3k  ↓ 5.2k

Activate by setting currentStyle: "powerline" in your config.

Simple Theme

Fallback theme without icons for terminals that don't support Nerd Fonts:

my-project  main  claude-3-5-sonnet-20241022  ↑ 12.3k  ↓ 5.2k

Automatically used when USE_SIMPLE_ICONS=true or on unsupported terminals.

Available Modules

Status line modules display different types of information:

ModuleDescriptionVariables
workDirCurrent working directory name{{workDirName}}
gitBranchCurrent Git branch{{gitBranch}}
modelModel being used{{model}}
usageToken usage (input/output){{inputTokens}}, {{outputTokens}}
contextContext window usage{{contextPercent}}, {{contextWindowSize}}
speedToken processing speed{{tokenSpeed}}, {{isStreaming}}
costAPI cost{{cost}}
durationSession duration{{duration}}
linesCode changes{{linesAdded}}, {{linesRemoved}}
scriptCustom script outputDynamic

Configuration

Configure statusline in ~/.claude-code-router/config.json:

Default Style Example

{
"StatusLine": {
"currentStyle": "default",
"default": {
"modules": [
{
"type": "workDir",
"icon": "󰉋",
"text": "{{workDirName}}",
"color": "bright_blue"
},
{
"type": "gitBranch",
"icon": "",
"text": "{{gitBranch}}",
"color": "bright_magenta"
},
{
"type": "model",
"icon": "󰚩",
"text": "{{model}}",
"color": "bright_cyan"
},
{
"type": "usage",
"icon": "↑",
"text": "{{inputTokens}}",
"color": "bright_green"
},
{
"type": "usage",
"icon": "↓",
"text": "{{outputTokens}}",
"color": "bright_yellow"
}
]
}
}
}

Powerline Style Example

{
"StatusLine": {
"currentStyle": "powerline",
"powerline": {
"modules": [
{
"type": "workDir",
"icon": "󰉋",
"text": "{{workDirName}}",
"color": "white",
"background": "bg_bright_blue"
},
{
"type": "gitBranch",
"icon": "",
"text": "{{gitBranch}}",
"color": "white",
"background": "bg_bright_magenta"
}
]
}
}
}
{
"StatusLine": {
"currentStyle": "default",
"default": {
"modules": [
{
"type": "workDir",
"icon": "󰉋",
"text": "{{workDirName}}",
"color": "bright_blue"
},
{
"type": "gitBranch",
"icon": "",
"text": "{{gitBranch}}",
"color": "bright_magenta"
},
{
"type": "model",
"icon": "󰚩",
"text": "{{model}}",
"color": "bright_cyan"
},
{
"type": "context",
"icon": "🪟",
"text": "{{contextPercent}}% / {{contextWindowSize}}",
"color": "bright_green"
},
{
"type": "speed",
"icon": "⚡",
"text": "{{tokenSpeed}} t/s {{isStreaming}}",
"color": "bright_yellow"
},
{
"type": "cost",
"icon": "💰",
"text": "{{cost}}",
"color": "bright_magenta"
},
{
"type": "duration",
"icon": "⏱️",
"text": "{{duration}}",
"color": "bright_white"
},
{
"type": "lines",
"icon": "📝",
"text": "+{{linesAdded}}/-{{linesRemoved}}",
"color": "bright_cyan"
}
]
}
}
}

Custom Scripts

You can create custom modules by executing scripts:

{
"type": "script",
"icon": "🔧",
"scriptPath": "/path/to/script.js",
"options": {
"customOption": "value"
}
}

Script format (CommonJS):

// my-status-module.js
module.exports = function(variables, options) {
// Access variables like model, gitBranch, etc.
// Access options from configuration
return `Custom: ${variables.model}`;
};

// Or async
module.exports = async function(variables, options) {
const data = await fetchSomeData();
return data;
};

Color Options

Standard Colors

  • black, red, green, yellow, blue, magenta, cyan, white
  • bright_black, bright_red, bright_green, bright_yellow, bright_blue, bright_magenta, bright_cyan, bright_white

Background Colors

Prefix with bg_: bg_blue, bg_bright_red, etc.

Hexadecimal Colors

Use 24-bit TrueColor with hex codes:

{
"color": "#FF5733",
"background": "bg_#1E90FF"
}

Available Variables

All variables are accessible in module text using {{variableName}}:

VariableDescriptionExample
{{workDirName}}Current directory namemy-project
{{gitBranch}}Git branch namemain
{{model}}Model nameclaude-3-5-sonnet-20241022
{{inputTokens}}Input tokens (formatted)12.3k
{{outputTokens}}Output tokens (formatted)5.2k
{{tokenSpeed}}Tokens per second45
{{isStreaming}}Streaming statusstreaming or empty
{{contextPercent}}Context usage percentage45
{{contextWindowSize}}Total context window200k
{{cost}}Total cost$0.15
{{duration}}Session duration2m34s
{{linesAdded}}Lines added150
{{linesRemoved}}Lines removed25
{{sessionId}}Session ID (first 8 chars)a1b2c3d4

Environment Variables

Control behavior with environment variables:

VariableValuesDescription
USE_SIMPLE_ICONStrue/falseForce simple theme without icons
NERD_FONTAny valueAuto-detect Nerd Font support

Examples

Minimal Status Line

{
"StatusLine": {
"default": {
"modules": [
{
"type": "model",
"text": "{{model}}"
},
{
"type": "usage",
"text": "↑{{inputTokens}} ↓{{outputTokens}}"
}
]
}
}
}

Output: claude-3-5-sonnet-20241022 ↑12.3k ↓5.2k

Developer Productivity Focus

{
"StatusLine": {
"default": {
"modules": [
{
"type": "gitBranch",
"icon": "",
"text": "{{gitBranch}}",
"color": "bright_magenta"
},
{
"type": "lines",
"icon": "📝",
"text": "+{{linesAdded}}/-{{linesRemoved}}",
"color": "bright_cyan"
},
{
"type": "duration",
"icon": "⏱️",
"text": "{{duration}}",
"color": "bright_white"
}
]
}
}
}

Output:  feature/auth 📝 +150/-25 ⏱️ 2m34s

Preset Integration

Statusline themes can be included in presets. When you install a preset with statusline configuration, it will automatically apply when you activate that preset.

See Presets for more information.

Troubleshooting

Icons Not Displaying

Set USE_SIMPLE_ICONS=true in your environment:

export USE_SIMPLE_ICONS=true

Colors Not Working

Ensure your terminal supports TrueColor (24-bit color):

export COLORTERM=truecolor

Git Branch Not Showing

Ensure you're in a Git repository and have the git command installed.