statusline: expose per-model weekly rate limits (Opus/Sonnet/Fable) to the status line command
Feature request
Expose the per-model weekly rate limits (Opus / Sonnet / Fable) to the status line command's stdin JSON, so custom status lines can display the same meters that /status shows.
Current behavior
The status line JSON only ever includes two entries under rate_limits:
"rate_limits": {
"five_hour": { "used_percentage": ..., "resets_at": ... },
"seven_day": { "used_percentage": ..., "resets_at": ... }
}
Internally, Claude Code already tracks more than this. The rate-limit object is populated from the anthropic-ratelimit-unified-* response headers into these keys:
five_hourseven_dayseven_day_overage_included← labeled "Fable 5 limit" in the UIoverage
and the UI additionally distinguishes seven_day_opus ("Opus limit") and seven_day_sonnet ("Sonnet limit").
But the function that assembles the status line payload spreads only five_hour and seven_day, dropping the model-specific weekly limits (observed in 2.1.199, minified, paraphrased):
rate_limits = {
...v.five_hour && { five_hour: { used_percentage: v.five_hour.utilization * 100, resets_at: v.five_hour.resets_at } },
...v.seven_day && { seven_day: { used_percentage: v.seven_day.utilization * 100, resets_at: v.seven_day.resets_at } },
// seven_day_opus / seven_day_sonnet / seven_day_overage_included are not forwarded
};
So /status can show "Current week (Fable) — 60% used, resets …", but a custom status line has no way to read that number. It isn't persisted to disk anywhere either — the only source is the in-memory header parse.
Requested behavior
Forward the model-specific weekly limits to the status line JSON as well, using the same { used_percentage, resets_at } shape, e.g.:
"rate_limits": {
"five_hour": { "used_percentage": ..., "resets_at": ... },
"seven_day": { "used_percentage": ..., "resets_at": ... },
"seven_day_opus": { "used_percentage": ..., "resets_at": ... },
"seven_day_sonnet": { "used_percentage": ..., "resets_at": ... },
"seven_day_overage_included": { "used_percentage": ..., "resets_at": ... }
}
Each key would be present only when the corresponding limit is active, mirroring the existing conditional-spread pattern. This looks like a one-line change in the payload builder (the data is already in the object being spread from).
Why
Fable 5 has a dedicated weekly limit that's separate from the general 7-day window. Users who track their usage in a custom status line currently can't surface it, even though the client already has the value and shows it in /status.
Environment
- Claude Code
2.1.199 - Status line configured via
settings.json→statusLine.command