Giving the Agent Context
An agent is only as good as the context you give it. Most bad output is not a bad model — it is missing context. The model cannot see what you never showed it.
Four Things to Provide
“Context” here is concrete. When you hand a task to an agent, give it all four:
- The relevant files — the actual code and data it will touch
- A clear spec of the task — what done looks like
- Examples of what good looks like — a sample of the output you want
- Constraints — what it must not change or break
Ground It in the Repo
Point the agent at the actual code and docs, so it works from your reality rather than its guesses. Without them it fills the gaps with plausible inventions.
Too Much vs Too Little
Both extremes hurt. Aim for the relevant slice — enough to ground the work, no more.
- Too much — irrelevant files waste the window and dilute the signal
- Too little — the agent has to guess, and guesses drift from your intent
- Module 5 goes deeper on these context-window tradeoffs
Examples Beat Description
Showing one example of the output you want is often worth a paragraph of instructions. The example pins down format, tone and shape that prose leaves ambiguous.
Build It
How to implement: before your next agent task, gather the 2–3 files it truly needs and write one example of the output you want — then paste those in.
- Weekly AI Tasks tracker — give the agent the data model and one sample task record, so new code matches your shapes
- Personal brand site — give it your real résumé and notes as context, so it writes from facts, not invention
What you learned
Context is the relevant files, a clear spec, examples, and constraints. Ground the agent in the real repo, aim for the relevant slice, and remember one example often beats a paragraph.