A customizable statusline tool for Claude Code that displays real-time session information, Git status, GitHub PR details, and task tracking links in your terminal.
- Features
- Prerequisites
- Installation
- Configuration
- Usage
- Output Format
- Development
- Architecture
- Troubleshooting
- Contributing
- License
- Go 1.25 or later
- Git CLI (for Git status information)
- GitHub CLI (
gh) - optional (for PR information, falls back gracefully if missing) - Terminal with ANSI color support
- Claude Code Session Info: Display current model, version, output style, working directory, session stats (lines added/removed, duration, cost), and 200K+ context indicator
- Git Integration: Show remote origin URL, current branch, file change status, and diff statistics (lines added/removed)
- GitHub PR Integration: Display PR number, title, statistics, merge status, and URL
- Task Tracking: Automatically extract and link to task/issue numbers from branch names and PR head ref names
- Styled Output: Rich terminal formatting with colors, bold, italic, and underline styles
go install github.com/iskorotkov/cc-statusline@latestgit clone https://github.com/iskorotkov/cc-statusline.git
cd cc-statusline
go build -o cc-statusline .To use this statusline with Claude Code, add the following to your Claude Code settings file (~/.claude/settings.json):
{
"statusLine": {
"type": "command",
"command": "cc-statusline",
"padding": 0
}
}If you want to include task tracking integration, set the CC_TASK_SERVER environment variable in the command:
{
"statusLine": {
"type": "command",
"command": "CC_TASK_SERVER='https://github.com/iskorotkov/cc-statusline/issues' cc-statusline",
"padding": 0
}
}For Jira integration:
{
"statusLine": {
"type": "command",
"command": "CC_TASK_SERVER='https://yourcompany.atlassian.net/browse' cc-statusline",
"padding": 0
}
}-
CC_TASK_SERVER: Base URL for your task tracking system (e.g.,https://jira.example.com/browse). When set, the tool will extract task IDs from branch names and PR head ref names and generate clickable links. -
CC_THEME: Controls the color scheme for better visibility on different terminal backgrounds:dark(default): Light colors optimized for dark terminal backgroundslight: Bright, vibrant dark colors optimized for light terminal backgroundsauto: Automatically detects terminal background using$COLORFGBGenvironment variable
For users with light terminal backgrounds, explicitly set the theme for better contrast:
{
"statusLine": {
"type": "command",
"command": "CC_THEME=light cc-statusline",
"padding": 0
}
}The tool automatically detects most terminal themes, but you can override this behavior by setting CC_THEME to light or dark as needed.
Example:
export CC_TASK_SERVER="https://github.com/iskorotkov/cc-statusline/issues"The tool reads Claude Code hook data from stdin and outputs a formatted statusline:
# Example with formatted JSON for readability
cat <<EOF | cc-statusline
{
"session_id": "test-session-456",
"version": "1.0.0",
"model": {
"id": "claude-3-5-sonnet-20241022",
"display_name": "Claude 3.5 Sonnet"
},
"output_style": {
"name": "detailed"
},
"workspace": {
"project_dir": "/home/user/projects/my-project",
"current_dir": "/home/user/projects/my-project/src"
},
"cost": {
"total_lines_added": 150,
"total_lines_removed": 75,
"total_api_duration_ms": 5000,
"total_cost_usd": 1.25
},
"exceeds_200k_tokens": true
}
EOF
# Or as a one-liner for quick testing
echo '{"session_id":"test","version":"1.0.0","model":{"display_name":"Claude 3.5 Sonnet"},"output_style":{"name":"detailed"},"workspace":{"project_dir":"/home/user/project","current_dir":"/home/user/project/src"},"cost":{"total_lines_added":150,"total_lines_removed":75,"total_api_duration_ms":5000,"total_cost_usd":1.25},"exceeds_200k_tokens":true}' | cc-statuslineThe statusline displays information in multiple rows:
CC v1.0.0 | Claude 3.5 Sonnet | detailed | src | +150L -75L 0.1m $1.25 | 200K+
GIT https://github.com/iskorotkov/cc-statusline | main | M:5 A:2 D:1 | +25L -10L
PR #42 | Fix authentication bug | +200L -50L ~8F M
PR https://github.com/iskorotkov/cc-statusline/pull/42
TASK https://github.com/iskorotkov/cc-statusline/issues/42
Each row shows different information:
- CC: Claude Code version, model, output style, current directory, session statistics, context size indicator
- GIT: Remote origin URL (underlined), current branch (italic), file status (M=modified, A=added, D=deleted, etc.), and diff stats (lines added/removed from HEAD)
- PR: Pull request number, title, statistics (lines added/removed, files changed), mergeable status
- TASK: Extracted task/issue URL based on branch name and PR head ref name patterns
go build -o cc-statusline .go test -v -race ./...golangci-lint rungo fmt ./...# Run all quality checks before submitting PRs
go vet ./...
go test ./...
golangci-lint runThe tool expects JSON input matching the CCHook structure:
{
"session_id": "string",
"version": "string",
"model": {
"id": "string",
"display_name": "string"
},
"output_style": {
"name": "string"
},
"workspace": {
"project_dir": "string",
"current_dir": "string"
},
"cost": {
"total_lines_added": 0,
"total_lines_removed": 0,
"total_api_duration_ms": 0,
"total_cost_usd": 0.0
},
"exceeds_200k_tokens": false
}The statusline implements accessible color schemes that meet WCAG 2.1 contrast standards (4.5:1 minimum ratio):
Dark Theme Colors (for dark terminal backgrounds):
- Headers: RGB(192, 192, 255) - Light blue for section labels
- Positive values: RGB(127, 255, 127) - Light green for additions, costs
- Negative values: RGB(255, 127, 127) - Light red for deletions, errors
Light Theme Colors (for light terminal backgrounds):
- Headers: RGB(0, 64, 160) - Bright dark blue for section labels
- Positive values: RGB(0, 128, 0) - Vibrant green for additions, costs
- Negative values: RGB(180, 0, 0) - Saturated red for deletions, errors
All color combinations provide sufficient contrast for users with visual impairments and various lighting conditions.
For detailed development commands, testing patterns, and contribution guidelines, see CLAUDE.md
The project follows a modular architecture with composable parts:
main.go: Entry point and statusline compositionparts/: Individual statusline components (Git, GitHub, Claude Code info)shell/: Command execution utilitiesstyle/: Terminal formatting functions
Each statusline component is a Part - a function that takes context and hook data and returns a formatted string. Parts are composed using Row() and Rows() functions to build the complete statusline.
For Developers: See CLAUDE.md for detailed technical documentation, development guidelines, testing patterns, and comprehensive examples for extending the statusline functionality.
# Ensure Go bin directory is in your PATH
export PATH=$PATH:$(go env GOPATH)/bin
# Or check your GOBIN directory
go env GOBIN# Make sure the binary is executable
chmod +x $(which cc-statusline)
# Or if using Claude Code settings, check file permissions
ls -la ~/.claude/settings.json-
Verify your
~/.claude/settings.jsonconfiguration:{ "statusLine": { "type": "command", "command": "cc-statusline", "padding": 0 } } -
Test the command manually:
echo '{"version":"1.0.0"}' | cc-statusline
-
Check Claude Code logs for error messages
# Verify environment variable is set
echo $CC_TASK_SERVER
# For Claude Code integration, ensure the variable is in the command:
{
"statusLine": {
"command": "CC_TASK_SERVER='https://your-jira.com/browse' cc-statusline"
}
}-
Check if you're in a Git repository:
git status git remote -v
-
Test with minimal input:
echo '{}' | cc-statusline
# Verify Git is installed and accessible
git --version
# Check if you're in a Git repository
git rev-parse --git-dir
# Verify remote origin exists
git remote get-url originNote: GitHub CLI is optional - the tool works without it, but PR information won't be displayed.
# Check if GitHub CLI is installed and authenticated
gh --version
gh auth status
# Verify repository access
gh repo view
gh pr list- Ensure
CC_TASK_SERVERis set correctly - Check branch naming convention or PR head ref name (should contain issue/task numbers)
- Example branch/PR ref names that work:
feature/PROJ-123-add-auth→ extractsPROJ-123bugfix/issue-456→ extractsissue-456JIRA-789-implement-api→ extractsJIRA-789hotfix/123-critical-fix→ extracts123enhancement/ABC123-feature→ extractsABC123fix/#456-urgent-bug→ extracts#456
# Check terminal ANSI support
echo -e "\033[31mRed Text\033[0m"
# Try running in a different terminal
# Common terminals with good ANSI support: iTerm2, Terminal.app, GNOME Terminal- Ensure your terminal font supports Unicode
- Try a different terminal font (e.g., JetBrains Mono, Fira Code)
- Reduce terminal width or adjust Claude Code window size
- Consider customizing the statusline to show fewer components
# Check for slow Git operations
time git status
time git remote get-url origin
# Check GitHub CLI performance
time gh pr list --limit 1
# Profile the tool (for developers)
go test -bench=. -benchmem- Navigate to a Git repository directory
- Initialize Git if needed:
git init
- GitHub CLI is optional; the tool will work without it
- Install with:
brew install gh(macOS) or download from GitHub
- Network timeouts when fetching GitHub data
- Check internet connection
- Verify GitHub API rate limits:
gh api rate_limit
If you continue to experience issues:
- Check the logs: Look for error messages in Claude Code output
- Test manually: Run the command directly in your terminal
- File an issue: Report bugs at GitHub Issues
- Provide details:
- Operating system and version
- Terminal type and version
- Claude Code version
- Full error messages
- Output of
cc-statuslinewhen run manually
Contributions are welcome! Please feel free to submit a Pull Request.
To add a new statusline component:
- Create a new function in the
parts/package that returns aPart - Implement the logic to extract and format your information
- Add your part to the composition in
main.go - Submit a PR with your changes
MIT License - see LICENSE file for details
Ivan Korotkov (@iskorotkov)

