What is context engineering?

Andrej Karpathy, who helped popularize the term, describes it as "the delicate art and science of filling the context window with just the right information for the next step." It grew out of prompt engineering. A prompt is one input. Context engineering covers everything the model sees: system instructions, the conversation so far, files and documents pulled in by retrieval, the results of tool calls, and memory carried between sessions.

Context engineering vs prompt engineering

Prompt engineering is about how you phrase a request. Context engineering is about what information sits around that request, and it matters more as agents run longer tasks with many tool calls. A well-written prompt can't make up for a missing fact.

The main parts of an agent's context

  • Instructions: system prompts and rules files such as CLAUDE.md or AGENTS.md.
  • Retrieved knowledge: documents or code fetched for the task, often through retrieval-augmented generation.
  • Tool results: what the agent gets back from tools, often connected over the Model Context Protocol.
  • Memory and history: what earlier steps produced and what's worth keeping.

Context engineering for coding agents

For an AI coding agent, most context comes from the repository it's working in. The gap is everything outside it: the jobs, services and dashboards in other repositories that read the tables and columns the agent is about to change. Rules files can tell the agent to check, but they can't list those consumers. A context graph built from source code can, and the agent can query it over MCP. Read more about context engineering for AI coding agents.

Related terms

AI coding agent · Model Context Protocol (MCP) · Context graph · Context layer · Retrieval-augmented generation

FAQ

Is context engineering the same as RAG?

No. RAG is one technique for adding retrieved documents to context. Context engineering covers every source of context, including tools and instructions.

Why does context engineering matter for coding agents?

Because agents act on what they see. If the context leaves out what depends on the code, the agent can't account for it.

code snippet <goes here>
<style>.horizontal-trigger {height: calc(100% - 100vh);}</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.8.0/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.8.0/ScrollTrigger.min.js"></script>
<script>
// © Code by T.RICKS, https://www.timothyricks.com/
// Copyright 2021, T.RICKS, All rights reserved.
// You have the license to use this code in your projects but not to redistribute it to others
gsap.registerPlugin(ScrollTrigger);
let horizontalItem = $(".horizontal-item");
let horizontalSection = $(".horizontal-section");
let moveDistance;
function calculateScroll() {
 // Desktop
 let itemsInView = 3;
 let scrollSpeed = 1.2;  if (window.matchMedia("(max-width: 479px)").matches) {
   // Mobile Portrait
   itemsInView = 1;
   scrollSpeed = 1.2;
 } else if (window.matchMedia("(max-width: 767px)").matches) {
   // Mobile Landscape
   itemsInView = 1;
   scrollSpeed = 1.2;
 } else if (window.matchMedia("(max-width: 991px)").matches) {
   // Tablet
   itemsInView = 2;
   scrollSpeed = 1.2;
 }
 let moveAmount = horizontalItem.length - itemsInView;
 let minHeight =
   scrollSpeed * horizontalItem.outerWidth() * horizontalItem.length;
 if (moveAmount <= 0) {
   moveAmount = 0;
   minHeight = 0;
   // horizontalSection.css('height', '100vh');
 } else {
   horizontalSection.css("height", "200vh");
 }
 moveDistance = horizontalItem.outerWidth() * moveAmount;
 horizontalSection.css("min-height", minHeight + "px");
}
calculateScroll();
window.onresize = function () {
 calculateScroll();
};let tl = gsap.timeline({
 scrollTrigger: {
   trigger: ".horizontal-trigger",
   // trigger element - viewport
   start: "top top",
   end: "bottom top",
   invalidateOnRefresh: true,
   scrub: 1
 }
});
tl.to(".horizontal-section .list", {
 x: () => -moveDistance,
 duration: 1
});
</script>

Give Your Coding Agents the Context Outside the Repo

Request a demo to see how Foundational shows an agent what depends on the code it changes.

Give Your Coding Agents the Context Outside the Repo

Request a demo to see how Foundational shows an agent what depends on the code it changes.

Give Your Coding Agents the Context Outside the Repo

Request a demo to see how Foundational shows an agent what depends on the code it changes.

Share this post

Governance that starts at the source.