Dictionary
Context engineering
The practice of deliberately assembling what an AI coding assistant knows, relevant files, docs, constraints, and conventions, so its output matches your project's reality instead of generic best guesses.
Context engineering is the unglamorous skill behind good AI-assisted coding: deciding what the model gets to see. An AI assistant with your repo's conventions, the relevant modules, and your constraints will write code that fits. The same assistant with no context writes generic code that looks right and integrates poorly.
What good context looks like
- The files being changed, plus the ones they depend on
- Project conventions (a
CLAUDE.md,AGENTS.md, contributing guide, or style doc) - Constraints stated plainly: "no new dependencies," "must stay under 100ms," "follow the existing error-handling pattern"
- Relevant docs or API references, not the entire documentation site
The principle is curation, not volume. Dumping your entire repository into the context window is the opposite of context engineering, it's context flooding. Models handle large contexts better than they used to, but attention still dilutes. The skill is selecting the 5% of your codebase that determines whether the output is right.
Why it matters more than prompting
Most "the AI wrote bad code" stories are actually "the AI was given bad context" stories. Prompting tricks fade in importance as models improve; context quality doesn't. The developers getting the best results from AI tools in 2026 aren't better prompters, they're better curators of what the model knows.
This has a practical consequence: context engineering compounds. A well-maintained CLAUDE.md improves every session, for every developer on the team, forever. A clever prompt helps once. Invest accordingly.
The layers of context
Think of context in layers, from most to least durable. Project context lives in files like CLAUDE.md, stack, architecture, conventions, gotchas. It changes rarely and benefits everyone. Task context is what you attach to a specific request: the relevant files, the error message, the ticket. Session context is the conversation history itself, what you've already tried, what didn't work. Good context engineering manages all three deliberately instead of leaving them to chance.
Most teams only do the middle layer, and only implicitly. The biggest wins come from the first layer: writing down the things every new hire (human or AI) needs to know, in a file the tools read automatically.
Anti-patterns
Context files fail in predictable ways, and a stale context file is worse than none, because the agent follows it confidently.
- Stale context. The file describes the architecture you had last year. The agent dutifully applies patterns you migrated away from, and every output needs the same corrections. Review the file whenever the architecture changes; treat it like code, because the agent does.
- Contradictions. Two files, or two sections of one file, instruct opposite things (one says "always add tests," another says "skip tests for prototypes," with no scoping). The agent picks whichever it read last. Resolve conflicts explicitly and scope rules to the situations they govern.
- The everything file. Eight hundred lines covering every tool, team, and edge case. Attention dilutes, maintenance stops, and the file becomes the stale-context problem at scale. Keep the canonical file tight, and let it point to deeper docs instead of containing them.
- Secrets and noise. Credentials, internal URLs, and personal data do not belong in context files. They get committed, copied, and sent to model providers. Context is for conventions, not keys.
How you know it's working
Good context engineering shows up in boring metrics: fewer corrective prompts per task, a higher share of agent diffs accepted without structural changes, and the agent citing your conventions unprompted ("following the service-layer pattern from the context file"). When those signals move, the file is earning its keep. When they don't, the fix is almost never a better prompt. It's a better file.
The craft angle
Context engineering is just good engineering communication, applied to a new colleague who happens to be a language model. Write down your conventions. Keep docs current. Make the codebase explain itself. Everything that helps a human onboarding helps the AI too, which is a convenient excuse to finally do the documentation you've been postponing.
There's a deeper point here: the discipline of explaining your project to an AI forces you to articulate things that were previously tribal knowledge. Teams that do this well often report that the humans benefit as much as the models. The context file becomes the onboarding doc you always meant to write.
Related terms
- Agentic coding
A workflow where an AI coding agent plans and executes multi-step software changes, editing files, running commands, and iterating, with a human supervising rather than typing.
- Vibe coding
Writing software by describing what you want to an AI in natural language, accepting its output with minimal review, and iterating on vibes rather than specifications.