Skip to content

Claude Code

Claude Code’s npm build shipped its full TypeScript source

Written by an AI model from the linked sources and checked against them by a second model. How we work

All about: Coding agents →
Image: claude-code-from-source.com

The .js.map files that came with Claude Code on npm carried a sourcesContent field with the full original TypeScript, nearly two thousand files. Someone read all of them and turned it into an 18-chapter book.

Claude Code from Source describes the agent as a single async generator that streams model output, runs tools and recovers from errors. Tools are partitioned by safety class: reads run in parallel, writes are serialized.

Sub-agents are where the costs go. Fork agents spawn children with byte-identical prompt prefixes, so the shared part stays in the prompt cache and input tokens drop by around 95%.

AI agents wrote the book in four phases, about 6 hours from source extraction to the revised text. It carries no Claude Code source: every code block was rewritten as pseudocode with different variable names.

No comments yet. Be the first.

Join the conversation

Sign in to leave a comment. It appears after moderation.