Sessions and persistence
A session is one chat conversation bound to one workspace. Its transcript is the sequence of messages in the conversation, and — as in the loop — that transcript is the state: a session restored from disk is in exactly the state the loop left it, including a turn that was paused for approval.
A workspace is a named canonical directory root. The shell shows one workspace at a time and lists that workspace’s sessions.
What is stored
The session store is SQLite, at the path in ROBI_DATABASE_URL (see
File locations). Migrations run on startup.
The tables a user should know about:
workspaces— each workspace root, plus its MCP trust hash.chat_sessions— the title, mode, per-mode model config, path grants, approved MCP pairs, the plan path, and timestamps.chat_messages— the transcript, in order. A tool call’s result payload is not in this row.session_file_baselines— the file baselines that checkpoints are computed against. Nothing writes them in the default build, because a shell command is opaque; git is the undo.
Tool results, the stored originals of compressed results, and image bytes live in
~/.robi/sessions/<session_id>/blobs.redb, one file per session. The transcript
records an image as an id and a media type. Deleting a session removes that
directory.
Deleting a session cascades to its messages. last_used_at moves when a message
is appended; updated_at moves when metadata or a title changes.
Settings and secrets
Two files under ~/.robi, both read through one settings port so a later
keychain can replace the secret backend without changing callers:
config.toml— ordinary settings;secrets.toml— credentials, mode0600, refused when group or world can read it.
Every key is fixed and whitelisted; see Configuration. A default is written through the store on the first read, so the file and later reads agree.
Model selection
The model and reasoning effort are resolved per session, per mode, in this order:
- a per-session, per-mode override stored on the session;
- the per-mode setting (
model_agent,reasoning_effort_agent, …); - the base setting (
model,reasoning_effort); - the built-in default (
glm-5.3, no effort).
Switching model mid-session is allowed; the transcript is provider-agnostic. The active model is shown where you type, not buried in settings.
The runtime
One tokio actor per session runs that session’s turns. The process holds an
agent factory, not an agent: the actor builds an Agent for a turn and drops
it when idle, so a process with many open sessions is not holding many agents in
memory.
- Sending a message while a turn is running is allowed; the latest instruction wins.
- Sending a message while the turn is paused rejects the calls still waiting on approval, then runs the new instruction (see Approvals).
stopcancels the running turn through the cancellation token. A cancelled turn leaves a transcript that is either resumable or cleanly finished, never a half-written assistant message with dangling tool calls.- A session response carries
has_pending_agent, so the shell knows a turn is in flight without subscribing to that session’s stream. - The same response carries
turn_display(idle,pending,awaiting_approval, orfailed) for the sidebar. The transcript remains the source of truth for approval.
The title is generated by the model after the first completed turn when the client did not supply one.
Where this is specified
The store choice, the schema, the settings port, and the session lifecycle are in Persistence. The per-session actor, the interrupt rules, and the stop path are in Chat runtime.