Linkly AILinkly AI
Back to blog

RAG for Claude Code: Do You Need a Vector Database?

·Linkly AI·

For code, usually not. Claude Code finds its way with file search and grep, and code has exact names to match. For documents, it helps: PDF and Word files can’t be searched with grep, and the words in your question often differ from the words in the text.

What Claude Code does on its own

It searches file names and text, then reads files. PDF support is for reading: files over 10 pages are read in ranges of up to 20 pages, and binary formats such as .xlsx are refused. That works when you know which file to open. It is slow when the answer is somewhere in 500 PDFs.

Three options

What you doGood for
Convert to Markdown, use grepRun a converter, keep files in the repositoryDozens of documents that rarely change
Build your own RAGChoose chunking, embeddings, a vector database and an MCP serverTeams with special needs
Use a ready-made index over MCPInstall an app, add foldersMany files in mixed formats

What goes wrong with chunks

A basic RAG pipeline returns a handful of text fragments. The model doesn’t see what comes before or after, and can’t tell whether a fragment is an example or a rule. We wrote about this in why we abandoned RAG.

An agent can do better when it gets tools instead of fragments: search for documents, look at an outline, then read the section it needs. This takes more steps, so it is slower than a single lookup, but the model can check its own result.

Set it up

  1. Install Linkly AI and add your document folders. Indexing runs on your computer.
  2. Run:
claude mcp add --transport http linkly-ai "http://127.0.0.1:60606/mcp?client=claude-code"
  1. Ask something that needs a document: “Find our notes on the retry policy and check whether this code follows them.”

Linkly AI combines keyword and semantic search and reads scans, images, audio and video as well. Local features are free. See Claude Code setup and reading PDFs in Claude Code.