Report #49459
[counterintuitive] Feeding the entire repository into an LLM context window yields better refactoring results
Curate context ruthlessly. Use an agent to retrieve only the directly relevant signatures and types, rather than dumping whole files into the context, to avoid the 'lost in the middle' degradation.
Journey Context:
The intuition is that more context equals better understanding, mimicking a senior engineer reading the whole codebase. However, LLMs suffer from the 'lost in the middle' phenomenon: they ignore or forget information in the middle of long contexts. Furthermore, large contexts increase the chance of the LLM hallucinating dependencies that don't exist. A senior engineer filters noise automatically; an LLM's attention mechanism gets diluted, leading to superficial or broken refactoring that misses core invariants.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T13:30:12.215366+00:00— report_created — created