{"id":51341002,"url":"https://github.com/onury/claude-statusline","last_synced_at":"2026-07-02T07:33:27.458Z","repository":{"id":365945943,"uuid":"1274428329","full_name":"onury/claude-statusline","owner":"onury","description":"Two-line Claude Code statusline with green→red gradient context \u0026 rate-limit bars","archived":false,"fork":false,"pushed_at":"2026-06-26T19:17:55.000Z","size":3066,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-26T21:10:37.648Z","etag":null,"topics":["claude","claude-code","claude-code-statusline","cli","developer-tools","posix","rate-limit","shell","statusline","terminal","tui"],"latest_commit_sha":null,"homepage":"https://github.com/onury/claude-statusline","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/onury.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":"2026-06-19T13:57:17.000Z","updated_at":"2026-06-26T19:17:48.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/onury/claude-statusline","commit_stats":null,"previous_names":["onury/claude-statusline"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/onury/claude-statusline","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onury%2Fclaude-statusline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onury%2Fclaude-statusline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onury%2Fclaude-statusline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onury%2Fclaude-statusline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onury","download_url":"https://codeload.github.com/onury/claude-statusline/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onury%2Fclaude-statusline/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35038239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-02T02:00:06.368Z","response_time":173,"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","claude-code","claude-code-statusline","cli","developer-tools","posix","rate-limit","shell","statusline","terminal","tui"],"created_at":"2026-07-02T07:33:26.855Z","updated_at":"2026-07-02T07:33:27.438Z","avatar_url":"https://github.com/onury.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# claude-statusline\n\n[![Version](https://img.shields.io/github/v/release/onury/claude-statusline?label=version\u0026color=CB6D4D)](https://github.com/onury/claude-statusline/releases/latest)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n![Shell: POSIX sh](https://img.shields.io/badge/shell-POSIX%20sh-4EAA25?logo=gnubash\u0026logoColor=white)\n![Platform: macOS | Linux](https://img.shields.io/badge/platform-macOS%20%7C%20Linux-730A8B)\n![Claude Code](https://img.shields.io/badge/Claude%20Code-statusline-E5750B)\n\nNever get blindsided by a rate limit again. This drop-in status line keeps your\ncontext-window, 5-hour, and weekly usage — and how close each is to its cap — visible at\nthe bottom of every [Claude Code](https://code.claude.com) prompt.\n\n![claude-statusline: animated context-window, 5-hour and weekly bars filling green→red, with the branch and model sections](demo.gif)\n\n- **Line 1** — sections separated by ` | ` (default `context,5hr,week,branch`):\n  - `used/total` context tokens + context-window `%`\n  - `5hr \u003ctime\u003e` + 5-hour rate-limit `%`\n  - `Week \u003ctime\u003e` + 7-day rate-limit `%`\n  - `Branch` — the active git branch (shown when the workspace is a git repo)\n- **Line 2** — a 16-cell gradient bar under each rate/context section (the `branch`/`model`\n  sections show their value here instead).\n\n\u003e [!NOTE]\n\u003e For the `5hr` and `Week` sections, the `%` and bar are **quota usage** (how much of the\n\u003e window's limit you've consumed), while the time next to the label is the **window clock**\n\u003e (see `--time` below). These are independent: `Week -5days … 3%` means 5 days until reset\n\u003e *and* only 3% used — low usage doesn't mean more time left, and a near-full bar doesn't\n\u003e mean the reset is close.\n\n## Features\n\n- **Per-cell gradient** — every cell owns a color mapped green (0%) → red (100%).\n  Fill level is shown by *brightness* (filled cells bright, the track is the same hue\n  but dim), so the full green→red sweep is always visible and red only lights up bright\n  as you approach a limit.\n- **Three brightness tiers** on line 1: dim `/total` \u003c medium used-token count \u003c bright `%`.\n- **Right-aligned, brightened `%`** at the end of each bar section (expanded layout; compact\n  drops the padding and puts a single space before the `%`).\n- **Awaiting placeholders** — the `rate_limits` object is absent before the first API\n  response (and for API-key sessions). Until data arrives, the `5hr`/`Week` sections show\n  an animated `•••` indicator in place of the numbers, then fill in once it lands — so the\n  layout never jumps. API-key sessions never get this data; drop the sections there with\n  `--sections context,model`. The context section always shows.\n- Top-aligned quarter-cell ticks (`▘`) for a slim look.\n- Pure `sh` + `jq` + `awk`; 24-bit truecolor.\n\n## Install\n\n1. Download the script into your Claude Code config dir:\n\n   ```sh\n   curl -fsSL https://raw.githubusercontent.com/onury/claude-statusline/main/statusline-command.sh \\\n     -o ~/.claude/statusline-command.sh\n   ```\n\n   \u003csub\u003eOr, from a clone of this repo: `cp statusline-command.sh ~/.claude/statusline-command.sh`\u003c/sub\u003e\n\n2. Point `~/.claude/settings.json` at it:\n\n   ```json\n   {\n     \"statusLine\": {\n       \"type\": \"command\",\n       \"command\": \"sh ~/.claude/statusline-command.sh\"\n     }\n   }\n   ```\n\n3. Start a new prompt — the status line refreshes automatically.\n\n### Requirements\n\n- `jq` and `awk` on `PATH` (both default on macOS; `awk` is BSD awk there).\n- A terminal with 24-bit truecolor support.\n- Reset times use macOS/BSD `date -r \u003cepoch\u003e`. On GNU/Linux, change `date -r \"$x\"` to\n  `date -d \"@$x\"` in the two reset-formatting lines.\n\n## Status line JSON fields used\n\nClaude Code pipes a JSON object to the script on stdin. This script reads:\n\n| Path | Meaning |\n|------|---------|\n| `.context_window.total_input_tokens`  | input tokens used |\n| `.context_window.total_output_tokens` | output tokens used |\n| `.context_window.context_window_size` | context window size |\n| `.rate_limits.five_hour.used_percentage`  | 5-hour window usage % |\n| `.rate_limits.five_hour.resets_at`        | 5-hour reset (Unix epoch) |\n| `.rate_limits.seven_day.used_percentage`  | 7-day window usage % |\n| `.rate_limits.seven_day.resets_at`        | 7-day reset (Unix epoch) |\n| `.model.display_name`                     | model name for the `model` section |\n| `.workspace.current_dir` (or `.cwd`)      | working dir for the `branch` section's git lookup |\n\nTerminal width for `--responsive` comes from the `$COLUMNS` environment variable, which\nClaude Code sets before each run (requires Claude Code v2.1.153+).\n\n## Customizing\n\nPass options on the command line in `settings.json` — no need to edit the script:\n\n```json\n{\n  \"statusLine\": {\n    \"type\": \"command\",\n    \"command\": \"sh ~/.claude/statusline-command.sh --width 20 --sections context,week\"\n  }\n}\n```\n\n| Flag | Default | Description |\n|------|---------|-------------|\n| `--width N`             | `16`              | Cells per bar / width of each line-1 field (expanded layout; compact fits content). |\n| `--glyph CHAR`          | `▘`               | Bar cell character. Must be **single-column** (e.g. `▖` bottom, `▌` full height, `█` full block, `▂` quarter height). |\n| `--sections LIST`       | `context,5hr,week,branch` | Comma-separated sections to show, **in the order given**. Any subset of `context`, `5hr`, `week`, `branch`, `model`. (`tokens` is accepted as a legacy alias for `context`.) |\n| `--time MODE`           | `reset`           | What the `5hr`/`Week` time field shows. `reset` — the reset point (`@23:00`, `@Jun25`); `remaining` — time left, ticking down (`-04:30`, `-6days`); `elapsed` — time used, ticking up (`+00:30`, `+1day`). `@` = at, `-` = before reset, `+` = since start. The week switches to the `-HH:MM`/`+HH:MM` clock once under a day. |\n| `--fill F`              | `0.80`            | Brightness (`0`–`1`) of filled bar cells. |\n| `--track F`             | `0.22`            | Brightness (`0`–`1`) of the unfilled track. |\n| `--responsive true\\|false` | `true`         | When the line is wider than the terminal, drop sections **from the right** until it fits. |\n| `--layout expanded\\|compact` | `expanded`   | `expanded` — the default two-line view (text + bars). `compact` — a **single line**: drops the line-2 bars and the `branch`/`model` sections show their value (e.g. `main`, `Opus 4.8 (1M)`) in place of the label. |\n\nUnknown flags are ignored, and any section whose data is absent is skipped. The `branch`\nand `model` sections are turned on or off purely by listing (or omitting) them in\n`--sections` — there are no separate `--branch`/`--model` flags.\n\n\u003e [!TIP]\n\u003e **Set [`refreshInterval`](https://code.claude.com/docs/en/statusline) only when using `--time remaining` or `--time elapsed`.** Claude Code re-runs the status line on session activity (a new message, tool call, etc.), so a ticking clock looks frozen while you sit idle. Add `refreshInterval` (seconds) next to `command` to make it advance on its own — `10` is a good balance for the minute-level clock:\n\u003e\n\u003e ```json\n\u003e \"statusLine\": {\n\u003e   \"type\": \"command\",\n\u003e   \"command\": \"sh ~/.claude/statusline-command.sh --time remaining\",\n\u003e   \"refreshInterval\": 10\n\u003e }\n\u003e ```\n\u003e\n\u003e With the default `--time reset`, the field is a fixed point that changes only on activity anyway, so a timer would just re-run the script for no visible gain — leave `refreshInterval` off.\n\u003e\n\u003e Note: `resets_at` only refreshes on session activity, so an idle countdown can reach the reset before fresh data arrives. When that happens the field shows an animated `•••` \"awaiting\" indicator (rather than a stuck `-00:00`) until the next update lands. The dot advances one step **per render** regardless of `refreshInterval` (so no interval can freeze it) — `1` gives a fast spin, the default `10` a gentle one. It only touches a tiny temp file while the indicator is on screen; normal renders write nothing.\n\n### Branch section\n\nIn the default section list, a section shows the active **git branch** — the `Branch` label on line 1\nand the branch name on line 2 (in blue). The branch is read from the workspace dir\n(`.workspace.current_dir`, falling back to `.cwd`); a detached `HEAD` shows the short commit hash,\nand the section is skipped entirely when the directory isn't a git repo. Drop it with a\n`--sections` list that omits `branch` (e.g. `--sections context,5hr,week`).\n\n### Model section\n\nAdd `model` to `--sections` (e.g. `--sections context,5hr,week,branch,model`) to show the active model —\nthe `Model` label on line 1 and the name on line 2, colored in tiers: family (Claude orange),\nversion (dim white), context (dim gray). Sections render in the order you list them.\n\n![status line with the model section, ending in \"Opus 4.8 (1M)\"](ss-model.png)\n\n### Compact layout (single line)\n\nWith `--layout compact`, the status line collapses to **one line** — the line-2 bars are dropped, and the\n`branch`/`model` sections show their value directly (since there's no second line to hold it):\n\n```\n191k/1000k 19% | 5hr -02:37 12% | Week -6days 7% | main | Opus 4.8 (1M)\n```\n\nEvery section fits its own content — without a second line to align pipes to, there's no\nbar-width padding, just a single space before each gradient-colored `%` (and the `branch` (blue)\nand `model` values stand on their own). Pairs naturally with `--time remaining` or `--time elapsed`.\n\n### Responsive\n\nWith `--responsive true` (the default), the script reads the `$COLUMNS` environment variable\n(set by Claude Code to the terminal width) and drops sections from the right — least-important\nfirst (`model`, then `branch`, `week`, …) — until the line fits. The leftmost section (`context`) is always\nkept. Set `--responsive false` to always render every section even if it wraps.\n\nIn the expanded layout both lines share the same per-section `--width` and ` | ` separator, so the pipes stay vertically aligned — a field that overflows `--width` is clipped (only the last field may overflow), and a multi-column `--glyph` breaks this. When `--width` is too narrow to hold a section plus its `%`, the `%` is dropped (the bar underneath still shows the level). For the `5hr`/`Week` sections the label then stays pinned left while the time value (e.g. `-02:35`, `-6days`) right-aligns into the freed space; the context section stays left-aligned. Compact is a single line with nothing to align beneath it, so fields just fit their content.\n\n## `/sl` slash command (optional)\n\nA small [custom slash command](https://docs.claude.com/en/docs/claude-code/slash-commands) for\n**changing the status line from inside Claude Code** — no need to hand-edit `settings.json`. It's two\nfiles: [`commands/sl.md`](commands/sl.md) (the command) and [`sl-config.sh`](sl-config.sh) (the helper\nit calls). Install both:\n\n```sh\nmkdir -p ~/.claude/commands\ncurl -fsSL https://raw.githubusercontent.com/onury/claude-statusline/main/commands/sl.md \\\n  -o ~/.claude/commands/sl.md\ncurl -fsSL https://raw.githubusercontent.com/onury/claude-statusline/main/sl-config.sh \\\n  -o ~/.claude/sl-config.sh\n```\n\n\u003csub\u003eOr, from a clone: `cp commands/sl.md ~/.claude/commands/ \u0026\u0026 cp sl-config.sh ~/.claude/`. Restart Claude Code to pick it up.\u003c/sub\u003e\n\nThen, in any session:\n\n```\n/sl compact               switch to the single-line layout\n/sl expanded              back to two lines\n/sl context,branch,model  set the sections (comma list, in order)\n/sl model off             add/remove a section\n/sl time remaining        change the time mode\n/sl width 18              set the bar/field width\n/sl help                  list all options\n/sl                       show the current config\n```\n\nIt edits the `--flag`s on your `statusLine.command`, **changing only what you named and keeping the\nrest**, then writes it back to `settings.json` — so the change **persists** across sessions (it isn't\na session-only toggle). The new look applies on the next status line refresh.\n\nThe command itself is a one-line wrapper: it just runs the bundled `sl-config.sh`, which does the\nrequest→flag mapping deterministically in shell. Earlier versions baked the whole mapping into the\nslash-command prompt and let the model work it out on every call; moving it into the script does the\n**same edits for ~10× fewer tokens and near-instantly** — there's no model reasoning to parse the\nrequest, just one command. (Behavior is identical: same requests, same flags, same in-place write.)\n\n## Testing\n\nPipe sample JSON through it (strip ANSI to read the layout):\n\n```sh\necho '{\"context_window\":{\"total_input_tokens\":58000,\"total_output_tokens\":2000,\"context_window_size\":200000},\"rate_limits\":{\"five_hour\":{\"used_percentage\":45,\"resets_at\":1750346400},\"seven_day\":{\"used_percentage\":20,\"resets_at\":1750600800}}}' \\\n  | sh statusline-command.sh | sed 's/\\x1b\\[[0-9;]*m//g'\n```\n\nTo preview specific values for a screenshot, temporarily hardcode them after the parsing\nblock, e.g. `tok_pct=82; fh_pct=37; wk_pct=53`, then remove the override.\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md).\n\n## License\n\n[MIT](LICENSE) © Onur Yıldırım\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonury%2Fclaude-statusline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonury%2Fclaude-statusline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonury%2Fclaude-statusline/lists"}