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.

Source Notes · Part I Follow One Task Through the Claude Code Runtime

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 Layer

Trace 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 Summary

See how memory, transcript, compact, and microcompact contribute different data to the next provider request.

Source Notes · Part IV How tool requests become local actions

Follow model tool_use through validation, permission checks, execution, and the paired tool_result.

Source Notes · Part V Permissions are the side-effect brake

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 turn

See 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 work

Compare 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 execution

See what hooks receive, how stdout is parsed, and what can change before prompts, tools, stop, and compact.

Source Notes · Part IX Resume rebuilds runtime state

Follow 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 prefix

Connect cache markers, sticky headers, fork suffixes, microcompact, deterministic replacements, and cache-break detection.