Skip to content

Commit e8661fa

Browse files
lroolleclaude
andcommitted
feat: smart countdowns, model+context merge, auto extra gating
Countdown display now responds to two signals: percentage pressure (5h >= 80%, 7d >= 70%) and time proximity (5h reset <= 2h, 7d reset <= 3d). Either signal triggers the countdown independently. Recovery color (DIM_GREEN) when usage is high but reset is imminent -- reduces false urgency for users about to get a fresh window. Context bar merged into model component: opus4.6[1m][15%] instead of opus4.6[1m] [15%]. Context is a property of the model session. Extra display default changed from "always" to "auto" -- shows when quota runs out (5h >= 80%, 7d >= 70%) or extra utilization >= 50%. Hidden during calm sessions. Switched 5h from clock time (@14:30) to relative time (~1h30m) for consistency with 7d. Removed dead format_reset_clock(). Extracted all thresholds as named constants. 95 bats tests, all passing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c0501c1 commit e8661fa

6 files changed

Lines changed: 554 additions & 82 deletions

File tree

CHANGELOG.md

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,61 @@
11
# Changelog
22

3-
## Unreleased
3+
## v0.6.0 — 2026-05-26 — Smart Countdowns & Information Grouping
4+
5+
Tested against Claude Code CLI v2.1.143 (MAX and PRO accounts).
6+
7+
### Smart Countdown Display
8+
9+
Reset countdowns now respond to two independent signals:
10+
11+
- **Percentage pressure**: 5h >= 80% or 7d >= 70% (existing behavior)
12+
- **Time proximity**: 5h reset <= 2h or 7d reset <= 3d (new)
13+
14+
Either signal triggers the countdown. A user at 40% with 90 minutes to reset
15+
sees `5h[40%~1h30m]` — the opportunity signal: "burn freely, fresh window
16+
coming." Switched 5h from wall-clock (`@14:30`) to relative time (`~1h30m`)
17+
for consistency with 7d.
18+
19+
**Recovery color**: DIM_GREEN when usage is high but reset is imminent
20+
(5h: <= 30min, 7d: <= 12h). Communicates "it was hot, it's cooling down."
21+
22+
### Model + Context Merge
23+
24+
Context bar now attaches directly to the model: `opus4.6[1m][█░░░░░15%]`
25+
instead of `opus4.6[1m] [█░░░░░15%]`. Context is a property of the model
26+
session, not an independent stat.
27+
28+
### Extra Usage: Auto Mode
29+
30+
New default `--extra auto` replaces `always`. Shows the extra-usage section
31+
only when actionable:
32+
33+
- 5h >= 80% or 7d >= 70% (quota running out)
34+
- Extra utilization >= 50% (budget pressure)
35+
36+
Hides extra during calm sessions. `always`, `on-limit`, `off` still available.
37+
38+
### Thresholds as Named Constants
39+
40+
All auto-display thresholds extracted to top-level variables:
41+
42+
```
43+
FIVE_HOUR_COUNTDOWN_SECS=7200 # 2h
44+
FIVE_HOUR_RECOVERY_SECS=1800 # 30min
45+
SEVEN_DAY_COUNTDOWN_SECS=259200 # 3d
46+
SEVEN_DAY_RECOVERY_SECS=43200 # 12h
47+
EXTRA_AUTO_UTIL_PCT=50 # 50%
48+
```
49+
50+
### Cleanup
51+
52+
- Removed dead `format_reset_clock()` (replaced by relative time)
53+
- Removed `context` from all theme `stat_order` strings (now part of model)
54+
- 95 bats tests (was 81)
55+
56+
---
57+
58+
## v0.5.0 — 2026-05-25 — Stdin-First Architecture & Extra Usage
459

560
Tested against Claude Code CLI v2.1.141 (MAX and PRO accounts).
661

@@ -34,7 +89,7 @@ directly from the CLI's JSON input instead of computing independently.
3489

3590
New `--extra` flag controls when the extra-usage component appears:
3691

37-
- `always` (default) — show whenever extra usage is enabled
92+
- `always` — show whenever extra usage is enabled
3893
- `on-limit` — show only when 5h >= 80% or 7d >= 70% (quota under pressure)
3994
- `off` — never show
4095

@@ -47,8 +102,6 @@ The `developer` theme defaults to `on-limit`; `minimal` defaults to `off`.
47102
flight, `!` when the last fetch failed and data may be stale. Extra usage
48103
has its own independent indicator (separate API call).
49104
- Duration shows hours for long sessions: `1h30m` instead of `90m`.
50-
- Added space between model suffix and context bar to prevent visual confusion:
51-
`opus4.6[1m] [█░░░░░26%]` instead of `opus4.6[1m][█░░░░░26%]`.
52105
- Removed dead `add_component_no_space` and `format_usage_bar` functions.
53106
- Fixed `format_duration(0)` returning "1m" instead of "0m".
54107
- Fixed color variables used before definition (git info, path had no color).
@@ -61,11 +114,6 @@ The `developer` theme defaults to `on-limit`; `minimal` defaults to `off`.
61114
- Time: plain dim instead of dim cyan — less color noise.
62115
- User tier label gets color: MAX=green, PRO=cyan, ENT/TEAM=dim cyan.
63116

