|
Claude Code's Source Code Leaks Via npm Source MapsGrady Martin writes: A security researcher has leaked a complete repository of source code for Anthropic's flagship command-line tool. The file listing was exposed via a Node Package Manager (npm) mapping, with every target publicly accessible on a Cloudflare R2 storage bucket. There's been a number of notable discoveries as people continue examining the code. The DEV Community has outlined some of the leak's most notable architectural elements and the key technical choices behind them.
Architecture Highlights The Tool System (~40 tools): Claude Code uses a plugin-like tool architecture. Each capability (file read, bash execution, web fetch, LSP integration) is a discrete, permission-gated tool. The base tool definition alone is 29,000 lines of TypeScript. The Query Engine (46K lines): This is the brain of the operation. It handles all LLM API calls, streaming, caching, and orchestration. It's by far the largest single module in the codebase. Multi-Agent Orchestration: Claude Code can spawn sub-agents (they call them "swarms") to handle complex, parallelizable tasks. Each agent runs in its own context with specific tool permissions. IDE Bridge System: A bidirectional communication layer connects IDE extensions (VS Code, JetBrains) to the CLI via JWT-authenticated channels. This is how the "Claude in your editor" experience works. Persistent Memory System: A file-based memory directory where Claude stores context about you, your project, and your preferences across sessions. Key Technical Decisions Worth Noting Bun over Node: They chose Bun as the JavaScript runtime, leveraging its dead code elimination for feature flags and its faster startup times. React for CLI: Using Ink (React for terminals) is bold. It means their terminal UI is component-based with state management, just like a web app. Zod v4 for validation: Schema validation is everywhere. Every tool input, every API response, every config file. ~50 slash commands: From /commit to /review-pr to memory management -- there's a command system as rich as any IDE. Lazy-loaded modules: Heavy dependencies like OpenTelemetry and gRPC are lazy-loaded to keep startup fast. Read more of this story at Slashdot. |
|
Our Privacy Policy can be viewed at https://freeinternetpress.com/privacy_policy.php FIP XML/RSS/RDF Newsfeed Syndication https://freeinternetpress.com/rss.php © 2026 FreeInternetPress.com Free Internet Press is licensed under a Creative Commons Attribution 3.0 United States License. You may reuse or distribute original works on this site, with attribution per the above license. Any mirrored or quoted materials may be copyright their respective authors, publications, or outlets, as shown on their publication, indicated by the link in the news story. Such works are used under the fair use doctrine of United States copyright law. Should any materials be found overused or objectionable to the copyright holder, notification should be sent to [email protected], and the work will be removed and replaced with such notification. Please email [email protected] with any questions. |
|