Claude Code grep: Why Anthropic Dropped RAG Indexing

Key takeaways
- Claude Code builds no index; it searches on the spot with glob and grep
- pptx, docx and xlsx are XML inside a ZIP, so grep does not match them
- Convert internal documents to text and keep them locally to control search
I see local search as the core strength of Claude Code. My reason for thinking so is the history Boris Cherny of the Claude Code team has described. The earliest versions of Claude Code used RAG, building an index over the codebase, but the team eventually settled on agentic search with glob and grep — and he says it outperformed the alternatives by a wide margin*1.
This article covers why search in Claude Code is grep-centric, how that differs from search routed to an external system over MCP, and what to do with files grep cannot read. The conclusion first: if you want Claude Code to work with your internal documents, the most effective preparation is to put those documents on local disk in text form before you connect anything. That way the quality of search stays in your own hands.
I also shared this on X.
Masahiro Chaen@masahirochaenClaude Codeの本質は『ローカル検索』の強さ。MCPやAPIで繋ぐと、検索は相手のサーバー任せ。何件返すか、どう並べるかは向こうが決めるのであまり信用していない。
ファイルが手元にあれば、Claudeがgrepで言葉を変えながら何度でも探し直せる。
実際に開発チーム自身も初期のRAG+ベクトルDBをやめ、2025年2月にはgrep中心に切り替え済み。
事前に索引を作らないので情報が古くならないし、どう探すかをClaud…View on X ↗
What makes Claude Code grep strong: local search without an index

