|
| 1 | +<h1 align="center">Open Claude Code</h1> |
| 2 | +<h3 align="center">Open Source Claude Code CLI — Reverse Engineered & Rebuilt</h3> |
| 3 | + |
| 4 | +<p align="center"> |
| 5 | + <em>The open source implementation of Anthropic's Claude Code CLI,<br/> |
| 6 | + built from decompiled source intelligence using <a href="https://github.com/ruvnet/rudevolution">ruDevolution</a>.</em> |
| 7 | +</p> |
| 8 | + |
| 9 | +<p align="center"> |
| 10 | + <img alt="Node.js" src="https://img.shields.io/badge/Node.js-18%2B-brightgreen?style=flat-square" /> |
| 11 | + <img alt="License" src="https://img.shields.io/badge/License-MIT-blue?style=flat-square" /> |
| 12 | + <img alt="Status" src="https://img.shields.io/badge/v2-coming_soon-purple?style=flat-square" /> |
| 13 | + <img alt="Based on" src="https://img.shields.io/badge/based_on-Claude_Code_v2.1.91-orange?style=flat-square" /> |
| 14 | +</p> |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## 🔥 Background: The Claude Code Source Leak |
| 19 | + |
| 20 | +On March 31, 2026, Anthropic accidentally shipped source maps in the Claude Code npm package, exposing the full TypeScript source. The leak revealed: |
| 21 | + |
| 22 | +- **KAIROS** — an autonomous agent system that works without user input |
| 23 | +- **Undercover Mode** — hides AI involvement in commits from Anthropic employees |
| 24 | +- **Internal tools** (TungstenTool, SendUserFileTool, PushNotificationTool) |
| 25 | +- **22 private repository names** |
| 26 | +- **Animal codenames** for unreleased models |
| 27 | + |
| 28 | +Anthropic patched it within hours, but the architecture was documented by [Sabrina Ramonov](https://www.sabrina.dev/p/claude-code-source-leak-analysis) and others. |
| 29 | + |
| 30 | +**This project takes a different approach.** Instead of relying on leaked source, we use [ruDevolution](https://github.com/ruvnet/rudevolution) — an AI-powered decompiler — to analyze the **published npm package** legally, and rebuild an open source version from that intelligence. |
| 31 | + |
| 32 | +## 📦 What Is This? |
| 33 | + |
| 34 | +**Open Claude Code** is a clean-room open source implementation of the Claude Code CLI architecture. It's not a copy of Anthropic's code — it's a ground-up rebuild informed by decompilation analysis of the published binary. |
| 35 | + |
| 36 | +### v1 (Current — 2025) |
| 37 | + |
| 38 | +The original implementation with basic WASM terminal UI, conversation management, and Claude API integration. Built before the decompilation intelligence was available. |
| 39 | + |
| 40 | +### v2 (Coming Soon — 2026) |
| 41 | + |
| 42 | +A complete rewrite based on [ruDevolution's decompilation](https://github.com/ruvnet/rudevolution/releases) of Claude Code v2.1.91 (34,759 declarations, 981 modules). The v2 architecture mirrors the actual Claude Code internals: |
| 43 | + |
| 44 | +- **Async generator agent loop** — 13 event types, recursive after tool execution |
| 45 | +- **25+ built-in tools** — Bash, Read, Edit, Write, Glob, Grep, Agent, WebFetch |
| 46 | +- **6 permission modes** — bypassPermissions, acceptEdits, auto, default, dontAsk, plan |
| 47 | +- **MCP client** — stdio, SSE, Streamable HTTP transports |
| 48 | +- **Hooks system** — PreToolUse, PostToolUse, Stop events |
| 49 | +- **Settings chain** — user/project/local/managed |
| 50 | +- **Context compaction** — automatic context window management |
| 51 | +- **Custom agents & skills** — extensible AI personas |
| 52 | + |
| 53 | +[Preview the v2 source →](./v2/) |
| 54 | + |
| 55 | +## 🔍 What ruDevolution Found in Claude Code |
| 56 | + |
| 57 | +Our decompiler discovered capabilities Anthropic hasn't publicly announced: |
| 58 | + |
| 59 | +| Discovery | Evidence | |
| 60 | +|-----------|---------| |
| 61 | +| 🤖 **Agent Teams** | `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`, `TEAMMATE_COMMAND` | |
| 62 | +| 🌙 **Auto Dream Mode** | `tengu_auto_dream_completed` — works while you sleep | |
| 63 | +| 🔮 **claude-opus-4-6** | Unreleased model ID (current public is 4.5) | |
| 64 | +| 🔮 **claude-sonnet-4-6** | Unreleased model ID | |
| 65 | +| 🔐 **6 "amber" codenames** | `amber_flint`, `amber_prism`, `amber_stoat`, `amber_wren` | |
| 66 | +| 🧰 **Advisor Tool** | `tengu_advisor_tool_call` — new tool type | |
| 67 | +| 🧰 **Agentic Search** | Search that spawns sub-agents | |
| 68 | +| ☁️ **CCR (Cloud Code Runner)** | Full cloud execution with BYOC | |
| 69 | +| 🎮 **Powerups** | Gamification with unlockable abilities | |
| 70 | +| 📡 **MCP Streamable HTTP** | New transport replacing SSE | |
| 71 | +| 📱 **Chrome Extension** | Extension ID: `fcoeoabgfenejglbffodgkkbkcdhcgfn` | |
| 72 | +| 🎙️ **Native Audio** | Voice input capability | |
| 73 | +| **117 new env vars** | Since v2.0 | |
| 74 | + |
| 75 | +[Download decompiled releases →](https://github.com/ruvnet/rudevolution/releases) |
| 76 | + |
| 77 | +## ⚡ Quick Start |
| 78 | + |
| 79 | +### v1 (Current) |
| 80 | + |
| 81 | +```bash |
| 82 | +git clone https://github.com/ruvnet/open-claude-code.git |
| 83 | +cd open-claude-code/open_claude_code/src |
| 84 | +npm install |
| 85 | +ANTHROPIC_API_KEY=your-key node index.mjs |
| 86 | +``` |
| 87 | + |
| 88 | +### v2 (Preview) |
| 89 | + |
| 90 | +```bash |
| 91 | +cd open-claude-code/v2 |
| 92 | +ANTHROPIC_API_KEY=your-key node src/index.mjs "explain this codebase" |
| 93 | +``` |
| 94 | + |
| 95 | +### Decompile Claude Code Yourself |
| 96 | + |
| 97 | +```bash |
| 98 | +npx ruvector decompile @anthropic-ai/claude-code |
| 99 | +``` |
| 100 | + |
| 101 | +## 🏗️ v2 Architecture |
| 102 | + |
| 103 | +``` |
| 104 | +v2/src/ |
| 105 | +├── core/ |
| 106 | +│ └── agent-loop.mjs # Async generator (13 event types) |
| 107 | +├── tools/ |
| 108 | +│ ├── registry.mjs # validateInput/call interface |
| 109 | +│ ├── bash.mjs, read.mjs # Built-in tools |
| 110 | +│ ├── edit.mjs, write.mjs |
| 111 | +│ └── glob.mjs, grep.mjs |
| 112 | +├── permissions/ |
| 113 | +│ └── checker.mjs # 6 permission modes |
| 114 | +├── config/ |
| 115 | +│ ├── settings.mjs # User/project/local chain |
| 116 | +│ └── cli-args.mjs |
| 117 | +└── index.mjs # Entry point |
| 118 | +``` |
| 119 | + |
| 120 | +## ⚖️ Legal |
| 121 | + |
| 122 | +This project is a **clean-room implementation** — not a copy of Anthropic's source code. The architecture is informed by analysis of the **published npm package** using [ruDevolution](https://github.com/ruvnet/rudevolution), which is legal under: |
| 123 | + |
| 124 | +- 🇺🇸 US DMCA §1201(f) — reverse engineering for interoperability |
| 125 | +- 🇪🇺 EU Software Directive Art. 6 — decompilation for interoperability |
| 126 | +- 🇬🇧 UK CDPA §50B — decompilation for interoperability |
| 127 | + |
| 128 | +No leaked source code was used. No DRM was bypassed. No proprietary code was copied. |
| 129 | + |
| 130 | +## 🔗 Related |
| 131 | + |
| 132 | +- [ruDevolution](https://github.com/ruvnet/rudevolution) — The AI-powered decompiler used to analyze Claude Code |
| 133 | +- [Decompiled Claude Code Releases](https://github.com/ruvnet/rudevolution/releases) — Every major version decompiled |
| 134 | +- [Sabrina Ramonov's Leak Analysis](https://www.sabrina.dev/p/claude-code-source-leak-analysis) — Coverage of the March 2026 source leak |
| 135 | + |
| 136 | +## 📄 License |
| 137 | + |
| 138 | +MIT |
0 commit comments