Source path: source/ → Claude Code reconstructed source tree
Docs path: doc/ → research notes, indexes, summaries, and module analysis
A research repository for studying @anthropic-ai/claude-code@2.1.88 from the published npm package.
This repo is built from the released package artifact, its shipped sourcemap, and reconstructed source files. It is intended for reverse engineering, architecture study, and structured documentation — not as an official source mirror.
This repository is organized around four layers:
-
Raw npm artifacts
- the original downloaded package
- extracted package files such as
cli.js,cli.js.map, andpackage.json
-
Reconstructed source
- source recovered from
cli.js.map - focused primarily on Claude Code’s own source tree
- source recovered from
-
Research documents
- bilingual module-by-module analysis documents
- structure summaries and investigative notes
-
Repository-level navigation
- English + Chinese README
- reading order and topic index
The npm release of @anthropic-ai/claude-code@2.1.88 shipped with a usable sourcemap (cli.js.map) containing embedded sourcesContent.
That makes it possible to:
- reconstruct a large portion of the source tree
- inspect architecture decisions from the shipped build
- study how Claude Code handles auth, permissions, multi-agent workflows, MCP, remote sessions, telemetry, and installation/update logic
This repo packages that work into something easier to browse than a raw npm tarball.
@anthropic-ai/claude-code@2.1.88 is not just a thin terminal wrapper around a model API.
From the reconstructed source, it appears to include substantial subsystems for:
- OAuth and API-key authentication
- permission approval and risk control
- multi-agent / teammate / swarm orchestration
- deep MCP integration
- remote sessions / bridge / direct-connect execution
- telemetry / analytics / experimentation
- update, installation, and migration workflows
If you only read one section on this page, read this one.
-
Identity is central to runtime behavior
- login/logout affects more than credentials
- auth transitions refresh policy, feature gates, trusted-device state, and dependent services
-
Permissions are layered, not binary
- modes, allow/deny/ask rules, classifiers, managed policy, and shell-safety checks all interact
-
Multi-agent is first-class, not experimental garnish
- the codebase contains teammate/swarm/task/mailbox/leader-control machinery, not just a single subagent helper
-
MCP is deeply productized
- connection lifecycle, auth, registry, commands, resources, policy filtering, and UI all indicate core-platform status
-
Remote execution is session-centric and high-trust
- bridge workers, session ingress auth, trusted-device tokens, and approval return paths point to a serious remote session plane
-
Telemetry is operational infrastructure, not just logging
- Datadog, first-party event logging, GrowthBook, and OTel-style paths are clearly separated by purpose and privacy boundaries
-
Distribution is in transition
- the code strongly suggests migration from npm-based delivery toward a native installer model
A rough mental model of the recovered system:
+----------------------+
| Auth / Identity |
| OAuth, API keys, |
| managed context, |
| trusted device |
+----------+-----------+
|
v
+------------------+ +---------+----------+ +------------------+
| Update / Install | ---> | Core Runtime | <--- | Telemetry |
| npm, local, | | commands, tools, | | Datadog, 1P, |
| native installer | | state, sessions | | GrowthBook, OTel |
+------------------+ +----+-----------+---+ +------------------+
| |
| |
v v
+----------+--+ +---+---------------+
| Permissions | | Extensibility |
| modes, | | MCP, plugins, |
| rules, | | dynamic tools / |
| classifiers | | commands/resources|
+------+------+
|
v
+---------+-------------------+
| Orchestration / Execution |
| multi-agent, swarm, remote, |
| bridge, direct connect |
+-----------------------------+
This is simplified, but it matches the strongest patterns visible in the recovered package.
Start with:
Start with:
Start with:
Start with:
Identity, OAuth, managed auth context, token sources, trusted-device coupling.
Permission modes, rules, classifiers, managed policy, shell-level safety.
AgentTool, subagents, teammate/swarm runtime, task graphs, leader control.
Connection lifecycle, auth, registry, dynamic tools/commands/resources.
Bridge workers, session ingress auth, trusted devices, direct connect, approval return paths.
Datadog, 1P logging, GrowthBook, metadata enrichment, privacy controls.
Auto updater, native installer, npm migration, package-manager detection, rollout safety.
Raw package artifacts and extracted release files.
Typical contents include:
anthropic-ai-claude-code-2.1.88.tgzcli.jscli.js.mappackage.json- extraction metadata
Reconstructed source tree derived from cli.js.map.
This repo focuses on Claude Code’s own source and removes most third-party node_modules noise to make browsing easier.
Research and analysis documents.
This is the most important directory for readers who want conclusions before code spelunking.
Top-level navigation in English and Chinese.
If you are new to this repo, I recommend:
- read this README for repository scope
- open the English documentation index for structured navigation
- then choose a reading path by topic
If you want one straightforward path, read in this order:
- This README
- Documentation Index
- Authentication & Login
- Permissions & Risk Control
- Multi-Agent
- MCP
- Remote / Bridge
- Telemetry
- Update / Install
Why this order:
- auth explains identity state
- permissions explains execution control
- multi-agent + MCP explain extensibility and orchestration
- remote/bridge explains high-privilege session execution
- telemetry explains observability and rollout control
- update/install explains delivery and migration strategy
Focus:
- OAuth + PKCE
- Claude.ai vs Console login paths
- token source handling
- managed auth context
- trusted-device coupling
Focus:
- permission modes
- rule engine
- classifier-driven approvals
- managed policy
- Bash security analysis
Focus:
- AgentTool
- forked subagents
- teammate/swarm runtime
- task graphs
- mailbox and leader approval bridge
Focus:
- MCP connection lifecycle
- transports and auth
- official registry
- dynamic tools/commands/resources
- policy-aware extension model
Focus:
- bridge workers
- session ingress auth
- trusted devices
- direct connect
- remote permission return paths
Focus:
- analytics entry points
- Datadog vs 1P logging
- GrowthBook
- metadata enrichment
- privacy and kill switches
Focus:
- auto updater
- native installer
- npm global/local migration
- package-manager detection
- version gates and rollout safety
Claude Code treats auth as a control-plane concern, not just a token lookup.
Permissions are implemented as a layered system: modes, rules, classifiers, and shell-level safety analysis.
Multi-agent behavior is first-class, with task graphs, teammate contexts, and leader-mediated control.
MCP is deeply embedded into commands, tools, permissions, and UI — not a bolt-on plugin interface.
Remote execution is session-centric and tied to strong identity and device trust.
Telemetry is stratified across Datadog, first-party logging, and OTel-style paths, with visible privacy controls.
Installation/update logic reflects a live migration from npm-based delivery toward a native installer model.
This repository was built by:
- downloading the npm package for
@anthropic-ai/claude-code@2.1.88 - extracting package contents
- inspecting
cli.js.map - recovering files from embedded
sourcesContent - separating likely first-party source from bundled third-party code
- writing structured analysis documents by subsystem
Important caveat:
- reconstructed source comes from the shipped build, not an original development repository
- file names and code content can still be highly informative, but build-time transformations may exist
- some internal-only or feature-gated behavior may be stubbed, absent, or partially represented in the public package
This repo is useful for:
- architecture study
- reverse engineering
- security review starting points
- product analysis
- implementation pattern comparison
This repo is not:
- an official source release
- guaranteed complete
- guaranteed identical to Anthropic internal builds
- a replacement for runtime testing
Completed module reports:
- Authentication & Login
- Permissions & Risk Control
- Multi-Agent
- MCP
- Remote / Bridge
- Telemetry
- Update / Install
- Package:
@anthropic-ai/claude-code - Version analyzed:
2.1.88 - Reconstruction basis:
cli.js.mapwith embeddedsources+sourcesContent
Possible future additions to this repo:
- hidden commands / feature flags report ✅ (English / 中文)
- a dedicated permissions-bypass deep dive
- a remote session protocol note
- a telemetry privacy-boundary note
- an MCP auth deep dive
This repository is for research, learning, and analysis of a publicly distributed npm package artifact. It is not affiliated with or endorsed by Anthropic.