Back to directory

Dive into Claude Code

A source-level architectural analysis of Claude Code's roughly 512,000 lines of TypeScript, arguing that only a small fraction is AI decision logic while the rest is deterministic infrastructure, packaged with a design guide for agent builders.

Dive into Claude Code

Dive into Claude Code is a research repository built around a detailed architectural analysis of Claude Code's source code, spanning about 1,900 TypeScript files and 512,000 lines. Its central finding is that only 1.6% of the codebase implements AI decision logic; the agent loop itself is a simple while-loop, and the remaining 98.4% is deterministic infrastructure such as permission gates, context management, tool routing and recovery logic that does the real engineering work.

It traces every design choice back to five underlying values and thirteen implementation principles, covering the agentic query loop, safety and permission handling, extensibility, context and memory management, subagent delegation and session persistence, and separately documents two CVEs where extensions could execute before a trust dialog appeared. Beyond the paper's own content, the repository adds a design-space guide for anyone building their own AI agent system, a cross-system comparison against OpenClaw and Hermes-Agent, and a curated collection of community analyses and related projects.

It accompanies a published arXiv paper and is organized as a reading guide tailored to different audiences, from agent builders to security researchers.

More in Coding agents

See all 793
  • The City

    github.com

    A native macOS app that shows Claude Code runs as a city, with each project as a building, each team as a floor of robots, and every animation driven by a real event from the claude CLI's stream.

  • rig

    tryrig.ai

    A small, single-binary agent runtime that points at any OpenAI-compatible model, local or hosted, reads and edits a repository's code, runs its tests and remembers what it learned, with a loop implemented in a few hundred lines.

  • Jauvex

    jauvex.reindent.com

    An Electron desktop app that puts Claude Code, Codex and Grok coding-agent sessions side by side and lets you steer them by voice, with a small model handling fast routing decisions.