Skip to content

v0.35.0 — Scope auto-switching to one usage window

Choose a tag to compare

@errhythm errhythm released this 21 Sep 05:21
· 5 commits to main since this release
cbd3e7b

Scope auto-switching to one usage window

ccswap auto weighs both of Claude's account-wide windows: the rolling 5-hour session and the 7-day quota. When two accounts are each pinned by a different window, neither clears the hysteresis margin against the other, and auto correctly refuses to move. That is the right call when both windows matter. It is the wrong one if you are deliberately running your weekly quota all the way down and only care about the session window.

autoswitch.windows picks which windows bind the decision:

ccswap config set autoswitch.windows 5h   # session window only, ignore weekly
ccswap config set autoswitch.windows 7d   # weekly only, ignore the session window
ccswap config set autoswitch.windows both # default, today's behavior

The scoping reaches the auto engine's decision and stops there. Polling cadence keeps the full 5h/7d view, so the ignored window never goes stale in the background, and ccswap list, ccswap watch, the TUI and the manual switch --strategy modes keep reading and showing both numbers. The default is unchanged in every path.

Thanks to @leosp1983 for the feature (#6).

Keeping the setting inside the auto engine

Two paths let the new selection escape into surfaces it was never meant to touch, both fixed before release.

The shared usage collector threaded the selection into the 429-stale trust bound. Narrowing the window set only ever removes reset candidates, so a stale snapshot stayed trusted past the reset that should have invalidated it. That collector also backs ccswap list, the TUI, the menu bar and switch --strategy, so with autoswitch.windows=7d a snapshot whose 5h window had already rolled over would keep serving 5h=95% to all of them for up to the full trust ceiling, and switch --strategy best would refuse an account that had actually recovered. Whether cached data is still fresh is objective, so the trust bound now keeps the full view, matching what the cadence planner already does.

The TUI's auto panel ranked candidates on the account-wide default while the engine ranked on the scoped view. With autoswitch.windows=5h and accounts at 5h=20%, 7d=95% and 5h=50%, 7d=30%, the panel displayed the first as the most used and ranked the second ahead of it, then watched auto switch to the one it had just shown as worst. The panel now derives the same selection the engine does.

Full changelog: v0.34.0...v0.35.0