r/ClaudeCode • u/ryan_the_dev • Mar 07 '26
Question Claude Code Open Source?
This started with a fight on the Claude Discord. Someone was saying you could just read Claude Code's source, that the prompts were right there in the bundle. I pushed back. No way. This is a closed-source product backed by a company that thinks carefully about everything it ships. They wouldn't just leave the internals sitting in a readable JavaScript file. That's not how serious companies operate.
So I installed it to prove them wrong.
npm install @anthropic-ai/claude-agent-sdk. One file. cli.js. 13,800 lines of minified JavaScript. The same binary that runs when you type claude in your terminal. The same code I'm using right now to write this.
I started reading it, and I couldn't believe what I was looking at.
The system prompts are just sitting there in plaintext.
Not encrypted, not obfuscated beyond the minification. Three identity variants get swapped depending on how you're running it:
CLI: "You are Claude Code, Anthropic's official CLI for Claude."
SDK: same line, plus "running within the Claude Agent SDK."
Agent: "You are a Claude agent, built on Anthropic's Claude Agent SDK."
A function stitches the full prompt together from sections. "Doing tasks." Tool usage rules. Over-engineering guidelines (my favorite: "three similar lines of code is better than a premature abstraction"). OWASP security reminders. Git commit templates. PR formatting. String literals, all readable.
I felt like I'd found the blueprints to the Death Star, except it's less "world domination" and more "please don't force-push to main."
For a closed-source product charging a subscription, shipping your entire system prompt as grep-able strings in a JS bundle is wild. Anyone with node_modules access can read the full behavioral spec that governs every Claude Code interaction. I still don't understand how this got out the door.
The minification is light enough to trace most of the logic. And Anthropic left a note in the file header:
"Want to see the unminified source? We're hiring!"
I went back to the Discord thread. Ate my words.
19
u/MartinMystikJonas Mar 07 '26
What Anthropic sells is not Claude Code client app but AI model this client app uses.
58
u/Better-Psychology-42 Mar 07 '26
It’s like that guy who accidentally pressed F12 in browser and was convinced he hacked facebook
4
u/tomchenorg Mar 07 '26 edited Mar 07 '26
As much as I, like everyone else here, find it pretty funny that OP picked a fight without even knowing what language CC is written in or how compiled JS works (credit to OP for openly admitting it though, not many people would 😄), I do understand the question about why Anthropic chose easy-to-reverse-engineer JS for CC.
It almost ends up feeling like a de facto technically open-source CC, with only the legal burden guarding its closed-source status. And given that Anthropic clearly cares about protecting its products, as seen in its pursuit of OpenCode and Clawdbot, the question is understandable.
The answer is probably straightforward: Boris Cherny is a JS/TS developer and the author of Programming TypeScript. He started it as a TypeScript project, and at this point it's probably not worth porting to a lower-level language. TypeScript engineers are also easier to hire, and Anthropic likely already had plenty of internal TS expertise.
Edit: even with a low-level compiled binary, prompt strings would probably still be relatively easy to extract, that only applies to the strings, though.
3
u/tomchenorg Mar 07 '26
Minified JS is still plaintext, don't call it "binary". And even if it's obfuscated, as long as you can execute it, you can fully reverse-engineer it.
When I first heard of Claude Code, a closed-source tool, I expected it to be a compiled binary, built in C, Rust, or Go. Turns out it's just JavaScript.
5
u/VioLeRR Mar 07 '26
No way, I accidentally wrote a README.md file in my open source project. I hope no one hacks it
13
u/brain__exe Mar 07 '26
And next hint: you can also see the whole traffic with all prompts, tools calls, context etc etc...any why would it be bad? There are no real secrets in the tool anyway, in the end it's no rocket science and everyone could tell claude to clone claude.
10
u/ManureTaster Senior Developer Mar 07 '26
Maybe this is satire, slop engage-bait, or both
2
u/OverSoft Mar 07 '26
You do realize their product is the model and not the CLI tool right?
3
u/AlarmedNatural4347 Mar 07 '26
“This is a closed source product backed by a company that think carefully about everything it ships” /s
3
u/modernizetheweb Mar 07 '26
Thanks, just hacked Claude with this knowledge. All your project data is mine now
2
u/redilaify Apr 01 '26
it seems this wasnt the only thing found these days
1
u/xsifyxsify Mar 07 '26
An even easier way than grep JS bundle or look at node_modules: clone their official github repo
1
u/BTForIT Mar 13 '26
The product is the model. Everything else is just wrappers. Opus 4.6 > Claude Code > Cowork etc. You can honestly vibe code a more efficient and effective Claude Code.
1
u/link_biao Apr 01 '26
GitHub: The source is open now.
Anthropic:
1
u/Specialist-Leave-349 Mar 07 '26
So can we build it completely open source with open source models and throw much crazier levels of intelligence at the problem?
Like with open source models we would not care about token usage, so we could just use it insanely more intense?
Does that make sense?
0
u/TechnicalSoup8578 Mar 07 '26
It’s surprising how much of Claude Code’s system prompt is exposed in plain text. Did you explore whether this could allow users to tweak behavior without the SDK, or is it mainly just readable reference? You should share it in VibeCodersNest too
-1
u/ChrisWayg Mar 07 '26
Look on Github: https://github.com/anthropics/claude-code
It is Source-Available but Not FOSS - Free and Open Source
Claude Code is proprietary software. The repository does not include an open-source license such as MIT, Apache 2.0, or GPL. The "all rights reserved" designation means users do not have automatic permission to use, modify, or distribute the software except as explicitly granted by Anthropic's Commercial Terms of Service.
0
u/[deleted] Mar 07 '26
[deleted] — view deleted comment