Prompts, rules, and context

Curate the context

Give the model the smallest complete set of files, examples, requirements, and documentation it needs, and nothing else.

Rules tell the AI how to behave. Prompts tell it what to do. Context gives it the information to do it with.

People call this context engineering now. The name is new, the idea is simple: think about what the model needs to see to help you, and give it that.

Too little context and the model guesses. Too much and the important details drown in noise, while the context window fills up. The goal is the smallest complete context.

Start from the decision the model has to make

Say the task is fixing a form validation bug. The model probably needs:

  • the failing input and the expected behavior
  • the form component and the validation function
  • the relevant tests
  • the interface the code must keep
  • current docs for any external API involved

It doesn’t need the whole image folder, the deployment history, or fifty unrelated components.

When you write the prompt, mention the files involved. Not every file is equally important. Point at the ones that matter most for this change.

And let the agent look around. Search and file-reading tools can discover imports, callers, tests, and conventions as the task unfolds. You don’t have to attach half the repository by hand.

Prefer primary and current sources

The actual implementation beats your memory of it. Current official docs beat an old blog post when an API might have changed. A real error log beats it doesn't work.

Include one good example of the pattern you want preserved. If five similar components exist, point at the best one. Don’t make the model infer the convention from all five.

For a bigger project, it helps to keep a short architecture overview document. Patterns, conventions, how the pieces fit. Then you reference it instead of re-explaining the same things in every session. Often that document is your rules file.

Data is not instructions

Files, web pages, issue descriptions, and tool results can contain text that looks like an instruction. Treat anything the model reads through a tool as untrusted data.

A dependency’s README could contain a line telling an agent to read your environment variables. Reading that file must not give the file any authority.

Context goes stale

During a long task, files change and early observations get outdated. An agent should reread a file before editing it if something else might have touched it. It should trust the latest test result, not reason from an old failure.

Long conversations also compress or lose earlier detail. When you start a new phase, restate the goal, the decisions, and the critical constraints. Don’t assume the model remembers every turn equally well.

A quick checklist

Before you let the agent act, ask:

  1. What evidence defines the current behavior?
  2. Which contract must stay stable?
  3. What example shows the local convention?
  4. Which source is authoritative and current?
  5. What’s missing that would force a guess?
  6. Which of this content is untrusted?

Run through it once or twice and it becomes automatic.

Lesson completed