Copilot vs Claude Code: Two Very Different Bets on How AI Should Understand Your Codebase
- Ajay Dandge
- 3 days ago
- 4 min read
Every AI coding tool faces the same fundamental problem: your codebase is too large to fit in a context window, but the model needs to understand it to help you. How a tool solves that problem shapes everything about what it can and can't do.
GitHub Copilot and Claude Code solve it in opposite ways — and the gap between them isn't a matter of polish or features. It's a genuine architectural disagreement.
How Copilot Works: Index First, Retrieve Later
If your repository is hosted on GitHub or Azure DevOps, Copilot creates a remote index of your codebase and computes an embedding that captures patterns and relationships in your code. Based on your prompt, Copilot performs a semantic search on that index. Unlike traditional search, which matches exact words, semantic search focuses on meaning — using advanced vector embeddings, Copilot identifies files with the highest semantic similarity to your request and adds them to its context.
In September 2025, GitHub shipped a new embedding model to power this retrieval layer — delivering a 37.6% lift in retrieval quality, about 2x higher throughput, and an 8x smaller index size. These vector representations retrieve semantically relevant code even when the exact words do not match.
The architecture has layers. When eligible, Copilot executes two searches in parallel — the remote search hits GitHub's embeddings API, receiving semantically ranked chunks from the indexed commit, while a local diff search handles files modified since the last commit. For diffs between 301–2,000 files, it skips embeddings entirely and uses TF-IDF. Unchanged files use GitHub's fast indexed results; modified files use current code state.
It's a sophisticated system, purpose-built for speed at scale.
How Claude Code Works: Explore Now, Index Never
Claude Code does none of this. There is no index, no embeddings, no pre-built vector database.
Claude Code uses filesystem tools — Glob for file pattern matching, Grep for content search, and Read for loading specific files — to explore code on demand as it works through each task. Anthropic calls this "agentic search."
The model decides what to look at. It reads the file tree, follows imports, searches for symbols, opens configs — the same way a new engineer would orient themselves in an unfamiliar codebase. The intelligence is in the model, not the retrieval infrastructure.
This approach was inspired by how Boris Cherny observed engineers at Instagram searching code when the click-to-definition functionality in the in-house coding editor was broken. They used grep. It worked.
Why Claude Code Abandoned RAG — In Boris's Own Words
This wasn't a philosophical starting position. The team built RAG first and changed their minds based on results.
Boris Cherny, creator of Claude Code, on X:
"Early versions of Claude Code used RAG + a local vector db, but we found pretty quickly that agentic search generally works better. It is also simpler and doesn't have the same issues around security, privacy, staleness, and reliability."
On the Latent Space podcast, he went further:
"We tried RAG… we tried a few different kinds of search tools. And eventually, we landed on just agentic search as the way to do stuff. One: it outperformed everything. By a lot. And this was surprising."
The team tried several approaches — local vector databases, recursive model-based indexing, and others. All had downsides: stale indexes, permission complexity. Plain glob and grep, driven by the model, beat everything.
The four reasons Boris cited for abandoning RAG:
- Precision — grep finds exact matches; embeddings introduce fuzzy positives. In code, `createD1HttpClient` either appears in a file or it doesn't. Semantic similarity without textual match is usually noise.
- Simplicity — no index to build, maintain, or sync.
- Freshness — a pre-built index drifts from code the moment you start editing. Filesystem reads are always current.
- Security & privacy — the index has to live somewhere. If that provider gets hacked, it's a liability. Even for Anthropic's own codebase, they don't want to upload it to a third-party system. Agentic search sidesteps all of that.
The Real Trade-offs
Neither approach is strictly better. They're optimized for different things.
Copilot's index wins on: Speed of first retrieval. Semantic search across a massive, stable codebase — finding "where is authentication handled?" without knowing what it's called. Near-zero per-task token cost for retrieval.
Claude Code's agentic search wins on: Precision for exact-match lookups. Always-current results with no staleness. Multi-step reasoning, where the model reads one file, learns something, and decides what to look at next. Zero setup, zero infrastructure. And critically — it gets better for free as models improve, because the intelligence stays in the model.
The cost is real: every file Claude Code reads consumes tokens and takes time. On a large, stable codebase, a RAG system can surface relevant files in milliseconds for near-zero cost. Agentic search pays that cost on every task.
What This Tells You About Each Tool's Design Philosophy
Cherny describes Claude Code as "a Unix utility, not a product." No GUI, no managed index, no infrastructure — just a model with filesystem tools, composable into any workflow. The design bet is that model capability is the bottleneck, not retrieval speed, and that the model should be the one doing the reasoning.
Copilot's bet is the opposite: invest in retrieval infrastructure so the model gets better inputs faster. The original framing from GitHub Next: "Real programming tasks are seldom self-contained. What you're about to write in one file crucially depends on details elsewhere in the codebase." Their answer is to build the system that surfaces those details before the model even starts.
Both bets are coherent. They reflect different views of where the constraint actually lives — and as context windows grow and models improve, the answer will keep shifting.
References
1. Boris Cherny (X / Twitter) - RAG vs Agentic Search
2. Boris Cherny (Latent Space Podcast, May 2025) - Building Claude Code
3. Pragmatic Engineer - Building Claude Code with Boris Cherny
4. GitHub Blog - Copilot's new embedding model
Well written ✨