What it is
Anthropic’s official agentic CLI. The most production-hardened agent in the corpus, and the one to read first if you want to see what “shipping a tool that millions use” looks like.
What’s worth studying
Claude Code is the cleanest reference for a generator-driven agent loop with everything turned on: streaming tool calls, explicit prompt caching with a sentinel-string boundary, thinking blocks with signature preservation across turns, latched sticky flags for cache coherence, and a slash-command + skills system that lets users (and Anthropic) extend the agent without touching its core.
Three patterns are uniquely visible here:
- The cache-edit boundary as a literal string. A 24-character sentinel splits the system prompt into org-static and session-dynamic regions. Survives every refactor and every contributor. See cache-boundary-sentinel.
- Latched sticky flags. User-toggleable flags that live in the cacheable prefix are latched on: once on, they stay on for the session, even if the user toggles them off. The team accepted a small UX surprise for a 50–70K-token cache win. See latched-sticky-flags.
- Thinking-signature preservation across turns, stripped on model switch. Anthropic’s HMAC signatures are model-bound; switching from Sonnet to Opus mid-session would crash if Claude Code didn’t strip the blocks. See thinking-signature-preservation.
Drill-down
The full per-doc analysis lives below — these are the original numbered analyses, rendered as styled HTML. Pick a section to study deeper.
- Claude Code — Source Tree Analysis
- 1. Purpose, Problem, and Tech Stack
- 2. Architecture Overview
- 3. Entry Points and Execution Flow
- 4. The Agent Loop and LLM Usage
- 5. The Tool System
- 6. Agents, Skills, Slash Commands, MCP
- 7. Prompts and Guardrails (verbatim)
- 8. Memory and Context
- 9. State, UI, and Session Persistence
- 10. Design Patterns, Tradeoffs, and Clever Tricks
- 11. Key Files Map
- 12. Deep Dive — The
/btwCommand - 13. Multi-Agent Coordination
- 14. Mid-Turn Messages, Interruption, and the Command Queue
- 15. Memory System — Deep Dive
- 16. The Agentic Loop — Schematic Walkthrough