Add native /context usage breakdown for context window visibility

Open 💬 1 comment Opened Jun 12, 2026 by faj-design5260

What variant of Codex are you using?

CLI / TUI

What feature would you like to see?

I would like to propose a read-only /context command in the Codex TUI that shows a native-style context usage card.

The command would help users inspect how the current context window is being used during a session. In workflows that use MCP servers, tools, or skills, it is not always easy to tell how much of the available context window is being used by system prompt content, system tools, MCP tool schemas, skill-related context, regular messages, or remaining free space.

The proposed /context card would show the current context window composition across these categories:

  • System prompt
  • System tools
  • MCP tools
  • Skills
  • Messages
  • Free space

The command would support a compact default view through /context and a fuller breakdown through /context full.

The goal is to provide a lightweight inspection surface that helps users understand what is currently occupying the context window, without changing request construction, conversation history, model behavior, or provider-side usage accounting.

This proposal is not intended to change provider-side usage accounting, rate limit behavior, context compaction behavior, tool or skill injection policy, or request construction semantics. It is intended only as a native visibility and inspection feature.

A focused implementation can stay inside the native Codex codebase. It can include the core /context feature, native context usage bucket accounting, compact and full slash command routing, TUI rendering, and relevant in-repo tests or snapshots needed to keep the behavior stable.

The command should remain read-only. It should not mutate the live session, should not add messages to the conversation, and should not change the next request.

Additional information

I attached two screenshots below to show the proposed TUI shape:

Default compact /context view:

<img width="915" height="856" alt="Image" src="https://github.com/user-attachments/assets/50d1115d-dbe8-49f5-ad56-76f507a55186" />

Full /context view:

<img width="947" height="1032" alt="Image" src="https://github.com/user-attachments/assets/b24ed0f8-7551-47af-829e-a6bbe7548077" />

For the initial upstream PR, I would keep the submitted changes focused on the native feature implementation and the relevant in-repo tests or snapshots.

During development, I also checked the accounting model against request-shaped context data to make sure the displayed buckets align with how the context is assembled. I do not think that external validation harness needs to be part of the clean feature PR by default.

If maintainers think additional validation details, test cases, or validation scripts would be useful or acceptable for upstream review, I would be happy to provide them or adapt the PR accordingly.

This proposal is related to context visibility and usage inspection discussions such as:

#26845
#27244
#24403

If this direction looks aligned with Codex’s roadmap, I would be happy to open a focused PR.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