A significant portion of the source code for Anthropic's Claude Code has been inadvertently exposed, following the discovery of a source map file within its npm registry. This leak, first reported by Twitter user @chaofan_shou (via @fried_rice), has provided unprecedented insight into the inner workings of the advanced AI coding assistant.
The leaked data, which includes a downloadable zip file containing the source code, has been widely shared and analyzed within the developer community. The implications of this exposure are far-reaching, offering valuable information for competitors looking to build similar tools or for developers seeking to understand and potentially enhance Claude Code's capabilities.
What Was Leaked?
The leak consists of over 2,300 original files from Claude Code's codebase. These files offer a detailed look at the tool's architecture, including:
- The exact prompts and agent setup used to build and guide Claude Code.
- How the AI handles permissions and orchestrates multiple "sub-agents."
- Specific safety features and checks implemented in the system.
- The methods used for managing context and long conversations.
- The underlying tool system and its extensibility through hooks.
Key Revelations from the Source Code
Analysis of the leaked code by figures like Twitter user @mal_shaik has highlighted several critical aspects of Claude Code's design:
1. CLAUDE.md is Loaded Every Turn
The source code reveals that the CLAUDE.md file, which likely contains core instructions, coding style preferences, and other global configurations, is loaded for every single query iteration. This means Claude Code re-reads and re-evaluates these instructions with each turn, allowing for highly dynamic and responsive behavior. This is described as a high-leverage feature that many users might not be fully utilizing.
