Skip to content

kunhai-88/buildagent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

30 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Build Agent

ไธญๆ–‡ | English

A close reading of Claude Code (~540K LOC TypeScript) and Codex (~467K LOC Rust). What can we learn about building AI agents by studying these two production systems side-by-side?

License Website

Status: Work in progress. Some articles are deep, some are stubs being filled in. Findings get published here as they're written.

๐ŸŽฏ What is this?

Claude Code (Anthropic, ~540K LOC TypeScript) and Codex (OpenAI, ~467K LOC Rust) are two of the most ambitious open coding-agent codebases shipped to date.

This repo is a long-running effort to read both line by line and write down what's actually going on โ€” the patterns, the trade-offs, and the design decisions that aren't obvious from using the tools.

๐Ÿ’ก Core Insights (so far)

A few things that became clear early:

  1. Agent โ‰  LLM. A model that suggests is a fundamentally different product from a system that executes. Most of the interesting engineering lives in that gap.
  2. The bottleneck is the system, not the model. Tools, loops, context, and prompt assembly often matter more than which model you call.
  3. Intelligence amplification compounds, it doesn't add. Each mechanism (tools ร— loops ร— context ร— prompt ร— compaction) multiplies the others โ€” weakening any one drags the whole product down.
  4. The next big improvements are in the system layer, not the model layer.

These threads are explored in detail throughout the articles below.

๐Ÿ“š Documentation Structure

Build deep understanding of AI Agent intelligence essence

Learn from failures, understand necessity of each mechanism

Deep dive into reasons behind key design decisions

Compare implementation approaches of Claude Code and Codex

Five Mechanisms Comparison:

System Design Comparison:

Real-world cases, learn how to build specific types of Agents

Part 5: Summary (3 articles)

Summarize core insights, guide practice

๐Ÿš€ Quick Start

1. Understand Intelligence Essence (10 minutes)

Read first 3 articles to build cognitive foundation:

2. Learn from Failures (30 minutes)

Read failure cases to understand necessity of each mechanism:

3. Build Your Agent (1 hour)

Follow tutorial to build your first Agent:

๐Ÿ“Š At a Glance

A rough side-by-side. Numbers are based on the source trees we read; speed/feature characterizations are our impressions, not benchmarks.

Project Language Lines of Code Architecture Tooling
Claude Code TypeScript ~540K Layered (โ‰ˆ6 layers) 50+ built-in tools
Codex Rust ~467K Centralized core ~30 tools, Skills-based

Recurring themes we keep coming back to (each gets its own article):

  • Prompt cache is the single biggest cost lever in both systems
  • Auto-compaction is what makes long sessions actually work
  • Tool concurrency is bounded by correctness, not by hardware
  • Permission modeling is more product design than security engineering

๐ŸŽ“ Learning Paths

Fast Track (2 hours)

  1. Cognitive Foundation (3 articles)
  2. Failure Cases (5 articles)
  3. Build MVP (1 article)

Deep Dive (10 hours)

  1. Cognitive Foundation (3 articles)
  2. Failure Cases (5 articles)
  3. Design Decisions (5 articles)
  4. Deep Comparison (10 articles)
  5. Case Studies (3 articles)
  6. Summary (3 articles)

Production Ready (20+ hours)

  • Read all articles
  • Build 3 real-world Agents
  • Deep dive into source code

๐Ÿ”ฅ Core Aha Moments

  1. Case 3272 Failure - Why circuit breaker is needed
  2. Mathematics of Trust - 10 successes vs 1 failure
  3. 90/10 Rule - 90% tasks use only 10% tools
  4. Optimal Concurrency Point - Not more is better, it's 10
  5. System > Model - GPT-3.5 + system > GPT-4 alone
  6. Multiplication vs Addition - Intelligence amplification is mutual enhancement
  7. Completeness > Single Point - Barrel theory
  8. Next 10x - In system, not in model

๐Ÿ› ๏ธ Tech Stack Comparison

Claude Code

  • Language: TypeScript
  • Runtime: Bun
  • Architecture: Layered (6 layers)
  • Tools: 52+
  • Features: Enterprise-grade, feature-rich

Codex

  • Language: Rust
  • Architecture: Centralized core
  • Tools: 30+ (Skills-based)
  • Features: Lightweight, high-performance

๐Ÿ“ˆ Project Status

  • Articles drafted: 28 across 6 sections โ€” some are deep dives, some are stubs being filled in
  • Runnable examples: 1 (TypeScript minimal agent), more on the roadmap
  • Updates: roughly weekly as new findings get written up
  • What's missing: most articles still need a second pass, more code citations, and runnable companion examples

๐Ÿค Contributing

Contributions welcome!

  • ๐Ÿ› Report bugs
  • ๐Ÿ’ก Suggest ideas
  • ๐Ÿ“ Improve docs
  • ๐ŸŽจ Share your Agent

๐Ÿ“„ License

MIT License - see LICENSE

๐Ÿ™ Acknowledgments

๐Ÿ“ฎ Contact


โญ If this project helps you, please star the repo!

Remember: The future is not waited for, it's built. Start building your Agent now!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors