Remote OpenClaw Blog
Claude Code Source Code Leaked: What We Found Inside
6 min read ·
Remote OpenClaw Blog
6 min read ·
On March 31, 2026, Anthropic published a routine update of Claude Code to the npm registry. The published package included something it should not have: the source map file (.map), which contains the complete original TypeScript source code before it was compiled and minified for distribution.
Source maps are standard development files that map minified production code back to the original source. They are essential for debugging but are never supposed to ship in production packages. A missing .npmignore entry or a misconfigured build pipeline is the most likely cause, according to analysis by CyberNews, which first reported the leak.
Anyone who downloaded the Claude Code npm package during the window between publication and removal had access to the full source. The leak was also covered by AI Coding Daily on Substack, which provided detailed analysis of the codebase structure.
The source map decoded to approximately 512,000 lines of TypeScript, representing the entirety of Claude Code's codebase. This includes the CLI interface, the agent runtime, tool implementations, prompt engineering, model routing logic, and internal utilities.
Key structural findings from the leaked source:
The codebase quality is notably high. Clean TypeScript with comprehensive type definitions, consistent error handling patterns, and extensive internal documentation via code comments.
The most unexpected discovery was a fully implemented Tamagotchi-style virtual pet system hidden behind the /buddy command. The feature is not documented in any official Claude Code documentation and appears to be an internal Easter egg built by the engineering team.
The source code reveals 18 pet species:
Each species has its own ASCII art representation, personality traits, and evolution stages. The pet gains experience points when you complete coding tasks, write tests, fix bugs, and make commits. At certain XP thresholds, the pet evolves into new forms with different ASCII art and personality changes.
The pet has a health system based on coding habits. It gets "hungry" when you have not committed in a while, "sleepy" during off-hours, and "happy" after successful test runs. There is even a "mood" system that affects the pet's dialogue when you interact with it between tasks.
Whether the /buddy feature was intended for eventual public release or was purely an internal team morale project is unclear. The implementation is polished enough to suggest it was more than a quick hack.
The leaked source reveals how Anthropic implements rate limiting in Claude Code, which is directly relevant to anyone using the Claude API — including OpenClaw operators.
Key findings about rate limiting:
Marketplace
Free skills and AI personas for OpenClaw — browse the marketplace.
Browse the Marketplace →This information is valuable for OpenClaw operators tuning their API rate limit settings. The api.rateLimitBackoff exponential setting in OpenClaw mirrors what Claude Code does internally.
Beyond the headline features, the leak provided insight into several architectural decisions:
Claude Code uses a sliding window approach for context, similar to OpenClaw's compaction system. When the context window fills up, Claude Code summarizes older conversation turns and replaces them with compressed versions. The summarization prompt is explicit about preserving file paths, function names, and error messages while discarding conversational filler.
Every tool execution goes through a sandbox layer that restricts filesystem access to the current project directory and its subdirectories. The sandbox implementation uses a combination of path validation and process-level restrictions. Attempts to access files outside the project root are blocked before execution.
The source includes a telemetry module that tracks usage patterns, error rates, and performance metrics. The telemetry is opt-out and the source code confirms that no user code, file contents, or conversation content is included in telemetry data — only aggregate usage statistics and error types.
Anthropic acknowledged the leak within hours of CyberNews publishing their report. The source map was removed from the npm registry and subsequent package versions were published without it.
In a statement, Anthropic confirmed:
Anthropic did not comment on the /buddy Tamagotchi feature specifically.
For Claude Code users, the practical implications are minimal. The leaked code is the client-side CLI — it does not reveal anything about Anthropic's model training, inference infrastructure, or safety systems. Your conversations and data were not affected.
For OpenClaw operators, the leak is informative rather than actionable. The rate limiting internals help explain behavior patterns that OpenClaw operators have observed when hitting Claude API limits. The context management approach validates the compaction strategies that the OpenClaw community has independently developed.
The broader takeaway is about supply-chain security. If Anthropic — a company valued at billions with a dedicated security team — can accidentally ship source maps in an npm package, smaller projects are even more vulnerable. This is the same category of risk that affects ClawHub skills and any npm dependency in the OpenClaw ecosystem.
For a detailed comparison of Claude Code and OpenClaw as tools, see OpenClaw vs Claude Code.
On March 31, 2026, Anthropic published a new version of Claude Code to the npm registry. The published package accidentally included the source map file, which contains the complete original TypeScript source before compilation. The leak was first reported by CyberNews. Anthropic removed the file within hours.
The /buddy command activates a hidden Tamagotchi-style virtual pet inside Claude Code. The source code reveals 18 pet species including dragon, duck, capybara, fox, and penguin. Each species has ASCII art, personality traits, and evolution stages tied to your coding activity. The feature appears to be an internal Easter egg built by the Claude Code team.
Not directly. Claude Code and OpenClaw are separate products. However, the leak revealed details about how Anthropic implements rate limiting, token counting, and API request handling that are relevant to anyone using Claude's API, including OpenClaw operators. The rate limiting internals show that Anthropic tracks usage per-organization and per-user with separate quotas.