Skip to content

feat: add persistent CLI status bar and usage details#1104

Closed
kshitijk4poor wants to merge 3 commits intoNousResearch:mainfrom
kshitijk4poor:feat/cli-status-bar-683
Closed

feat: add persistent CLI status bar and usage details#1104
kshitijk4poor wants to merge 3 commits intoNousResearch:mainfrom
kshitijk4poor:feat/cli-status-bar-683

Conversation

@kshitijk4poor
Copy link
Copy Markdown
Collaborator

@kshitijk4poor kshitijk4poor commented Mar 12, 2026

Summary

  • add a persistent CLI status bar that shows model, context usage, estimated cost, and elapsed session time during interactive sessions
  • add a shared pricing helper and reuse it in /usage and /insights so cost and duration formatting stay consistent across CLI surfaces
  • add targeted regression tests for the status bar and unknown-pricing behavior, including provider models that should remain n/a

POC:
Screenshot 2026-03-13 at 5 00 35 AM

Test Plan

  • source /Users/kshitij/Projects/hermes-agent/.venv/bin/activate && python -m pytest -o addopts='' tests/test_cli_status_bar.py tests/test_insights.py tests/test_cli_init.py tests/test_cli_loading_indicator.py tests/test_resume_display.py -q
  • source /Users/kshitij/Projects/hermes-agent/.venv/bin/activate && python -m hermes_cli.main chat -q \"What tools do you have available?\"
  • source /Users/kshitij/Projects/hermes-agent/.venv/bin/activate && python -m pytest -o addopts='' tests/ -q (3221 passed, 154 skipped, 2 pre-existing failures already reproducible on upstream/main: tests/test_cli_provider_resolution.py::test_codex_provider_uses_config_model, tests/test_real_interrupt_subagent.py::TestRealSubagentInterrupt::test_interrupt_child_during_api_call)

Closes #683.

Introduce a shared helper for token pricing, cost estimation, and compact usage formatting so the CLI and insights command can reuse the same logic.
Route insights cost and duration helpers through the shared pricing module so pricing behavior stays consistent across CLI surfaces.
Surface model, context usage, cost, and elapsed time directly in the interactive CLI and expand /usage with a clearer session cost breakdown.
teknium1 pushed a commit that referenced this pull request Mar 16, 2026
Salvaged from PR #1104 by kshitijk4poor. Closes #683.

Adds a persistent status bar to the CLI showing model name, context
window usage with visual bar, estimated cost, and session duration.
Responsive layout degrades gracefully for narrow terminals.

Changes:
- agent/usage_pricing.py: shared pricing table, cost estimation with
  Decimal arithmetic, duration/token formatting helpers
- agent/insights.py: refactored to reuse usage_pricing (eliminates
  duplicate pricing table and formatting logic)
- cli.py: status bar with FormattedTextControl fragments, color-coded
  context thresholds (green/yellow/orange/red), enhanced /usage with
  cost breakdown, 1Hz idle refresh for status bar updates
- tests/test_cli_status_bar.py: status bar snapshot, width collapsing,
  usage report with/without pricing, zero-priced model handling
- tests/test_insights.py: verify zero-priced providers show as unknown

Salvage fixes:
- Resolved conflict with voice status bar (both coexist in layout)
- Import _format_context_length from hermes_cli.banner (moved since PR)
@teknium1
Copy link
Copy Markdown
Contributor

Merged via PR #1522. Your three commits were cherry-picked onto current main with authorship preserved.

Salvage fixes applied:

  • Resolved merge conflict with the voice status bar widget (added since your PR — both now coexist in the layout)
  • Fixed _format_context_length import — it moved from cli.py to hermes_cli/banner.py since your branch was created

Everything else carried over as-is: the status bar, usage_pricing module, enhanced /usage, and all tests. Nice work on this — the responsive layout and zero-priced-model handling are solid.

@teknium1 teknium1 closed this Mar 16, 2026
teknium1 added a commit that referenced this pull request Mar 16, 2026
Salvaged from PR #1104 by kshitijk4poor. Closes #683.

Adds a persistent status bar to the CLI showing model name, context
window usage with visual bar, estimated cost, and session duration.
Responsive layout degrades gracefully for narrow terminals.

Changes:
- agent/usage_pricing.py: shared pricing table, cost estimation with
  Decimal arithmetic, duration/token formatting helpers
- agent/insights.py: refactored to reuse usage_pricing (eliminates
  duplicate pricing table and formatting logic)
- cli.py: status bar with FormattedTextControl fragments, color-coded
  context thresholds (green/yellow/orange/red), enhanced /usage with
  cost breakdown, 1Hz idle refresh for status bar updates
- tests/test_cli_status_bar.py: status bar snapshot, width collapsing,
  usage report with/without pricing, zero-priced model handling
- tests/test_insights.py: verify zero-priced providers show as unknown

Salvage fixes:
- Resolved conflict with voice status bar (both coexist in layout)
- Import _format_context_length from hermes_cli.banner (moved since PR)

Co-authored-by: kshitijk4poor <kshitijk4poor@users.noreply.github.com>
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.

Feature: CLI Status Bar & Token/Cost Tracking — Persistent Context Window Visibility

2 participants