PS: I will publish deeper analysis and follow-up notes on my blog: shengfu-zhang.github.io. If this GitHub repo changes later, that site is where I plan to keep the long-form writeups indexed.
Attribution: Public rediscovery credit goes to Chaofan Shou (@Fried_rice) on X on March 31, 2026. This README also keeps visible credit to the broader public writeups that documented the package contents.
Important
This repository is unofficial and is not affiliated with Anthropic.
The underlying Claude Code source remains Anthropic's proprietary work.
This repo only preserves files extracted from the public npm package @anthropic-ai/claude-code version 2.1.88, plus light organization, path cleanup, and documentation.
It is shared for research, reference, interoperability discussion, and education only.
No ownership is claimed over Anthropic's code. If you are a rights holder and want any material removed, please contact the repository owner and it will be taken down promptly.
Language: English | 中文
This repository keeps together four things that are useful for studying the public Claude Code package:
- the original npm tarball
- a locally extracted source archive
- a browsable
src/tree reconstructed from the distributed package artifacts - a generated documentation set for faster navigation and analysis
The goal is simple: make the public package easier to inspect without pretending this is an official upstream repository.
| Path | Description | Use it when |
|---|---|---|
src/ |
Browsable extracted TypeScript source tree | You want to read code directly on GitHub |
artifacts/extracted/claude-code-2.1.88-src.zip |
Downloadable zip of the extracted source tree | You want the extracted tree locally without rebuilding it |
artifacts/original/claude-code-2.1.88.tgz |
Original npm package archive | You want provenance, the published bundle, or to reproduce extraction |
scripts/extract-sources.js |
Local helper script used during extraction work | You want to rerun extraction from a local cli.js.map |
.agents/summary/ |
Generated architecture and navigation docs | You want a structured overview before digging into code |
AGENTS.md |
Concise repo guide for coding agents | You want the shortest useful entry point for repo-specific navigation |
Current local extract:
src/contains1,902files1,884files are.ts/.tsx- the extracted JS/TS tree is about
514,587lines - the local
src/directory is about33 MB
Notes:
artifacts/extracted/claude-code-2.1.88-src.zipcontains only the extracted source tree.artifacts/original/claude-code-2.1.88.tgzcontains the original bundled package, includingcli.js,cli.js.map, and vendor/native binaries, so it is much larger.- Most people only need
src/or the extracted zip; the original.tgzis mainly for provenance and reproducibility.
This repo now includes a generated documentation set aimed at both humans and AI coding assistants:
.agents/summary/index.mdis the primary knowledge-base index.agents/summary/architecture.md,components.md,interfaces.md,data_models.md,workflows.md, anddependencies.mdprovide deeper breakdowns.agents/summary/review_notes.mdrecords extraction caveats and documentation gapsAGENTS.mdis the concise root-level navigation guide
If you want the fastest orientation path, start with AGENTS.md or .agents/summary/index.md, then jump into src/.
This repo also includes a browser-based teaching artifact for understanding the runtime shape without reading the whole tree first:
index.html— GitHub Pages landing page for the demoartifacts/demo/index.html— shorter demo entrypoint inside the demo directoryartifacts/demo/claude-code-loop-simulator.html— English teaching consoleartifacts/demo/claude-code-loop-simulator.zh.html— Chinese entry point
What it now shows:
- 10 guided replays covering direct answers, recursive tool use, skills/plugins, agent teams, permission denials, canceled tasks, intercepted slash-command input, compaction/continuation, tool-error recovery, and one final session that combines every branch in a sensible order
- a guided workspace where
Transcriptis the first reading surface,Inspectoris the second, and deeper debugger detail stays collapsed until you ask for it - a live
Source Lensthat fetches the real repo file around the active line and highlights the current seam - a scenario-specific
File Guidethat tells you what to open first, what can wait, and what is missing from the recovered extract - labeled reply payloads that explicitly show what the runtime is trying to emit at each beat
Suggested usage:
- If GitHub Pages is enabled for this repo, open the repo root URL for the landing page or
/artifacts/demo/for the demo shortcut. Both now resolve throughindex.html. - For local use, serve the repo over a simple HTTP server, then open the teaching console in a browser.
python3 -m http.server 8123from the repo root is enough. If you double-click the HTML file or open it through a file browser withfile://,Source Lensmay fail because the browser blocks the live file fetch. - Start with
Plain Assistant Answerto learn the shortest path. - Use
Intercepted Input / Slash Command,Tool Loop And Recursion,Compaction And Continuation, andTool Error And Recoveryto learn the main runtime seams one by one. - Open
Everything Combinedonly after the smaller branches feel obvious. - Read left first, then right:
Transcriptshows visible output,Inspectorshows the owning seam, andSource Lensproves it in the actual file.
The console is a replay model, not live instrumentation. It is meant to teach shape and control flow, not to claim that every value shown came from a real captured session.
Why it is organized this way:
- the teaching order follows the architecture: visible output first, wrapper ownership second, exact source proof third
QueryEngineplusqueryLoop()are the durable center; the Ink/terminal shell is important, but replaceable- the demo intentionally treats the current REPL as one UX layer on top of a reusable conversation engine, because that is the most transferable mental model for building other surfaces
Source LensandFile Guideexist to tie each replay beat back to concrete files, including important extraction gaps such assrc/types/message.js
If your goal is architectural understanding, focus on the runtime center before spending much time on the terminal UX shell.
src/query.tsandsrc/QueryEngine.tsare the real center of gravity. That is where turns are wrapped, tool use is coordinated, and recursion happens.src/screens/REPL.tsxis important for interaction details, but it is a replaceable surface layer. A web debugger, IDE panel, headless SDK surface, or another frontend could reuse the same engine without reusing the Ink UI.- Skills, plugins, permissions, and agent teams are best understood as side-paths wrapped around the same conversation engine, not as separate products.
In other words: the current UX layer is useful, but not sacred. The most reusable mental model is QueryEngine around queryLoop(), then everything else layered around that.
The teaching console follows that same rule on purpose: it starts from the replayed output, then reveals wrapper ownership, then points directly at the source seam. The terminal UI is shown as one layer in that stack, not as the architectural center.
- The published package is much harder to inspect in bundled form.
- Keeping the tarball, extracted tree, and helper script together makes analysis more reproducible.
- The generated docs reduce the cold-start cost of navigating a large recovered source tree.
- Longer architecture notes and follow-up analysis will live on my blog instead of turning this front page into a giant dump.
# inspect the extracted source tree cd src # read the concise repo guide less ../AGENTS.md # read the generated knowledge-base index less ../.agents/summary/index.md # inspect the original published package tar -xzf artifacts/original/claude-code-2.1.88.tgz # inspect the zipped extract unzip -l artifacts/extracted/claude-code-2.1.88-src.zip | head # rerun extraction from an unpacked package/cli.js.map node scripts/extract-sources.js
The files here were reconstructed locally from publicly distributed package artifacts. In practice, that means:
- Start from the public npm package
@anthropic-ai/claude-code2.1.88. - Recover source paths and file contents from the shipped bundle and source map data.
- Normalize the extracted paths into a regular source tree for browsing.
This is a research archive, not an official development checkout. Some internal-only or feature-gated code may still be absent from public artifacts.
If you are using this repo for code reading or interoperability work, keep these constraints in mind:
- This is not a normal upstream checkout. Standard authoring metadata such as
package.json, lockfiles, and CI config is not present in the recovered tree. - Some recovered files look transformed rather than hand-authored, so they are reliable for behavior and dependencies but weaker as style precedent.
- A central message-type source,
src/types/message.js, is imported widely but missing from the extracted tree, so exact message-schema refactors should be treated cautiously. - Feature-gated, internal, native, or vendor-backed behavior may be only partially represented in
src/, even when surrounding TypeScript call sites are present.
- Do not treat this repository as open source.
- Do not reuse Anthropic's proprietary code in commercial products or closed redistributions.
- Do not represent this archive as an official Anthropic repository.
- The added README text, organization, and commentary are original editorial work; the product code itself is not.
- Rights-holder removal requests will be honored promptly.
- Anthropic for the original Claude Code product and publicly distributed npm package.
- Chaofan Shou (@Fried_rice) for the March 31, 2026 X posts that drew renewed attention to the package contents.
- Kuber Mehta for an early public repo writeup and blog post that helped document the issue and wider discussion: