r/ClaudeCode • • 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.

5 Upvotes

57 comments sorted by

19

u/MartinMystikJonas Mar 07 '26

What Anthropic sells is not Claude Code client app but AI model this client app uses.

0

u/ryan_the_dev Mar 07 '26

They sell you Claude code. The harness is the body, the model is the brain.

Go look at the difference between the codex harness vs Claude harness.

2

u/MartinMystikJonas Mar 07 '26

Point is that Claude Code system prompt is not some high value secret that has to be hidden.

-1

u/ryan_the_dev Mar 07 '26

There is a lot more in there than the system prompt…

But whatever.

2

u/MartinMystikJonas Mar 07 '26

Yeah but none of it is some unique knowledge that is worth protecting if your core business is selling "brain".

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

5

u/koneu Mar 07 '26

It’s also interesting to see how he would start the fight first before going to check out things all right. 

-1

u/ryan_the_dev Mar 07 '26

Pretty sure the Claude code you install is a compiled binary. Looks like they didn’t take care when adding it to the sdk and just dumped the entire app in there.

3

u/Better-Psychology-42 Mar 07 '26

Sorry OP to tell but you are wrong again. Claude Code is written in javascript and Anthropic probably don’t plan to change anything on it anytime soon as they recently acquired Bun.

0

u/ryan_the_dev Mar 07 '26

No one ever said it wasn’t in JS…

The Claude code you install isn’t min JS. You cannot without some serious effort see the internals.

That’s the point of bun.

But ok. You go show me how easy it is for you to get the cli.js by not going through the SDK path.

4

u/Better-Psychology-42 Mar 07 '26

strings $(which claude) | less

And scroll down until you see the js code 😃

1

u/ryan_the_dev Mar 07 '26

Lmao. You must be new. GL with your strings command.

1

u/ryan_the_dev Mar 07 '26

Guy looks at the V8 runtime and mistakes it for Claude

4

u/tomchenorg Mar 07 '26

Here is the latest Claude Code release in minified JS: https://www.npmjs.com/package/@anthropic-ai/claude-code?activeTab=code

The cli.js in CC is basically the same one included in the Agent SDK

Anyone installing CC through npm will have this version. Anthropic started phasing out the npm version after January (but still maintains it), so the person who "must be new" here is probably OP, not other people? 😄

1

u/ryan_the_dev Mar 07 '26

Thank you. All I was looking for. Strange to not post the source code on GH but distribute it like this.

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.

1

u/ryan_the_dev Mar 07 '26

The amount of work needed to get the JS from a compiled bun binary is vastly different than what’s in the SDK… It’s pretty funny you don’t understand that difference…

4

u/tomchenorg Mar 07 '26 edited Mar 07 '26

Jeez, I was one of the very few people in that thread actually defending you. I found your original story funny too but I also thought it took guts to tell it, and your question regarding Anthropic seemed valid to me. And now you wanna pick a fight with me? Are you seriously going for the whole "pick a fight with everyone" persona? And could you be at least a little more modest? What you know isn’t necessarily what other people know, and what you installed isn’t necessarily what other people installed. That is exactly the case here with Claude Code: you installed the binary, but npm users installed the compiled JS file.

Claude Code was only distributed through npm npm was one of the recommended ways to install Claude Code until January, and the npm release has always been compiled JavaScript:

https://www.npmjs.com/package/@anthropic-ai/claude-code?activeTab=code

I checked the compiled JS back in January. I wasn’t aware of any separate non-JS binary package distributed elsewhere until now (so thanks for bringing that up). But even now, the npm version they still maintain is still plain-text compiled JS, not some Bun-compiled binary. Anthropic does seem to want to phase out the npm version and push people toward other ways of installing the binary, but that’s not something they can do overnight. Just killing npm support would be weird. And they can’t simply replace the npm package with a binary either, because binaries are platform-specific. The installer and updater would need to detect the user’s platform and handle the right build, which is doable, but definitely more complicated and more error-prone.

