// the find
Windy3f3f3f3f/claude-code-from-scratch
Build your own Claude Code from scratch. 🔍 Claude Code 开源了 50 万行代码,读不动?用 ~4000 行 TypeScript / Python 从零复现核心架构,11 章分步教程带你理解 coding agent 精髓
A step-by-step tutorial that reimplements Claude Code's core architecture in ~4300 lines of TypeScript (with a Python port), covering agent loop, tool execution, context compression, memory, multi-agent, and MCP. Aimed at developers who want to understand how a production coding agent actually works without reading 500k lines of source. Primarily written for Chinese-speaking developers, with English docs available.
The scope is genuinely impressive for the line count — parallel tool execution, streaming with early tool launch, 4-layer context compression, and semantic memory recall are non-trivial features that most tutorials skip or fake. Side-by-side comparison table with real Claude Code is honest about what's simplified vs. what's faithfully reproduced. Both TypeScript and Python implementations exist and are kept in sync. The companion repo (how-claude-code-works) at 330k words of source-level analysis is a serious commitment to depth.
Testing is 19 manual test cases with no automated suite — for a project teaching agent architecture, that's a credibility gap. The Python port ships committed .pyc files and an editable-install egg-info directory in the repo, which is sloppy. OpenAI-compatible backend support adds complexity and the README buries the fact that the default model is claude-opus-4-6 (expensive) in a small config note. Last push was May 2026 and Claude Code itself has evolved significantly since; the source-code comparisons will drift without active maintenance.