Problem
The status-bar context bar shows a 200k maximum (0 / 200k) even when the running model is
Opus 4.8 with a 1M context window (Claude Code's header reads "Opus 4.8 (1M context)"). The
context-window maximum should be determined by the model's actual context window (i.e. from the
model's specs / "model cards"), not defaulted to 200k.
User: 「這個 model 明明就是 1M,你的顯示需要依照 model cards 來決定吧」
(Observed on Claude Code v2.1.207, model "Opus 4.8 (1M context)", fresh session → the HUD context
bar read 0 / 200k. Screenshot not attached — it also shows personal plan-usage figures and this is
a public repo; the load-bearing facts are quoted here instead.)
Current behavior (grounded)
ClaudeUsageReader.contextMax(forModel:observedTokens:)
(Sources/Logos/Services/ClaudeUsageReader.swift:48-51) ignores the model argument entirely:
static func contextMax(forModel model: String?, observedTokens: Int = 0) -> Int {
if observedTokens > 200_000 { return 1_000_000 }
return 200_000
}
So the max is 200k until the used count actually crosses 200k, at which point it jumps to 1M. A
1M-context session therefore under-reports its window as 200k for the entire first 200k of use (and
a fresh session always shows 200k). The existing doc comment (:44-48) states the original rationale:
"The model id alone — e.g. claude-opus-4-8 — does NOT encode the 1M-context beta, so a 1M session
reads 200k here until it actually crosses 200k…"
The catch (diagnosis hint)
That rationale may be stale. The actual model id for this session is claude-opus-4-8[1m] — the
[1m] suffix does encode the 1M-context variant. So if the session transcript's usage.model
field carries that suffix (to be verified in diagnosis), contextMax could parse it and return 1M
without waiting to cross 200k. The open question is exactly what string the transcript records
(claude-opus-4-8 vs claude-opus-4-8[1m] vs something else).
Direction
- Derive the context-window maximum from the model, via a model → context-window mapping ("model
cards"): recognise the 1M-context models/variants (parse a [1m]/[1M] suffix, and/or a known-id
table) and return 1M for them up front.
- Keep the observed-tokens heuristic (
> 200k → 1M) only as a fallback for genuinely unknown /
suffix-less model ids, so the display never under-reports once usage proves a larger window.
- A fresh 1M session should then read
0 / 1M, not 0 / 200k.
Scope
Sources/Logos/Services/ClaudeUsageReader.swift — contextMax(forModel:observedTokens:) +
whatever parses usage.model from the transcript.
- Tests:
ClaudeUsageReaderTests — a claude-opus-4-8[1m] model → 1M without needing observed
tokens; a bare/unknown id → 200k default; the > 200k fallback preserved.
Relation
Affects the context bar shipped in #47 / #49 / #90 (the HUD). Orthogonal to #89 (fresh session shows
empty) — this is about the bar's maximum, not its used value.
Source: dogfooding of the HUD build (2026-07-12); the user compared the 0 / 200k context bar
against Claude Code's own "Opus 4.8 (1M context)" header.
Problem
The status-bar context bar shows a 200k maximum (
0 / 200k) even when the running model isOpus 4.8 with a 1M context window (Claude Code's header reads "Opus 4.8 (1M context)"). The
context-window maximum should be determined by the model's actual context window (i.e. from the
model's specs / "model cards"), not defaulted to 200k.
(Observed on Claude Code v2.1.207, model "Opus 4.8 (1M context)", fresh session → the HUD context
bar read
0 / 200k. Screenshot not attached — it also shows personal plan-usage figures and this isa public repo; the load-bearing facts are quoted here instead.)
Current behavior (grounded)
ClaudeUsageReader.contextMax(forModel:observedTokens:)(
Sources/Logos/Services/ClaudeUsageReader.swift:48-51) ignores themodelargument entirely:So the max is 200k until the used count actually crosses 200k, at which point it jumps to 1M. A
1M-context session therefore under-reports its window as 200k for the entire first 200k of use (and
a fresh session always shows 200k). The existing doc comment (
:44-48) states the original rationale:The catch (diagnosis hint)
That rationale may be stale. The actual model id for this session is
claude-opus-4-8[1m]— the[1m]suffix does encode the 1M-context variant. So if the session transcript'susage.modelfield carries that suffix (to be verified in diagnosis),
contextMaxcould parse it and return 1Mwithout waiting to cross 200k. The open question is exactly what string the transcript records
(
claude-opus-4-8vsclaude-opus-4-8[1m]vs something else).Direction
cards"): recognise the 1M-context models/variants (parse a
[1m]/[1M]suffix, and/or a known-idtable) and return 1M for them up front.
> 200k → 1M) only as a fallback for genuinely unknown /suffix-less model ids, so the display never under-reports once usage proves a larger window.
0 / 1M, not0 / 200k.Scope
Sources/Logos/Services/ClaudeUsageReader.swift—contextMax(forModel:observedTokens:)+whatever parses
usage.modelfrom the transcript.ClaudeUsageReaderTests— aclaude-opus-4-8[1m]model → 1M without needing observedtokens; a bare/unknown id → 200k default; the
> 200kfallback preserved.Relation
Affects the context bar shipped in #47 / #49 / #90 (the HUD). Orthogonal to #89 (fresh session shows
empty) — this is about the bar's maximum, not its used value.
Source: dogfooding of the HUD build (2026-07-12); the user compared the
0 / 200kcontext baragainst Claude Code's own "Opus 4.8 (1M context)" header.