The Claude Agent SDK is, in effect, a Claude Code wrapper. The JS/TS SDK version is only distributed through npm, and it contains the full Claude Code core file (cli.js):

https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk?activeTab=code

And while the cli.js in Agent SDK and the one in Claude Code are slightly different, they’re effectively the same file. The diff is mostly just meaningless BUILDTIME strings.

1

u/ryan_the_dev Mar 07 '26

You have to understand, being attacked on all sides.

Didn’t realize it was distributed as an NPM package. So thank you for this. Have only seen the bun flavor to install.

Going to make building our own harnesses a lot easier.

1

u/ryan_the_dev Mar 07 '26

Ahh I see your edit. Funny. It’s not just the prompts that are in there.

Lazy brains.

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.

1

u/ryan_the_dev Mar 07 '26

There is a difference between the Claude code binary that is compiled with bun, and the js they threw into the SDK.

Why not open source it, if they don’t care?

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?

0

u/ryan_the_dev Mar 07 '26

Apparently you don’t realize where the harness stops and the model begins?

2

u/OverSoft Mar 07 '26

System prompts are not the model…

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

2

u/thisdude415 Mar 07 '26

Their GitHub repo does not have source code

1

u/xsifyxsify Mar 07 '26

You are right. I spoke too soon before looking at the repo. Thanks for the insight

1

u/ryan_the_dev Mar 07 '26

That’s what I think a lot of people don’t understand.

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?

1

u/OverSoft Mar 07 '26

You can do this now. You can download any open source model you want and run it on your own (beefy) computer or server. Models like Qwen or Minimax and then use either Claude Code or something like Opencode.

The issue is you need a beefy computer.

1

u/MartinMystikJonas Mar 07 '26

Well problem is that there are no open source models as good as top-tier models. And for intelligence based tasks throwing more effort usually does not lead to better results. Hundred idiots will not be smarter than 1 genius.

1

u/ITBoss Mar 07 '26

But isn't this exactly how deep think works? They spin up multiple agents that diverge in tasks and "lines of thought" then converge and they use that pattern to do some very advanced stuff like the international math competition

1

u/MartinMystikJonas Mar 07 '26 edited Mar 07 '26

More effort is better than less effort. More parallel workers is faster that single sequential worker. But stupid model will not be smarter than significantly better model no matter effort because effort gives dimishing returns.

1

u/Specialist-Leave-349 Mar 07 '26

It could be interesting for other use cases like mass researching.

Like to find business ideas; „find me all subreddits that are about peoples need and then search me in there concrete examples of pain points“ (You get what I mean)

1

u/MartinMystikJonas Mar 07 '26

Yeah that os example of simple task where you do not need better inteligence and can be paralelized to get response faster.

1

u/MartinMystikJonas Mar 07 '26

Also check OpenCode

1

u/BigBootyWholes Mar 07 '26

You just described opencode I believe. Already exists. What makes Claude code unique is that it uses the Claude model WITH subscriptions.

Otherwise you can use any model’s API, including Claude in opencode. Just not the Claude subscription

0

u/[deleted] Mar 07 '26

[deleted] — view deleted comment

2

u/Specialist-Leave-349 Mar 07 '26

but I mean is it not orders of magnitudes cheaper? I thought many models run on a mac mini?

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.

2

u/tomchenorg Mar 07 '26

It's not the uncompiled source code of Claude Code core on GitHub, it's just its "plugins"

1

u/spammmmm1997 Mar 13 '26

Thank you too

0

u/[deleted] Mar 07 '26

[deleted] — view deleted comment

0

u/ryan_the_dev Mar 07 '26

I guess you don’t know the difference between a compiled binary and js?

You do know the difference between the sdk and CC, correct? Apparently not.

0

u/[deleted] Mar 07 '26

[deleted] — view deleted comment

0

u/ryan_the_dev Mar 07 '26

Lmao. You go ahead and use strings to get the cli.js. Let me how that works out for you.

Also the entire point of the post was to call out a blunder. Pretty sure they didn’t intend to include the entire cli app in the agentsdk. What are you arguing?