James' Growth Diary
James' Growth Diary
May 1, 2026 · Artificial Intelligence

QueryEngine: One Instance Equals One Session – Full Breakdown of Claude Code’s Session Lifecycle

The article dissects Claude Code’s QueryEngine class, explaining how each QueryEngine instance represents a single conversation thread, detailing its configuration, state management across turns, the submitMessage workflow, SDK vs REPL modes, persistence mechanisms, and the four key engineering decisions and technical debts.

AIClaudeQueryEngine
0 likes · 14 min read
QueryEngine: One Instance Equals One Session – Full Breakdown of Claude Code’s Session Lifecycle