Skip to content

Sessions, persistence, and remote

This chapter treats sessions as the durable spine of Claude Code. A session is not only a chat transcript: it is a local JSONL event stream, a resume/continue target, a fork/rewind boundary, and a possible remote-control or remote-session handoff point.

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, rewound, or controlled remotely?

Source-anchor policy

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

Semantic aliasMinified anchorScope
Sessions/persistence/remote chapterN/A — navigation pageGroups local JSONL transcripts, resume/continue/fork/rewind, remote sessions, teleport, and Remote Control.
Session implementation pagesSee linked source-anchor tablesConcrete bundle anchors live in destination pages.

Session spine

flowchart TD
Startup[CLI mode selection] --> NewOrResume{new / continue / resume?}
NewOrResume --> New[Fresh session]
NewOrResume --> Continue[Continue latest]
NewOrResume --> Resume[Resume by id/search]
Continue --> Restore[Restore transcript]
Resume --> Restore
Restore --> Loop[Interactive or headless loop]
New --> Loop
Loop --> Jsonl[local-jsonl transcript]
Loop --> Remote[remote / teleport / Remote Control]

Primary reading order

OrderPageSession question answered
1Session resume and transcriptsHow do JSONL transcript roots, --continue/--resume/--session-id/fork/no-persistence/rewind connect, and how do SessionDiscovery + SessionRestore rehydrate permission/model/agent state?
2Remote control and teleportHow do --remote, --teleport, remote-control, bridge tokens, and Remote Control paths connect to sessions?
3Session API, events, and storageWhich API endpoints, event families, bridge frames, and internal storage areas are visible around sessions and remote control?
4Data models and frame schemasWhich observable transcript records, session layers, stream/control frames, and storage record families shape sessions?
5Session and remote-control architectureHow is a session decomposed into a durable JSONL layer + live envelope, and how do resume/fork/rewind/remote reuse the same address?

Handoffs

Created and maintained by Yingting Huang.