Turns out Claude Code source code was leaked today. I saw several snapshots of the TypeScript code base on GitHub. I don't want to link here for legal reasons, but there are some interesting educational tidbits that can be learned here.
Of course, it's probably common knowledge that Claude Code works better for coding than the Claude web chat because it is not just a chat interface with a shell added to it but more of a carefully designed tool with some nice prompt and context optimizations.
I should also say that while a lot of the qualitative coding performance comes from the model itself, I believe the reason why Claude Code is so good is this software harness, meaning that if we were to drop in other models (say DeepSeek, MiniMax, or Kimi) and optimize this a bit for these models, we would also have very strong coding performance.
Anyways, below are some interesting tidbits for educational purposes to better understand how coding agents work.
1. Claude Code Builds a Live Repo Context
This is maybe most obvious, but when you start prompting, Claude loads the main git branch, current git branch, recent commits, etc. in addition to CLAUDE.md for context.
2. Aggressive Prompt Cache Reuse
There seems to be something like a boundary marker that separates static and dynamic content. Meaning the static sections are globally cached for stability so that the expensive parts do not need to be rebuilt and reprocessed every time.
3. The Tooling Is Better Than “Chat With Uploaded Files”
The prompt seems to tell the model to uses a dedicated Grep tool instead of invoking grep or rg through Bash, presumably because the dedicated tool has better permission handling and (perhaps?) better result collection.
There is also a dedicated Glob tool for file discovery. And finally it also has a LSP (Language Server Protocol) tool for call hierarchy, finding references etc. That should be a big “power up” compared to the Chat UI, which (I think) sees the code more as static text.
4. Minimizing Context Bloat
One of the biggest problems is, of course, the limited context size when working with code repos. This is especially true if we have back-and-forths with the agent and repeated file reads, log files, long shell outputs etc.
