Custom Statusline

Use this prompt:

@"statusline-setup (agent)" 

**Output shape:** `Model | [██░░░░░░░░] 30% | branch ~2 +4 | ⏱ 42% (in 3h) · 18% (in 2d)`

**Segment 1 — Model.** Pull `.model.display_name`, fall back to `.model.id`, fall back to `"Unknown"`.

**Segment 2 — Context battery.** Pull `.context_window.used_percentage`, round to integer, render as a 10-block bar (`█` filled, `░` empty) with the percentage after it: `[██░░░░░░░░] 23%`. If the field is missing, show an empty bar `[░░░░░░░░░░] --%` so the slot still renders.

**Segment 3 — Git.** Read `.cwd` (fall back to `.workspace.current_dir`); skip the segment if not a git repo. Get the current branch with `git rev-parse --abbrev-ref HEAD`. Count unstaged-edit files (`git diff --name-only`) and untracked files (`git ls-files --others --exclude-standard`). Render as `branch`, appending ` ~N` only when unstaged > 0 and ` +N` only when untracked > 0. Use `--no-optional-locks` on every git call to avoid touching the index lock.

**Segment 4 — Claude.ai rate limits.** Read `.rate_limits.five_hour.used_percentage` and `.rate_limits.seven_day.used_percentage`, plus their `resets_at` timestamps. Try snake_case (`five_hour`, `seven_day`, `resets_at`) and camelCase (`fiveHour`, `sevenDay`, `resetsAt`) for each, in that order, since the field shape may vary. Render as `⏱ 42% (in 3h) · 18% (in 2d)` — the icon is once, the dot separates the two windows. The 5-hour window's countdown uses hours (or minutes if under 1h); the 7-day window uses days (or hours if under 1d). Round to nearest unit, not floor — flooring makes "in 1d" appear when the real reset is 41h away. Skip the entire segment if `rate_limits` is absent (it only appears after the first API response in a Claude.ai session). If percentage exists but the timestamp is missing or unparseable, show just the percent without the parenthesized countdown.

**Timestamp parsing.** Accept three shapes: ISO 8601 with `Z` suffix, ISO 8601 with `+HH:MM` offset, and a plain Unix epoch in seconds or milliseconds. Strip fractional seconds and any timezone suffix (treat the remainder as UTC) before feeding to BSD `date -j -u -f "%Y-%m-%dT%H:%M:%S"`. For numeric inputs, treat 13+ digits as milliseconds and divide by 1000. If parsing fails, treat the timestamp as missing and let the segment fall back to the no-countdown form.

**Composition.** Always include model and context. Append the git segment with ` | ` only if the cwd is a git repo. Append the rate-limit segment with ` | ` only if at least one of the percentages was present.

Hey, now in many of my videos you may have seen that I have a status line, which is basically the thing in the bottom left that shows me how much context I've been using. And I will show you how to set this

up yourself in this video. So to get started, you want to do @status_line and you will see that there is a status line setup agent over here. So press tab and then we can say something

along the lines of, can you add a status line that shows me which model I'm currently using has a space with a bar and then shows me the percentage with like a battery style filling up

thing of how much of the context window that I've used up. And then has another bar and space and then shows me the branch that I'm currently on and whether there are any unstaged changes.

And if there are, how many unstaged files there are. So you basically want to describe the functionality that you want and that can include a lot of things. Such as what the weather is, like how the deployment is

going along and that kind of stuff. Basically anything that can be accessible via an API can be included in the status line. So let's press enter here. And then this will go through the setup process and also refer to

the docs and any other things that the subagent is aware of. And now you can see that right over here. So it added it for me. So it says, this is how the model would appear. This is how the battery would appear.

And then it would say like the branch with the number of unstaged files. So currently you can see that I have a sonnet running. This is a battery and this is the number of unstaged files. So about 1 unstaged

file. Okay. Now, since I recorded the earlier part of the video, they added a brand new field to the status line, which allows you to show your rate limits in the status line as well.

So you can see, I have it right over here. So 35%, which resets in 1 minute. And then 24% that resets in one day has been used so far. So altogether we have the model that's

being used, the percentage of the context window used so far, the branch, how many changes have been made, and then the, uh, reset limits too. So this will be part of the prompt down below. So you can set this

up using that.

Agentic Coding School

© 2026 Agentic Coding School. All rights reserved.

Not affiliated with Anthropic, OpenAI, or any other AI company.