What is Claude Code?
Claude Code is Anthropic’s official command-line interface (CLI) tool that brings Claude’s capabilities directly into your terminal. Unlike chat-based interfaces, Claude Code is purpose-built for software engineering workflows — it can read and edit files, execute shell commands, search codebases, manage git operations, and orchestrate complex multi-step tasks. Think of it as an agentic coding assistant that lives in your terminal, with direct access to your filesystem, shell, and development tools.Key Characteristics
- Terminal-native: Built with React + Ink for rich CLI UIs
- Agentic: Autonomous tool execution with permission controls
- Extensible: Plugin system, MCP integration, custom skills
- Multi-model: Supports Claude Opus, Sonnet, and Haiku variants
- IDE-integrated: Bridge system connects VS Code and JetBrains IDEs
How the Source Became Available
On March 31, 2026, security researcher Chaofan Shou (@Fried_rice) discovered that Anthropic had accidentally shipped source maps alongside the minified bundle in their public npm package@anthropic-ai/claude-code.
The Discovery
The npm package contained a.map file that referenced the full, unobfuscated TypeScript source code. This source was hosted in a publicly accessible R2 storage bucket and could be downloaded by anyone who ran:
What Was Exposed
The leak revealed:- Complete TypeScript source code (~1,900 files, 512,000+ lines)
- System prompts and agent instructions
- Tool implementations and schemas
- Internal architecture and design patterns
- Feature flags and experimental features
- Configuration schemas and validation logic
Community Response
The security community and developers began analyzing the source to understand:- How Claude Code actually works under the hood
- What tools and capabilities are available
- How the agentic loop operates
- Security implications and permission models
- Integration points for extensions
Tech Stack
Based on the source code analysis:| Component | Technology |
|---|---|
| Language | TypeScript |
| Runtime | Bun (JavaScript runtime) |
| CLI Framework | Commander.js |
| Terminal UI | React + Ink |
| API Client | Anthropic SDK (@anthropic-ai/sdk) |
| Schema Validation | Zod |
| State Management | React-based AppState store |
| Persistence | JSONL (JSON Lines) format |
| Protocol | Model Context Protocol (MCP) |
Models Used
Claude Code uses different Claude models for different purposes:Main Loop Models
- Claude Opus 4.6 - Most capable, used for complex reasoning
- Claude Sonnet 4.6 - Balanced performance and cost
- Claude Haiku 4.5 - Fast, lightweight tasks
Specialized Models
- Extended Thinking - Activated for complex problems requiring deep reasoning
- Bedrock/Vertex AI - Enterprise deployments with custom routing
How to Read These Docs
This documentation is organized into phases:- Getting Started - High-level overview and architecture
- Core Concepts - Control flow, project structure, agent loop
- Tools & Commands - What Claude Code can do
- Models & State - How inference and memory work
- Configuration - Settings, permissions, environment variables
- Advanced Features - REPL mode, coordinator mode, plugins, skills
- Security - Permission system, vulnerabilities, safe usage
- Technical explanations based on source code
- Code snippets illustrating patterns (max 15 lines)
- Mermaid diagrams for complex flows
- Related links to other relevant pages
When we say “implementation details unclear,” it means the source code didn’t provide enough context to make a definitive claim. We prioritize accuracy over completeness.
Disclaimer & Legal
Copyright
All source code, system prompts, and intellectual property belong to Anthropic PBC. This documentation:- Explains what the code does and how it works
- Does not reproduce large verbatim code blocks
- Uses short snippets (under 15 lines) to illustrate patterns
- Paraphrases and explains rather than transcribes
Fair Use
This documentation is created under fair use principles for:- Educational purposes
- Research and analysis
- Commentary and criticism
- Transformative use (explanation, not reproduction)
No Warranty
This documentation is provided “as is” without warranty of any kind. The authors make no guarantees about:- Accuracy of technical details
- Completeness of coverage
- Applicability to current versions
- Security implications
Not Affiliated
This is an independent community project. It is not:- Created by Anthropic
- Endorsed by Anthropic
- Approved by Anthropic
- Supported by Anthropic
Related Links
Architecture Overview
High-level system architecture and component relationships
Control Flow
Complete flow from user input to agent output
Project Structure
Directory structure and file organization
Official Docs
Anthropic’s official Claude documentation