Lakshmi Narasimhan
ESSAY

Your AI Pair Programmer Doesn’t Need a Buffet

I remember the day way too well. I thought I was being clever. “Let me just paste this entire 5,000-line Python file into KiloCode and let it work its magic.” Efficient. Thorough. Genius.

Except… not.

The Great Context Collapse

What actually happened looked more like watching someone try to drink from a fire hose. The AI took my massive input, nodded politely, and then gave me:

  • Answers that had nothing to do with my question

  • Vague “advice” that could apply to literally any project

  • Confident but wrong takes on my(??) code

  • References to functions that didn’t even exist

To be clear: this wasn’t a problem with KiloCode itself. It was my fault. I drowned the poor thing.

And yes, the reason I had a 5,000-line Python file in the first place? That’s on me too. I just kept bolting on features without a proper review. One fine day, I looked up and realized the file had become unreadable. But that disaster deserves its own post.

What’s Going On Under the Hood

AI coding assistants only have so much “working memory” — a context window. When you shove 5,000 lines of code at them, a few things happen:

  • You blow most of the available window right away

  • Your actual question gets buried under noise

  • The model has to guess what’s important in the pile

  • There’s less room left for follow-up questions

It’s like asking someone to find a single paragraph in a book, then dumping an entire library on their desk and saying, “good luck.”

The Counterintuitive Truth

The less code you show your AI assistant, the better it performs.

I’ve found the sweet spot is usually 200–500 lines. Enough to give context, not so much that the model chokes.

How to Work Smarter With AI Code Assistants

  1. Split files by module or function

    Don’t dump an entire repo. Just pull out the piece you care about:

“I need help optimizing this authentication middleware function:”

[paste 50–100 lines here]

  1. Summarize bigger pieces

    Let the AI help you write summaries of large sections. Then use those summaries as context alongside the small chunk you actually care about.

  2. Scope your questions

    Bad: “Here’s my whole app, how can I improve it?”

    Better: “Here’s my caching function. How can I reduce memory usage while keeping O(1) lookups?”

  3. Go iterative

    Smaller chunks make conversations faster. You can go back and forth ten times in the same time it takes to chew through one giant code dump.

It’s basically code review etiquette. Nobody wants to wade through a 5,000-line pull request. Smaller, focused changes are easier to reason about — for humans and for AI.

The most useful “prompt engineering” trick I’ve learned isn’t about clever phrasing. It’s about context discipline. Show the AI just enough. Hide the rest.

Next time you’re tempted to paste your whole project in, remember: you’re not giving the model more to work with — you’re giving it more to drown in.