Skip to content

feat: add configurable context usage display#359

Open
kidush wants to merge 2 commits into
huggingface:mainfrom
kidush:context-usage-display-config
Open

feat: add configurable context usage display#359
kidush wants to merge 2 commits into
huggingface:mainfrom
kidush:context-usage-display-config

Conversation

@kidush

@kidush kidush commented Jul 13, 2026

Copy link
Copy Markdown

Summary

Adds a configurable context usage display for Tau's TUI.

Users can now choose how the compact context meter below the prompt is shown via ~/.tau/tui.json:

{
  "context_usage_display": "both"
}

Supported values:

  • tokens — current/default behavior, e.g. 12k/200k
  • percent — percentage of the active model context window, e.g. 6%
  • both — tokens and percentage, e.g. 12k/200k · 6%
  • off — hide the compact context meter entirely

Rendered output follows the footer convention from #407: the meter sits on its own line below provider:model, with no context label. In off mode that line is omitted rather than left blank.

Changes

  • Added context_usage_percent(...) in tau_coding.context_window.
  • Exposed CodingSession.context_usage_percent.
  • Added TuiSettings.context_usage_display, defaulting to tokens; missing or invalid values in an existing tui.json fall back to tokens / raise TuiConfigError.
  • Wired the setting into compact TUI session info rendering, including the render-cache fingerprint added in Improve TUI sidebar session insights #400 so the footer redraws when the setting changes.
  • Updated /session to report context usage as tokens and percentage. This output is deliberately not controlled by context_usage_display, which only governs TUI chrome.
  • Updated configuration docs.
  • Added a dev note with the implementation plan.

Checks

uv run ruff check .
uv run ruff format --check .
uv run mypy
uv run pytest -q

All passing — 1062 tests.

Rebased onto main @ 102482b.

@kidush
kidush requested a review from alejandro-ao as a code owner July 13, 2026 23:26
@kidush
kidush force-pushed the context-usage-display-config branch from 9f84327 to 5018515 Compare July 20, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant