Claude Code Internals
AI coding agents represent a new paradigm: an LLM in a loop that can read files, run commands, edit code, and spawn sub-agents — all autonomously. This section dissects the architecture behind these systems, using Claude Code as a case study to explore the design patterns that make agentic coding work.
Based on publicly available information, official documentation, and architectural analysis. No proprietary source code is reproduced.
High-Level Architecture
What Makes Coding Agents Different from Chatbots
- Single request → single response
- No file system access
- No persistent state between turns
- User must copy-paste code manually
- Context limited to conversation
- Multi-step loop: think → act → observe → repeat
- Direct file read/write/edit access
- Terminal command execution (sandboxed)
- Tool results feed back into reasoning
- Sees full codebase via retrieval + grep
The Agent Loop
How agentic coding assistants use a read-think-act-observe cycle to solve multi-step tasks — with animated execution traces
Tool Use & Sandboxing
File edits, terminal commands, web fetches — how the tool system works, permission boundaries, and why sandboxing matters
Context Window Engineering
Fitting a whole codebase into 200K tokens — summarization, compression, retrieval strategies, and what gets evicted first
Multi-Agent Architecture
Sub-agent spawning, parallel execution, worktree isolation, and how orchestrators coordinate specialized workers