Skip to content

Start here

Start here when you need the fastest coherent mental model of the extracted Claude Code runtime. This chapter answers three questions before sending readers into deep source-anchored pages:

  1. What is the extracted artifact?
  2. What major runtime capabilities does it contain?
  3. Which path should I follow for a specific investigation?

The primary readable artifact is claude-code-pkg/src/entrypoints/cli.js. It is a bundled/minified production file, so this wiki uses stable semantic aliases in prose and keeps minified names only as searchable anchors for this exact build.

Source-anchor policy

This page is an orientation document. Concrete anchors live in the linked pages.

Semantic aliasMinified anchorScope
Start pageN/A — navigation pageEstablishes the first reading path and the wiki’s conceptual map.
Glossary and aliasesSee glossary-and-aliases.mdDefines recurring semantic aliases, minified-symbol search handles, and terminology.
Bundle identitySee what-is-cli-js.mdExplains package, Bun graph, cli.js, bytecode, and native-module boundaries.
Runtime capability mapSee main-feature-map.mdMaps the major systems implemented by the extracted runtime.
System architectureSee system-architecture.mdSynthesizes module boundaries, data/control flows, integration seams, and runtime state relationships.
Communication protocolsSee runtime-communication-protocols.mdDistinguishes in-process calls from MCP JSON-RPC, task/agent tools, bridge frames, Remote Control, and provider streaming.

First reading path

StepReadWhy
1cli.js overviewDefines what the artifact is and what it is not.
2Glossary and aliasesDefines the semantic aliases and minified-anchor terms used throughout the wiki.
3Main feature mapShows how CLI modes, context, tools, sessions, remote control, agents, and ops connect.
4System architectureExplains module boundaries, data/control flows, integration seams, and runtime state relationships.
5Runtime communication protocolsExplains which boundaries use function calls, JSON-RPC, JSON envelopes, WebSocket/SSE, or HTTP streaming.
6CLI main pathsExplains bootstrap, argv routing, headless mode, interactive mode, resume, MCP, and subcommands.
7Session resume and transcriptsShows how durable JSONL sessions, resume/continue, fork, rewind, and transcript roots fit into the runtime.

Choose your route

QuestionGo to
What do the wiki’s semantic aliases and minified anchors mean?Glossary and aliases
How does the binary/package start and select a mode?Runtime lifecycle
What becomes model-visible context?Context and model loop
How are context compaction, checkpoints, and rewind managed?Context, memory, compaction, checkpoints, and rewind
How are models selected and usage/quota/billing handled?Model selection, calls, usage, quota, and billing
Which tools, integrations, and permission boundaries exist?Tools, integrations, and security
Where do sessions, transcripts, resume, and remote control live?Sessions, persistence, and remote
Which operational contracts cover logs, telemetry, updates, diagnostics, and native media modules?Hosted agent ops
How are agents, subagents, tasks, and automation surfaced?Agents and automation

Internals map

flowchart TD
Start[Start here] --> Runtime[Runtime lifecycle]
Runtime --> Loop[Context and model loop]
Loop --> Tools[Tools, integrations, and security]
Runtime --> Sessions[Sessions, persistence, and remote]
Sessions --> Hosted[Hosted agent ops]
Loop --> Agents[Agents and automation]
click Start "./" "Open Start here"
click Runtime "../01-runtime-lifecycle/" "Open Runtime lifecycle"
click Loop "../02-context-model-loop/" "Open Context and model loop"
click Tools "../03-tools-integrations-security/" "Open Tools, integrations, and security"
click Sessions "../04-sessions-persistence-remote/" "Open Sessions, persistence, and remote"
click Hosted "../05-hosted-agent-ops/" "Open Hosted agent ops"
click Agents "../06-agents-automation/" "Open Agents and automation"

Reading strategy

  • Use section README pages as narrative guides.
  • Use implementation pages when you need exact strings, byte offsets, env vars, command flags, or call paths.
  • Treat the JavaScriptCore .jsc dump as low-level corroboration, not recovered source.
  • For cli.js, prefer exact strings plus byte offsets over minified symbol names alone.

Created and maintained by Yingting Huang.