{"id":45498554,"url":"https://github.com/fredrikaverpil/claudeline","last_synced_at":"2026-04-26T00:00:49.002Z","repository":{"id":339923836,"uuid":"1163862379","full_name":"fredrikaverpil/claudeline","owner":"fredrikaverpil","description":"Minimalistic Go statusline for Claude Code","archived":false,"fork":false,"pushed_at":"2026-04-25T11:40:10.000Z","size":274,"stargazers_count":35,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-25T13:28:04.237Z","etag":null,"topics":["claude-code"],"latest_commit_sha":null,"homepage":"","language":"Go","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/fredrikaverpil.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2026-02-22T09:13:45.000Z","updated_at":"2026-04-25T11:40:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/fredrikaverpil/claudeline","commit_stats":null,"previous_names":["fredrikaverpil/claudemeter"],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/fredrikaverpil/claudeline","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredrikaverpil%2Fclaudeline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredrikaverpil%2Fclaudeline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredrikaverpil%2Fclaudeline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredrikaverpil%2Fclaudeline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fredrikaverpil","download_url":"https://codeload.github.com/fredrikaverpil/claudeline/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredrikaverpil%2Fclaudeline/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32280981,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T18:29:39.964Z","status":"ssl_error","status_checked_at":"2026-04-25T18:29:32.149Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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"],"created_at":"2026-02-22T18:06:25.472Z","updated_at":"2026-04-26T00:00:48.985Z","avatar_url":"https://github.com/fredrikaverpil.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# claudeline\n\nA minimalistic and opinionated\n[Claude Code status line](https://code.claude.com/docs/en/statusline).\n\n\u003cimg width=\"930\" height=\"112\" alt=\"claudeline_pro\" src=\"https://github.com/user-attachments/assets/1c28cf80-c562-47fa-8ae4-2dda6bccd336\" /\u003e\n\n\u003cimg width=\"930\" height=\"112\" alt=\"claudeline\" src=\"https://github.com/user-attachments/assets/51ab601c-760a-41da-8dca-d682bf7ad138\" /\u003e\n\n\u003cimg width=\"930\" height=\"112\" alt=\"image\" src=\"https://github.com/user-attachments/assets/8728028b-8cbb-4113-af88-3bbf4e6ab23b\" /\u003e\n\nIt displays the subscription plan (or API/provider), current Anthropic model,\ncontext window usage, and 5-hour/7-day quota usage as ANSI-colored progress\nbars. Written in Go with no external dependencies (stdlib only).\n\n\u003e [!NOTE]\n\u003e\n\u003e The 5-hour and 7-day quota bars require a Claude Code subscription (Pro, Max,\n\u003e or Team). They are not available for Enterprise or API key users. The bars may\n\u003e also disappear silently if the usage API is temporarily unavailable or rate\n\u003e limited — use `-debug` to diagnose.\n\n## Indicator legend\n\n| Indicator            | Meaning                                                                                                                                                               |\n| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `⚡️`                 | Peak hours: 5-hour limit burns [faster than normal](https://xcancel.com/trq212/status/2037254607001559305#m)                                                          |\n| `⚠️`                 | Approaching auto-compaction threshold                                                                                                                                 |\n| `🥵`                 | Extended context (\u003e200k tokens) — model quality may degrade                                                                                                           |\n| `🔥▂` `🔥▄▂` `🔥▆▄▂` | Anthropic service disruption (minor / major / critical)                                                                                                               |\n| `🥊`                 | [Prompt cache](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#how-prompt-caching-works) miss — this turn was not served from cache (costs more) |\n| `↑`                  | New `claudeline` update available                                                                                                                                     |\n\n## Installation\n\n### Via Claude Code plugin\n\n1. Inside Claude Code, add the plugin marketplace and install:\n\n```\n/plugin marketplace add fredrikaverpil/claudeline\n/plugin install claudeline@claudeline\n```\n\n2. Run `/claudeline:setup` inside Claude Code — this downloads the Go binary and\n   configures your statusline\n3. Restart Claude Code\n\n### Manual\n\n1. Download the latest binary from\n   [GitHub releases](https://github.com/fredrikaverpil/claudeline/releases), or\n   use `go install github.com/fredrikaverpil/claudeline@latest`.\n2. Add the statusline to `~/.claude/settings.json`:\n\n```jsonc\n{\n  \"statusLine\": {\n    \"type\": \"command\",\n    \"command\": \"/path/to/claudeline\",\n  },\n}\n```\n\n\u003e [!TIP]\n\u003e\n\u003e If installing via `go install`, set the command to `~/go/bin/claudeline`\n\n3. Restart Claude Code\n\n## Flags\n\n| Flag                  | Default | Description                                          |\n| --------------------- | ------- | ---------------------------------------------------- |\n| `-debug`              | `false` | Write warnings/errors to `/tmp/claudeline/debug.log` |\n| `-cwd`                | `false` | Show working directory name in the status line       |\n| `-cwd-max-len`        | `30`    | Max display length for working directory name        |\n| `-git-branch`         | `false` | Show git branch in the status line                   |\n| `-git-branch-max-len` | `30`    | Max display length for git branch                    |\n| `-cost`               | `false` | Show estimated session cost in the status line       |\n| `-usage-file`         |         | Read usage data from file instead of API             |\n| `-status-file`        |         | Read status data from file instead of API            |\n| `-update-file`        |         | Read update data from file instead of API            |\n| `-version`            | `false` | Print version and exit                               |\n\nExample with working directory and git branch enabled:\n\n```json\n{\n  \"statusLine\": {\n    \"type\": \"command\",\n    \"command\": \"claudeline -cwd -git-branch\"\n  }\n}\n```\n\n## Architecture\n\nSingle-binary design with `main.go` orchestrating `internal/` packages.\n\n**Data flow:** stdin JSON → parse input + read credentials → fetch usage\n(cached) + fetch status (cached) + check update (cached) → render ANSI output →\nstdout\n\nKey components:\n\n- **Credential resolution:** Detects API provider from environment variables\n  following\n  [Claude Code's authentication precedence](https://code.claude.com/docs/en/authentication#credential-management):\n  `CLAUDE_CODE_USE_MANTLE`, `CLAUDE_CODE_USE_BEDROCK`, `CLAUDE_CODE_USE_VERTEX`,\n  `CLAUDE_CODE_USE_FOUNDRY`, `ANTHROPIC_API_KEY`/`ANTHROPIC_AUTH_TOKEN`,\n  `CLAUDE_CODE_OAUTH_TOKEN` — displaying \"Mantle\", \"Bedrock\", \"Vertex\",\n  \"Foundry\", \"API\", or \"OAuth\" instead of the plan name. When no provider is\n  detected, reads OAuth credentials from macOS Keychain\n  (`security find-generic-password`), falling back to\n  `~/.claude/.credentials.json`. The subscription type is mapped from the\n  credential's `subscriptionType` field (pro, max, team, enterprise).\n  Unrecognized subscription types are silently omitted from the status line (use\n  `-debug` to see the raw value). Works on any platform via the file fallback.\n  Failure is non-fatal (usage bars are omitted).\n- **Usage API:** `GET https://api.anthropic.com/api/oauth/usage` with OAuth\n  bearer token. 5-second HTTP timeout.\n- **File-based cache:** `/tmp/claudeline/usage.json` with 60s TTL on success,\n  15s TTL on failure.\n- **Context bar:** 5-char width using `█`/`░` with four color zones inspired by\n  [Dax Horthy's \"dumb zone\" theory](https://www.youtube.com/watch?v=rmvDxxNubIg\u0026t=493s)\n  on context window quality degradation:\n  - **Smart** (green, 0–40%) — model performs at full capability\n  - **Dumb** (yellow, 41–60%) — quality starts to degrade\n  - **Danger** (orange, 61–80%) — significant quality loss\n  - **Near compaction** (red, 80%+) — approaching auto-compaction threshold\n- **Quota bars:** 5-char width using `█`/`░` (blue/magenta/red) for 5-hour and\n  7-day quotas. Per-model sub-bars (sonnet, opus, cowork, oauth) appended to the\n  7-day bar with `·` sub-separator. Extra usage shown as `$used/$limit` (hidden\n  when $0, red at 80%+ of limit). A `⚡️` prefix appears on the 5-hour bar during\n  peak hours (weekdays 13:00–19:00 UTC) for Pro and Max plans, when the 5-hour\n  session limit\n  [burns faster than normal](https://xcancel.com/trq212/status/2037254607001559305#m).\n- **Compaction warning:** A yellow `⚠️` appears on the context bar when it\n  enters the red near-compaction zone (80% by default). Claude Code\n  auto-compacts later, at approximately 95% of its effective context capacity,\n  but claudeline warns earlier so you have time to react. If Claude Code's\n  `CLAUDE_CODE_AUTO_COMPACT_WINDOW` is set, claudeline applies its warning zones\n  relative to that effective capacity. If `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is\n  set, claudeline warns 5 percentage points before that configured percentage,\n  applied relative to the effective capacity.\n- **Extended context indicator:** A `🥵` appears on the context bar when\n  `exceeds_200k_tokens` is true, signaling the session has entered extended\n  context territory where model quality may degrade.\n- **Update check:** Fetches\n  `https://api.github.com/repos/fredrikaverpil/claudeline/releases/latest`\n  (GitHub API, no auth required). Release tag is cached in\n  `/tmp/claudeline/update.json` with 24h OK TTL, 15s fail TTL. Shows a green `↑`\n  indicator when a newer version is available. Hidden when already on the latest\n  version or when the version cannot be determined (e.g. `(devel)`,\n  `(unknown)`).\n- **Service status:** Fetches `https://status.claude.com/api/v2/status.json`\n  (Atlassian Statuspage API, no auth required). Cached in\n  `/tmp/claudeline/status.json` with 2min OK TTL, 30s fail TTL. Shows an orange\n  fire icon with severity bars when there is a disruption: `🔥▂` (minor), `🔥▄▂`\n  (major), `🔥▆▄▂` (critical). Hidden when all systems are operational.\n- **Session cost:** Displays the session cost as `$X.XX` from the\n  `cost.total_cost_usd` field in stdin JSON. Always shown for direct API key\n  users; opt-in with `-cost` for all others. Claude Code calculates this for all\n  users by multiplying token usage against\n  [public API pricing](https://docs.anthropic.com/en/docs/about-claude/pricing).\n  For direct API key users this reflects actual spend; for subscription users\n  and cloud provider users (Bedrock, Vertex, Foundry) it is an estimate based on\n  Anthropic's public API rates. The cost accumulates for the lifetime of the\n  Claude Code process and resets when you quit and relaunch (not on `/clear` or\n  `/new`).\n- **Working directory:** Last path segment from `cwd` in stdin JSON, opt-in with\n  `-cwd`.\n- **Git info:** Branch name read from `.git/HEAD` (no subprocess), opt-in with\n  `-git-branch`.\n- **Custom .claude folder**: Support `CLAUDE_CONFIG_DIR`.\n- **Debug mode:** Pass `-debug` to write warnings and errors to\n  `/tmp/claudeline/debug.log`. Set the statusline command to\n  `claudeline -debug`, then `tail -f /tmp/claudeline/debug.log` in another\n  terminal.\n\n## Development\n\nThis project uses [Pocket](https://github.com/fredrikaverpil/pocket), a\nMakefile-like task runner. Run `./pok` to execute linting, formatting, and\ntests.\n\n### Capturing and rendering\n\nClaudeline can be tested fully offline using a two-step workflow:\n\n1. **Capture** (requires credentials + network): Start Claude Code with\n   `claudeline -debug`, make sure claudeline shows up. In a new terminal, run\n   `./pok capture` (or `./pok capture -config-dir ~/.claude-work` for a custom\n   profile). This reads credentials, calls the usage and status APIs, and writes\n   the responses to testdata files under `internal/stdin/testdata/`,\n   `internal/creds/testdata/`, `internal/usage/testdata/`,\n   `internal/status/testdata/`, and `internal/update/testdata/`.\n2. **Render** (100% offline): Run `./pok render` to render the statusline from\n   the captured files. No credentials or network access needed. Use\n   `./pok render -json internal/stdin/testdata/stdin_pro_opus.json` to render a\n   specific stdin payload.\n\n### Stdin payload schema\n\nThe `internal/stdin/testdata/stdin_*.json` files are named as\n`stdin_\u003cplan\u003e_\u003cmodel\u003e.json` (version is stored in the JSON payload itself). A\ncomprehensive `payload` struct in `internal/stdin/stdin_test.go` maps every\nknown field. The `TestPayloadSchema` test uses `DisallowUnknownFields` to detect\nwhen Claude Code adds new fields — if the test fails, update the `payload`\nstruct and re-run `./pok capture` to refresh the testdata.\n\n### Credentials schema\n\nThe `internal/creds/testdata/creds_*.json` files are sanitized snapshots of\nClaude Code's OAuth credentials (tokens replaced with `\"sanitized\"`). A\n`credentials` struct in `internal/creds/creds_test.go` maps every known field.\nThe `TestCredentialsSchema` test uses `DisallowUnknownFields` to detect schema\nchanges — if the test fails, update the `credentials` struct and re-run\n`./pok capture` to refresh the testdata.\n\n### Usage API schema\n\nThe `internal/usage/testdata/usage_*.json` files are snapshots of the OAuth\nusage API response (`api.anthropic.com/api/oauth/usage`), named as\n`usage_\u003cplan\u003e.json`. A `usageResponse` struct in `internal/usage/usage_test.go`\nmaps every known field. The `TestUsageResponseSchema` test uses\n`DisallowUnknownFields` to detect schema changes — if the test fails, update the\n`usageResponse` struct and re-run `./pok capture` to refresh the testdata.\n\n### Status API schema\n\nThe `internal/status/testdata/status.json` file is a snapshot of the Atlassian\nStatuspage API response (`status.claude.com/api/v2/status.json`). A\n`statusResponse` struct in `internal/status/status_test.go` maps every known\nfield. The `TestStatusResponseSchema` test uses `DisallowUnknownFields` to\ndetect schema changes — if the test fails, update the `statusResponse` struct\nand re-run `./pok capture` to refresh the testdata.\n\n## References\n\n- [claude-hud](https://github.com/jarrodwatts/claude-hud) — inspiration for this\n  project\n- [Create Claude plugins](https://code.claude.com/docs/en/plugins)\n- [Customize your status line](https://code.claude.com/docs/en/statusline)\n- [Authentication and credential management](https://code.claude.com/docs/en/authentication#credential-management)\n- [Costs and context window](https://code.claude.com/docs/en/costs)\n\n### Usage API\n\nThe quota bars use `GET https://api.anthropic.com/api/oauth/usage` with an\n`Anthropic-Beta: oauth-2025-04-20` header. This endpoint is undocumented by\nAnthropic and is not part of their public API. It was reverse-engineered from\nClaude Code's own OAuth flow and is used by several third-party projects:\n\n- [JetBrains ClaudeQuotaService](https://github.com/JetBrains/intellij-community/blob/master/plugins/agent-workbench/sessions/src/claude/ClaudeQuotaService.kt)\n- [claude-hud usage-api.ts](https://github.com/jarrodwatts/claude-hud/blob/main/src/usage-api.ts)\n\nBecause the endpoint is in beta, it may change or break without notice.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredrikaverpil%2Fclaudeline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffredrikaverpil%2Fclaudeline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredrikaverpil%2Fclaudeline/lists"}