Skip to content

fix(cli): surface recent sessions inside /history and /resume - #4448

Closed
kshitijk4poor wants to merge 1 commit into
NousResearch:mainfrom
kshitijk4poor:fix/chat-resume-session-list
Closed

fix(cli): surface recent sessions inside /history and /resume#4448
kshitijk4poor wants to merge 1 commit into
NousResearch:mainfrom
kshitijk4poor:fix/chat-resume-session-list

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Summary

The interactive CLI made session recovery too discoverability-hostile at the exact point users need it most: right after opening chat. If the current chat had no in-memory messages, /history only said No conversation history yet, and /resume required already knowing a session id or title.

This PR keeps Hermes' session-boundary resume model intact, but brings the in-chat UX closer to what other agent CLIs do when users need to recover prior work:

  • OpenCode exposes an in-TUI /sessions surface (aliases /resume, /continue) for listing and switching sessions.
  • Codex keeps transcript/history browsing available from inside the TUI rather than forcing users out to external shell commands.
  • Aider supports restoring prior chat history directly at launch instead of requiring a separate session-discovery step.

Hermes should preserve its frozen-session semantics, but it should not require users to leave the chat TUI just to discover resumable sessions.

What Changed

  • added HermesCLI._list_recent_sessions() to fetch recent CLI sessions from the session DB while excluding the current session
  • added HermesCLI._show_recent_sessions() to render a compact inline session table inside the active chat TUI
  • changed /history so an empty current chat now shows recent resumable sessions instead of a dead-end No conversation history yet
  • changed /resume with no argument so it lists recent sessions inline and shows resume guidance, instead of only telling users to run hermes sessions list
  • kept the actual resume mechanics unchanged when a target session id/title is provided

Why This Shape

Hermes should not copy CLIs that mutate a live session's underlying model/runtime state in-place, because Hermes relies on frozen per-session prompt identity and cache-friendly resume boundaries.

But discoverability is orthogonal to that constraint. Showing resumable sessions from inside the TUI improves the UX without:

  • mutating the current live session's toolset/model assumptions
  • rebuilding prompts mid-conversation
  • breaking session cache expectations

So this follows the competitor UX pattern at the discovery layer, while keeping Hermes-safe session switching semantics underneath.

Testing

  • source /Users/kshitij/Projects/hermes-agent/.venv/bin/activate && python -m pytest tests/test_cli_init.py tests/test_resume_display.py -q
    • 53 passed
  • live dry run via isolated HERMES_HOME + SessionDB
    • verified cli.show_history() prints an inline recent-session table when the active chat has no messages

Notes

Related to the broader /resume parity/discoverability thread in #2591, but this PR focuses specifically on the in-chat session-listing UX gap that still remained after CLI resume support landed.

@teknium1

teknium1 commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Merged via PR #4728. Your commit was cherry-picked onto current main with your authorship preserved in git log. Style adjustments made on top: replaced ASCII box drawing with the column-header style matching hermes sessions list, widened columns, moved guidance text above the table. Thanks for the contribution!

@teknium1 teknium1 closed this Apr 3, 2026
teknium1 pushed a commit that referenced this pull request Apr 3, 2026
When /history is used in an empty chat, show a table of recent
resumable sessions instead of a dead-end message. When /resume is
called with no argument, show the same table with resume guidance.

- Add _list_recent_sessions() and _show_recent_sessions() to HermesCLI
- Remove redundant exclude_sources (already filtered by source='cli')
- Center the table header properly

Cherry-picked from PR #4448.
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 28, 2026
When /history is used in an empty chat, show a table of recent
resumable sessions instead of a dead-end message. When /resume is
called with no argument, show the same table with resume guidance.

- Add _list_recent_sessions() and _show_recent_sessions() to HermesCLI
- Remove redundant exclude_sources (already filtered by source='cli')
- Center the table header properly

Cherry-picked from PR NousResearch#4448.
@kshitijk4poor
kshitijk4poor deleted the fix/chat-resume-session-list branch August 5, 2026 07:07
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.

2 participants