Production AI
Selective Context Retrieval

Most AI code review systems are doing too much.
They feed the model the whole codebase and hope it finds the signal.
What actually works:
- parse the repo into AST-based chunks
- retrieve only the most relevant chunks for the PR
- keep the context focused on the change
On one benchmark, that meant:
- 99 chunks down to 15
- 31,000+ characters down to about 3,500
- an 88.9% reduction in context size
And the surprising part?
More context did not mean better review quality.
- No context: the model misses repository patterns
- Full context: too much noise, lower quality
- Selective context: better precision, recall, and F1
The lesson is simple:
In AI code review, relevance beats volume.
How are you deciding what context your LLM actually needs?