feat(shell): visual context progress bar with color coding#1972
Open
xiaoye5200 wants to merge 8 commits intoMoonshotAI:mainfrom
Open
feat(shell): visual context progress bar with color coding#1972xiaoye5200 wants to merge 8 commits intoMoonshotAI:mainfrom
xiaoye5200 wants to merge 8 commits intoMoonshotAI:mainfrom
Conversation
added 7 commits
April 21, 2026 16:06
Replace the plain text `context: 0.0%` status bar indicator with a block-style progress bar: `Context █░░░░░░░░░ 10%`. The bar uses 10 Unicode block characters (█ filled, ░ empty) to give an at-a-glance sense of context usage, followed by an integer percentage. Token counts are preserved when available: `Context █████░░░░░ 50% (5.0k/10.0k)`.
Apply green/yellow/red coloring to the context progress bar and percentage text based on usage thresholds: - < 70% → green (Context ██░░░░░░░░ 20%) - 70–85% → yellow (Context ███████░░░ 70%) - ≥ 85% → red (Context █████████░ 90%) Both the bar characters and the percentage digits share the same color. The "Context" label and optional token counts (e.g. 5.0k/10.0k) remain in the default toolbar color. Changes: - theme.py: add context_ok/warn/critical color fields to ToolbarColors - prompt.py: _render_right_span now returns FormattedText fragments so individual spans can carry independent styles; width calculation updated accordingly - _blocks.py: rebuild Rich Text with styled append instead of setting .plain, so Rich renders the color in the streaming agent view
Split the progress bar into two separately styled spans so the filled blocks (█) use the context color while the empty blocks (░) are dimmed, matching claude-hud's coloredBar behavior exactly. Also moves the percentage digit into its own colored span so the full visual is: Context [colored █…][dim ░…][colored N%] [(tokens)].
Replace fixed grey dim color with per-state dim variants so the empty
░ blocks appear as dark green / dark amber / dark red instead of grey,
matching claude-hud's behavior of dimming within the same color family.
- theme.py: replace context_dim with context_dim_ok/warn/critical
- prompt.py: select matching dim_color alongside color
- _blocks.py: use Rich 'dim {color}' style for empty blocks
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c63985e193
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
N/A (new feature, no prior issue)
Description
Replace the plain-text
context: 0.0%status bar indicator with a color-coded Unicode block progress bar, matching the visual style of the claude-hud plugin.Changes
src/kimi_cli/soul/__init__.pyformat_context_statusnow rendersContext █░░░░░░░░░ 4%instead ofcontext: 4.0%math.ceilso any non-zero usage always shows at least 1 filled blocksrc/kimi_cli/ui/theme.pycontext_ok / context_warn / context_criticalcolor fields toToolbarColors(bright green / amber / red, with dark/light theme variants)context_dim_ok / context_dim_warn / context_dim_criticalfor the empty block color (same hue, darker shade)src/kimi_cli/ui/shell/prompt.py_render_right_spannow returnslist[tuple[str, str]](FormattedText fragments) so each span can carry its own color█, empty blocks░, and percentage text each get independent color spanssrc/kimi_cli/ui/shell/visualize/_blocks.pyself.text.plain = format_context_status(...)with styledText.append()calls for Rich live-view renderingColor thresholds (same as claude-hud)
█░Empty blocks use a dimmed variant of the same hue, matching claude-hud's behavior of applying
DIMafter setting the color.Example output
Checklist
make gen-changelogto update the changelog.make gen-docsto update the user documentation.