An agent can have the right information but still make the wrong decision. For instance, it may never find the architecture decision that governs the service it's changing. Or, it might read a policy without capturing the exception that qualifies it. It could follow an instruction that was true six months ago or lose the one detail that mattered when its history was compressed to fit.
Failures such as these occur at different points in what's called the context development lifecycle, and each needs a different intervention. Context engineering is the set of practices for constructing and then managing that lifecycle; it's the discipline that helps us make interventions. It's also becoming more cohesive: we've shifted from prompting to curating and organizing knowledge, from single calls to dynamic, multi-step agentic workflow, and, now, from individual craft to organizational assets. This is clear evidence of its value in modern software engineering.
However, focusing on the context development lifecycle as the part beneath context engineering is important as it helps us better identify risks and challenges and then take proactive steps to address them. In this piece, I want to present the lifecycle as four stages:
- Design and create
- Discover and retrieve
- Manage context at runtime
- Evaluate and improve
Each one is important and, as I'll demonstrate, are all reflected in a number of the technologies featured in volume 35 of the Thoughtworks Technology Radar.
Design and create
Goal: Define the relevant knowledge for an agent, create context as a team.
This stage is probably the hardest part across the context development lifecycle. A coding agent may need source code, project instruction, architecture decision records, business context, decision and design. A customer support agent may need product documentation, account history and support policies. Some of the relevant knowledge will already exist, but even if it does, it's likely to be scattered across systems, wikis, tickets and repositories. Some of it will be held in people's heads, and people come and go. Subsequently, defining and creating useful context and knowledge is a process that needs to be revisited regularly.
Different kinds of context
Knowing the type or kind of context you're dealing with is important. In a recent talk, Birgitta Böckeler categorized context into two categories: codified and ambient. Take coding agents as an example. Here, codified context includes things like AGENTS.md, agent skills, architecture decision records or system records. These are often version controlled, have clear ownership and are highly reusable across different scenarios. Ambient context, by contrast, refers to things like meeting notes and Slack discussions; these lack clear ownership and organization and often relate to highly specific situations.
Codified contexts are today usually maintained as instructions and harnesses. For software engineering, instead of individually crafted instructions and harnesses, we see a growing adoption of curated shared instructions for software teams and a trend in building enterprise harnesses. The key thing here is the growing awareness of team level ownership and active maintenance. When instructions and harnesses are used by a team on a daily basis, there's an increased need for maintenance but there are also more opportunities to do it.
While codified context are usually instructions specific to one repository, directory or workflow, ambient context is often a crucial detail or decision that may shape what an agent actually does, but which escaped easy codification. The challenge with ambient context is it can emanate from anywhere; no one owns it and it's not being maintained. While there is no easy fix for this, a number of Thoughtworks teams have found agent-maintained knowledge bases to be useful.
The pattern involves an agent reading raw source material without changing it, then creating and maintaining a linked collection of plain-text notes under a defined schema. Product managers, designers, developers and their agents can then consult the same connected knowledge base instead of maintaining separate personal collections. The agent can also organize and update notes as sources change.
Context quality matters
It's possible to use AI to generate context, codified and ambient. However, teams often fall into a trap of blindly trusting what AI generates; this causes ambient context drift from reality, and can lead to codified context context and context overload. It's important to check whether anything is missing, incorrect or out of date. On the latest edition of the Technology Radar, we advocate for harness quality evaluation, which can help address these issues.
Discover and retrieve
Goal: Make context discoverable and accessible in a context window friendly manner.
From MCP to progressive context disclosure
When MCP came out, it gave agents a standard way to connect to external tools, and conveniently it can be used for context discovery and retrieving. A coding agent can reach a ticketing system, query documentation or inspect a database through a common protocol. But when harness loads all tool definitions by default, this approach creates a problem: loading every tool definition and reference upfront consumes the context window before useful work begins.
Agent skills illustrate how discovery can be separated from loading. A database migration skill, for example, can make the team’s migration workflow discoverable without adding its full procedure to every coding conversation. Skills can also guide the use of tools exposed through MCP: access to a capability and guidance on using it work together.
This is the broader principle behind progressive context disclosure: start with essential context and enough information to discover what else is available, then load detail as the task develops. The principle is just-in-time procurement. A convention that applies to one directory should arrive when the agent enters that directory, not on every call. A schema should arrive when something needs to be written to that table, not when the session opens. A policy should arrive when the agent is about to make a decision the policy governs, not at the start of a conversation that may never reach it.
Context graphs
How knowledge is represented matters as much as whether it is reachable. A context graph links decisions, policies, exceptions, evidence and outcomes, so an agent can retrieve the reasoning behind a decision as well as the decision itself. That’s a different shape of retrieval from a search over chunks. A chunk can tell the agent what a policy says. A graph can tell it that the policy has an exception, that the exception was granted for a specific case, and that a later decision superseded it.
Graph-grounded codebase reasoning applies relationship-based retrieval to code. By following connections between callers, interfaces and implementations, an agent can retrieve focused context and identify dependencies that text search may miss, therefore help improve answer quality and reduce token usage. Graph grounded codebase reasoning is particularly good with large codebases, but sometimes coding agent native search can perform better, teams should evaluate whether the added graph structure improves accuracy and total cost on their own codebases.
Manage context at runtime
Goal: Keep the working context concise and useful during agent execution as tasks change.
Although context windows are growing, they remain limited. As an agent works, tool outputs, retrieved documents and conversation history accumulate, leaving less room for new information and making relevant details harder to attend to. Managing context at runtime means continually deciding what to retain, summarize or set aside as the task changes. The goal is to preserve the decisions, constraints and evidence needed for the next step, while keeping a way to retrieve details that are no longer in the window.
Compression
Compression is an important technique in this stage, it reduces what an agent has to carry forward. But there are three important moves in compression that are often conflated by teams. Our observation is compression can be easily misused, causing more problems than it solves.
The first move of compression is trimming at the boundary: selecting fields from a tool response, truncating a log, summarising a test run before it enters the window. The original response can remain where it was produced. The second move is pruning after use: removing old results once they have served their purpose, while keeping a way to retrieve the originals if the agent needs them again. The third move is compaction: summarising decisions, progress and open questions, then starting a fresh context window.
Naive context compression, in Caution, is the pattern that describes the failure modes of these moves. Trimming tool output too aggressively can remove details the agent later needs, forcing another retrieval that costs more than the tokens saved. Pruning and compaction history can also reduce prompt cache reuse, so a shorter prompt can cost more if reduced cache reuse outweighs the token savings. Generating summaries adds its own cost, in tokens and in latency. The useful measure is not the size of the compressed context, it is whether compression improves the whole task, including accuracy and total cost.
Keeping intermediate work out of context
Some work should never reach the main context at all. The subagents for better context management patterns is one way of doing that. A specialist agent can explore a narrow question in its own context and return a distilled result. The main agent receives the finding without carrying every file read, retry and intermediate tool result.
Subagents reduce the main agent’s context, but doesn’t necessarily reduce total work for the model or cost. Programmatic tool calling, on the other hand, is similar to subagent but takes a different approach. Instead of the model calling a tool, pulling the output into the window and reasoning over it, the model writes code that calls the tools and returns a result. The intermediate results are processed in an execution environment without being added to the model’s context. The context window sees the answer, not the transcript.
Evaluate and improve
Goal: Evaluate and measure context lifecycle practices end-to-end and using runtime feedback to improve persistent assets and harnesses.
Runtime gives you visibility
Context profiling makes context use visible by showing where tokens are spent, from file reads to tool calls. For coding agents, getting started can be straightforward: many expose session histories or traces, letting teams inspect what the agent loaded, which tools it called and where repeated work occurred. Reviewing a session is an accessible first step before investing in dedicated profiling tools. Combined with token usage, cache behavior and model pricing, these observations help teams identify worthwhile changes. Comparing sessions on similar tasks before and after a change also helps verify whether it actually helped to either lower total cost, or perform less repeated retrieval, or has better task quality.
The improvement loop
Feedback flywheel suggests using agent successes and failures to improve the harness. Self-improving harness attempts to make the process self driven: examine traces and corrections, suggest changes to persistent assets, test those changes against real or replayed tasks, and retain the ones that improve future work.
The improvement loop is where organizational ownership becomes unavoidable. Feedback from agent sessions can only be useful if someone is responsible for reviewing it, deciding what to change and following through. Without that ownership, useful observations remain in individual conversations and the same problems recur. A named owner and a regular review cadence help make the loop an ongoing practice, with changes tested and maintained over time.
Realizing that context has a lifecycle changes what counts as the work that needs to be done.
Realizing that context has a lifecycle changes what counts as the work that needs to be done.
Context engineering as operational capability
The techniques discussed here aren't particularly new or novel. Selection, retrieval, skills, compaction and feedback are well-established phases. What is emerging, though, is the discipline of managing how these things interact over time: creating trustworthy context, delivering it when it is useful, measuring its effect and improving what the next agent inherits.
Realizing that context has a lifecycle changes what counts as the work that needs to be done. While prompt writing is a craft practised at the point of use, context engineering is more than just a technique; it's also an operational capability: a knowledge supply chain, a retrieval layer, a runtime policy, an evaluation suite and a feedback loop. Each one should have an owner and a standard.
It also changes the unit of improvement. The question is no longer whether one prompt performed well, but instead whether the system's context got better — whether the next run inherits a more accurate picture of the organization than the last one did.
That’s why context is becoming an organizational asset.