Skip to content

Workspace Session

Workspace session persistence is split across layers:

  • snapshot shape and reconstruction logic: rim-domain
  • load/save orchestration: rim-application
  • file I/O: rim-infra-storage

The session file is stored as:

  • session/last-session.json under rim_paths::user_state_root()

The session snapshot includes:

  • buffers and their text
  • clean text
  • buffer ordering
  • tabs and windows
  • per-window view state
  • scratch-buffer history when applicable
sequenceDiagram
participant App as rim-app
participant Application as rim-application
participant Domain as rim-domain
participant Storage as rim-infra-storage
App->>Application: quit or startup action
Application->>Domain: workspace_session_snapshot() / restore_workspace_session()
Application->>Storage: enqueue save/load session
Storage-->>Application: WorkspaceSessionLoaded
Application->>Domain: restore snapshot

The current restore path still supports the legacy untitled-buffer history shape in old session files. That compatibility lives in the domain snapshot model and must be preserved unless a format migration is explicitly introduced.

  • serializing ad hoc UI state into the session snapshot
  • reconstructing editor state inside the storage adapter
  • changing the snapshot format as an incidental refactor