Skip to content

Add TUI usage status line items for context and token usage #21324

@wruty

Description

@wruty

What variant of Codex are you using?

CLI

What feature would you like to see?

Persistent TUI footer/status line items that show context usage and token usage with progress bars and percentages.

Additional information

Summary

I implemented a local branch that adds Codex TUI status line items for context/token usage.

Compare URL:
https://github.com/openai/codex/compare/main...wruty:codex:add-tui-usage-status-line-items?expand=1

Motivation

It would be useful for Codex CLI users to see context usage and token usage persistently in the TUI footer/status line, similar in spirit to Claude Code status line tools.

This helps users understand how close they are to context or token limits while Codex is open.

Implemented locally

  • Added TUI status line items for context/token usage.
  • Added progress-bar display for context usage and token usage.
  • Added compact usage-bars summary item.
  • Documented usage in docs/config.md.
  • Updated config schema.
  • Fixed Windows-specific TUI test expectation failures.

Added status line items

  • context-usage-bar
  • context-usage-percent
  • context-used-tokens
  • context-window-tokens
  • token-usage-bar
  • token-usage-percent
  • token-used
  • token-limit
  • usage-bars

Behavior

  • Context usage uses real context token count and model context window.
  • Token usage is displayed only when a reliable internal token limit is available.
  • Unknown, invalid, or zero max values are rendered as unknown instead of guessed.
  • This does not represent API billing tokens.

Manual local TUI check

Local build verification was required because global Codex v0.128.0 does not include these new status line items.

Confirmed with local build:

  • OpenAI Codex v0.0.0 was launched from codex-rs\target\debug\codex.exe.
  • No "Ignored invalid status line items" warning appeared.
  • The footer/status line rendered:
    Ctx [----------] unknown · Tok [----------] unknown · Ctx unknown unknown/unknown | Tok unknown unknown/unknown

Recommended config:
[tui]
status_line = ["usage-bars"]

Progress-bar item check:
[tui]
status_line = ["context-usage-bar", "token-usage-bar", "usage-bars"]

Tests

  • git diff --check: passed
  • cargo fmt --all: passed; emitted an existing stable warning for imports_granularity = Item
  • cargo test -p codex-tui compose_agents_summary -- --nocapture: passed
  • cargo test -p codex-tui usage_bar -- --nocapture: passed
  • cargo check -p codex-tui --message-format short: passed
  • cargo clippy -p codex-tui --all-targets -- -D warnings: passed
  • cargo test -p codex-tui: passed; 2100 passed; 0 failed; 5 ignored

Note

I could not open a pull request because the repository currently limits pull request creation to collaborators.

The compare URL above contains the implemented local branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLITUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displaycontextIssues related to context management (including compaction)enhancementNew feature or requestrate-limitsIssues related to rate limits, quotas, and token usage reporting

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions