Most coding agents treat prompt construction like retrieval: they gather more files and add more context, hoping the model figures it out. As context grows, irrelevant code competes for attention and when the window fills, agents start compressing their own memory—often mid‑task. This “forgetting” is usually just degraded context.
The article proposes a different approach: treat prompt construction like a Context Compiler that decides what to keep, what to reduce, and what to discard. A three‑pass pipeline written in pure Python resolves symbol dependencies, strips reachable files to bare interfaces, and drops everything else. The tool runs in under 75 ms.
Across two real Python repos it cut prompt sizes by 69–74% and flagged missing dependencies explicitly. A synthetic test showed a 34.9% token reduction, with tiered context (full source, skeletonized, excluded) and warnings for dynamic dispatch and event decorators.
Context compilation is a specific application of context engineering, a term coined by Andrej Karpathy. Since model context windows are controlled by the provider, the real leverage is in what you feed the model, not the window size itself.
Source: Towards Data Science · Summarized by HeadlinesBriefing