Skip to content

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

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-865f6958
Mar 16, 2026
Merged

feat: add persistent CLI status bar and usage details#1522
teknium1 merged 1 commit into
mainfrom
hermes/hermes-865f6958

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Salvage of PR #1104 by @kshitijk4poor. Closes #683.

Adds a persistent status bar to the CLI that shows model name, context window usage (with visual bar), estimated cost, and session duration.

Status Bar

 ⚕ claude-sonnet-4-20250514 │ 12.4K/200K │ [██████░░░░] 6% │ $0.06 │ 15m

Responsive — degrades for narrow terminals:

  • ≥ 76 cols: full layout with context bar
  • 52–75 cols: compact (percent, cost, duration)
  • < 52 cols: minimal (model + duration only)

Color-coded context thresholds: green (< 50%), yellow (50–80%), orange (80–95%), red (≥ 95%).

Enhanced /usage Command

Now shows model name, per-category cost breakdown (input/output), session duration. Zero-priced provider models (GLM, Kimi, MiniMax) correctly show "n/a" instead of "$0.00".

Shared Pricing Module

Extracts pricing table + cost estimation + duration formatting from agent/insights.py into agent/usage_pricing.py. Eliminates duplicate code between /insights and /usage. Uses Decimal arithmetic to avoid floating-point rounding.

Files Changed

File Change
agent/usage_pricing.py NEW — shared pricing table, cost estimation, formatting helpers
agent/insights.py Refactored to import from usage_pricing
cli.py Status bar widget, enhanced /usage, 1Hz idle refresh
tests/test_cli_status_bar.py NEW — status bar + usage report tests
tests/test_insights.py Zero-priced model assertion

Salvage Fixes

  • Resolved merge conflict with voice status bar (both coexist in layout)
  • Fixed _format_context_length import (moved to hermes_cli/banner.py since PR was written)

Test Plan

python -m pytest tests/ -n0 -q   # 4544 passed

Follow-up Notes

  • Status bar colors are hardcoded, not skin-aware. Could be integrated with the skin engine in a future PR.

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 teknium1 merged commit 00a0c56 into main Mar 16, 2026
1 check passed
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
)

Salvaged from PR NousResearch#1104 by kshitijk4poor. Closes NousResearch#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>
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
)

Salvaged from PR NousResearch#1104 by kshitijk4poor. Closes NousResearch#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>
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
)

Salvaged from PR NousResearch#1104 by kshitijk4poor. Closes NousResearch#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>
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
)

Salvaged from PR NousResearch#1104 by kshitijk4poor. Closes NousResearch#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