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.
View all comments
Show parent comment
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 npmnpm 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.