Is Claude Code Open Source? Source Code, Licensing, and Alternatives
Claude Code is proprietary software governed by Anthropic's Commercial Terms of Service, not an open source project. A March 2026 packaging error exposed its full 512,000-line TypeScript codebase through npm source maps, spawning community forks and clean-room rewrites. This guide covers the actual license, what the leak revealed, and five open source coding agents that offer similar capabilities without proprietary restrictions.
Claude Code Is Not Open Source
A 59.8 MB source map file accidentally shipped inside @anthropic-ai/claude-code version 2.1.88 on March 31, 2026, exposing 512,000 lines of unobfuscated TypeScript across roughly 1,900 files. The leak answered a question thousands of developers had been asking: what is actually inside Claude Code? The more fundamental question, whether you can legally use that code, has a simpler answer. You cannot.
Claude Code's LICENSE.md on GitHub contains one sentence: "© Anthropic PBC. All rights reserved. Use is subject to Anthropic's Commercial Terms of Service." There is no MIT license, no Apache 2.0, no GPL. The repository at github.com/anthropics/claude-code exists publicly, but public visibility is not the same as open source. You can read the README and file issues. You cannot fork the code, modify it, or redistribute it under any permissive or copyleft license.
This distinction matters because Anthropic does publish genuine open source software elsewhere. The anthropic-sdk-python and anthropic-sdk-typescript packages both carry MIT licenses. The Claude Agent SDK, however, follows the same proprietary model as Claude Code itself, governed by Commercial Terms of Service rather than an open source license. When someone says "Anthropic is open source," they usually mean the language model SDKs, not the agentic coding tool.
Anthropic also runs a Claude for Open Source program that provides six months of free Claude Max 20x access to maintainers of projects with 5,000+ GitHub stars or 1M+ monthly npm downloads. The program supports the open source ecosystem with free tooling, but it does not make Claude Code itself open source. A GitHub issue (#8517) requesting open source licensing documentation was closed by Anthropic as "not planned."
How 512,000 Lines of Source Code Got Exposed
Security researcher Chaofan Shou discovered the exposure on March 31, 2026, and posted about it on X, where the disclosure quickly went viral with millions of views. The technical cause was straightforward: Claude Code is built with the Bun runtime, which generates source maps by default during compilation. The source map file, cli.js.map, referenced the complete unobfuscated TypeScript source hosted on Anthropic's R2 cloud storage bucket. Anyone who downloaded the npm package could follow those references to a ZIP archive containing the full codebase.
Preventing this required a single configuration change to exclude map files from the published package. Standard npm release workflows include safeguards like file whitelists and dry-run audits that would have caught the inclusion, but none were in place for the 2.1.88 release.
Anthropic called it "a release packaging issue caused by human error, not a security breach" and stated that no customer data or credentials were compromised. The company announced measures to prevent recurrence. This was not the first time it happened. Earlier versions shipped with source maps in February 2025 before Anthropic removed them, making the March 2026 incident at minimum the second such exposure in 13 months.
The repeated nature of the leak raised questions about Anthropic's release pipeline. A source map exclusion is a one-time configuration change. The fact that it regressed suggested either the build system was rebuilt between incidents or the original fix was applied at the wrong layer, fixing the symptom without hardening the process.
Give Your Coding Agents a Shared Workspace
Fast.io workspaces connect to any open source coding agent through MCP. Files are indexed for search, versioned automatically, and shareable with one link. Start with a 14-day free trial.
What the Leaked Code Revealed
Within hours of Shou's disclosure, the codebase was archived to multiple GitHub repositories. Analysis by independent developers and security researchers revealed 44 feature flags gating over 20 unshipped capabilities. The most discussed findings included internal model codenames (Capybara, Fennec, Numbat), references to an autonomous background agent called KAIROS described as a "persistent, always-on" daemon mode, and a terminal companion system codenamed BUDDY with Tamagotchi-like mechanics.
The most controversial discovery was a feature labeled "Undercover Mode," which appeared designed to strip AI attribution markers from code contributed to external repositories. Another flag, ANTI_DISTILLATION_CC, suggested mechanisms intended to prevent competitor model training on Claude Code outputs. Internal benchmarks also surfaced, including a reported 29-30% false claims rate metric, though the context around that number was unclear from the source code alone.
Anthropic responded to the unauthorized distribution with DMCA copyright notices targeting 8,100 GitHub repositories that contained direct mirrors of the leaked TypeScript source. Clean-room reimplementations, projects that studied Claude Code's behavior and architecture without copying proprietary code, were not targeted by these takedowns.
The most notable clean-room project was Claw-code, created by developer Sigrid Jin. Written in Python from scratch based on Claude Code's observed behavior rather than its source, Claw-code reached 100,000 GitHub stars in approximately 24 hours, making it the fastest-growing repository in GitHub's history. It surpassed the previous record holder, OpenClaw, which took weeks to reach the same milestone. Claw-code is model-agnostic, working with OpenAI, Gemini, DeepSeek, and local models through Ollama. Because it contains no lines from the original TypeScript codebase, it survived the DMCA campaign that took down thousands of direct mirrors.
Five Open Source Alternatives to Claude Code
If you want Claude Code's terminal-native, agentic coding capabilities without proprietary restrictions, several open source projects now offer comparable functionality. Each takes a different approach to the same core problem: giving an AI agent the ability to read, edit, and manage code across a project. All five are model-agnostic, meaning you can use Claude, GPT-4, Gemini, or local models through Ollama.
OpenCode
The most-starred open source coding agent at 161,000+ GitHub stars, OpenCode is MIT-licensed and runs in the terminal. It connects to over 75 LLM providers through Models.dev and supports mid-session model switching. Its dual-agent architecture separates planning from implementation, with a Plan agent that reasons about changes before a Build agent executes them. If you are looking for the closest direct replacement for Claude Code's terminal workflow, OpenCode is the default starting point.
OpenHands
Formerly known as OpenDevin, OpenHands takes the most autonomous approach at 74,400+ GitHub stars. It operates inside a sandboxed Docker environment with access to a full development setup, handling complete task sequences from planning through execution without step-by-step guidance. Where Claude Code requires ongoing human interaction in the terminal, OpenHands can run end-to-end on larger tasks with minimal supervision.
Cline
With 61,000+ GitHub stars and 5M+ installs across VS Code, JetBrains, Cursor, Zed, and Neovim, Cline is the most widely installed open source AI coding extension. Licensed under Apache 2.0, it runs as an IDE sidebar rather than a standalone terminal tool. Its Plan/Act mode separation provides human approval at every step, and automatic model routing picks the cheapest capable model per task, bringing typical monthly API costs to $8-12 for most developers.
Aider
The pioneer of git-native AI pair programming, Aider has 42,000+ GitHub stars and automatically commits every change with a descriptive message. This means you can revert any AI edit instantly with git revert. Aider supports Claude, GPT-4, Gemini, and local models, and its repository map feature builds a structural understanding of your codebase architecture that persists across editing sessions.
Goose
Built by Block (Jack Dorsey's company) and now under Linux Foundation governance, Goose connects to 70+ MCP extensions spanning databases, GitHub, Slack, APIs, and browser automation. Its MCP-first architecture makes it the strongest option for developers who already use the Model Context Protocol for tool integration and want their coding agent to plug into the same ecosystem.
Giving Open Source Coding Agents a Persistent Workspace
Open source coding agents solve the model lock-in problem, but they introduce a practical one: where do agents store their work between sessions? A terminal agent that runs locally keeps files on your machine. That works for solo development. It breaks down when multiple agents need to collaborate on a project, when you need to hand off agent-generated output to a client, or when you want to search across everything an agent has produced over weeks of work.
Local filesystems, S3 buckets, and shared drives each solve part of this problem. S3 gives you durability but no semantic search, no permissions model, and no way for an agent to share a file with a human through a branded link. Google Drive and Dropbox add sharing but lack the API surface that coding agents need for programmatic file operations at scale.
Fast.io provides workspaces where both agents and humans operate on the same files, with an MCP server that exposes workspace, storage, AI, and workflow operations through a single endpoint. When Intelligence is enabled on a workspace, uploaded files are automatically indexed for semantic search and RAG chat with citations. An agent can write code, upload documentation, and query related files through natural language, all through the same Streamable HTTP endpoint at /mcp or legacy SSE at /sse.
The practical workflow: an open source coding agent generates output locally, pushes files to a Fast.io workspace through the API or MCP server, and a human reviews the work through the web interface. File versioning tracks every change without manual commits. Granular permissions control access at the org, workspace, folder, or file level. When the project is done, ownership transfer lets the agent hand off the entire workspace to a client while retaining admin access for ongoing maintenance.
This storage layer is model-agnostic by design. The same workspace works whether you are running OpenCode with Claude, Aider with GPT-4, or Goose with a local Ollama model. The agent does not need to know or care what other agents or humans are using the same files.
Frequently Asked Questions
Is Claude Code open source?
No. Claude Code is proprietary software owned by Anthropic PBC. Its LICENSE.md states all rights are reserved and use is subject to Anthropic's Commercial Terms of Service. The GitHub repository is publicly visible for documentation and issue tracking, but the code cannot be forked, modified, or redistributed under any open source license.
Can I see Claude Code's source code?
The official repository at github.com/anthropics/claude-code contains documentation and issues but not the full application source. In March 2026, the complete TypeScript source was accidentally exposed through npm source maps in version 2.1.88. Anthropic issued DMCA notices against 8,100 repositories hosting direct copies, though clean-room reimplementations like Claw-code were not targeted.
What happened with the Claude Code source leak?
On March 31, 2026, security researcher Chaofan Shou discovered that a 59.8 MB source map file shipped in the npm package referenced the full 512,000-line TypeScript codebase hosted on Anthropic's R2 storage. The Bun runtime generates source maps by default, and no .npmignore rule excluded them. Anthropic called it a packaging error caused by human error. This was the second such incident, following a similar leak in February 2025.
What are open source alternatives to Claude Code?
The most popular open source alternatives are OpenCode (161,000+ stars, MIT license, terminal-native), OpenHands (74,400+ stars, Docker-sandboxed autonomous agent), Cline (61,000+ stars, Apache 2.0, IDE extension), Aider (42,000+ stars, git-native pair programming), and Goose (Linux Foundation governance, 70+ MCP extensions). All five are model-agnostic and work with Claude, GPT-4, Gemini, and local models through Ollama.
Is the Anthropic Agent SDK open source?
No. The Claude Agent SDK for both TypeScript and Python is governed by Anthropic's Commercial Terms of Service, the same proprietary license as Claude Code. Anthropic's standard language model SDKs (anthropic-sdk-python and anthropic-sdk-typescript) are MIT-licensed open source, but the Agent SDK and Claude Code itself are not.
Related Resources
Give Your Coding Agents a Shared Workspace
Fast.io workspaces connect to any open source coding agent through MCP. Files are indexed for search, versioned automatically, and shareable with one link. Start with a 14-day free trial.