Claude Code's Source Code Leaks Via npm Source Maps (dev.to) 65
Grady Martin writes: A security researcher has leaked a complete repository of source code for Anthropic's flagship command-line tool. The file listing was exposed via a Node Package Manager (npm) mapping, with every target publicly accessible on a Cloudflare R2 storage bucket. There's been a number of discoveries as people continue to pore over the code. The DEV Community outlines some of the leak's most notable architectural elements and the key technical choices:
Architecture Highlights
The Tool System (~40 tools): Claude Code uses a plugin-like tool architecture. Each capability (file read, bash execution, web fetch, LSP integration) is a discrete, permission-gated tool. The base tool definition alone is 29,000 lines of TypeScript.
The Query Engine (46K lines): This is the brain of the operation. It handles all LLM API calls, streaming, caching, and orchestration. It's by far the largest single module in the codebase.
Multi-Agent Orchestration: Claude Code can spawn sub-agents (they call them "swarms") to handle complex, parallelizable tasks. Each agent runs in its own context with specific tool permissions.
IDE Bridge System: A bidirectional communication layer connects IDE extensions (VS Code, JetBrains) to the CLI via JWT-authenticated channels. This is how the "Claude in your editor" experience works.
Persistent Memory System: A file-based memory directory where Claude stores context about you, your project, and your preferences across sessions.
Key Technical Decisions Worth Noting
Bun over Node: They chose Bun as the JavaScript runtime, leveraging its dead code elimination for feature flags and its faster startup times.
React for CLI: Using Ink (React for terminals) is bold. It means their terminal UI is component-based with state management, just like a web app.
Zod v4 for validation: Schema validation is everywhere. Every tool input, every API response, every config file.
~50 slash commands: From /commit to /review-pr to memory management -- there's a command system as rich as any IDE.
Lazy-loaded modules: Heavy dependencies like OpenTelemetry and gRPC are lazy-loaded to keep startup fast.
Architecture Highlights
The Tool System (~40 tools): Claude Code uses a plugin-like tool architecture. Each capability (file read, bash execution, web fetch, LSP integration) is a discrete, permission-gated tool. The base tool definition alone is 29,000 lines of TypeScript.
The Query Engine (46K lines): This is the brain of the operation. It handles all LLM API calls, streaming, caching, and orchestration. It's by far the largest single module in the codebase.
Multi-Agent Orchestration: Claude Code can spawn sub-agents (they call them "swarms") to handle complex, parallelizable tasks. Each agent runs in its own context with specific tool permissions.
IDE Bridge System: A bidirectional communication layer connects IDE extensions (VS Code, JetBrains) to the CLI via JWT-authenticated channels. This is how the "Claude in your editor" experience works.
Persistent Memory System: A file-based memory directory where Claude stores context about you, your project, and your preferences across sessions.
Key Technical Decisions Worth Noting
Bun over Node: They chose Bun as the JavaScript runtime, leveraging its dead code elimination for feature flags and its faster startup times.
React for CLI: Using Ink (React for terminals) is bold. It means their terminal UI is component-based with state management, just like a web app.
Zod v4 for validation: Schema validation is everywhere. Every tool input, every API response, every config file.
~50 slash commands: From /commit to /review-pr to memory management -- there's a command system as rich as any IDE.
Lazy-loaded modules: Heavy dependencies like OpenTelemetry and gRPC are lazy-loaded to keep startup fast.
Re: (Score:2)
hey, not everyone follow AI development and are up to date with all the details
for me, most of the info was new
Re:Sloppary (Score:4, Insightful)
The rest, and ChatGPT's opinion on them is just padding your word count:
"This is the brain of the operation." "leveraging its dead code elimination for feature flags and its faster startup times." "there's a command system as rich as any IDE."
And of course, they're also simply not fact-based in the slightest.
The Tool System (~40 tools): Claude Code uses a plugin-like tool architecture.
All modern agents do. My home-rolled Perl ones do, too.
Multi-Agent Orchestration: Claude Code can spawn sub-agents (they call them "swarms") to handle complex, parallelizable tasks.
Yes. This is a core feature of modern agents.
IDE Bridge System: A bidirectional communication layer connects IDE extensions (VS Code, JetBrains) to the CLI via JWT-authenticated channels. This is how the "Claude in your editor" experience works.
If you use Claude Code, and you use an IDE, or you link any agent to your IDE, this is how it works. How is this an insight garnered by the code dump?
Persistent Memory System: A file-based memory directory where Claude stores context about you, your project, and your preferences across sessions.
Again, agents 101, here.
Bun over Node:
If they had chosen Node over Bun, now that would be newsworthy.
React for CLI
Actually cool information. Already known (they've discussed it)- but still, informative for those who haven't kept up.
Zod v4 for validation
Ya, Zod is what you use for schema validation in TS.
~50 slash commands
Again, anyone who has used the tool knows this. How is this an insight of the code dump?
Lazy-loaded modules
Holy fuck, welcome to 2001.
The LLM summary can almost be moderated -1 Off Topic
It has nothing to do with the code dump.
Instead, it could have summarized some of the cool shit people have figured out [reddit.com], like its built in Tomagatchilike
Re: (Score:2)
It are the fluff opinions- the sound bites- that are devoid of fact.
Read again:
The rest, and ChatGPT's opinion on them is just padding your word count:
"This is the brain of the operation." "leveraging its dead code elimination for feature flags and its faster startup times." "there's a command system as rich as any IDE."
And of course, they're also simply not fact-based in the slightest.
This is why elementary school is important.
Re: (Score:2)
all are obvious for you... you are probably a programmer and probably even understand how AI works...
but alas, not everyone is a programmer and even programmers, not all understand/follow AI!
Also, before, all that info is suspect/should work like that, now we KNOW that is LIKE THAT
yes, maybe it could be better, but for me, it is good enough. it is a quick summary! if it talked too much technical info, most people would not understand, just like saying "it uses garbage collection", most people have a idea of
Re: (Score:1)
Re: (Score:3)
I guess that makes Anthropic no longer a threat to the US. The man can now take it and do what he wants.
I'm not sure how much "the man" (Hegseth?) can do with what was leaked. It appears to be the code for the command-line tool, not the LLM or its trained weights.
Re: (Score:2)
I'd be more worried if competent people were attempting something.
These idiots can't even redact documents properly.
TypeScript? (Score:1)
Re: (Score:3, Informative)
They probably wanted a scripting language that wasn't a total dog when it comes to speed.
Re:TypeScript? (Score:5, Informative)
Then they should have used Tcl.
Re: (Score:2)
Wow, some pythonistas are sure touchy about their dog-slow language...
Re: (Score:1)
Re: TypeScript? (Score:3)
Claude just needs to load fast, relatively..,it doesn't need to do anything else fast because the bottleneck is the ai calls or tools. Python would be perfectly fine here. Ideal even. The reason why not was likely not related to performance primarily. 3.12 python is plenty fast for a higher level language with a ton of experienced developers for it. It's likely that the choice came down to what the dev team uses elsewhere....and so just code it in the same language. Companies work that way far mo
Re: (Score:3)
Re: TypeScript? (Score:3)
I use claude regularly (we have to). I'm not sure what text animation is being required ...,it doesn't do anything you haven't seen it any ncurses type of application and any animation is simply aesthetic in the tool. All of the actual content is effectively just scrolling the text the ai or tools output or menu driven navigation. Again, i think the framework and stack was chosen because that's just what they use in general first and foremost. You dont need high performance to rotate a stupid 'waiting
Re: (Score:2)
Re: (Score:2)
Claude Code uses a rendering engine that runs at a high fps.
Now, should it? That'd be a fair question. But it does.
Also, Python isn't the best tool for any fucking job, except accelerating global warming.
Re: (Score:2)
Cause yeah, popular is how you should always make arch decisions. And also WTH would anyone use Python for a serious system that requires performance?
Claude code is basically just a fancy network client for the cloud-hosted LLM. There is nothing in it demanding high performance. It just needs to be a sandbox around the shell environment and be able to send off prompts, collect user input, and carry out intents returned from the LLM. 99.9% of the time the CLI app is idle waiting for user input, idle waiting for LLM network I/O, or idle waiting for a cli tool invocation to return.
The more important requirement is for it to be something cross platform and
Re: (Score:2)
There is nothing in it that should demand high performance, I agree.
But Claude Code is never waiting on your input. It's waiting on its frame timer to expire so it can render the next frame of its interface. Because decisions... were made... my people of questionable wisdom.
It's a real time React renderer that runs at 60fps.
Re: (Score:2)
JavaScript is actually a pretty interesting, powerful language, but one with quite a few problems. (I recommend the book JavaScript: The Good Parts by Douglas Crockford if you want to learn more about that.) TypeScript solves some, but by no means all, of those problems. From what I've heard, it's increasingly popular.
Re: (Score:1)
Re:TypeScript? (Score:5, Informative)
That surprised me, too. TypeScript is a very poorly-congealed ("designed" seems a bit strong) language.
Of the two popular scripting languages - python and ruby - python probably makes more sense as you can compile into actual binaries if you want.
For speed and parallel processing, which I'd assume they'd want, they'd be better off with Tcl or Erlang, both of which are much much better suited to this sort of work.
Re: (Score:2)
lol, this place is hilarious sometimes
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Possibly the motivation for this. [howfuckedi...tabase.com]
Re: TypeScript? (Score:2)
Same but elixir was a huge step up. Not really sure if either is the right answer for implementing a Claude CLI
Re: (Score:2)
There are some significant advantages over Python. JavaScript on Node.js (or Bun in this case) is inherently event-driven. TypeScript gives strong typing on top of that. And apparently Bun can package up an app into a standalone executable, also unlike Python. I'm going to have a look at Bun, seems powerful.
Re: (Score:2)
As much as I hate it, TypeScript is a legitimate choice.
There are millions of developers out there to choose from, which makes sourcing talent far easier and cheaper.
There are several runtimes to choose from for optimization, and massive 3rd party library support for practically everything.
It's a strongly-typed language that prevents you from footgunning yourself in any myriad of ways, which "transpiles" back to good ol Javascript that runs everywhere.
Radio silence? (Score:2, Interesting)
Its very odd that Slashdot would report on this, but with how much the Anthropic/Claude Code sub-reddits have been blowing up with them completely screwing over users with their ridiculous usage limits this past week, remain totally radio silent. Suspicious even.
I will never give Anthropic the time of day after the rug they've pulled on all of us. Screw them.
Re: (Score:2)
Re: (Score:2)
hmmm (Score:2)
As a non-programmer and non-expert in AI, how bad is this for Anthropic? By client-side they mean this is the source code to what people download anyway? This has nothing to do with the server-side stuff accessed by the Claude chat interface?
Re: (Score:2)
My sense of it is that this code is not the LLM itself, it is the infrastructure and interface layer between the user and the LLM. But even so, there's a lot of expensive work that has been exposed. At the very least it will give the competition some ideas.
Re:hmmm (Score:4, Informative)
Even OpenCode is keeping up well with Claude Code, and it works with any LLM.
Re: (Score:2)
"Claude Code has gone from zero to be the #1 tool in only eight months."
https://newsletter.pragmaticen... [pragmaticengineer.com]
Looks like OpenCode is #7.
Re: (Score:2)
1) We weren't talking about a popularity contest. Though I do imagine Claude Code definitely had the most mentions by respondents to the, uhhh
2) After this [slashdot.org] comment, I'm not sure you should ever reply to anything technical ever again.
If there's anything that can be learned here, it's that people like you l
Re: (Score:2)
Lol, now you're accusing me of not writing my own posts here? Hilarious!
>> The competition is easily keeping up with Claude Code
Show evidence. Like I did.
Re: (Score:2)
Lol, now you're accusing me of not writing my own posts here? Hilarious!
Not an accusation in the slightest. Was giving you an out for disclaiming authorship of that post ;)
It is impressively ignorant.
Show evidence. Like I did.
You showed evidence of popularity of a thing within a tiny non-representative sample in a discussion about feature parity. Put scientifically- you showed nothing.
As mentioned, no amount of Claude Code's codebase is going to make you give OpenCode more github stars. Idiots are led by a different metric than code.
Re: (Score:2)
>> Was giving you an out
That's an obvious lie, and I stand by my statement.
>> you showed nothing
Another obvious lie. I merely showed something you didn't like.
Re: hmmm (Score:2)
Re: (Score:2)
Only if you can distinguish AI-written lines from human-written lines. The human-written lines are still copyrighted and even small snippets would burn a pirate, if I understand the law correctly.
Re: (Score:2)
You'd have to first discover that they used it, then show that whatever code they implemented was based on yours I would think.
Re: (Score:2)
No, you just let them bring a suit against you. At that point they will have to tell you for exactly which lines you are being charged with infringement.
Re: (Score:2)
Re: hmmm (Score:2)
My company has most of that record for our git repo. I am fairly certain we could bring such a suit. I do not know if Anthropic could. Even so, the "AI generated cannot be copyrighted" theory has not been tested in court. That is only a ruling of the copyright office. I think there is a lot of questions around "transformative use" if you are the person who wrote the transformer based on some of the other invention law.
Re: hmmm (Score:2)
It would be a civil case. If they has some plausible scenario, then theoretically a jury can accept it as fact for the case.
Re: (Score:3)
As a non-programmer and non-expert in AI, how bad is this for Anthropic?
Not at all bad. Their competitors, such as Codex, are already open source. Anthropic is the odd man out being closed. It's just client side "prompt engineering" and IDE integration stuff, click bait headlines not withstanding.
Nothing of real value has been disclosed. It's interesting, but that's about all.
Re: (Score:2)
As for "of value", perhaps the system and agent prompts. That's a pretty fast-moving target. But since Claude has locked down Opus access to just API keys for external tools, those are really just for trying to glean ideas from.
It's okay guys (Score:2)
It's already gone. (Score:5, Informative)
The github page that's being pointed to has already taken down the code. Unlike the fools that posted the WinAmp source code, [slashdot.org] they actually know how to wipe out the commits. However, I found that searching github with leaked Claude Code language:TypeScript [github.com] was enough to find several mirrors of the code.
Re: (Score:2)
Thank you, Baby Jesus.
this is not the actual anthropic code. (Score:1)
this is a AI Port of what some guy in Korea claimed was the real code. I would be more willing to bet this i misdirection and subterfuge then anything else.
Quite a dick move (Score:2)