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.
The English pages are written as standalone articles, not route stubs. Use the language switch on any article to jump to the matching Chinese version.
Build the source-reading route first: CLI, REPL, queue, query loop, model stream, tool gates, transcript, and resume.
Source Notes · Part II Memory Is a Long-Lived Instruction LayerTrace CLAUDE.md, auto memory, session memory, agent memory, and user context projection into the next request.
Source Notes · Part III Context Is Not Just a SummarySeparate memory, transcript, compact, microcompact, and model-visible projection instead of calling everything context.
Source Notes · Part IV Tools Are Runtime ContractsRead the path from model tool_use to validated local work and paired tool_result.
Follow allow, deny, ask, hooks, permission requests, and denied tool results through the tool path.
Source Notes · Part VI Commands, Skills, and MCP Feed the Same Capability PoolRead how slash commands, skills, plugins, MCP prompts, and MCP tools enter the current command table and tool pool.
Source Notes · Part VII Subagents and Forks Are Context ProjectionsCompare normal subagents with fork paths, worker tool scope, cache-stable prefixes, and context isolation.
Source Notes · Part VIII Hooks Are Runtime GatesPlace hooks back into the turn lifecycle: prompt, tool, stop, compact, session, and subagent boundaries.
Source Notes · Part IX Resume Rebuilds Runtime StateSeparate UI messages, durable transcript, API view, content replacement, and restored runtime state.
Source Notes · Part X Prompt Cache Is Request-Shape DisciplineTie cache_control, stable prefixes, fork suffixes, microcompact, replacement state, and cache-break detection into one performance story.