Skip to content

robinebers/claude-code-statusline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claude Code Statusline

A custom statusline script for Claude Code on macOS that displays useful session and API usage information.

Screenshot

Example statusline

What It Displays

  • Repository name - Current project directory name
  • Model - Active Claude model (e.g., "Opus")
  • Context window - Visual progress bar with percentage
  • Session tokens - Total tokens used this session (formatted as K/M)
  • API usage - 5-hour and 7-day utilization (color-coded: green <60%, yellow 60-89%, red ≥90%)
  • Git branch - Current branch name

Requirements

  • macOS (uses Keychain for OAuth token)
  • jq - Install with brew install jq
  • Claude Code with OAuth authentication

Installation

With AI Agent

Copy and paste this prompt into Claude Code:

Use the statusline-setup agent to download and install this script:
https://raw.githubusercontent.com/robinebers/claude-code-statusline/main/statusline-command.sh

Manual Install

  1. Copy the script to your Claude directory:
mkdir -p ~/.claude
curl -o ~/.claude/statusline-command.sh https://raw.githubusercontent.com/robinebers/claude-code-statusline/main/statusline-command.sh
chmod +x ~/.claude/statusline-command.sh
  1. Add to your Claude Code settings (~/.claude/settings.json):
{
  "statusLine": {
    "type": "command",
    "command": "~/.claude/statusline-command.sh"
  }
}
  1. Restart Claude Code to see the statusline.

How It Works

The script receives JSON on stdin from Claude Code containing:

  • Workspace info (project directory)
  • Model info
  • Context window usage and size
  • Session token counts

It also fetches API usage from Anthropic's OAuth endpoint using credentials stored in macOS Keychain, with a 60-second cache to avoid excessive API calls.

About

Custom statusline script for Claude Code on macOS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages