We treat context engineering as part of engineering operations. The goal is to help AI coding agents find the right codebase context retrieval path, spend context budget on useful evidence, and hand off changes in a form humans can review.
Write repo instructions as working constraints.
Large codebases need a short source of truth for agent behavior. It should name the test commands, package managers, architecture boundaries, generated files, migration rules, review expectations, and files the agent should avoid changing.
The owner is usually the engineering team that owns the repository. The output is a maintained instruction file that answers the first questions an engineer would ask before making a change.
Spend context budget on evidence.
Context engineering starts with choosing what the agent reads. Useful inputs include the target file, nearby tests, shared interfaces, call sites, error logs, product requirements, and recent commits that explain current behavior.
The failure mode is easy to spot. The agent edits from a narrow view, misses a caller, and breaks behavior outside the file it touched. Good code retrieval makes hidden dependencies visible before implementation.
Use maps for dependencies and ownership.
Dependency maps help agents understand where changes travel. They can show package boundaries, API consumers, database tables, job queues, feature flags, and services that share a contract.
Ownership maps are just as useful. They tell the agent when a change needs review from platform, data, security, product, or infrastructure. That prevents quiet edits to code with a wider blast radius.
Keep stale docs out of the critical path.
Old docs can be worse than missing docs because agents tend to follow them confidently. Teams should label deprecated instructions, remove obsolete setup steps, and connect docs to the tests or systems that prove they still apply.
Every agent task should end with a definition of done. That can include passing tests, screenshots, schema checks, lint results, manual verification, migration notes, and a clear PR handoff for the human reviewer.
Make the right context easier to find than the wrong context.