Architecture
The pieces of Claude Code, its processes, where it runs, and the steps it takes when it starts.
The Agent Loop
How a turn runs from your prompt to the final answer, where each hook and mod event fires, how the loop recovers from errors, and why a turn ends.
Request and Cache
What one request to the model holds, which cache markers it carries, how long the cache lives, and which actions break it.
The System Prompt
How Claude Code builds the system prompt from named sections, how it picks the short or full version, and every way to change it.
Context and Compaction
What fills the context window, when Claude Code compacts, the formulas for each level, the summary prompt, and what survives.
Context Budget
What an empty Claude Code session holds, what each tool costs, what else changes the budget, and how to keep it small.
Sessions and Storage
How Claude Code saves a session, how resume and branch work, what is restored, and where every file lives on disk.
Models
How Claude Code picks the model, effort, and thinking mode, what the capability flags do, how fallback and retries work, and which timeouts apply.
Permission Flow
How Claude Code decides to allow, ask about, or deny a tool call, in order, with hooks, modes, the sandbox, and the auto mode classifier.
Account and Access
How Claude Code learns your account and plan, where it keeps them, when it asks again, and how it decides which models you can pick.