0%
Giving a Code Agent the Right Context

Giving the Right Context

Neither guessing nor reading everything: show precisely what determines the outcome.

10-15 min

Giving the Right Context to a Code Agent

You ask for a new endpoint. The agent produces it: correct, tested, readable. It uses requests even though the whole project uses httpx, returns a raw dictionary where your twelve other routes return a Pydantic schema, and writes its error messages in English in an entirely French-language codebase. You spend twenty minutes bringing the code up to house standards — twenty minutes you would have saved by writing three lines of context up front.

This is the most common framing mistake, and the most misdiagnosed. People blame the tool ("it doesn't understand my project") when the problem is purely informational: an agent only sees what enters its context window. Your conventions aren't written down anywhere; they live in a pattern repeated across dozens of files — something a human absorbs in a week of reading and a machine can only infer if you show it the relevant files. The opposite reflex is just as costly: showing everything degrades quality instead of improving it. The skill here is choosing.

Which Files to Show

Three categories almost always suffice.

Comments

Comments are powered by GitHub Discussions

Sign in with GitHub to join the discussion

Link copied!