Context Engineering
[WIP] Context engineering: the art and science of shaping context-aware AI systems
Install / Use
/learn @bonigarcia/Context EngineeringQuality Score
Category
Development & EngineeringSupported Platforms
README
Context engineering 
Context engineering can be defined as the practice of designing systems that provide a Large Language Model (LLM) with all the necessary information to complete a task effectively. It goes beyond prompt engineering since it focuses on building a comprehensive and structured context from various sources like system instructions, external knowledge, memory, tools, and state. The central idea is that the success of a complex LLM-based system depends more on the quality and completeness of the context provided than on the specific wording of the prompt itself.
Tobi Lütke, the CEO of Shopify, coined the term context engineering in a tweet on June 19, 2025. He defined context engineering as the art of providing all the context for the task to be plausibly solvable by the LLM. This novel concept captures the essence of the current evolution of LLM-based systems, inspiring others (like me) to understand and define this emerging engineering discipline. Since then, I've been working on a book entitled Context engineering: the art and science of shaping context-aware AI systems, to be published by Manning in 2026.
This GitHub repository is intended to be a companion resource for this book and a go-to reference for practitioners looking to understand and adopt the context engineering principles.
Warning: This repository is a work in progress, so content and structure may change.
Table of contents
This book aims to provide a strong, general-purpose theoretical foundation for context engineering, supported by hands-on examples. Its table of contents is the following:
- Introduction to context engineering
- System instructions and user prompts
- Retrieval and external knowledge
- Tools and memory for AI agents
- State and multi-agent systems
- Context management and evaluation
- Context in AI frameworks
- Context engineering in real-world environments
- Context engineering through the software development lifecycle
- State of the art on context engineering
Appendix A. The AI ecosystem
Appendix B. References and further reading
Each chapter of this book starts by explaining the underlying principles and patterns of each thematic block. Then, the final part of each chapter is devoted to presenting specific examples. This GitHub repository contains all these examples. Moreover, I will include new examples and maintain the existing ones even after the book is published. The goal is to provide an open-source, updated reference for everyone interested in context engineering.
Online tool
This repo also hosts the context-aware prompt builder, an online tool presented in chapter 2 for designing, comparing, and reusing structured prompts across multiple frameworks and AI models.
Resources
Although the concept of context engineering is new, the underlying technologies (LLMs, AI agents, prompt engineering, RAG, MCP, memory management, etc.) have been developed over the years. Nevertheless, summarizing all these converging technologies and tools in a single book is a very challenging task. As you know, nowadays there is more information than ever, and it is very easy to get lost with so many sources. This section summarizes some of the most relevant references and resources I found during my journey to unravel the essence of context engineering.
Context Engineering
- The rise of "context engineering" (LangChain, Jun 23, 2025) Overview of context engineering as an emerging essential skill for AI engineers building dynamic, tool-using systems.
- Context Engineering (LangChain, Jul 02, 2025) Breakdown of strategies (write, select, compress, isolate) for filling an agent's context window with only the most relevant information at each step.
- From Vibe Coding to Context Engineering: A Blueprint for Production-Grade GenAI Systems (Sundeep Teki, Jul 07, 2025) Ad-hoc vibe coding doesn't scale and proposing context engineering as a disciplined approach for production-grade GenAI systems.
- What is Context Engineering: Clearly Explained (Ashley Goolam, Jul 09, 2025) Introduction of context components (instructions, history, tools, external data) and why high-quality context is often more important than model size.
- Context Engineering: Bringing Engineering Discipline to Prompts (Addy Osmani, Jul 13, 2025) Explanation of context engineering as providing models with structured, complete context-beyond prompt tweaking to increase reliability.
- The AI Skeptic's Guide to Context Windows (Rizel Scarlett, Aug 18, 2025) Critical look at the limitations of LLM context windows and how context engineering mitigates overload, noise, and degradation.
- Context Engineering - Making Every Token Count (Addy Osmani, Sep 09, 2025) Talk about how to structure and manage context for AI systems to produce better, more reliable outputs.
- Effective context engineering for AI agents (Anthropic, Sep 29, 2025) Introduction about context engineering, i.e., carefully curating and limiting what information an AI agent sees.
- Context Engineering Guide (PromptingGuide.ai, 2025) Guide defining context engineering as architecting and optimizing all information fed into an LLM to improve output quality and reduce errors.
- Context Engineering – Short-Term Memory Management with Sessions from OpenAI Agents SDK (OpenAI, 2025) Practical demonstration of managing short-term memory using sessions, showing how structured context improves coherence in multi-step agent interactions.
- Context Engineering: Sessions, Memory (Kimberly Milam et al., 2025) Whitepaper describing how to engineer session and long-term memory to support reliable, stateful AI agents.
- The Context Engineering Guide (Weaviate, 2025) Guide explaining how to design, structure, and optimize context for LLM applications, including chunking, retrieval, memory, and agent workflows.
Prompt Engineering
- Prompt Engineering (Lee Boonstra, 2025) Overview of prompt engineering principles and methods aimed at helping developers construct effective prompts for LLMs.
- Prompt Engineering Guide (PromptingGuide.ai, 2025) Guide that defines prompt engineering as a discipline for designing and optimizing prompts to make LLMs perform better on diverse tasks, offering techniques, references, and best practices.
- The Prompt Engineering Playbook for Programmers (Addy Osmani, 2025) Practical playbook targeting programmers, giving structured guidelines and patterns for writing prompts that yield consistent and reliable outputs from AI.
- Anthropic's Prompt Engineering Interactive Tutorial (Anthropic, 2025) Hands-on tutorial that walks users step-by-step through designing and refining prompts (with exercises and example-based practice) to get better results from their models.
- Meta's prompt engineering guide (Meta, 2025) Guide describing how to craft prompts for their models, covering best practices to structure instructions, context, and examples for improved performance.
- Google's Gemini prompt engineering guide (Google, 2025) How to write effective prompts for Google's Gemini (or related models), emphasizing clarity, context, and structured prompting for reliable responses.
- Prompt examples, by OpenAI (OpenAI, 2025) Collection of sample prompts illustrating good practices and giving real-world examples to help users understand how to frame prompts effectively for best results.
- Prompt Library, by Anthropic (Anthropic, 2025) Repository of tested prompt templates and examples, serving as a practical library for users to build on and adapt for their own AI tasks.
AI Agents
- Introduction to Agents, by Alan Blount et al. (Alan Blount et al., 2025) Definition of agent as a complete application, combining LLM reasoning, tooling and orchestration that plans and acts autonomously rather than just responding to single prompts.
- What are AI Agents? Why do they matter? (Addy Osmani, 2025) Explanation that AI agents are programs that use language models and tools to perform goal-driven tasks, emphasizing their importance for automating complex workflows.
- Agents Companion, by Antonio Gulli et al. (Antonio Gulli et al., 2025) Whitepaper presenting production-grade considerations for agents: orchestration, memory, evaluation,
