62

Context is a managed resource

#
  • author’s position
  • opinionated
  • no code

Scope. “Generation quality = context quality” is reductive: the result also depends on the model, the task, the tools, the policy and the eval loop. Small files are not a goal in themselves; cohesion matters more than size.

References: AGENTS.md — a vendor-neutral instruction file for coding agents

Generation quality = context quality. The context window is a finite budget with a falling marginal value: what goes into it is chosen, kept short and kept true, like any other scarce resource.

A model answers from what it was given plus what it learned in training; for your codebase, only the first part knows your conventions. More context is not monotonically better. Liu et al., “Lost in the Middle: How Language Models Use Long Contexts” (TACL, 2024), found that on multi-document question answering, accuracy was highest when the relevant passage sat at the start or end of the input and dropped when it sat in the middle — measured on the models of that time, but the lesson that position and noise matter has held up. Every irrelevant file in the window costs tokens, latency and attention.

Practices: one vendor-neutral canonical instruction file in the repository (AGENTS.md: project conventions as a machine-readable artifact), with tool-specific files such as CLAUDE.md reduced to thin adapters that point at it instead of copying it; task context delivered by retrieval from a repo structure that is friendly to it (small files, descriptive names, up-to-date module READMEs), not by multiplying instruction files. Every always-loaded instruction spends context in every session, and every copy is a future contradiction. For the first time, documentation has a consumer that actually reads it.

What to put in, and what not. In: what the code cannot tell — invariants, why a constraint exists (44), traps, the commands that verify a change. Out: what a command or the code already answers — file trees, API inventories — because it rots and then misleads with authority. A stale instruction is worse than none; review instruction files like code. The trade-off is against discoverability: too little and the agent rediscovers conventions by trial; too much and the rules that matter drown. Measure by outcome — fewer corrections per task — not by length.

Last technical review: 2026-08-04 · Reference · 112 principles