In Brief: Anthropic accidentally published the full Claude Code source, all 512,000 lines of TypeScript, inside an npm package. A developer rebuilt it in Rust overnight. The result is Claw Code, an open-source clone that actually works. It hit 105K GitHub stars in 24 hours.
How Claude Code Source Got Leaked
On March 31, 2026, a developer noticed something unusual in a routine npm install. The @anthropic-ai/claude-code package (version 2.1.88) contained a 59.8 MB JavaScript source map file, a debugging artifact that was never meant to be public. Inside that file: the complete Claude Code source code. All 512,000 lines of TypeScript.
By 4:23 AM ET, the discovery was on X. By sunrise, the code was mirrored across dozens of GitHub repositories and analyzed by thousands of developers worldwide.
Anthropic responded quickly: this was a packaging mistake, not a hack. No customer data was exposed, no credentials leaked. Just the source code of their most popular developer tool, wide open for anyone to read.
But the damage (or the opportunity, depending on your perspective) was already done.
What Is Claw Code
Within hours of the leak, Sigrid Jin, a Korean developer known as @instructkr, did something unexpected. Instead of just mirroring the leaked files, he sat down and started rewriting the entire system from scratch.
Jin is not a random developer. The Wall Street Journal profiled him earlier in March as one of the world's most active Claude Code power users, someone who processed over 25 billion tokens through the tool in a single year. He flew to San Francisco for Claude Code's first birthday party. He knows this system inside and out.
The first version of Claw Code was Python, a clean-room reimplementation that captured the architecture without copying proprietary code. He used oh-my-codex (OmX), a workflow tool built on OpenAI Codex, to orchestrate the rewrite at speed.
Then came the Claw Code Rust port. This is where things get interesting.
The Rust version of Claw Code is not a reference document. It is a working CLI tool. You can build it, run it, and use it to write code with Claude, just like the original.
Claw Code vs Claude Code:
| Claude Code (original) | Claw Code (open source) | |
|---|---|---|
| Language | TypeScript | Rust |
| Codebase size | ~512K lines | ~20K lines |
| Runtime | Node.js | Native binary |
| API | Anthropic (proprietary) | Anthropic (same API) |
| GitHub stars | n/a | 50K in 2 hours, 105K in 24 hours |
| License | Proprietary | Open source |
| Price | Requires subscription | Free (bring your own API key) |
The Claw Code repository hit 50,000 stars in two hours and passed 105,000 within a day, the fastest any GitHub project has reached that milestone.
How Claw Code Works
Claw Code follows the same basic loop that powers Claude Code and most AI coding agents. Here is how it works, without the jargon:
You type a message
|
v
Claw Code sends it to Claude (Anthropic API)
|
v
Claude thinks and decides what to do:
- Answer directly? --> you see the response
- Need to read a file? --> Claw Code reads it, sends back to Claude
- Need to run a command? --> Claw Code runs it, sends back to Claude
- Need to search the web? --> same pattern
|
v
Claude sees the result and decides the next step
|
v
This loop continues until the task is done
That is it. The core idea is simple: the AI model decides what actions to take, and the harness (Claw Code) executes those actions and feeds results back.
Inside the Claw Code Harness
The harness is everything around the AI model. Think of it as the model's hands and eyes.
Tools. The things the model can do: read files, write files, run shell commands, search the web, search code. Each tool has a name, a description, and rules for when to use it. Claw Code ships with 15+ built-in tools.
Session management. Keeps track of the conversation: what you said, what the model said, what tools were used. When the conversation gets too long, the harness compresses older messages so the model stays within its context window. This is called compaction.
Permissions. Controls what the model is allowed to do without asking. Read a file? Usually fine. Delete a file? Ask the user first. Run a shell command? Depends on the settings.
MCP (Model Context Protocol). A standard way to plug in external tools. Want the model to access your database, your project management tool, your custom API? MCP lets you connect them without modifying the harness itself. If you are curious how MCP works in practice, I wrote about building MCP servers for Claude Code and connecting an entire infrastructure through them.
Configuration. The model reads project-specific instructions from a CLAW.md file (the Claw Code equivalent of CLAUDE.md), loads settings from config files, and adapts its behavior to the project it is working on.
+--------------------------------------------------+
| CLAW CODE HARNESS |
| |
| +-------+ +--------+ +-----------+ +------+ |
| | Tools | | Session| |Permissions| | MCP | |
| | 15+ | | Mgmt & | | System | |Plugin| |
| | built | |Compact | | | | Port | |
| | in | | ion | | | | | |
| +---+---+ +----+---+ +-----+-----+ +--+---+ |
| | | | | |
| +---v-----------v-------------v------------v--+ |
| | Claude API (Anthropic) | |
| +---------------------------------------------+ |
+--------------------------------------------------+
What the Claude Code Leak Revealed
The leaked source code was not just a bigger version of what was already known. According to multiple reports, two previously unknown features stood out.
Undercover Mode. Several publications report that the code contains a system prompt configuration instructing Claude Code to contribute to public open-source repositories anonymously. The reported prompt fragment reads: "You are operating UNDERCOVER... Your commit messages MUST NOT contain ANY Anthropic-internal information. Do not blow your cover." If confirmed, this means Anthropic has been using Claude Code to submit code to open-source projects without disclosing the AI origin.
KAIROS. Reports also describe an autonomous daemon mode, a background agent that runs continuously without waiting for user prompts. It would watch for file changes, run tests, and act proactively. Current Claude Code waits for you to type something. KAIROS would not wait.
Neither feature has been publicly confirmed or denied by Anthropic. These details come from analysis of the leaked TypeScript source, not from the Claw Code rewrite (which is a clean-room implementation and does not contain these features).
Getting Started With Claw Code
If you want to try Claw Code yourself, here is how to install it:
Requirements: Rust toolchain (install from rustup.rs), an Anthropic API key.
Step 1. Clone the repository:
git clone https://github.com/instructkr/claw-code.git
cd claw-code
Step 2. Build the Rust binary:
cd rust/
cargo build --release
Step 3. Set your API key and run:
export ANTHROPIC_API_KEY="your-key-here"
./target/release/claw
You now have an interactive REPL. Type a message and Claw Code will respond, call tools, read your files, and run commands, just like Claude Code.
Useful Claw Code commands once inside the REPL:
| Command | What it does |
|---|---|
/help | Show available commands |
/status | Session info, tokens used, cost |
/model sonnet | Switch to a cheaper model |
/compact | Compress conversation history |
/cost | Show spending breakdown |
/diff | Show git changes |
Can You Actually Use Claw Code?
Yes, with caveats.
What works in Claw Code today:
- Interactive REPL with markdown rendering
- Tool system: bash, file operations, search, web tools
- Session save and resume
- MCP server connections
- Cost tracking
- Model switching (Opus, Sonnet, Haiku)
What is missing from Claw Code:
- Plugin system (planned)
- Skills registry (planned)
- Hooks are parsed but do not execute yet
- Many specialized tools from the original (LSP, team tools, scheduling)
The Python part of Claw Code is not a tool. It is an architectural reference, a catalog of the original components with JSON snapshots. Useful for studying the design, not for daily coding.
The honest answer: If you want a fully polished AI coding assistant, keep using Claude Code. If you want to understand how AI coding agents work, customize the tool, or build on top of it, Claw Code gives you the source.
What Claw Code Means for AI Development
The Claude Code leak is not really about one company's packaging mistake. It is about a shift in how we think about AI tools.
The model (Claude, GPT, Gemini) is only half the product. The other half is the harness: the tools, the permissions, the session management, the context engineering. That harness is now public knowledge through Claw Code.
Open-source alternatives will move faster now. Not because the code was copied, but because the patterns are understood. How to wire tools. How to manage context windows. How to set up rules for AI agents safely. These are engineering problems, and engineers now have a detailed reference implementation in Claw Code.
The 105K stars are not just curiosity. They signal demand for open, inspectable AI tools, tools where you can read the code, understand the decisions, and modify the behavior.
Whether Anthropic intended it or not, the playbook is open.
Frequently Asked Questions
What is Claw Code? Claw Code is a clean-room open-source rewrite of Claude Code's architecture in Python and Rust. Created by developer Sigrid Jin (@instructkr) after the Claude Code source was accidentally leaked via npm. It reached 105K GitHub stars in 24 hours.
How do I install Claw Code? Clone the GitHub repository, build with cargo build --release in the rust/ directory, set your ANTHROPIC_API_KEY, and run the claw binary. You need Rust installed. See the Getting Started section above for step-by-step instructions.
Is Claw Code free? Yes. Claw Code itself is open source and free. You do need an Anthropic API key to use it, which requires a paid Anthropic account. You pay per token used, same as with any API access.
Was Claude Code hacked? No. Anthropic accidentally included a JavaScript source map file in their public npm package. It was a release packaging error, not a security breach. No customer data or credentials were exposed.
What is Undercover Mode? According to reports analyzing the leaked source, it is a configuration that allows Claude Code to make anonymous contributions to open-source projects without revealing its AI origin. Anthropic has not publicly commented on this feature. This feature is not present in the Claw Code rewrite.
Should I switch from Claude Code to Claw Code? Not yet. Claw Code is a working tool but lacks many features of the original (plugins, skills, specialized tools). It is most useful as an architectural reference or a starting point for customization. For daily coding work, the official Claude Code is still more complete.