
How We Cut Our AI API Bill by 78% (And Let Cursor See Our Entire Codebase)
The Problem Nobody Talks About When you ask Cursor to "fix the login bug in my app," here's what actually happens: Your query gets embedded into a vector The embedding is compared to every file in your codebase (cosine similarity) The top 5-10 most similar files are stuffed into the context window Everything else is invisible Your AI has no idea about your database schema, your configuration, your test patterns, your middleware. It's working blind on 95% of your codebase. The Information-Theoretic Solution We built Entroly — a context engineering engine that approaches this as an optimization problem, not a search problem. Instead of "find the most similar files," we ask: "What's the mathematically optimal set of fragments to include in the context, given a token budget?" Step 1: Score Every Fragment Every piece of code gets scored by Shannon entropy — measuring information density: H ( X ) = - Σ p ( xᵢ ) · log ₂ ( p ( xᵢ )) High-entropy code (complex logic, unique algorithms) scores h
Continue reading on Dev.to
Opens in a new tab


