Skip to content

Sessions, persistence, and remote

This chapter treats sessions as the durable spine of the runtime. A session is not just a chat transcript: it is an event-sourced state machine with replay, workspace sidecars, file-system abstractions, SQLite/FTS indexes, UI projections, repository/ref metadata, and local/remote handoff behavior.

Read this chapter when the question is: where did the agent’s state come from, where was it saved, and how can it be resumed, forked, searched, or controlled remotely?

Source-anchor policy

This page is a chapter guide. Linked implementation pages carry concrete app.js anchors.

Semantic aliasMinified anchorScope
Sessions/persistence/remote chapterN/A — navigation pageGroups event-sourced sessions, replay, SessionFs, SQLite indexing, schemas, UI projection, git context, cloud sessions, and remote control.
Session implementation pagesSee linked source-anchor tablesConcrete bundle anchors live in the destination pages.

Session spine

flowchart TD
Startup[Startup selection] --> Lifecycle[Session lifecycle]
Lifecycle --> Replay[Event replay]
Replay --> Runtime[Agentic loop and tools]
Runtime --> Events[Durable events]
Events --> SessionFs[SessionFs and workspace files]
Events --> SQLite[SQLite / FTS index]
Events --> UI[UI projection]
SessionFs --> Fork[Fork / rewind / checkpoints]
SQLite --> Search[History / search / reindex]
Runtime --> Remote[Remote/cloud control]
Git[Git/repo/ref context] --> Lifecycle
click Lifecycle "./conversation-session-end-to-end/" "Open end-to-end lifecycle"
click Replay "./session-manager-and-event-replay/" "Open session manager"
click SessionFs "./session-fs-provider-and-state-files/" "Open SessionFs"
click SQLite "./session-store-sqlite-indexing/" "Open SQLite indexing"
click Remote "./remote-control-protocol-and-steering/" "Open remote control"
click Git "./git-repository-context/" "Open git context"

Primary reading order

OrderPageSession question answered
1Conversation session end-to-endHow do create/resume/continue, replay, workspace state, tool refresh, UI projection, indexing, remote export, and shutdown connect?
2Session manager and event replayHow does event-sourced local persistence, workspace artifact management, startup resolution, APIs, and handoff behavior work?
3Session persistence, replay, and indexingHow do JSONL events, SessionFs, workspace sidecars, SQLite/FTS, search/reindex, fork, rewind, checkpoints, and cloud sync fit together?
4SessionFs provider and state-file lifecycleHow do local and SDK/RPC-backed filesystems handle state files, reverse calls, large output temp files, and fork-time copying?
5Session, remote, cloud, and history workflowsHow do resume/continue/name handling, background sessions, cloud sessions, remote steering, and history interact?
6Remote control protocol and steeringHow do Mission Control export, command polling, /remote, permission bridging, and remote task attach work?

Supporting session topics

TopicPageWhy it matters
Schema contractsAPI and session event schema contractsConnects JSON-RPC/session schemas to runtime forwarding and replay behavior.
Search/indexingSession-store SQLite indexingDocuments session-store DB schema, FTS, refs, Chronicle, sync, and backfill.
UI projectionSystem events and UI projectionExplains system messages, notifications, timeline entries, and ephemeral UI state.
Repository metadataGit, repository, PR, and ref contextShows Git root/branch/head/base detection, PR context, session refs, and GitHub MCP overlap.

Handoffs

Created and maintained by Yingting Huang.