VL

vila-lab/dive-into-claude-code

Developer tools
2.2K stars Quality 77 Trend 49NOASSERTION

The Design Space of Today's and Future AI Agent Systems

Overview

The Design Space of Today's and Future AI Agent Systems

README

Dive into Claude Code

The Design Space of Today’s and Future AI Agent Systems

English | 中文

A comprehensive source-level architectural analysis of Claude Code (v2.1.88, ~1,900 TypeScript files, ~512K lines of code), combined with a curated collection of community analyses, a design-space guide for agent builders, and cross-system comparisons.

[!TIP] TL;DR – Only 1.6% of Claude Code’s codebase is AI decision logic. The other 98.4% is deterministic infrastructure – permission gates, context management, tool routing, and recovery logic. The agent loop is a simple while-loop; the real engineering complexity lives in the systems around it. This repo dissects that architecture and distills it into actionable design guidance for anyone building AI agent systems.


Table of Contents

From Our Paper

Beyond the Paper


Key Highlights

  • 98.4% Infrastructure, 1.6% AI – The agent loop is a simple while-loop; the real complexity is permission gates, context management, and recovery logic.
  • 5 Values → 13 Principles → Implementation – Every design choice traces back to human authority, safety, reliability, capability, and adaptability.
  • Bounded Analysis with an Approval Fallback – In the legacy shell-parser path, more than 50 subcommands triggers an ask decision.
  • 2 CVEs Revealed a Pre-Trust Window – In earlier releases, MCP servers and settings environment variables took effect before the user accepted the trust dialog.
  • The Cross-Cutting Harness Resists Reimplementation – The loop is easy to copy; hooks, classifier, compaction, and isolation are not.

Reading Guide

1,884 files · ~512K lines · v2.1.88 · 7 safety layers · 5 compaction stages · 54 tools · 27 hook events · 4 extension mechanisms · 7 permission modes

The architecture sections describe Claude Code v2.1.88. The design guide and resource catalog extend that analysis with work reviewed through October 6, 2026, and Claude Code and Codex release notes checked through October 14, 2026. The main PDF link opens arXiv v3, October 10, 2026, which redraws the layered architecture (Figure 3) and the context figure (Figure 6) and clarifies resume and pre-trust behavior. arXiv v2 and the April 2026 repository PDF remain available as archives.



The paper also applies a sixth evaluative lens – long-term capability preservation – citing evidence that developers in AI-assisted conditions score 17% lower on comprehension tests.

↑ Back to top



↑ Back to top









Find Resources by Design Question

The sections above give Claude Code’s own answer to each design question. The catalogs below are organized by resource type instead. This table joins the two, so you can start from a question rather than from a resource type.

Design question Claude Code’s answer Where the outside resources are
How does one turn actually run? Agent loop, tool dispatch, recovery. The Agentic Query Loop Architecture Analysis · Open-Source Reimplementations · Coding Agent CLIs · Harness Engineering
Who is allowed to do what? Permissions, approval, sandboxing. Safety and Permissions Security Research & Incidents · Runtime & Sandbox Infrastructure · Product Documentation · Academic Papers
How is the system extended? Hooks, skills, plugins, MCP. Extensibility Skills and Harness Extensions · MCP Ecosystem · Product Documentation
What does the model see? Context assembly, memory, compaction. Context and Memory Memory and Persistent Context · Blog Posts & Technical Articles · Academic Papers
How is work divided? Subagents, teams, orchestration. Subagent Delegation Agent Frameworks and Orchestration · Cross-Vendor Engineering · Cross-System Comparison
What survives a restart? Sessions, checkpoints, persistence. Session Persistence Runtime & Sandbox Infrastructure · Cross-Vendor Engineering
How do you know it worked? Evaluation, benchmarks, trace analysis. New Signals: closing the improvement loop Evaluation & Benchmarks · Academic Papers

For shifts that cut across every axis rather than sitting on one, see New Signals in the Agent Design Space.




Contributing

Contributions are welcome — this space moves fast, and things slip past us.

If you come across a paper, blog post, repository, benchmark, or security write-up worth adding, feel free to open a pull request or an issue.

Citation

@article{diveclaudecode2026,
  title={{Dive into Claude Code: The Design Space of Today's and Future AI Agent Systems}},
  author={Liu, Jiacheng and Zhao, Xiaohan and Shang, Xinyi and Shen, Zhiqiang},
  journal={arXiv preprint arXiv:2604.14228},
  year={2026},
  eprint={2604.14228},
  archivePrefix={arXiv},
  primaryClass={cs.SE}
}

License

This work is licensed under CC BY-NC-SA 4.0.

View the full README on GitHub

Recommended Tools

Try a different keyword or remove a filter.

Install

npx skillfish add vila-lab/dive-into-claude-code
New to MCP? Start with the mcpskill.org guide →