Skip to content

Feature: Display Previous Messages When Resuming a Session in CLI TUI #719

@teknium1

Description

@teknium1

Overview

When resuming a session via hermes --continue or hermes --resume <id>, the conversation history is loaded into the agent's internal state but nothing is displayed to the user. The user sees only:

↻ Resumed session 20260308_143012_a1b2 (5 user messages, 18 total messages)

...and then a fresh input prompt. They have zero visual context about what was discussed previously. This was specifically reported by a user who said 'when resuming a session you can't see the previous messages in the TUI.'

Current Behavior

  1. User runs hermes --continue
  2. CLI loads conversation history from SQLite into self.conversation_history
  3. A one-line status message is printed
  4. The welcome banner is shown (same as a fresh session)
  5. User sees the input prompt with no context about what happened before

The messages ARE loaded (the agent can reference them), but the human has no way to see them without asking the agent 'what did we discuss?'

Proposed Solution

After loading the resumed session's history, render a concise recap of previous messages before showing the input prompt. Show the key exchanges, not raw tool call JSON.

Display Format

Show user messages in full, shorten assistant responses to first ~2 lines, collapse tool calls to a count with key tool names, skip system messages. Use Rich panels consistent with the existing banner style. Cap at ~30 lines with a '... (N earlier messages)' indicator if needed. Use dim/muted colors to distinguish from the active conversation.

Alternative: Summary Mode

For very long sessions, could also offer a one-paragraph LLM-generated summary instead of message replay (piggyback on #624's title generation infrastructure). Config option:

display:
  resume_display: full    # full | summary | minimal
  • full — show previous messages (default)
  • summary — LLM-generated 2-3 sentence recap
  • minimal — current behavior (just the one-liner)

Implementation Notes

The conversation history is already loaded in cli.py _init_agent() at line ~1199. The display logic would go right after the 'Resumed session' print, before the banner.

Key considerations:

  • Tool call messages have complex structure (tool_calls JSON, tool results) — need smart formatting
  • Should handle edge cases: sessions with only system messages, very short sessions, etc.
  • The display should use patch_stdout context or print before prompt_toolkit takes over
  • Consider: should /history command also exist for viewing history mid-conversation?

Relevant Files

  • cli.py lines 1192-1218 — session resume logic (where display would be added)
  • cli.py build_welcome_banner() — Rich panel patterns to reuse
  • hermes_state.py get_messages_as_conversation() — returns the message list
  • agent/display.py — existing display utilities

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions