Context
The TUI status line already implements a token/context segment (#1067): ctx used/window pct% (yellow >80%, red >95%), plus $cost and cache % in renderMakaPiStatusLine (packages/cli/src/pi-transcript.ts).
However, the segment is silently absent unless ALL of these hold:
- the connection's selected model has a resolvable
contextWindow (declared via relay profile, connection model list, or static metadata), and
- the provider reports per-step input tokens so the runtime can emit
contextRemaining in token_usage (ai-sdk-backend.ts), and
- at least one turn has completed.
Observed on an opencode-go connection: Maka · Full access · muse-spark-1.2-contributor · opencode-go · ~/project/maka-agent — no ctx, no cost. The user cannot tell whether the connection doesn't report usage, the model lacks a declared context window, or just no turn has finished yet.
Reference: pi's footer design (badlogic/pi-mono)
pi's interactive footer (packages/coding-agent/src/modes/interactive/components/footer.ts) always renders a context segment and degrades explicitly:
pct%/window with color thresholds (warning >70%, error >90%)
- fallback
?/200k when usage is unknown but the window is known
- cumulative
↑in ↓out R/W CH% $cost stats alongside
Proposal
- When
modelContextWindow is known but contextRemaining is not yet available (fresh session / provider doesn't report usage), render ctx ?/<window> (dim) instead of nothing.
- When neither is known, keep the segment hidden (current behavior) — no window to anchor a fallback.
- Follow-up: verify whether the opencode-go relay reports per-step input tokens; if it does but
contextRemaining still isn't emitted, fix that path.
Acceptance criteria
- A session on a connection with a known context window shows
ctx ?/<window> before the first completed turn, and ctx used/window pct% after.
- Existing color thresholds and the omit-when-unknown-window behavior are unchanged.
Context
The TUI status line already implements a token/context segment (#1067):
ctx used/window pct%(yellow >80%, red >95%), plus$costandcache %inrenderMakaPiStatusLine(packages/cli/src/pi-transcript.ts).However, the segment is silently absent unless ALL of these hold:
contextWindow(declared via relay profile, connection model list, or static metadata), andcontextRemainingintoken_usage(ai-sdk-backend.ts), andObserved on an
opencode-goconnection:Maka · Full access · muse-spark-1.2-contributor · opencode-go · ~/project/maka-agent— no ctx, no cost. The user cannot tell whether the connection doesn't report usage, the model lacks a declared context window, or just no turn has finished yet.Reference: pi's footer design (badlogic/pi-mono)
pi's interactive footer (
packages/coding-agent/src/modes/interactive/components/footer.ts) always renders a context segment and degrades explicitly:pct%/windowwith color thresholds (warning >70%, error >90%)?/200kwhen usage is unknown but the window is known↑in ↓out R/W CH% $coststats alongsideProposal
modelContextWindowis known butcontextRemainingis not yet available (fresh session / provider doesn't report usage), renderctx ?/<window>(dim) instead of nothing.contextRemainingstill isn't emitted, fix that path.Acceptance criteria
ctx ?/<window>before the first completed turn, andctx used/window pct%after.