Query Engine & API Layer
The heart of Claude Code — how it talks to the AI model, streams responses, executes tools, and manages context.
The Query Loop (query.ts)
Location: src/query.ts (1500+ lines)
This is the most important file in the codebase. Every AI interaction goes through this loop.