Sessions are the SDK's memory
The Agent SDK assigns a session id and persists conversation state internally. With ClaudeSDKClient, the session lives as long as the client; with query(), it is single-use. You can resume a session by id to continue where you left off — the SDK reloads internal state and applies your new prompt.
JSONL as the durable record
The SDK can stream events to a JSONL file. Each line is a typed event: prompt, response chunk, tool use, tool result. cwkPippa makes this its ground truth — SQLite and ChromaDB are derived mirrors that can be rebuilt from the JSONL. Recovery is purge-and-replay, not patch-and-reconcile.
Resume across processes
If your worker process restarts, you can spin up a new ClaudeSDKClient with the same session id and the SDK will recover. This is what enables cwkPippa's heartbeat jobs to survive a server restart without losing conversational state.