Searching on the spot instead of from an index
When Claude Code looks for a file, it runs glob and grep right then rather than consulting a prebuilt index. Anthropic’s engineering article describes this as a hybrid: basic tools like glob and grep fetch the files it needs just in time, while CLAUDE.md alone is loaded into context from the start*4.
The official documentation shows that the implementation varies slightly by platform. On macOS, Linux and WSL, the dedicated Glob and Grep tools are not part of the default tool set, and Claude uses find and grep through Bash instead. Those two run as bfs and ugrep, which ship inside Claude Code*5. On Windows, the dedicated tools are used by default*5.
Claude decides how to search
The reason I rate this design is that Claude controls the search terms, the scope and the number of attempts. If the first query misses, it rephrases, narrows by file extension, reads around the files it did find, and searches again. Because there is no index to build, a file you saved a moment ago is searchable immediately.
| Item | Detail |
|---|---|
| Search method | No prebuilt index; glob and grep run on the spot*1 |
| Earliest method | RAG that indexed the codebase (using Voyage)*1 |
| Main tools (macOS, Linux, WSL) | find and grep through Bash (the bundled bfs and ugrep)*5 |
| Main tools (Windows) | The Glob and Grep tools by default*5 |
| Grep tool default | Skips files covered by .gitignore*5 |
| Glob tool default | Up to 100 results by modification time; ignores .gitignore*5 |
| Loaded from the start | CLAUDE.md*4 |
| The trade-off | More latency and more tokens*1 |
How the team moved away from RAG and vector databases
The earliest version was an index-based RAG
On a Latent Space podcast published on May 7, 2025, Cherny said the earliest Claude Code used RAG, indexing the codebase with Voyage*1. The team then tried several approaches and ultimately settled on ordinary code search with glob and grep*1.
Claude Code itself was released as a limited research preview on February 24, 2025, and the announcement listed searching and reading code first among its capabilities*2. In my own post on X I wrote that the switch to grep-centric search had already happened by February 2025, but I could not find a primary source that pins down the exact timing. All I could confirm is that agentic search was in place as of May 2025*1.
Freshness and security decided it
Cherny gave two main reasons. RAG requires an indexing step, so the code drifts out of sync with the index. And the index has to be stored somewhere, which creates security concerns of its own*1.
A March 4, 2026 article in The Pragmatic Engineer tells the same story: the team tried local vector databases and model-driven recursive indexing, among other things, but those came with stale indexes and complicated permission management, and naive glob and grep driven by the model beat everything else*3. Anthropic likewise writes that this approach avoids the problem of indexes going stale*4.
The price is time and tokens
The approach is not free. Cherny himself explains that you pay in latency and tokens in exchange for a search method with no security weak point*1. He also notes that the judgment that it won by a wide margin came from how it felt in internal use, not from a formal benchmark*1.
MCP connections vs. local search in Claude Code: who decides how to search
With MCP, the other side decides the result count and the ranking
Claude Code can add external tools by connecting MCP servers*5. That is convenient, but search over MCP or an API happens inside someone else’s server. How many results come back, how they are ranked, and how much body text is returned all depend on that implementation.
I do not put much trust in that part. When the answer is not in the handful of top results, it is hard for Claude to tell whether the information genuinely is not there or whether the ranking simply buried it. The quality of the search then becomes the ceiling on the quality of the answer.
Local files can be searched again as many times as needed
Files on local disk change the picture. The Grep tool can return matching file names only, matching lines with line numbers, or just a count, and it can filter by file extension or language and look for matches that span multiple lines*5. Claude reads the output, changes its wording, changes the scope and keeps searching until it is satisfied.
- 1Connected via MCP or APIThe search runs on the other side's server. Their implementation decides the result count and ranking. The strength is direct access to the freshest data
- 2Kept locally and greppedClaude runs the search locally. It can rephrase and retry as many times as it likes. With no index, a file is searchable the moment it is saved*1
| Aspect | Connected via MCP or API | Kept locally and grepped |
|---|---|---|
| Who decides how to search | The other side's server | Claude itself |
| Result count and ranking | Up to their implementation | Claude tunes the filtering |
| Freshness | As fresh as their data is | The local files themselves are the target*4 |
| Retrying a search | Only within their search spec | Rephrase and retry freely |
| Cost | API calls to the other side | Latency and tokens*1 |
| Good fit for | Fast-changing data: inventory, deals, tickets | Documents searched repeatedly: policies, proposals, minutes |
Which files grep can read, and which it cannot
md, txt and csv match all the way into the body text
grep can only search text. Markdown, plain text and CSV hold their contents as characters laid out as-is, so a company name or a product name matches inside the body. That is why I keep my material in those three formats.
pptx, docx and xlsx are XML wrapped in a ZIP
Office’s .docx, .xlsx and .pptx are formats built on XML and ZIP technologies, bundling the parts of a document into a single file as a ZIP package*6. Microsoft explains that documents are compressed automatically and can be up to 75% smaller, and also notes that because a ZIP package is used, the file itself is binary*6. As a result, grepping the file as it stands will generally not match words in the body text.
Claude Code’s Read tool also declines to load files with extensions it treats as binary, such as .xlsx and .zip. When that happens it proposes a skill for that format, or a command or script that can read it, and carries on with the work*5. So the content is not beyond reach — but every search costs you a conversion step and tokens.
PDFs can be read, but they are heavy
PDFs can be read with the Read tool. Short ones are read whole; anything over 10 pages is read in ranges of up to 20 pages at a time, and range reading requires pdftoppm from poppler-utils*5. That said, PDFs often do not store body text as a plain sequence either, so in most cases grepping one directly will not pick up the word you were after. If you need to search across a large number of PDFs, extracting the text first is the better fit.
| Format | Does plain grep match the contents? | Handling in Claude Code | What I do |
|---|---|---|---|
| .md / .txt | Yes | Read opens it directly | Keep as-is |
| .csv | Yes | Read opens it directly | Put column names on line 1 |
| .docx / .pptx | Generally no (XML inside a ZIP)*6 | Needs conversion | Convert to Markdown and keep alongside |
| .xlsx | Generally no*6 | Read declines and proposes another route*5 | One CSV per sheet |
| Almost certainly not | Over 10 pages, read 20 pages at a time*5 | Extract the text and keep that | |
| Images (PNG, JPEG, etc.) | No | Viewed as images*5 | Add a written description if needed |
How I organize documents locally
From here on is what I actually do. The thinking fits in one line: keep data at hand rather than connect to it, and connect only what cannot be kept at hand. Watching the strong engineers around me, I get the impression that in development work there is a move back from the cloud to local.
- 1GatherCollect the material you refer to often into a single folder
- 2ConvertConvert docx and pptx to Markdown, xlsx to CSV, PDFs to text — once only
- 3SplitBreak each file into small pieces by topic, and put the date and subject in the file name
- 4Draw a mapWrite the folder structure and search hints into CLAUDE.md
- 5UpdateDecide on a mechanism to redo the conversion when the originals change
Convert once, not every time
Claude Code can handle the conversion itself. Because it proposes a conversion script when Read declines a file*5, saving that as a single script means you can convert a whole folder at once from then on. I keep the original Office files and place the text version next to them.
Keep files small
By default the Read tool returns up to 25,000 tokens per call, and files over 256KB are read in parts rather than whole*5. A row of small files split by topic makes both grep hits and reading lighter than one enormous combined file.
Write a map in CLAUDE.md
CLAUDE.md is loaded into context from the start*4. Writing a map there — proposals in proposals, minutes in minutes in date order — lets Claude aim its very first search. Hints for rephrasing, such as a company’s former name or its abbreviations, help as well.
I have written about where to keep notes and how to write them in the article below.
Related articleObsidian vs Claude Code: Do You Still Need It?
I have written about running conversion and cleanup jobs overnight in the article below.
Related articleClaude Code Scheduled Tasks: End the Bedtime Prompt Loop
For companies: what to settle before putting internal documents on local disk
Points to check before rolling this out
- Rules on taking data out — first confirm that copying internal material onto an employee’s PC does not itself breach your policies
- Working scope — Read, Grep and Glob ask for confirmation before touching anything outside the working directory and any directories you have added*5. Decide deliberately whether the document folder goes inside that scope
- How .gitignore is treated — the Grep tool skips files excluded from Git, while the Glob tool looks at them by default*5. Files you think you have excluded may still be visible, depending on the tool
- Freshness of the converted copies — there may be no index to go stale, but a converted text version does go stale once the original is updated. Decide who refreshes it and how often
I have written about the risk of malicious instructions slipping into the files you keep locally in the article below.
Related articleClaude Code Security: Don’t Launch Agents in Downloads
A basis for deciding
| Type of information | Keep locally | Connect via MCP |
|---|---|---|
| Internal policies and manuals | Good fit (rarely updated, searched often) | Usually unnecessary |
| Past proposals and minutes | Good fit (high value in rephrasing searches) | Worth considering at very high volume |
| Customer, deal and inventory data | Poor fit (goes stale fast) | Good fit |
| Registers containing personal data | As a rule, do not keep locally | Connect with tight permissions |
| Company-wide document search | Too heavy for one machine | An index-based search platform fits better |
I have written about choosing between agents that run in the cloud and Claude Code running locally in the article below.
Related articlePersonal AI Agents vs Claude Code: How I Split the Work
How this lands in Japan, and what it means for overseas companies
Japanese companies keep their material mainly in Office formats
Across the 600-plus companies I have supported with AI adoption, my read is that most internal knowledge sits in Excel, PowerPoint and PDF. So when a Japanese company points Claude Code straight at its internal documents, the first thing it runs into is formats grep cannot work with. Concluding from that that AI cannot read your documents would be a waste.
At the same time, Japanese is a language with a great deal of surface variation: full-width and half-width characters, katakana versus the Latin alphabet, old company names versus new ones. I see the strength of local search — rephrasing and retrying as many times as needed — as especially valuable with Japanese-language material.
What this means for AI and tech companies abroad
There are two implications for overseas companies that want to bring a product to the Japanese market. The first is to make it possible to export your service’s data as Markdown or CSV. Whether you can emit a form an agent can handle locally looks likely to shape how your product actually gets used inside Japanese companies.
The second is that if you offer search over MCP, let the agent adjust the result count, the ranking and how body text is returned. My read is that a connection whose search internals are invisible loses points precisely with the cautious joho-system-bu, the in-house IT departments that sign off on tooling at Japanese firms.
Summary
- The mechanism — Claude Code builds no index; it searches on the spot with glob and grep, and loads only CLAUDE.md up front*4
- The history — the team dropped its early RAG and chose agentic search, citing stale indexes and security*1
- The formats — docx, pptx and xlsx are XML wrapped in a ZIP, so grep does not reach their contents as-is*6
- How to stage files — convert once, then make things findable with small text files and a map in CLAUDE.md
- The call for companies — keep documents you search repeatedly on local disk, and connect fast-changing data over MCP
What I would suggest is picking just ten documents you expect to open often next week, converting them to Markdown and CSV, and putting them in a single folder. Write a few lines of map for that folder in CLAUDE.md, then throw your usual questions at it. There is plenty of time to think about what to connect once you have seen how local search actually feels.
Sources
- *1Latent Space: Claude Code: Anthropic's Agent in Your Terminal (May 7, 2025)
- *2Anthropic: Claude 3.7 Sonnet and Claude Code (February 24, 2025)
- *3The Pragmatic Engineer: Building Claude Code with Boris Cherny (March 4, 2026)
- *4Anthropic Engineering: Effective context engineering for AI agents (September 29, 2025)
- *5Claude Code Docs: Tools reference
- *6Microsoft Learn: Overview of the XML file formats in the 2007 Office system
FAQ
Does Claude Code use RAG or a vector database?
According to the development team, the earliest version used RAG that indexed the codebase (with Voyage). It later settled on searching on the spot with tools like glob and grep. CLAUDE.md alone is loaded into context from the start.
Can Claude Code search inside pptx, docx and xlsx files?
Those formats bundle XML parts into a ZIP, so grepping them directly will generally not match words in the body text. The Read tool also declines files such as .xlsx as binary and proposes a skill or a conversion script instead. If you search them repeatedly, converting to Markdown or CSV and keeping that version locally is the practical answer.
Can Claude Code read PDFs?
Yes. Short PDFs are read whole, and anything over 10 pages is read in ranges of up to 20 pages at a time. Range reading requires pdftoppm from poppler-utils. If you search a large number of PDFs repeatedly, extracting the text in advance keeps both effort and tokens down.
Is it better to connect over MCP or keep files locally?
I recommend using both where each fits. Data that changes constantly, such as inventory or deals, suits an MCP connection, while documents you search over and over, such as policies and past material, suit being kept locally. With local files, Claude can change how it searches as many times as it needs to.
Based on a post on XOriginal post ↗