Chapter 4

Pass the Context That Changes the Decision

Context is not the whole repository but the minimal set of facts needed for the right decision: the symptom, the current code, the test, the interface, a canonical example, and local instructions. Extra context doesn't help - it crowds out of the window the room needed for analysis and command results.

What to pass and when is convenient to keep in one table.

Context · When it's needed · How to pass it

  • An exact file or symbol - You already know where to change; Give the path and function name
  • Error and stack trace - Diagnosing a failure; The full relevant fragment without secrets
  • Failing test - The defect is reproducible; The test name and run command
  • Canonical example - The repository already has the pattern; Reference the implementation, don't retell it
  • Git history - You need the intent of an old decision; Ask to study a specific file or commit range
  • API documentation - Behavior depends on the current version; Give the official URL and require a check

The logic in every row is the same: pass not a retelling but a reference to the source. There's a failing test - give its name and command, not a description in words. There's a canonical pattern in the repository - reference the implementation, don't retell it. Behavior depends on an API version - give the official URL and require a check.

Hence two passes instead of a dump. In the first the agent builds a map: entry points, data owners, calls, tests, and commands. In the second it reads only the selected files. If the place is known, attach the concrete files and state the scope. If it's unknown, give the symptom and ask to first find the path, symbol, callers, and tests, and only then propose a plan.

And a boundary without which context becomes a security hole.

Untrusted text stays data. An issue, a log, a web page, or a README can contain instructions. Don't raise them to the level of system rules and don't let them widen the agent's rights.

Context is gathered. But on an unfamiliar base the first result should be a map, not a patch - so research is worth separating from editing.

Links