Skip to content

Conversation

@YangLi-leo
Copy link
Contributor

feat: add /session command to list and switch between conversation sessions

Summary

This feature introduces session management and a new /session command for switching between conversation sessions interactively.

Details

  • Add session management functions in metadata.py with proper type annotations:
    • list_sessions(): List all sessions with metadata.
    • load_session(): Load and switch to a specific session.
    • _get_session_info(): Extract session preview information.
  • Add /session command (alias: /resume) for interactive session switching.
  • Display sessions with:
    • Preview of the first 50 characters
    • Relative timestamp
    • Message count
  • Support full conversation history restoration when switching sessions.
  • Handle edge cases:
    • Empty sessions
    • Current session
    • User cancellation
  • Fix import issues after upstream refactoring (load_agents_md moved to soul.globals).

@YangLi-leo YangLi-leo force-pushed the feature/session-management branch 5 times, most recently from 632771a to cfd30b6 Compare October 26, 2025 15:54
@stdrc
Copy link
Collaborator

stdrc commented Oct 27, 2025

I just refactored the cli entrypoint today. Now the main branch is a bit off with this PR. Could you please have a look and resolve the conflict? BTW, I guess it would be way easier to raise a Reload exception to let the cli entrypoint "continue" another specified session.

…ssions

  - Add session management functions in metadata.py with proper type annotations
    - list_sessions(): List all sessions with metadata
    - load_session(): Load and switch to a specific session
    - _get_session_info(): Extract session preview information
  - Add /session command (alias: /resume) for interactive session switching
  - Display sessions with preview (first 50 chars), relative time, and message count
  - Support full conversation history restoration when switching sessions
  - Handle edge cases: empty sessions, current session, user cancellation
  - Fix import issues after upstream refactoring (load_agents_md moved to soul.globals)
@YangLi-leo
Copy link
Contributor Author

I tried using Reload exception as suggested, but it causes a UX issue: the shell restarts and clears the screen, so users can't see their previous conversation history. The direct state replacement approach provides better UX.

@YangLi-leo
Copy link
Contributor Author

And I resolve the conflict issue in the newest commit but still use the old logical

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