Claude Code Source Notes
Claude Code Source Notes
This English edition follows one task through the Claude Code runtime first, then zooms into memory, context, tools, permissions, MCP, subagents, hooks, transcript, resume, and prompt cache. Each article is grounded in the public mirror and official documentation.
Source analysis uses the public mirror’s fixed March 31, 2026 snapshot, not the current release. Each chapter separates visible client mechanisms, current official documentation, and unavailable implementation details. Use the language switch to open the matching edition.
Build the source-reading route first: CLI, REPL, queue, query loop, model stream, tool execution, transcript, and resume.
Source Notes · Part II Memory Is a Long-Lived Instruction LayerTrace CLAUDE.md and memory files through cached reads, invalidation, reloads, and distinct request paths; a file write does not guarantee an immediate request update.
Source Notes · Part III Context Is Not Just a SummarySee how memory, transcript, compact, and microcompact contribute different data to the next provider request.
Source Notes · Part IV How tool requests become local actionsFollow model tool_use through validation, permission checks, execution, and the paired tool_result.
Follow the exact order of deny, ask, tool checks, bypass, allow, user confirmation, and denied tool results.
Source Notes · Part VI How commands, Skills, and MCP enter a turnSee which capabilities enter the user-facing command table and which tool schemas are sent to the model.
Source Notes · Part VII How Claude Code isolates subagents and forked workCompare rebuilt prompts and tools for normal subagents with the exact parent-prefix reuse of a fork child.
Source Notes · Part VIII Where Claude Code hooks can change executionSee what hooks receive, how stdout is parsed, and what can change before prompts, tools, stop, and compact.
Source Notes · Part IX Resume rebuilds runtime stateFollow transcript cleanup, content replacements, session hooks, worktree state, and the file used for later writes.
Source Notes · Part X Prompt cache depends on a stable request prefixConnect cache markers, sticky headers, fork suffixes, microcompact, deterministic replacements, and cache-break detection.