class LittleGhost::Session

Sessions let an agent continue a conversation without tying it to one Ruby process. Each session keeps messages, application state, and metadata together behind a SessionStore.

session = LittleGhost::Session.new(
  id: "conversation-42",
  actor_id: "user-7",
  store: LittleGhost::SessionStores::Memory.new
)
session.append(
  messages: [LittleGhost::Message.new(role: :user, content: "Hello")],
  state: {language: "en"}
)

reopened = LittleGhost::Session.new(
  id: "conversation-42",
  actor_id: "user-7",
  store: session.store
)
reopened.history.last.text # => "Hello"
reopened.state              # => {language: "en"}

Persistence and trust

System messages, transient messages, and private model reasoning are removed before persistence. Store failures reach the caller; a successful write is the checkpoint boundary.

Multi-tenant applications must derive actor_id from stable, authenticated identity. A nil actor provides no tenant isolation and is appropriate only for a store that serves one actor.