Skip to main content

Sessions

A session is the unit of conversation state: message history, model choice, mode flags, and memory scope.

Session keys

Gateway adapters derive a stable session key from channel-specific identifiers:

ChannelTypical key part
Web / CloudSession uuid in URL or cookie
Telegramtelegram:<userId>
CLI / TUIExplicit session id or default

Linked identities (same human on Telegram + web) can share context when identity links are configured.

Persistence

BackendUse case
In-memoryDev-only; lost on restart
Postgres / cloud DBProduction web and hosted workspaces
File / sqliteLightweight self-host

Session metadata includes title, last activity, pinned/archived flags (cloud app).

Lifecycle

  1. Create - First message or explicit POST /api/sessions
  2. Resume - Router loads history into the agent context window
  3. Archive / delete - User or retention policy; audit in cloud deployments

Source references

  • agents/session-manager.ts (and gateway session stores)
  • gateway/router.ts
  • memory/session-index.ts for searchable history