64-
### Documentation
65-
66-
- Documented the extra-usage component, API behavior, and updated README preview
67-
signals.
68-
69117
---
70118

71119
## v0.3.0 — 2026-05-12 — Quota Reset Time & API Cleanup

README.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ Then add to `~/.claude/settings.json`:
6666
## What It Shows
6767

6868
```text
69-
project (main*) +84/-14 1h30m $6.72 opus4.6[1m] [███░░░26%] [MAX|feast.t.] 5h[24%] 7d[100%~12h6m] ex[$16.29/$200 8% bal$4.66]
70-
| | | | | | | | | | |
71-
path branch edits time cost model context user 5h quota 7d quota extra usage
69+
project (main*) +84/-14 1h30m $6.72 opus4.6[1m][███░░░26%] [MAX|feast.t.] 5h[24%] 7d[100%~12h6m] ex[$16.29/$200 8% bal$4.66]
70+
| | | | | | | | | |
71+
path branch edits time cost model+context user 5h quota 7d quota extra usage
7272
```
7373

7474
Every component earns its place:
@@ -79,10 +79,10 @@ Every component earns its place:
7979
| Activity | Session diff without opening git. |
8080
| Time and cost | Track long sessions. Hours format above 60m (`1h30m`). |
8181
| Model | Abbreviated. `claude-opus-4-6[1m]` becomes `opus4.6[1m]`. |
82-
| Context bar | Green / yellow / red by pressure. Matches `/context` formula. |
82+
| Context bar | Merged with model. Green / yellow / red by pressure. |
8383
| User tier | MAX is green, PRO is cyan. Truncated display name. |
84-
| Quota | Integer percentages. Reset countdown when 5h >= 80% or 7d >= 70%. |
85-
| Extra usage | Monthly spend, limit, prepaid balance. `--extra on-limit` to auto-hide. |
84+
| Quota | Integer percentages. Countdown on pressure (>= 80%/70%) or time proximity (<= 2h/3d). Recovery color when high usage + imminent reset. |
85+
| Extra usage | Monthly spend, limit, prepaid balance. `--extra auto` shows when quota runs out. |
8686

8787
## vs Built-in `/statusline`
8888

@@ -98,7 +98,7 @@ Every component earns its place:
9898
| Tier display + model abbreviation | -- | Yes |
9999
| 5 themes, 9 bar styles | -- | Yes |
100100
| OAuth + macOS Keychain | -- | Yes |
101-
| 85 bats tests + CI | -- | Yes |
101+
| 95 bats tests + CI | -- | Yes |
102102

103103
## Configuration
104104

@@ -112,10 +112,10 @@ Flags go in the command string in `~/.claude/settings.json`:
112112
|------|--------|---------|
113113
| `--theme` | `minimal`, `compact`, `detailed`, `developer`, `manager` | (none) |
114114
| `--style` | `unicode-blocks`, `single-block`, `bracketed-bars`, `filled-dots`, `square-blocks`, `line-segments`, `ascii-bars`, `percent-only`, `fraction-display` | `unicode-blocks` |
115-
| `--order` | Comma-separated: `activity,time,cost,model,context,user,quota,extra` | all |
115+
| `--order` | Comma-separated: `activity,time,cost,model,user,quota,extra` | all |
116116
| `--path-display` | `project`, `cwd`, `full`, `relative` | `project` |
117117
| `--alignment` | `left-right`, `right-left`, `center` | `left-right` |
118-
| `--extra` | `always`, `on-limit`, `off` | `always` |
118+
| `--extra` | `auto`, `always`, `on-limit`, `off` | `auto` |
119119
| `--debug` | Write logs to `/tmp/claude-code-statusline.log` | off |
120120
| `--test [json]` | Render with mock data | off |
121121

@@ -132,14 +132,16 @@ Flags go in the command string in `~/.claude/settings.json`:
132132
### Extra Usage Gating
133133

134134
```text
135-
--extra always 5h[24%] 7d[10%] ex[$19.52/$200 10% bal$4.66]
136-
--extra on-limit 5h[24%] 7d[10%] (quota OK, hidden)
137-
--extra on-limit 5h[87%@14:30] 7d[10%] ex[$19.52/$200 10%] (5h >= 80%, shown)
135+
--extra auto 5h[24%] 7d[10%] (calm, hidden)
136+
--extra auto 5h[87%~2h] 7d[10%] ex[$19.52/$200 10%] (5h >= 80%, shown)
137+
--extra always 5h[24%] 7d[10%] ex[$19.52/$200 10% bal$4.66] (always shown)
138+
--extra on-limit 5h[87%~2h] 7d[10%] ex[$19.52/$200 10%] (same as auto minus extra_util gate)
138139
--extra off 5h[24%] 7d[10%] (always hidden)
139140
```
140141

141-
`on-limit` keeps the statusline compact until quota pressure makes extra-usage
142-
budget actionable.
142+
`auto` (default) shows extra when quota runs out (5h >= 80%, 7d >= 70%) or
143+
extra budget is pressured (utilization >= 50%). Compact by default, actionable
144+
when it matters.
143145

144146
### Quota Polling
145147

0 commit comments

Comments
 (0)