Isn't this what is called CAG (context augmented generation) these days?
1. Although I think RAG for code is nonsense, CAG seems to be very expensive even with cachig - imagine a huge code base. There should be a more efficient option.
2. How about indexing documentation - RAG should be okay there?