feat: display previous messages when resuming a session in CLI#734
Merged
feat: display previous messages when resuming a session in CLI#734
Conversation
When resuming a session via --continue or --resume, show a compact recap of the previous conversation inside a Rich panel before the input prompt. This gives users immediate visual context about what was discussed. Changes: - Add _preload_resumed_session() to load session history early (in run(), before banner) so _init_agent() doesn't need a separate DB round-trip - Add _display_resumed_history() that renders a formatted recap panel: * User messages shown with gold bullet (truncated at 300 chars) * Assistant responses shown with green diamond (truncated at 200 chars / 3 lines) * Tool calls collapsed to count + tool names * System messages and tool results hidden * <REASONING_SCRATCHPAD> blocks stripped from display * Pure-reasoning messages (no visible output) skipped entirely * Capped at last 10 exchanges with 'N earlier messages' indicator * Dim/muted styling distinguishes recap from active conversation - Add display.resume_display config option: 'full' (default) or 'minimal' - Store resume_display as instance variable (like compact) for testability - 27 new tests covering all display scenarios, config, and edge cases Closes #719
… docs - sessions.md: New 'Conversation Recap on Resume' subsection with visual example, feature bullet points, and config snippet - cli.md: New 'Session Resume Display' subsection with cross-reference - configuration.md: Add resume_display to display settings YAML block - AGENTS.md: Add _preload_resumed_session() and _display_resumed_history() to key components, add UX note about resume panel
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.
Summary
Implements #719 — when resuming a session via
--continueor--resume, displays a compact recap of previous conversation messages in a Rich panel before the input prompt.Before: User sees only a one-line status and has zero context about what was discussed.
After: A styled "Previous Conversation" panel shows user messages, assistant responses, and tool call summaries immediately upon resume.
What Changed
cli.py(3 files, +700 lines)New methods on
HermesCLI:_preload_resumed_session()— Loads session history from SQLite early (called fromrun()before the banner), so the user sees history immediately. Prints the one-liner status message. Returns True if history was loaded._init_agent()now skips the DB round-trip when history is already populated._display_resumed_history()— Renders a compact conversation recap using a Rich Panel:●, truncated at 300 chars◆, truncated at 200 chars / 3 lines[3 tool calls: terminal, web_search])<REASONING_SCRATCHPAD>blocks stripped from assistant text... N earlier messages ...indicatorIntegration in
run():show_banner(), ifself._resumed: calls_preload_resumed_session()then_display_resumed_history()Instance variable:
self.resume_display— captured from config at init time (likeself.compact)hermes_cli/config.pydisplay.resume_displaytoDEFAULT_CONFIGwith default"full"Config option
full(default) — show previous messages panelminimal— current behavior (just the one-liner)Test Plan
27 new tests in
tests/test_resume_display.py:_init_agent()skips DB when preloadedInteractive verification: Tested with
python cli.py --resume <session_id>against real sessions with tool calls, reasoning content, and context summaries. Display renders cleanly.Example Output
Closes #719