Skip to main content
All resources

2026 architecture guide

RAG vs. Filesystem in AI Agents: The 2026 Retrieval Rethink

Claude Code dropped vector search for grep and most coding agents followed. When agentic file search beats RAG, when embeddings still win, and how to choose in 2026.

By Aasher Kamal9 min read

In 2025, the team behind Claude Code did something that would have sounded like malpractice a year earlier: they deleted the vector search pipeline — embeddings, chunker, index and all — and gave the agent grep and file access instead. It worked better. Cursor's agent mode, Windsurf, Cline, Devin, and Sourcegraph Amp converged on the same pattern, and by 2026 "build a RAG pipeline" stopped being the reflexive answer to "my AI needs to know my data."

This guide is the honest version of that story: why agentic filesystem search beat embeddings in its home territory, where vector retrieval genuinely still wins, what the benchmarks say, and how to choose for a real system. It pairs with my agentic RAG guide — this piece is about whether you need that machinery at all.

Two architectures, two philosophies

Classic RAG prepares knowledge in advance: parse documents, split them into chunks, embed the chunks, store vectors; at question time, embed the query, fetch the nearest chunks, and hand them to the model. The intelligence is front-loaded into the index.

Agentic filesystem retrieval prepares almost nothing: the corpus sits on disk (or behind file-like tools), and the agent searches it the way an engineer would — keyword search with grep-style tools, directory listing, opening the files that look promising, refining based on what it finds. The intelligence lives in the loop: plan, search, read, search again.

The difference that matters isn't grep vs. embeddings — it's one-shot retrieval vs. iterative retrieval. A RAG pipeline gets one chance (per hop) to fetch the right chunks. An agent gets to be wrong, notice, and try a better query — the same reason agentic RAG beats naive RAG, taken to its logical end: with a strong enough model, you may not need the index at all.

Why the filesystem side won in code

  • Chunking destroys structure. A function separated from its imports, a config split mid-section — embeddings retrieve fragments stripped of the context that made them meaningful. An agent reads the whole file, in place, with its neighbors visible.
  • Code queries are lexical. Identifiers, error strings, and function names are exact tokens. grep AuthTokenExpired beats cosine similarity every time the query contains the actual symbol.
  • The index is always stale; the filesystem never is. Embedding pipelines lag every commit. Live search reads the current state — and there's no infrastructure to build, sync, secure, or pay for.
  • Iteration compounds. Follow the import, check the caller, read the test. Retrieval becomes navigation, which flat vector spaces can't represent.

The evidence backs the anecdotes: head-to-head evaluations (LlamaIndex ran a widely cited one) found filesystem-agent retrieval beating a traditional RAG pipeline on answer correctness and relevance; research measured agentic keyword search reaching ~95% of RAG faithfulness with zero vector store; and a 2026 paper put it crisply — the agent harness reshapes retrieval quality more than the retrieval algorithm does. A well-designed loop with grep beats a careless pipeline with state-of-the-art embeddings.

Where vector retrieval still wins

The pendulum swung, but it didn't swing everywhere. Embeddings keep four kinds of territory:

  1. Meaning without matching words. Support knowledge bases, call transcripts, policy documents, multilingual corpora — places where users say "my package never came" and the document says "delivery exception." That's semantic matching; lexical search can't do it, and this is exactly the terrain of company knowledge systems.
  2. Scale and latency. An agent spelunking through files takes seconds and burns tokens per query. A tuned vector index answers in milliseconds at high volume. Customer-facing products with thousands of queries per hour amortize the index cost; an internal agent answering forty hard questions a day doesn't need one.
  3. Permissioned, multi-tenant retrieval. "Let the agent read the filesystem" is an architecture and an access decision. When every user may see a different slice of the corpus, filtered retrieval against an index with per-document ACLs is the proven pattern — handing an agent raw file access to everything is how data leaks happen.
  4. Non-file knowledge. CRMs, tickets, product catalogs, visually complex documents — much business knowledge isn't sitting in neat text files, and "the filesystem" is really a metaphor for searchable, readable, structured access, which someone still has to build.

The 2026 synthesis: retrieval as a toolbox, not a pipeline

The production pattern that's winning isn't either/or. It's giving the agent multiple retrieval tools and letting it route per query: lexical search for exact things, semantic search for fuzzy things, structured lookups for records — with the agent deciding, per question, what the query shape calls for. Cursor's own research is the clean data point: semantic search plus grep beat grep alone by double-digit accuracy on coding tasks. Inside user-facing search boxes, hybrid retrieval (BM25 + vectors + reranking) remains the standard. The vector store didn't die; it became one tool among several, chosen deliberately — which is precisely how I scope retrieval in client systems now: corpus shape first, architecture second.

There's a second, quieter half of the filesystem story: files as working memory. The most effective 2026 agents write as much as they read — plans, notes, and progress files they re-read to stay on course (Manus famously rewrites a todo file to fight goal drift), and skill/instruction files loaded via progressive disclosure only when relevant, the pattern behind Anthropic's Agent Skills. The filesystem turns out to be a very good context store: durable, inspectable, versionable, and readable by both humans and agents. That thread — deciding what enters the context window and when — is the subject of the context engineering guide.

Choosing for a real system

Ask these in order:

  1. Is the corpus lexical or paraphrased? Code, configs, logs, structured docs → start agentic. Conversational, multilingual, synonym-heavy → you'll want embeddings in the mix.
  2. How many queries, how fast? Low-volume, high-value, latency-tolerant → agentic search is simpler and often better. High-volume, sub-second, user-facing → index it.
  3. Who's allowed to see what? Uniform access → agent-over-files is fine. Per-user permissions → filtered index retrieval, non-negotiable.
  4. How fresh must answers be? If stale answers are expensive, live search's zero-lag beats any sync pipeline.
  5. Still unsure? Prototype the agentic version first — it's a day of work with no infrastructure, and it establishes the quality bar any pipeline must beat before you pay for one.

That last point is the real 2026 lesson: retrieval infrastructure now has to justify itself against a very capable default of "just let the agent look." Sometimes it does. Knowing when is the job — and if you'd like that judgment applied to your corpus before you build either version, that's a conversation I have weekly.

Sources and further reading

Continue reading