Hasty Briefsbeta

Bilingual

Claude Code from Source

13 hours ago
  • Claude Code's architecture is extracted from its npm source maps, revealing a complete system design across 18 chapters.
  • The agent loop uses an async generator to stream model output, execute tools, recover from errors, and compress context across 4 layers.
  • Tool execution involves a 14-step pipeline with permission resolution, speculative execution, and concurrent batching by safety classification.
  • Multi-agent orchestration uses sub-agents sharing prompt cache prefixes to cut costs by 95%, with fork agents, coordinator mode, and swarm teams.
  • Memory is file-based with an LLM-powered recall system, including four memory types, staleness warnings, and Sonnet side-queries beating embedding search.
  • Performance engineering achieves 240ms startup via parallel I/O, slot reservations saving context in 99% of requests, and bitmap pre-filters for fuzzy search.
  • Extensibility and security feature two-phase skill loading and 27 lifecycle hooks with frozen config snapshots to prevent injection.
  • The book targets engineers building agentic systems, technical leaders evaluating architectures, and anyone curious about production AI tools.
  • The entire 18-chapter book was generated by 36 AI agents in 6 hours, rewritten as pseudocode with no verbatim source code.
  • Ten key architectural patterns define Claude Code, including abstracted design principles for production AI agents.