#Context Engineering
Articles about Context Engineering — exploring patterns, best practices, and real-world implementations in production systems.
19 posts tagged with context engineering. ← Blog home
The first memory problem every agent hits is the humblest: the conversation itself outgrows the window. Tool outputs pile up, reasoning accumulates, and somewhere past the first hour the agent must start forgetting parts of its own session — the only question is whether it forgets with judgment or at random. Compaction is where memory engineering starts, and it's harder than it looks because the thing doing the summarizing is the thing that needs the summary.
The strategy ladder — buffer, sliding window, selective eviction, compaction — and why the top rung needs engineering: a preservation contract for what survives verbatim, structured rolling summaries, boundary-triggered timing, and the architectural rule that compaction should demote to episodic storage, never delete.
Integrating context, specifications, and verification loops
Context, specifications, and verification loops composed into a single Go harness with one entry point — no path through it skips a discipline. The real execution flow and a real run, plus the honest wiring diagram: where the agent actually plugs in, and the artifact-compile gap that is the system's highest-leverage missing piece.
Every production agent has the same embarrassing failure mode: ask it to continue yesterday's work and it has no idea what you're talking about. The model that reasoned brilliantly for two hours retains nothing of those two hours. This is not a bug to patch but an architecture to build — memory is the system around the model, and designing it well is becoming the distinguishing skill of agent engineering. This series builds agent memory from first principles.
LLMs are stateless, and the context window is working memory — bounded, ephemeral, and unevenly attended — not memory. Forgetting costs re-work, broken user relationships, repeated mistakes, and drift, and no model upgrade fixes it: memory is the system around the model. Opens an 8-post series on building it.
The foundation that makes everything else work
Unconstrained agents improvise; context-engineered agents comply — demonstrated with a real A/B experiment on a live local model: the same HTTP-server prompt run with and without an ADR, both outputs compiled and compared verbatim. Plus the real context engine in Go: priority-ranked ADRs, specs, and code patterns assembled into every agent call, and the context-budget trade-off that shapes what fits.
Beyond unconstrained generation: building reliable AI-assisted development systems
Vibe coding generates code that works once; agentic engineering builds systems that work forever. This series introduces the five pillars — context engineering, specification engineering, AI-TDD verification loops, autonomy calibration, and security by design — all implemented in Go with production-ready patterns. Opens the series.
The single constraint that shapes every aspect of agent skill design is the context window — the finite amount of information an agent can hold and attend to at once. A skill that ignores this constraint bloats the agent's context, degrades its focus, and defeats its own purpose. Designing for the context window — loading only what is relevant, only when relevant, as compactly as possible — is the craft at the heart of good skills. This post is about that constraint and how it drives skill design.
The context window is the constraint that shapes every aspect of skill design. Why context is finite AND precious (more context degrades focus), the master principle — load only what's relevant, only when relevant, as compactly as possible — and why this makes skills beat big prompts.
A capable AI agent with no way to carry expertise between tasks relearns everything every time. Agent skills close that gap: reusable, self-contained packages of instructions, knowledge, and procedure that an agent loads when relevant, turning a general model into one that reliably does your specific work your specific way. This series is about designing, building, and deploying agent skills — and it starts with the gap they close and why it matters.
A capable agent with no way to carry expertise between tasks relearns everything every time. Agent skills close that gap — reusable, self-contained packages of instructions, knowledge, and procedure loaded on demand — turning a general model into a reliable specialist at your specific work.
Fixing a typo is one tool call; implementing a feature across a dozen files, with new tests and a migration, is a project. As coding tasks grow, a coding agent needs more than a tight edit-run loop — it needs to plan, decompose, track progress, and manage its own context over a long effort. This post is about how coding agents handle big, multi-step tasks, and why planning and decomposition are what let them tackle real work rather than just small edits.
Fixing a typo is one tool call; implementing a feature is a project. How coding agents handle big tasks: decompose into ordered subtasks, plan before acting, track progress, and manage context over a long effort — a hierarchical plan-plus-loop structure that scales from edits to real engineering, and benefits hugely from human direction.
A coding agent is only as good as its understanding of the code it's changing, and real codebases are enormous — far larger than any context window. The agent can't read everything, so it must find and load the right code for the task: navigate the repository, search for what's relevant, and build enough understanding to make correct changes. This grounding problem — understanding a large codebase through a small window — is where many coding-agent successes and failures are decided.
A coding agent is only as good as its understanding of the code it's changing, and codebases dwarf the context window. How agents find and understand the right code — search, navigation, strategic reading, repo conventions, semantic retrieval — and why most coding-agent failures are comprehension failures, so grounding is decisive.
Everything in this series — the budget, the system prompt, retrieval, memory, tools, and compaction — comes together as a pipeline that assembles the right window on every single turn, deliberately rather than by accident.
The budget, system prompt, retrieval, memory, tools, and compaction come together as a pipeline that assembles the right window on every turn — deliberately rather than by accident.
When context threatens to overflow, you compress it; and when you have a huge window to spend, you still should not fill it — because a long context is not used as well as a short, focused one.
When context threatens to overflow you compress it; and when you have a huge window you still should not fill it — because a long context is not used as well as a short, focused one.
The second-largest cost lever is almost embarrassingly simple: if no one is waiting on a response, run it in a batch for half off — and the discount is identical across all three major clouds, which makes it a safe architectural assumption. Then comes token hygiene, where the wins are real but one popular technique quietly costs more than it saves.
The second-largest cost lever is almost embarrassingly simple: if no one is waiting on a response, run it in a batch for half off — identical across all three major clouds. Then comes token hygiene, where one popular technique quietly costs more than it saves.
Tool definitions and structured data quietly consume a large share of the context budget, and how you select, describe, and format them shapes both what fits and how well the model uses it.
Tool definitions and structured data quietly consume a large share of the context budget, and how you select, describe, and format them shapes both what fits and how well the model uses it.
A conversation that never forgets eventually overflows, so managing what history an agent carries forward — and how it remembers across sessions — is one of the defining problems of context engineering.
A conversation that never forgets eventually overflows, so managing what history an agent carries forward — and how it remembers across sessions — is a defining problem of context engineering.
Since you pay for every input token, the fastest way to cut the cost of a call without changing the model is to send fewer tokens — and most production prompts are carrying far more than they need.
Since you pay for every input token, the fastest way to cut the cost of a call without changing the model is to send fewer tokens — and most production prompts carry far more than they need.
Retrieval is how you put external, current knowledge into a model's window, and doing it well is a context-engineering problem — the goal is not the most documents, but the right ones.
Retrieval is how you put external, current knowledge into a model's window, and doing it well is a context-engineering problem — the goal is not the most documents, but the right ones.
The system prompt is the one piece of context present on every single call, so how you structure its role, rules, and format is the highest-leverage writing in the whole system.
The system prompt is the one piece of context present on every call, so how you structure its role, rules, and format is the highest-leverage writing in the whole system.
Every token in the window costs money, adds latency, and competes for the model's attention, so the first skill of context engineering is treating context as a scarce budget to be spent deliberately.
Every token in the window costs money, adds latency, and competes for attention. The first skill of context engineering is treating context as a scarce budget to spend deliberately.
Prompt engineering was about wording a single instruction well; context engineering is the broader discipline of deciding everything a model sees at inference time — and for agents, it is the discipline that matters most.
Prompt engineering was about wording one instruction well; context engineering is the broader discipline of deciding everything a model sees at inference — and for agents it is the skill that matters most.
All posts on this site are written by Pratik Dhanave, an Agentic AI Architect with 7+ years building production distributed systems, multi-agent AI platforms, and cloud-native infrastructure. About the author → Each article includes working code, architecture diagrams, and references to the specific frameworks and standards discussed. Browse the blog or explore related topics using the tag cloud above.