{"id":47682233,"url":"https://github.com/yasasbanukaofficial/claude-code","last_synced_at":"2026-04-07T19:00:44.180Z","repository":{"id":348354413,"uuid":"1197656055","full_name":"yasasbanukaofficial/claude-code","owner":"yasasbanukaofficial","description":"🚀 Open source Claude Code CLI source code. Advanced AI Agent for developers. Includes TypeScript codebase for LLM tool-calling, agentic workflows, and terminal UI. Remember this is just the skeleton not the brain itself. Found by Chaofan Shou. ","archived":false,"fork":false,"pushed_at":"2026-04-04T21:25:14.000Z","size":9763,"stargazers_count":1731,"open_issues_count":4,"forks_count":2992,"subscribers_count":15,"default_branch":"main","last_synced_at":"2026-04-06T18:02:34.175Z","etag":null,"topics":["claude-ai","claude-code","leaked-claude-code","leaked-code"],"latest_commit_sha":null,"homepage":"https://github.com/yasasbanukaofficial/claude-code","language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yasasbanukaofficial.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-31T19:07:10.000Z","updated_at":"2026-04-06T17:58:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"4cd5e914-f314-4366-b645-81105593f665","html_url":"https://github.com/yasasbanukaofficial/claude-code","commit_stats":null,"previous_names":["yasasbanukaofficial/claude-code"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yasasbanukaofficial/claude-code","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasasbanukaofficial%2Fclaude-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasasbanukaofficial%2Fclaude-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasasbanukaofficial%2Fclaude-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasasbanukaofficial%2Fclaude-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yasasbanukaofficial","download_url":"https://codeload.github.com/yasasbanukaofficial/claude-code/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasasbanukaofficial%2Fclaude-code/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31524531,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["claude-ai","claude-code","leaked-claude-code","leaked-code"],"created_at":"2026-04-02T14:04:01.845Z","updated_at":"2026-04-07T19:00:44.138Z","avatar_url":"https://github.com/yasasbanukaofficial.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Claude Code's Entire Source Code Got Leaked via a Sourcemap in npm, Let's Talk About It\n\n\u003e **PS:** This breakdown is also available on [this blog](https://kuber.studio/blog/AI/Claude-Code's-Entire-Source-Code-Got-Leaked-via-a-Sourcemap-in-npm,-Let's-Talk-About-it) with a better reading experience and UX :)\n\n\u003e **Note:** There's a non-zero chance this repo might be taken down. If you want to play around with it later or archive it yourself, feel free to **fork it** and bookmark the external blog link!\n\n---\n\n## ⚠️ Important Disclaimer\n\n**I did not leak these files.** I have simply provided an easy, documented way to access and study this codebase for research purposes. All files and information originate from public findings shared on Twitter/X. All credit for the discovery goes to the original source.\n\n---\n\nEarlier today (March 31st, 2026) - **Chaofan Shou (@Fried_rice)** discovered something that Anthropic probably didn't want the world to see: the **entire source code** of Claude Code, Anthropic's official AI coding CLI, was sitting in plain sight on the npm registry via a sourcemap file bundled into the published package.\n\n[![The tweet announcing the leak](assets/x-post.png)](https://x.com/Fried_rice/status/2038894956459290963)\n\nThis repository is a backup of that leaked source, providing a full breakdown of what's in it, how the leak happened, and the internal systems that were never meant to be public.\n\n---\n\n## 🧐 How Did This Even Happen?\n\nWhen you publish a JavaScript/TypeScript package to npm, the build toolchain often generates **source map files** (`.map` files). These files bridge minified production code and the original source for debugging.\n\nThe catch? **Source maps contain the original source code** embedded as strings inside a JSON file under the `sourcesContent` key.\n\n```json\n{\n  \"version\": 3,\n  \"sources\": [\"../src/main.tsx\", \"../src/tools/BashTool.ts\", \"...\"],\n  \"sourcesContent\": [\"// The ENTIRE original source code of each file\", \"...\"],\n  \"mappings\": \"AAAA,SAAS,OAAO...\"\n}\n```\n\nBy forgetting to add `*.map` to `.npmignore` or failing to disable source maps in production builds (Bun's default behavior), the entire raw source was shipped to the npm registry.\n\n[![Claude Code source files exposed in npm package](assets/claude-npm-img.png)](assets/claude-npm-img.png)\n\n---\n\n## 🛠 What's Under the Hood?\n\nClaude Code is not just a simple CLI. It's a massive **785KB `main.tsx`** entry point featuring a custom React terminal renderer (Ink), 40+ tools, and complex multi-agent orchestration.\n\n### 🐣 BUDDY - The Terminal Tamagotchi\nInside [`src/buddy/`](./src/buddy/), there is a full **Tamagotchi-style companion system**.\n- **Deterministic Gacha:** Uses a Mulberry32 PRNG seeded from your `userId`.\n- **18 Species:** Ranging from Common (*Pebblecrab*) to Legendary (*Nebulynx*).\n- **Stats \u0026 Souls:** Every buddy has stats like `DEBUGGING`, `CHAOS`, and `SNARK`, with a \"soul\" description written by Claude.\n\n### 🕵️‍♂️ Undercover Mode - \"Do Not Blow Your Cover\"\nAnthropic employees use Claude Code to contribute to public repos. **Undercover Mode** ([`src/utils/undercover.ts`](./src/utils/undercover.ts)) prevents the AI from leaking internal info:\n- Blocks internal model codenames (e.g., *Capybara*, *Tengu*).\n- Hides the fact that the user is an AI.\n- Confirms that **\"Tengu\"** is likely the internal codename for Claude Code.\n\n### 🌙 The \"Dream\" System\nClaude Code \"dreams\" to consolidate memory. The **autoDream** service ([`src/services/autoDream/`](./src/services/autoDream/)) runs as a background subagent to:\n1. **Orient:** Read `MEMORY.md`.\n2. **Gather:** Find new signals from daily logs.\n3. **Consolidate:** Update durable memory files.\n4. **Prune:** Keep context efficient.\n\n### 🚀 KAIROS \u0026 ULTRAPLAN\n- **KAIROS:** An \"always-on\" proactive assistant that watches logs and acts without waiting for input.\n- **ULTRAPLAN:** Offloads complex tasks to a remote **Opus 4.6** session for up to 30 minutes of deep planning.\n\n---\n\n## 📂 Architecture \u0026 Directory Structure\n\n```text\nsrc/\n├── main.tsx                 # CLI Entrypoint (Commander.js + React/Ink)\n├── QueryEngine.ts           # Core LLM logic (~46K lines)\n├── Tool.ts                  # Base tool definitions\n├── tools/                   # 40+ Agent tools (Bash, Files, LSP, Web)\n├── services/                # Backend (MCP, OAuth, Analytics, Dreams)\n├── coordinator/             # Multi-agent orchestration (Swarm)\n├── bridge/                  # IDE Integration layer\n└── buddy/                   # The secret Tamagotchi system\n```\n\n---\n\n## ⚙️ How to Use \u0026 Explore\n\n### 📦 Prerequisites\n- **[Bun Runtime](https://bun.sh)** (Highly Recommended) or Node.js v18+\n- **TypeScript** installed globally\n\n### 🚀 Getting Started\n\n1.  **Clone the repository:**\n    ```bash\n    git clone https://github.com/your-username/claude-leaked.git\n    cd claude-leaked\n    ```\n\n2.  **Install Dependencies:**\n    ```bash\n    npm install\n    ```\n\n3.  **Build the Project:**\n    ```bash\n    npm run build\n    ```\n\n4.  **Run the CLI:**\n    ```bash\n    node dist/main.js\n    ```\n\n### 🔍 Explore with MCP\nThis repo includes an **MCP Server** to let you explore the source using Claude itself:\n```bash\nclaude mcp add code-explorer -- npx -y claude-code-explorer-mcp\n```\n\n---\n\n## 📈 SEO \u0026 Rankings\n**Keywords:** `Claude Code Leak`, `Anthropic Source Code`, `AI Agent Framework`, `Claude 3.5 Sonnet CLI`, `Tengu Anthropic`, `npm sourcemap leak`, `Open Source AI Agent`.\n\n---\n\n## 📜 Credits \u0026 Legal\n\n- **Discovery:** [Chaofan Shou (@Fried_rice)](https://x.com/Fried_rice)\n- **Source Post:** [Twitter/X Announcement](https://x.com/Fried_rice/status/2038894956459290963)\n- **Author of this Mirror:** [Yasas Banu](https://www.yasasbanuka.tech)\n\n**Disclaimer:** All original source code is the proprietary property of **Anthropic PBC**. This repository is for educational and archival purposes only. **This is not an official Anthropic product.**\n\n---\n\n### 📩 Contact\nFor spamming reasons the email has been removed. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasasbanukaofficial%2Fclaude-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyasasbanukaofficial%2Fclaude-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasasbanukaofficial%2Fclaude-code/lists"}