This column, Claude Code Deep Dive, uses this repo’s reverse‑engineered Claude Code–style CLI as the reference implementation. We trace questions like who calls the API, how tools are wired, and where system context is built—with pointers you can verify in the tree.
What to expect
- Main loop & API — e.g. streaming, turns, and tool execution paths under
query.ts. - Orchestration —
QueryEngine.ts, compaction, snapshots, and related session state. - Prompts & context —
context.ts,constants/prompts.ts, and what the model actually sees. - Tools & permissions — how capabilities are registered and gated (
Tool.ts,tools/).
Each piece follows claim → file/symbol → reasoning, with repo state and dates as the source of truth—not vendor marketing copy.
Next up
A walkthrough from “user submits a prompt” to “first streamed token,” naming entrypoints and branches. Add follow‑ups in the same shape for modules you care about.