You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(usage): the live footer warns about the Claude subscription wall
The Anthropic OAuth headers — unified 5h/7d utilisation, which window is
binding, the subscription status, the reset — were already captured from
every response into rateLimits, but only `/usage quota` ever showed them.
A Pro/Max user learned about the weekly or 5-hour wall when a turn
stalled. Now updateFooter looks up the active provider's snapshot and
appends footerQuotaSegment(snap): `⚠ 7d 8% · resets 14:05` once the
binding window is below 15% (FOOTER_WARN_FRACTION), or whenever the status
is anything but "allowed" (named, e.g. "allowed warning"); empty while
healthy, and always empty for providers that carry no such headers.
shortReset renders Anthropic's epoch-seconds reset as HH:MM today or
MM-DD HH:MM later, and leaves unwieldy raw values out of the footer.
No slow-lane retry loop — awareness only.
From the can1357/oh-my-pi study (session/anthropic-slow-mode.ts).
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,8 @@ Folded from each message's `usage.cost`, which pi already computes. It survives
20
20
21
21
When [`@pify/subagent`](https://github.com/pifydev/subagent), [`@pify/swarm`](https://github.com/pifydev/swarm) or [`@pify/workflow`](https://github.com/pifydev/workflow) run child agents, those children are separate in-memory sessions whose spend never reaches this branch — a session that delegates used to look cheaper than it was. Those packages now add every child message's cost to a process-wide tally, and the footer shows it as a separate ` · agents $0.12` beside the session's own figure (the `/usage` session block has the same line, with tokens). It is kept apart on purpose: the session numbers stay what the branch says, and the agents figure is what the delegation cost on top. The tally survives `/reload` and starts over with a new session.
22
22
23
+
On a Claude subscription (OAuth Pro/Max) the footer also carries the wall you are approaching: the headers `/usage quota` reads were already captured on every response, but only that command showed them, so the weekly or 5-hour limit used to arrive as a stalled turn. Now a `⚠ 7d 8% · resets 14:05` segment appears once the binding window is below 15%, or whenever Anthropic marks the subscription as anything but allowed, and stays out of the way otherwise. Other providers carry no such headers, so they never show it.
24
+
23
25
The gauge on the right is how full the context window is — the third mid-session question, next to tokens and cost. It was computed for the `/usage` dashboard but shown only there; now it is live. It appears once there is a window to measure against (so not under `-p`) and turns to `⚠` past 90%, the point where "how full" stops being trivia and becomes a decision. For the breakdown of what filled it, run `/context`.
0 commit comments