{"id":35771469,"url":"https://github.com/moogento/moo-statusline","last_synced_at":"2026-01-07T04:19:08.379Z","repository":{"id":330837556,"uuid":"1124100423","full_name":"moogento/moo-statusline","owner":"moogento","description":"A status line for ClaudeCode","archived":false,"fork":false,"pushed_at":"2025-12-29T12:13:46.000Z","size":48,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-30T22:23:22.388Z","etag":null,"topics":["claude-code","claudecode","claudecode-monitoring","cli","productivity","statusline"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moogento.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-28T10:35:42.000Z","updated_at":"2025-12-29T12:13:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/moogento/moo-statusline","commit_stats":null,"previous_names":["moogento/moo-statusline"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/moogento/moo-statusline","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moogento%2Fmoo-statusline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moogento%2Fmoo-statusline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moogento%2Fmoo-statusline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moogento%2Fmoo-statusline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moogento","download_url":"https://codeload.github.com/moogento/moo-statusline/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moogento%2Fmoo-statusline/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28232397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2026-01-07T02:00:05.975Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["claude-code","claudecode","claudecode-monitoring","cli","productivity","statusline"],"created_at":"2026-01-07T04:19:07.360Z","updated_at":"2026-01-07T04:19:08.375Z","avatar_url":"https://github.com/moogento.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Moo Statusline for Claude Code\n\nA beautiful, informative statusline for Claude Code CLI that shows your project, git branch, model, context usage, and **real-time rate limit tracking** via the Anthropic API.\n\n## Features\n\n- 🌿 **Git Integration** - Shows project name and current branch (highlighted in green)\n- 🤖 **Model Display** - Simplified model names (sonnet 4.5, opus 4.5, haiku, etc.)\n- 📊 **Context Tracking** - Shows current usage vs auto-compact threshold (e.g., `⛁ 97k/170k`)\n- ⚡ **Live Rate Limit Data** - Real 5-hour usage from Anthropic API with visual progress bar\n- ⏰ **Smart Reset Timer** - Displays next reset time and countdown (e.g., `↺ 9pm 1h43m`)\n- 🎨 **Color-Coded Warnings** - Orange/red alerts when context or rate limits are high\n- 📈 **Weekly Usage** - Optional 7-day usage percentage when available\n\n## What It Looks Like\n\n```\nrepo 🌿 main | sonnet 4.5 | ⛁ 97k/170k | [██░░░░░░░░] 5h:24% used ↺ 9pm 1h43m\n```\n\n**Breakdown:**\n- `repo 🌿 main` - Project name + git branch (branch in green #74BE33)\n- `sonnet 4.5` - Current model (simplified from full model ID)\n- `⛁ 97k/170k` - Current context usage / auto-compact threshold (always shown)\n  - Turns orange at 70%, red at 85%\n  - Shows `left:X%` warning when \u003c10% remaining\n- `[██░░░░░░░░] 5h:24% used` - 5-hour rate limit usage from Anthropic API\n  - Visual bar + percentage\n  - Gray: \u003c50%, Yellow: 50-79%, Red: ≥80%\n  - Shows `w:3%` if weekly data is available\n- `↺ 9pm 1h43m` - Next reset time + countdown\n  - Icon in dark green (#357500)\n  - Clean time format: `9pm` not `9:00pm`\n\n## Installation\n\n### Plugin Install (Recommended)\n\n```bash\n# 1. Add the plugin to Claude Code\nclaude plugins add github:moogento/moo-statusline\n\n# 2. Run the setup command\n/statusline\n\n# 3. Restart Claude Code\n```\n\n### Homebrew (macOS)\n\n```bash\n# 1. Tap and install\nbrew tap moogento/moo-statusline\nbrew install moo-statusline\n\n# 2. Add to your Claude Code settings (~/.claude/settings.json):\n{\n  \"statusLine\": {\n    \"type\": \"command\",\n    \"command\": \"bash ~/.claude/statusline.sh\"\n  }\n}\n\n# 3. Restart Claude Code\n```\n\n### Quick Install\n\n```bash\n# 1. Download the statusline script\ncurl -o ~/.claude/statusline.sh https://raw.githubusercontent.com/moogento/moo-statusline/main/statusline.sh\nchmod +x ~/.claude/statusline.sh\n\n# 2. Add to your Claude Code settings\n# Edit ~/.claude/settings.json (global) or .claude/settings.json (project-specific)\n{\n  \"statusLine\": {\n    \"type\": \"command\",\n    \"command\": \"bash ~/.claude/statusline.sh\"\n  }\n}\n\n# 3. Restart Claude Code\n```\n\n### Manual Install\n\n1. **Copy the script:**\n   ```bash\n   cp statusline.sh ~/.claude/statusline.sh\n   chmod +x ~/.claude/statusline.sh\n   ```\n\n2. **Configure Claude Code:**\n\n   Edit `~/.claude/settings.json` (for global settings) or `.claude/settings.json` (for project-specific settings):\n\n   ```json\n   {\n     \"statusLine\": {\n       \"type\": \"command\",\n       \"command\": \"bash ~/.claude/statusline.sh\"\n     }\n   }\n   ```\n\n3. **Restart Claude Code** to see the statusline in action.\n\n## Requirements\n\n- **Claude Code CLI** (version 2.0.76 or later)\n- **macOS or Linux**\n  - macOS: Uses Keychain for OAuth token\n  - Linux: Uses `secret-tool` (GNOME Keyring) or `~/.claude/credentials.json`\n- **jq** - JSON processor\n  - macOS: `brew install jq`\n  - Linux: `apt install jq` or `yum install jq`\n- **Git** (for branch display)\n- **Bash** shell\n- **Active Claude Code session** (must be logged in for API access)\n\n## Customization\n\n### Colors\n\nThe statusline uses RGB color codes. You can customize these in the script:\n\n```bash\nGRAY=$'\\033[38;2;121;121;122m'          # #79797A - Main text\nDARK_GRAY=$'\\033[38;2;74;74;74m'        # #4A4A4A - Pipe separators\nGREEN=$'\\033[38;2;116;190;51m'          # #74BE33 - Git branch\nDARK_GREEN=$'\\033[38;2;53;117;0m'       # #357500 - Reset icon (↺)\nYELLOW=$'\\033[38;2;255;193;7m'          # #FFC107 - Rate limit warning (50-79%)\nDARK_ORANGE=$'\\033[38;2;204;122;0m'     # #CC7A00 - Context warning (70-84%)\nRED=$'\\033[38;2;255;82;82m'             # #FF5252 - Critical (≥80% rate limit, ≥85% context)\n```\n\n### Auto-Compact Threshold\n\nDefault is 85% of context window. Adjust in the script:\n\n```bash\ncompact_threshold=$((window_size * 85 / 100))  # Change 85 to your preferred %\n```\n\n### API Cache Duration\n\nThe script caches Anthropic API responses for 30 seconds to avoid rate limits. Adjust if needed:\n\n```bash\nCACHE_MAX_AGE=30  # seconds\n```\n\n### Hide Segments\n\nYou can hide specific segments using environment variables. Set these in your shell profile or Claude Code settings:\n\n```bash\nexport MOO_HIDE_GIT=1      # Hide git branch\nexport MOO_HIDE_CONTEXT=1  # Hide context usage\nexport MOO_HIDE_WEEKLY=1   # Hide weekly percentage\nexport MOO_HIDE_RESET=1    # Hide reset timer\n```\n\n## How It Works\n\nThe statusline script:\n\n1. **Receives JSON input** from Claude Code via stdin (model info, workspace, context usage)\n2. **Detects git branch** if in a git repository\n3. **Fetches real usage data** from Anthropic OAuth API:\n   - macOS: Retrieves OAuth token from Keychain (`security find-generic-password`)\n   - Linux: Uses `secret-tool` or `~/.claude/credentials.json`\n   - Calls `https://api.anthropic.com/api/oauth/usage` for live rate limit data\n   - Caches results for 30 seconds to avoid API rate limits\n4. **Parses API response** for:\n   - `five_hour.utilization` - Current 5-hour usage percentage\n   - `five_hour.resets_at` - UTC timestamp of next reset\n   - `seven_day.utilization` - Weekly usage (if available)\n5. **Calculates context usage**:\n   - Shows current tokens vs auto-compact threshold (85% of window)\n   - Converts to k format (e.g., `97k/170k`)\n   - Color-codes based on usage level\n6. **Formats reset time**:\n   - Parses UTC timestamp and converts to local time\n   - Shows clean format: `9pm` instead of `9:00pm`\n   - Rounds `:59` minutes up to next hour for clarity\n7. **Outputs colored statusline** with ANSI RGB codes\n\nClaude Code refreshes the statusline automatically every ~300ms.\n\n## Troubleshooting\n\n### Statusline not showing?\n\n1. **Check script exists and is executable:**\n   ```bash\n   ls -la ~/.claude/statusline.sh\n   ```\n   Should show: `-rwxr-xr-x`\n\n2. **Test the script manually:**\n   ```bash\n   echo '{\"model\":{\"display_name\":\"Sonnet\",\"id\":\"claude-sonnet-4-5\"},\"workspace\":{\"current_dir\":\"'$PWD'\"}}' | ~/.claude/statusline.sh\n   ```\n\n3. **Verify settings.json syntax:**\n   ```bash\n   cat ~/.claude/settings.json | jq .\n   ```\n\n4. **Check jq is installed:**\n   ```bash\n   which jq\n   ```\n\n5. **Restart Claude Code completely**\n\n### Rate limit showing as `[░░░░░░░░░░] --%`?\n\nThis means the API call is failing. Check:\n\n1. **Verify you're logged in to Claude Code:**\n   ```bash\n   claude status\n   ```\n\n2. **Check OAuth token is accessible:**\n   ```bash\n   security find-generic-password -s \"Claude Code-credentials\" -w\n   ```\n   Should return JSON with OAuth credentials.\n\n3. **Test API access manually:**\n   ```bash\n   # Get token\n   TOKEN=$(security find-generic-password -s \"Claude Code-credentials\" -w | jq -r '.claudeAiOauth.accessToken')\n\n   # Test API\n   curl -s \"https://api.anthropic.com/api/oauth/usage\" \\\n     -H \"Authorization: Bearer $TOKEN\" \\\n     -H \"anthropic-beta: oauth-2025-04-20\"\n   ```\n\n4. **Check cache file:**\n   ```bash\n   cat /tmp/claude-usage-cache.json\n   ```\n   If corrupted, delete it: `rm /tmp/claude-usage-cache.json`\n\n### Reset time showing wrong timezone?\n\nThe script uses `TZ=UTC` for parsing and `LC_TIME=C` for formatting. If times are still wrong, verify your system timezone:\n```bash\ndate +%Z\n```\n\n### Escape codes showing as literal text?\n\nYour terminal or Claude Code version may not support ANSI escape sequences. Try removing the color codes or updating to the latest Claude Code version.\n\n### Shell/Terminal Issues\n\n**iTerm2**: Works out of the box. Ensure you're using a recent version.\n\n**Terminal.app (macOS)**: RGB colors require macOS 10.15+. Older versions may show incorrect colors.\n\n**tmux**: Add to your `.tmux.conf`:\n```bash\nset -g default-terminal \"xterm-256color\"\nset -ga terminal-overrides \",xterm-256color:Tc\"\n```\n\n**screen**: RGB colors may not display correctly. Consider using tmux instead.\n\n**Linux terminals**: Most modern terminals (GNOME Terminal, Konsole, Alacritty) support RGB colors. If colors don't work, check your `$TERM` variable:\n```bash\necho $TERM\n# Should be xterm-256color or similar\n```\n\n### API error indicator `[!]`?\n\nIf you see `[!]` before the progress bar, the API call is failing but cached data is being displayed. Common causes:\n- OAuth token expired (re-login to Claude Code)\n- Network issues\n- API rate limiting\n\n## Contributing\n\nContributions welcome! Feel free to:\n\n- Report bugs via issues\n- Submit pull requests for improvements\n- Share your customizations\n- Suggest new features\n\n## License\n\nMIT License - Feel free to use, modify, and distribute.\n\n## Credits\n\nCreated for the Claude Code community. Inspired by the need for better context awareness and rate limit tracking.\n\n---\n\n**Tips:**\n- The statusline updates automatically as you work (~300ms refresh)\n- Watch `⛁` values turn orange/red to know when auto-compact is approaching\n- Monitor the 5-hour rate limit bar to pace your usage\n- Dark green `↺` icon marks the reset timer\n- Weekly usage (`w:X%`) helps track longer-term patterns\n- Cache refreshes every 30 seconds to keep data current without hammering the API\n- Times are shown cleanly: `9pm` instead of `9:00pm`, `:59` rounds to next hour\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoogento%2Fmoo-statusline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoogento%2Fmoo-statusline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoogento%2Fmoo-statusline/lists"}