hermes - 💡(How to fix) Fix TUI: No context explosion detection — sessions grow without warning

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

The Hermes TUI (`hermes --tui`) has no mechanism to detect or warn users when a conversation session grows too long. As sessions accumulate messages, context window pressure increases and model quality degrades, but users receive no feedback. 2. No message-count or token-count tracking in TUI: Searching the entire `ui-tui/src` tree for `messageCount`, `contextSize`, `tokenwarn`, `contextwarn` yields no relevant results.

RAW_BUFFERClick to expand / collapse

Problem

The Hermes TUI (`hermes --tui`) has no mechanism to detect or warn users when a conversation session grows too long. As sessions accumulate messages, context window pressure increases and model quality degrades, but users receive no feedback.

Evidence

  1. `memoryMonitor.ts` monitors only process heap, not conversation length: The TUI's memory monitor (`ui-tui/src/lib/memoryMonitor.ts`) tracks Node.js RSS/heap usage (e.g. 1.5GB high, 2.5GB critical thresholds). This is Ink/React memory, completely unrelated to conversation length or token count.

  2. No message-count or token-count tracking in TUI: Searching the entire `ui-tui/src` tree for `messageCount`, `contextSize`, `tokenwarn`, `contextwarn` yields no relevant results.

  3. Real-world session data: User sessions in `~/.hermes/state.db` show sessions with 247 messages, 159 messages, 137 messages — all with zero warnings.

  4. `limits.ts` has no conversation-length limits: `ui-tui/src/config/limits.ts` defines MAX_HISTORY=800 (scrollback), LONG_MSG=300, WHEEL_SCROLL_STEP=1 — but nothing about session context size.

Impact

  • Long-running sessions silently degrade in quality as context window fills
  • Users have no opportunity to start a new session or summarize before hitting limits
  • Model provider may return degraded responses without the user understanding why

Suggested Fix

Add a context-length monitor to the TUI that:

  1. Tracks message count and/or estimated token count per session
  2. Displays a warning in the status bar when approaching model context limits (e.g. at 70% of context window)
  3. Optionally suggests `/new` or `/resume` to the user

This could reuse the existing `memoryMonitor.ts` pattern or be implemented as a separate `contextMonitor.ts`. The gateway already tracks `message_count` on the session object in `state.db`, so the data is already available.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING