Retrieval Augmented Generation is a technique where AI retrieves relevant information from external sources before generating a response. Instead of relying only on training data, RAG systems search documentation, codebases, or databases to ground their answers in current, specific information.
RAG addresses a fundamental AI limitation: models only know what was in their training data. RAG systems can access current, specific information — making AI actually useful for real codebases.
User Question
↓
[Retrieval] → Search relevant documents/code
↓
[Augmentation] → Add retrieved content to prompt
↓
[Generation] → AI generates response with context
Without RAG:
With RAG:
Cursor uses RAG to:
You benefit by:
Both help AI access more information:
| RAG | Large Context |
|---|---|
| Retrieves relevant info | Fits more in one prompt |
| Selective and focused | Everything available |
| More scalable | Bounded by window size |
| Requires good retrieval | Simpler to use |
Best tools combine both — large context windows with intelligent RAG retrieval.