Skip to main content
Prerequisite: You’ll need an account on Morph to access embeddings for larger repositories.

The Right Tool for the Right Size

Code retrieval should be simple by default, sophisticated when necessary. The approach depends entirely on your repository size:

Small Repos (<200 files)

Agent Search: Let Claude navigate file paths and symbols directly

Large Repos (200+ files)

Retrieval Funnel: Embeddings → Reranking → Agent Reading
For repositories under 200 files, skip the complexity. Use agent search where you give Claude three simple tools:

The Three Essential Tools

Let Claude explore the file structure naturally.
When Claude knows roughly what file it’s looking for.
Let Claude decide what to read based on what it discovers.
When Claude needs to find code by meaning, not just filename.
Benefits:
  • Zero setup time
  • No indexing required
  • Claude makes intelligent choices about what to read
  • Works perfectly for most development scenarios

Large Repositories: The Retrieval Funnel

When you hit 200+ files, raw agent search becomes inefficient. Use the retrieval funnel:
1

🔍 Cast Wide Net

Embeddings: Find 50-100 potentially relevant code chunks using Morph Embeddings
2

⚡ Focus Down

Reranking: Narrow to the 5-10 most relevant pieces using Morph Rerank
3

🧠 Agent Reading

Claude: Inspect the ranked results and decide what to read in full

Implementation: The Funnel Approach

When to Use Each Approach

Decision Tree

Best Practices

  • Begin with agent search for any new project
  • Only add complexity when Claude starts missing relevant code
  • Most projects never need embeddings
  • Switch to retrieval funnel when search becomes slow/inaccurate
  • Usually happens around 200-500 files depending on structure
  • Monitor Claude’s success rate in finding relevant code
  • Even with embeddings, let Claude make final reading decisions
  • Provide candidates, not conclusions
  • Claude’s reasoning beats pure similarity matching

Performance Expectations

Typical Performance

Repository SizeApproachSearch TimeSuccess Rate
< 200 filesAgent Search< 5 seconds95%+
200-1000 filesBasic Funnel< 10 seconds90%+
1000+ filesAdvanced Funnel< 15 seconds85%+
The key insight: Most code retrieval problems are solved by giving Claude the right navigation tools, not by throwing embeddings at everything. Ready to implement? Get your API key for repositories that need the retrieval funnel, or just start with agent search for everything else.