Skip to content

Add detailed context usage indicator mode#397

Open
emil-e wants to merge 1 commit intoxenodium:mainfrom
emil-e:context-indicator-detailed
Open

Add detailed context usage indicator mode#397
emil-e wants to merge 1 commit intoxenodium:mainfrom
emil-e:context-indicator-detailed

Conversation

@emil-e
Copy link
Contributor

@emil-e emil-e commented Mar 11, 2026

image image

Current context usage indicator in agent-shell is a small bar that only gives a rough estimate. There are other features to show more details, such as end-of-turn display and more. However, I and many others prefer to have a persistent display in the header, just with more details.

This PR adds the option to set agent-shell-show-context-usage-indicator to 'detailed. This displays context usage in the form ➤ 29k/200k (29%). Setting the variable to t works exactly like before.

Solves #372

Checklist

  • I agree to communicate (PR description and comments) with the author myself (not AI-generated).
  • I've reviewed all code in PR myself and will vouch for its quality.
  • I've read and followed the Contributing guidelines.
  • I've filed a feature request/discussion for a new feature.
  • I've added tests where applicable.
  • I've updated documentation where necessary.
  • I've run M-x checkdoc and M-x byte-compile-file.

@xenodium
Copy link
Owner

xenodium commented Mar 11, 2026

Thanks for the PR. Could you please include a screenshot, so I get a visual idea in context?

@emil-e
Copy link
Contributor Author

emil-e commented Mar 11, 2026

I noticed a bug when I was getting the screenshot, will get back with both a fix and a screenshot.

Extend `agent-shell-show-context-usage-indicator` from a boolean to a
three-way choice: nil (hidden), t (bar, existing default), or `detailed`
which shows a numeric format like "➤ 29k/200k (29%)".

The detailed indicator reuses the existing `agent-shell--format-number-compact`
helper and the same color thresholds (success/warning/error at 60%/85%) as
the bar indicator. The entire string except the ➤ prefix is propertized
with the appropriate face for coherent coloring.
@emil-e emil-e force-pushed the context-indicator-detailed branch from 5be242d to 364d989 Compare March 11, 2026 21:09
@emil-e
Copy link
Contributor Author

emil-e commented Mar 11, 2026

@xenodium There we go... I had forgotten about the text header, which proved a little tricky because it's actually a mode line. Fixed it now, and there are also screenshots.

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.

2 participants