← WIZ
// EXPERIMENTS
← experiments

Claude Code Unpacked

What actually happens inside Claude Code? The agent loop, 50+ tools, memory system, and unreleased features, mapped from the leaked source.

1,900
files
512K
lines
50+
tools
44
feature flags
March 31, 2026 — npm v2.1.88 shipped with a 59.8MB source map. A missing .npmignore entry exposed the full TypeScript source.
📖 Full analysis: Claude Code's Source Got Leaked. Here's What's Actually Worth Learning.

🔄The Agent Loop

From keypress to rendered response, step by step through the source

⌨️
1/11

User Input

User types a message or pipes input through stdin. Keyboard input comes from Ink's TextInput component. In non-interactive mode, reads from piped stdin.

src/components/TextInput.tsx

Largest files by lines of code

QueryEngine.ts
46K

Core LLM API engine, streaming, token tracking

Tool.ts
29K

Agent tool types, permission schemas

commands.ts
25K

Slash command registration and execution

print.ts
5.6K

Terminal rendering, game-engine techniques

history.ts
4.2K

Conversation history and CLAUDE.md reinsertion

loop.ts
3.8K

Agent loop, compaction, tool orchestration

Read the full analysis on Digital Thoughts →

Built by Pawel Jozefiak & Wiz — Analysis based on the Claude Code v2.1.88 source leak (March 31, 2026)

Not affiliated with Anthropic. Unofficial analysis.

by Pawel Jozefiak

More on AI, experiments & building things

Read Digital Thoughts →