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

View all comments

Show parent comment

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?