← 开源
Meirtz

Awesome-Context-Engineering

🔥 Comprehensive survey on Context Engineering: from prompt engineering to production-grade AI systems. hundreds of papers, frameworks, and implementation guides for LLMs and AI agents.

ListsPaper collections
在 GitHub 打开
增长势头
+124 小时新增 Star+0.0%
3.33k
Star
295
Fork
+8
本周
20
贡献者
创建于 2025-07-02 · 更新于 2026-10-15 · 今日第 5019 名
主要开发者
README

Awesome Context Engineering

💬 Join Our Community

Join our WeChat group for discussions and updates!

Join our Discord server

📄 Our comprehensive survey paper on Context Engineering is now published! Check out our latest academic insights and theoretical foundations.

A comprehensive survey and collection of resources on Context Engineering - the evolution from static prompting to dynamic, context-aware AI systems, and increasingly to agent runtimes, memory systems, protocols, coding agents, and observability stacks.

📧 Contact

For questions, suggestions, or collaboration opportunities, please feel free to reach out:

Lingrui Mei
📧 Email: meilingrui25b@ict.ac.cn or meilingrui22@mails.ucas.ac.cn

I WROTE THE WRONG EMAIL ADDRESS IN THE FIRST VERSION OF MY PAPER!! You can also open an issue in this repository for general discussions and suggestions.


📰 News


🎯 Introduction

In the era of Large Language Models (LLMs), the limitations of static prompting have become increasingly apparent. Context Engineering represents the natural evolution to address LLM uncertainty and achieve production-grade AI deployment. Unlike traditional prompt engineering, context engineering encompasses the complete information payload provided to LLMs at inference time, including all structured informational components necessary for plausible task completion.

This repository serves as a comprehensive survey of context engineering techniques, methodologies, and applications.


🧭 2026 Agent Era Update

From Context Engineering to Agent Engineering

As of March 2026, context engineering remains a useful and necessary concept, but it is no longer the whole story. The center of gravity has shifted from "how to pack the best prompt" to how agent systems manage runtime state, memory, tools, protocols, approvals, and long-horizon execution. In practice, context engineering now sits inside a broader stack that also includes agent harnesses, interoperability protocols, project memory for coding agents, and trace-first observability.

What This Repository Now Covers

This repository still preserves its original survey structure on long context, RAG, memory, agent communication, tool use, evaluation, and applications. At the same time, this README is being reorganized to better reflect the agent era through additional coverage of:

  • Agent harnesses and runtime systems for planning, subagents, checkpoints, sandboxes, and human approval loops
  • Context management in production through compaction, caching, artifact-backed context, and scoped instruction loading
  • Memory artifacts and portability including persistent memory, memory interchange formats, persona packaging, and project memory
  • Open protocols such as MCP, A2A, AG-UI, ACP, and portable agent schemas
  • Coding agents and computer use as the most visible production setting for context engineering today
  • Evaluation, observability, and telemetry for long-running agent systems rather than only static benchmarks

Reading Guide for 2026 Topics

Readers primarily interested in the 2026 shift should jump to the expanded sections on:


📚 Table of Contents


🔗 Related Survey

General AI Survey Papers

A Survey of Large Language Models, Zhao et al.,

The Prompt Report: A Systematic Survey of Prompt Engineering Techniques, Schulhoff et al., A Systematic Survey of Prompt Engineering in Large Language Models: Techniques and Applications, Sahoo et al.,

A Systematic Survey of Prompt Engineering on Vision-Language Foundation Models, Gao et al.,

Context and Reasoning

A Survey on In-context Learning, Dong et al., The Mystery of In-Context Learning: A Comprehensive Survey on Interpretation and Analysis, Zhou et al., A Comprehensive Survey of Retrieval-Augmented Generation (RAG): Evolution, Current Landscape and Future Directions, Gupta et al.,

Retrieval-Augmented Generation for Large Language Models: A Survey, Gao et al., A Survey on Knowledge-Oriented Retrieval-Augmented Generation, Cheng et al.,

Memory Systems and Context Persistence

Survey

A Survey on the Memory Mechanism of Large Language Model based Agents, Zhang et al., Survey on Memory-Augmented Neural Networks: Cognitive Insights to AI Applications, Khosla et al.,

From Human Memory to AI Memory: A Survey on Memory Mechanisms in the Era of LLMs, Wu et al.,

Survey on Evaluation of LLM-based Agents, Anonymous et al.,

A Survey of Personalized Large Language Models: Progress and Future Directions, Anonymous et al.,

Agentic Retrieval-Augmented Generation: A Survey, Anonymous et al.,

Retrieval-Augmented Generation with Graphs (GraphRAG), Anonymous et al., The Landscape of Agentic Reinforcement Learning for LLMs: A Survey, Zhang et al.,

Benchmarks

Evaluating Very Long-Term Conversational Memory of LLM Agents (LOCOMO), Anonymous et al., Evaluating Memory in LLM Agents via Incremental Multi-Turn Interactions, Hu et al., Episodic Memories Generation and Evaluation Benchmark for Large Language Models, Anonymous et al.,

On the Structural Memory of LLM Agents, Anonymous et al.,

HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answering, Yang et al.,

Neural Memory Architectures

Neural Turing Machines, Graves et al.,

Differentiable Neural Computers, Graves et al., A Brain-inspired Memory Transformation based Differentiable Neural Computer, Anonymous et al.,

Differentiable Neural Computers with Memory Demon, Anonymous et al.,

Memory-Augmented Transformers

Memorizing Transformers, Wu et al.,

Recurrent Memory Transformer, Bulatov et al., Leave No Context Behind: Efficient Infinite Context Transformers with Infini-attention, Munkhdalai et al.,

Memformer: A Memory-Augmented Transformer for Sequence Modeling, Wu et al.,

Token Turing Machines, Ryoo et al.,

TransformerFAM: Feedback Attention is Working Memory, Irie et al.,

Production Memory Systems

MemGPT: Towards LLMs as Operating Systems, Packer et al., MemoryBank: Enhancing Large Language Models with Long-Term Memory, Zhong et al., MEM0: Building Production-Ready AI Agents with Scalable Long-Term Memory, Taranjeet et al., MEM1: Learning to Synergize Memory and Reasoning for Efficient Long-Horizon Agents, Anonymous et al., A-MEM: Agentic Memory for LLM Agents, Anonymous et al., MemAgent: Reshaping Long-Context LLM with Multi-Conv RL-based Memory Agent, Anonymous et al.,

Memory OS of AI Agent, Kang et al.,

Graph-based Memory Systems

arigraph: learning knowledge graph world models with episodic memory for llm agents, Anonymous et al.,

Zep: A Temporal Knowledge Graph Architecture for Agent Memory, Anonymous et al., KG-Agent: An Efficient Autonomous Agent Framework for Complex Reasoning over Knowledge Graph, Anonymous et al.,

GraphReader: Building Graph-based Agent to Enhance Long-Context Abilities of Large Language Models, Anonymous et al.,

From Local to Global: A GraphRAG Approach to Query-Focused Summarization, Edge et al., Knowledge Graph-Guided Retrieval Augmented Generation, Zhu et al.,

Episodic and Working Memory

Larimar: Large Language Models with Episodic Memory Control, Goyal et al.,

EM-LLM: Human-like Episodic Memory for Infinite Context LLMs, Anonymous et al., Large Language Models with Controllable Working Memory, Goyal et al.,

Empowering Working Memory for Large Language Model Agents, Anonymous et al.,

Conversational Memory

MemoChat: Tuning LLMs to Use Memos for Consistent Long-Range Open-Domain Conversation, Anonymous et al.,

Think-in-Memory: Recalling and Post-thinking Enable LLMs with Long-Term Memory, Anonymous et al.,

Generative Agents: Interactive Simulacra of Human Behavior, Park et al.,

Self-Controlled Memory Framework for Large Language Models, Anonymous et al.,

Foundational Survey Papers from Major Venues

AUTOPROMPT: Eliciting Knowledge from Language Models with Automatically Generated Prompts, Shin et al., The Power of Scale for Parameter-Efficient Prompt Tuning, Lester et al., Prefix-Tuning: Optimizing Continuous Prompts for Generation, Li et al., An Explanation of In-context Learning as Implicit Bayesian Inference, Xie et al., Rethinking the Role of Demonstrations: What Makes In-context Learning Work?, Min et al.,

Additional RAG and Retrieval Surveys

Retrieval-Augmented Generation for AI-Generated Content: A Survey, Various, Retrieval Augmented Generation (RAG) and Beyond: A Comprehensive Survey on How to Make your LLMs use External Data More Wisely, Various,

Large language models (LLMs): survey, technical frameworks, and future challenges, Various,


🏗️ Definition of Context Engineering

Context is not just the single prompt users send to an LLM. Context is the complete information payload provided to a LLM at inference time, encompassing all structured informational components that the model needs to plausibly accomplish a given task.

LLM Generation

To formally define Context Engineering, we must first mathematically characterize the LLM generation process. Let us model an LLM as a probabilistic function:

$$P(\text{output} | \text{context}) = \prod_{t=1}^T P(\text{token}_t | \text{previous tokens}, \text{context})$$

Where:

  • $\text{context}$ represents the complete input information provided to the LLM
  • $\text{output}$ represents the generated response sequence
  • $P(\text{token}_t | \text{previous tokens}, \text{context})$ is the probability of generating each token given the context

Definition of Context

In traditional prompt engineering, the context is treated as a simple string: $$\text{context} = \text{prompt}$$

However, in Context Engineering, we decompose the context into multiple structured components:

$$\text{context} = \text{Assemble}(\text{instructions}, \text{knowledge}, \text{tools}, \text{memory}, \text{state}, \text{query})$$

Where $\text{Assemble}$ is a context assembly function that orchestrates:

  • $\text{instructions}$: System prompts and rules
  • $\text{knowledge}$: Retrieved relevant information
  • $\text{tools}$: Available function definitions
  • $\text{memory}$: Conversation history and learned facts
  • $\text{state}$: Current world/user state
  • $\text{query}$: User's immediate request

Definition of Context Engineering

Context Engineering is formally defined as the optimization problem:

$$\text{Assemble}^* = \arg\max_{\text{Assemble}} \mathbb{E} [\text{Reward}(\text{LLM}(\text{context}), \text{target})]$$

Subject to constraints:

  • $|\text{context}| \leq \text{MaxTokens} \text{(context window limitation)}$
  • $\text{knowledge} = \text{Retrieve}(\text{query}, \text{database})$
  • $\text{memory} = \text{Select}(\text{history}, \text{query})$
  • $\text{state} = \text{Extract}(\text{world})$

Where:

  • $\text{Reward}$ measures the quality of generated responses
  • $\text{Retrieve}$, $\text{Select}$, $\text{Extract}$ are functions for information gathering

Dynamic Context Orchestration

The context assembly can be decomposed as:

$$\text{context} = \text{Concat}(\text{Format}(\text{instructions}), \text{Format}(\text{knowledge}), \text{Format}(\text{tools}), \text{Format}(\text{memory}), \text{Format}(\text{query}))$$

Where $\text{Format}$ represents component-specific structuring, and $\text{Concat}$ assembles them respecting token limits and optimal positioning.

Context Engineering is therefore the discipline of designing and optimizing these assembly and formatting functions to maximize task performance.

Mathematical Principles

From this formalization, we derive four fundamental principles:

  1. System-Level Optimization: Context generation is a multi-objective optimization problem over assembly functions, not simple string manipulation.

  2. Dynamic Adaptation: The context assembly function adapts to each $\text{query}$ and $\text{state}$ at inference time: $\text{Assemble}(\cdot | \text{query}, \text{state})$.

  3. Information-Theoretic Optimality: The retrieval function maximizes relevant information: $\text{Retrieve} = \arg\max \text{Relevance}(\text{knowledge}, \text{query})$.

  4. Structural Sensitivity: The formatting functions encode structure that aligns with LLM processing capabilities.

Theoretical Framework: Bayesian Context Inference

Context Engineering can be formalized within a Bayesian framework where the optimal context is inferred:

$$P(\text{context} | \text{query}, \text{history}, \text{world}) \propto P(\text{query} | \text{context}) \cdot P(\text{context} | \text{history}, \text{world})$$

Where:

  • $P(\text{query} | \text{context})$ models query-context compatibility
  • $P(\text{context} | \text{history}, \text{world})$ represents prior context probability

The optimal context assembly becomes:

$$\text{context}^* = \arg\max_{\text{context}} P(\text{answer} | \text{query}, \text{context}) \cdot P(\text{context} | \text{query}, \text{history}, \text{world})$$

This Bayesian formulation enables:

  • Uncertainty Quantification: Modeling confidence in context relevance
  • Adaptive Retrieval: Updating context beliefs based on feedback
  • Multi-step Reasoning: Maintaining context distributions across interactions

Comparison

Dimension Prompt Engineering Context Engineering
Mathematical Model $\text{context} = \text{prompt}$ (static) $\text{context} = \text{Assemble}(...)$ (dynamic)
Optimization Target $\arg\max_{\text{prompt}} P(\text{answer} \mid \text{query}, \text{prompt})$ $\arg\max_{\text{Assemble}} \mathbb{E}[\text{Reward}(...)]$
Complexity $O(1)$ context assembly $O(n)$ multi-component optimization
Information Theory Fixed information content Adaptive information maximization
State Management Stateless function Stateful with $\text{memory}(\text{history}, \text{query})$
Scalability Linear in prompt length Sublinear through compression/filtering
Error Analysis Manual prompt inspection Systematic evaluation of assembly components

🌐 Related Blogs

Social Media & Talks


🤔 Why Context Engineering?

The Paradigm Shift: From Tactical to Strategic

The evolution from prompt engineering to context engineering represents a fundamental maturation in AI system design. As influential figures like Andrej Karpathy, Tobi Lutke, and Simon Willison have argued, the term "prompt engineering" has been diluted to mean simply "typing things into a chatbot," failing to capture the complexity required for industrial-strength LLM applications.

1. Fundamental Challenges with Current Approaches

Human Intent Communication Challenges

  • Unclear Human Intent Expression: Human intentions are often unclear, incomplete, or ambiguous when expressed in natural language
  • AI's Incomplete Understanding of Human Intent: AI systems struggle to fully comprehend complex human intentions, especially those involving implicit context or cultural nuances
  • Overly Literal AI Interpretation: AI systems often interpret human instructions too literally, missing the underlying intent or contextual meaning

Complex Knowledge Requirements

Single models alone cannot solve complex problems that require:

  • (1) Large-scale External Knowledge: Vast amounts of external knowledge that exceed model capacity
  • (2) Accurate External Knowledge: Precise, up-to-date information that models may not possess
  • (3) Novel External Knowledge: Emerging knowledge that appears after model training

Static Knowledge Limitations:

  • Static Knowledge Problem: Pre-trained models contain static knowledge that becomes outdated
  • Knowledge Cutoff: Models cannot access information beyond their training data
  • Domain-Specific Gaps: Models lack specialized knowledge for specific industries or applications

Reliability and Trustworthiness Issues

  • AI Hallucination: LLMs generate plausible but factually incorrect information when lacking proper context
  • Lack of Provenance: Absence of clear source attribution for generated information
  • Confidence Calibration: Models often appear confident even when generating false information
  • Transparency Gaps: Inability to trace how conclusions were reached
  • Accountability Issues: Difficulty in verifying the reliability of AI-generated content

2. Limitations of Static Prompting

From Strings to Systems

Traditional prompting treats context as a static string, but enterprise applications require:

  • Dynamic Information Assembly: Context created on-the-fly, tailored to specific users and queries
  • Multi-Source Integration: Combining databases, APIs, documents, and real-time data
  • State Management: Maintaining conversation history, user preferences, and workflow status
  • Tool Orchestration: Coordinating external function calls and API interactions

The "Movie Production" Analogy

If prompt engineering is writing a single line of dialogue for an actor, context engineering is the entire process of building the set, designing lighting, providing detailed backstory, and directing the scene. The dialogue only achieves its intended impact because of the rich, carefully constructed environment surrounding it.

3. Enterprise and Production Requirements

Context Failures Are the New Bottleneck

Most failures in modern agentic systems are no longer attributable to core model reasoning capabilities but are instead "context failures". The true engineering challenge lies not in what question to ask, but in ensuring the model has all necessary background, data, tools, and memory to answer meaningfully and reliably.

Scalability Beyond Simple Tasks

While prompt engineering suffices for simple, self-contained tasks, it breaks down when scaled to:

  • Complex, multi-step applications
  • Data-rich enterprise environments
  • Stateful, long-running workflows
  • Multi-user, multi-tenant systems

Reliability and Consistency

Enterprise applications demand:

  • Deterministic Behavior: Predictable outputs across different contexts and users
  • Error Handling: Graceful degradation when information is incomplete or contradictory
  • Audit Trails: Transparency in how context influences model decisions
  • Compliance: Meeting regulatory requirements for data handling and decision making

Economic and Operational Efficiency

Context Engineering enables:

  • Cost Optimization: Strategic choice between RAG and long-context approaches
  • Latency Management: Efficient information retrieval and context assembly
  • Resource Utilization: Optimal use of finite context windows and computational resources
  • Maintenance Scalability: Systematic approaches to updating and managing knowledge bases

Context Engineering provides the architectural foundation for managing state, integrating diverse data sources, and maintaining coherence across these demanding scenarios.

4. Cognitive and Information Science Foundations

Artificial Embodiment

LLMs are essentially "brains in a vat" - powerful reasoning engines lacking connection to specific environments. Context Engineering provides:

  • Synthetic Sensory Systems: Retrieval mechanisms as artificial perception
  • Proxy Embodiment: Tool use as artificial action capabilities
  • Artificial Memory: Structured information storage and retrieval

Information Retrieval at Scale

Context Engineering addresses the fundamental challenge of information retrieval where the "user" is not human but an AI agent. This requires:

  • Semantic Understanding: Bridging the gap between intent and expression
  • Relevance Optimization: Ranking and filtering vast knowledge bases
  • Query Transformation: Converting ambiguous requests into precise retrieval operations

5. The Future of AI System Architecture

Context Engineering elevates AI development from a collection of "prompting tricks" to a rigorous discipline of systems architecture. It applies decades of knowledge in operating system design, memory management, and distributed systems to the unique challenges of LLM-based applications.

This discipline is foundational for unlocking the full potential of LLMs in production systems, enabling the transition from one-off text generation to autonomous agents and sophisticated AI copilots that can reliably operate in complex, dynamic environments.


🔧 Components, Techniques and Architectures

Context Scaling

Position Interpolation and Extension Techniques

Extending Context Window of Large Language Models via Position Interpolation, Chen et al., YaRN: Efficient Context Window Extension of Large Language Models, Peng et al., LongRoPE: Extending LLM Context Window Beyond 2 Million Tokens, Ding et al., LongRoPE2: Near-Lossless LLM Context Window Scaling, Shang et al.,

Memory-Efficient Attention Mechanisms

Fast Multipole Attention: A Divide-and-Conquer Attention Mechanism for Long Sequences, Kang et al., Leave No Context Behind: Efficient Infinite Context Transformers with Infini-attention, Munkhdalai et al., DuoAttention: Efficient Long-Context LLM Inference with Retrieval and Streaming Heads, Xiao et al., Star Attention: Efficient LLM Inference over Long Sequences, Acharya et al.,

Ultra-Long Sequence Processing (100K+ Tokens)

TokenSwift: Lossless Acceleration of Ultra Long Sequence Generation, Wu et al., LongHeads: Multi-Head Attention is Secretly a Long Context Processor, Lu et al., ∞Bench: Extending Long Context Evaluation Beyond 100K Tokens, Bai et al.,

Comprehensive Extension Surveys and Methods

Beyond the Limits: A Survey of Techniques to Extend the Context Length in Large Language Models, Various,

A Controlled Study on Long Context Extension and Generalization in LLMs, Various, Selective Attention: Enhancing Transformer through Principled Context Control, Various,

Vision-Language Models with Sophisticated Context Understanding

Towards LLM-Centric Multimodal Fusion: A Survey on Integration Strategies and Techniques, An et al.,

Browse and Concentrate: Comprehending Multimodal Content via Prior-LLM Context Fusion, Wang et al., V2PE: Improving Multimodal Long-Context Capability of Vision-Language Models with Variable Visual Position Encoding, Dai et al., Flamingo: a Visual Language Model for Few-Shot Learning, Alayrac et al., LensVLM: Selective Context Expansion for Compressed Visual Representation of Text, Xie et al.,

Audio-Visual Context Integration and Processing

Aligned Better, Listen Better for Audio-Visual Large Language Models, Guo et al.,

AVicuna: Audio-Visual LLM with Interleaver and Context-Boundary Alignment for Temporal Referential Dialogue, Chen et al.,

SonicVisionLM: Playing Sound with Vision Language Models, Xie et al., SAVEn-Vid: Synergistic Audio-Visual Integration for Enhanced Understanding in Long Video Context, Li et al.,

Multi-Modal Prompt Engineering and Context Design

CaMML: Context-Aware Multimodal Learner for Large Models, Chen et al.,

Visual In-Context Learning for Large Vision-Language Models, Zhou et al.,

CAMA: Enhancing Multimodal In-Context Learning with Context-Aware Modulated Attention, Li et al.,

CVPR 2024 Vision-Language Advances

CogAgent: A Visual Language Model for GUI Agents, Various, LISA: Reasoning Segmentation via Large Language Model, Various, Reproducible scaling laws for contrastive language-image learning, Various,

Video and Temporal Understanding

Video Understanding with Large Language Models: A Survey, Various,

Context Management in Production

In the agent era, context engineering increasingly means runtime context management rather than only prompt construction. Production systems now rely on compaction, caching, artifact-backed state, and scoped instruction loading to keep long-horizon agents efficient and controllable.

Runtime Context Management Patterns

OpenAI Agents Guide, OpenAI, OpenAI Tools: Conversation State, Prompt Caching, and Compaction, OpenAI, Google ADK: Context Caching and Context Compression, Google, Claude Code Memory and Scoped Project Instructions, Anthropic, LangChain Deep Agents: Filesystem-Based Context Management, LangChain,

Context Optimization Engines

Entroly: The Context Engineering Engine for AI Coding Agents — Information-theoretic context optimization — 78% fewer tokens, 100% codebase visibility, reinforcement learning, Rust engine (<10ms). MCP server + HTTP proxy. Works with Cursor, Claude Code, Copilot, OpenClaw.

Production Design Questions

When should state stay in the prompt versus move into files, memory stores, or external tools? How should long-running threads be compacted without losing provenance, instructions, or active plans? How should project rules be loaded conditionally by path, task, or subagent instead of globally? How should prompt caching be combined with memory writes and retrieval freshness?

Structured Data Integration

Knowledge Graph-Enhanced Language Models

Learn Together: Joint Multitask Finetuning of Pretrained KG-enhanced LLM for Downstream Tasks, Martynova et al., Knowledge Graph Tuning: Real-time Large Language Model Personalization based on Human Feedback, Sun et al.,

Knowledge Graph-Guided Retrieval Augmented Generation, Zhu et al., KGLA: Knowledge Graph Enhanced Language Agents for Customer Service, Anonymous et al.,

Graph Neural Networks Combined with Language Models

Are Large Language Models In-Context Graph Learners?, Li et al., Let's Ask GNN: Empowering Large Language Model for Graph In-Context Learning, Hu et al., GL-Fusion: Rethinking the Combination of Graph Neural Network and Large Language model, Yang et al.,

NT-LLM: A Novel Node Tokenizer for Integrating Graph Structure into Large Language Models, Ji et al.,

Structured Data Integration

CoddLLM: Empowering Large Language Models for Data Analytics, Authors et al.,

Structure-Guided Large Language Models for Text-to-SQL Generation, Authors et al.,

StructuredRAG: JSON Response Formatting with Large Language Models, Authors et al.,

Foundational KG-LLM Integration Methods

Unifying Large Language Models and Knowledge Graphs: A Roadmap, Various, Combining Knowledge Graphs and Large Language Models, Various,

All Against Some: Efficient Integration of Large Language Models for Message Passing in Graph Neural Networks, Various,

Large Language Models for Graph Learning, Various,

Self-Generated Context

Self-Supervised Context Generation and Augmentation

SelfCite: Self-Supervised Alignment for Context Attribution in Large Language Models, Chuang et al., Self-Supervised Prompt Optimization, Xiang et al., SCOPE: A Self-supervised Framework for Improving Faithfulness in Conditional Text Generation, Duong et al.,

Reasoning Models That Generate Their Own Context

Self-Consistency Improves Chain of Thought Reasoning in Language Models, Wang et al.,

Tree of Thoughts: Deliberate Problem Solving with Large Language Models, Yao et al., Rethinking Chain-of-Thought from the Perspective of Self-Training, Wu et al., Autonomous Tree-search Ability of Large Language Models, Authors et al.,

Iterative Context Refinement and Self-Improvement

Self-Refine: Iterative Refinement with Self-Feedback, Madaan et al., Reflect, Retry, Reward: Self-Improving LLMs via Reinforcement Learning, Authors et al.,

Large Language Models Can Self-Improve in Long-context Reasoning, Li et al., Code Generation with AlphaCodium: From Prompt Engineering to Flow Engineering, Oren et al.,

Language Agent Tree Search Unifies Reasoning Acting and Planning in Language Models, Zhou et al.,

Meta-Learning and Autonomous Context Evolution

Meta-in-context learning in large language models, Coda-Forno et al.,

EvoPrompt: Connecting LLMs with Evolutionary Algorithms Yields Powerful Prompt Optimizers, Guo et al., AutoPDL: Automatic Prompt Optimization for LLM Agents, Spiess et al.,

Agent-Pro: Learning to Evolve Coder Agents via Proposal-based Programming, Zhang et al.,

Foundational Chain-of-Thought Research

Chain-of-thought prompting elicits reasoning in large language models, Wei et al.,


🛠️ Implementation and Challenges

0. Agent Harnesses and Runtime Systems

In 2026, many of the most important advances in context engineering no longer live only inside the prompt. They live inside the agent harness: the runtime loop that manages plans, subagents, checkpoints, files, approvals, tool execution, and recovery from failure. This is where context engineering becomes agent engineering.

Harness and Runtime Design References

Building Effective Agents, Anthropic, OpenAI Agents Guide, OpenAI, Google Agent Development Kit (ADK), Google, LangChain Deep Agents Overview, LangChain, Microsoft Agent Framework Overview, Microsoft, Bring Your AI — Local-first Claude Code to Codex harness mover for rules, skills, MCP config, and validation notes.

Core Runtime Concerns

Planning and decomposition: how long tasks are split into manageable units Durable execution: how agent state is checkpointed, resumed, or replayed Context isolation: how subagents and tools avoid polluting each other's working state Sandboxing and artifacts: how file systems, shells, browsers, and outputs become part of the context pipeline Human approvals and interrupts: how production agents remain controllable during risky or long-running actions

1. Retrieval-Augmented Generation (RAG)

survey

Retrieval-Augmented Generation for Large Language Models: A Survey, Yunfan Gao et al.,

A Survey of Graph Retrieval-Augmented Generation for Customized Large Language Models, Siyun Zhao et al.,

Retrieval Augmented Generation (RAG) and Beyond: A Comprehensive Survey on How to Make your LLMs use External Data More Wisely, Siyun Zhao et al.,

Evaluation of Retrieval-Augmented Generation: A Survey, Hao Yu et al.,

Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks, Lewis et al., A Survey on Knowledge-Oriented Retrieval-Augmented Generation, Cheng et al., A Survey on RAG Meeting LLMs: Towards Retrieval-Augmented Large Language Models, Ding et al.,

Naive RAG

Beyond the Limits: A Survey of Techniques to Extend the Context Length in Large Language Models, Xindi Wang et al.,

In-context Examples Selection for Machine Translation, Sweta Agrawal et al.,

In Defense of RAG in the Era of Long-Context Language Models, Tan Yu et al.,

Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks, Patrick Lewis et al.,

LightRAG: Simple and Fast Retrieval-Augmented Generation, Zirui Guo et al.,

Generate rather than Retrieve: Large Language Models are Strong Context Generators, Wenhao Yu et al.,

Large language models can be easily distracted by irrelevant context, Freda Shi et al.,

Old IR Methods Meet RAG, Oz Huly et al.

Dense Passage Retrieval for Open-Domain Question Answering, Vladimir Karpukhin et al.,

Advanced RAG

Adaptive-RAG: Learning to Adapt Retrieval-Augmented Large Language Models through Question Complexity, Soyeong Jeong et al.,

Improving language models by retrieving from trillions of tokens, Sebastian Borgeaud et al.,

FoRAG: Factuality-optimized Retrieval Augmented Generation for Web-enhanced Long-form Question Answering, Tianchi Cai et al.

IM-RAG: Multi-Round Retrieval-Augmented Generation Through Learning Inner Monologues, Diji Yang et al.,

RAGCache: Efficient Knowledge Caching for Retrieval-Augmented Generation, Chao Jin et al.,

Corrective Retrieval Augmented Generation, Shi-Qi Yan et al.,

RankRAG: Unifying Context Ranking with Retrieval-Augmented Generation in LLMs, Yue Yu et al.,

Astute RAG: Overcoming Imperfect Retrieval Augmentation and Knowledge Conflicts for Large Language Models, Fei Wang et al.,

Learning to Filter Context for Retrieval-Augmented Generation, Zhiruo Wang et al.,

Query Rewriting in Retrieval-Augmented Large Language Models, Xinbei Ma et al.,

UPRISE: Universal Prompt Retrieval for Improving Zero-Shot Evaluation, Daixuan Cheng et al.,

Longllmlingua: Accelerating and enhancing llms in long context scenarios via prompt compression, Huiqiang Jiang et al.,

Document-level event argument extraction by conditional generation, Sha Li et al.,

Multi-sentence Argument Linking, Seth Ebner et al.,

Fine-tuning or retrieval? comparing knowledge injection in llms, Oded Ovadia et al.,

IAG: Induction-Augmented Generation Framework for Answering Reasoning Questions, Zhebin Zhang et al.,

Retrieval Meets Long Context Large Language Models, Peng Xu et al.,

Dense x retrieval: What retrieval granularity should we use?, Tong Chen et al.,

Investigating the Factual Knowledge Boundary of Large Language Models with Retrieval Augmentation, Ruiyang Ren et al.,

The Power of Noise: Redefining Retrieval for RAG Systems, Florin Cuconasu et al.,

RECITATION-AUGMENTED LANGUAGE MODELS, Zhiqing Sun et al.,

Robust Retrieval Augmented Generation for Zero-shot Slot Filling, Michael Glass et al.,

In-Context Retrieval-Augmented Language Models, Ori Ram et al.,

Learning to Retrieve In-Context Examples for Large Language Models, Liang Wang et al.,

Modular RAG

FlashRAG: A Modular Toolkit for Efficient Retrieval-Augmented Generation Research, Jiajie Jin et al.,

Multi-Head RAG: Solving Multi-Aspect Problems with LLMs, Maciej Besta et al.,

StructRAG: Boosting Knowledge Intensive Reasoning of LLMs via Inference-time Hybrid Information Structurization, Zhuoqun Li et al.,

RAFT: Adapting Language Model to Domain Specific RAG, Tianjun Zhang et al.,

Retrieval-Generation Alignment for End-to-End Task-Oriented Dialogue System, Weizhou Shen et al.,

UniMS-RAG: A Unified Multi-source Retrieval-Augmented Generation for Personalized Dialogue Systems, Hongru Wang et al.,

Retrieve-and-Sample: Document-level Event Argument Extraction via Hybrid Retrieval Augmentation, Yubing Ren et al.

RA-DIT: RETRIEVAL-AUGMENTED DUAL INSTRUCTION TUNING, Xi Victoria Lin et al.,

Self-Knowledge Guided Retrieval Augmentation for Large Language Models, Yile Wang et al.,

Prompt-Guided Retrieval Augmentation for Non-Knowledge-Intensive Tasks, Zhicheng Guo et al.,

REPLUG: Retrieval-Augmented Black-Box Language Models, Weijia Shi et al.,

Query Rewriting for Retrieval-Augmented Large Language Models, Xinbei Ma et al.,

Lift Yourself Up: Retrieval-augmented Text Generation with Self-Memory, Xin Cheng et al.,

Improving the Domain Adaptation of Retrieval Augmented Generation (RAG) Models for Open Domain Question Answering, Shamane Siriwardhana et al.,

Graph-Based RAG

Don't Forget to Connect! Improving RAG with Graph-based Reranking, Jialin Dong et al.,

From Local to Global: A Graph RAG Approach to Query-Focused Summarization, Darren Edge et al.,

GRAG: Graph Retrieval-Augmented Generation, Yuntong Hu et al.,

Iseeq: Information seeking question generation using dynamic meta-information retrieval and knowledge graphs, Manas Gaur et al.,

G-retriever: Retrieval-augmented generation for textual graph understanding and question answering, Xiaoxin He et al.,

Knowledge graph prompting for multi-document question answering, Yu Wang et al.,

GNN-RAG: Graph Neural Retrieval for Large Language Model Reasoning, Costas Mavromatis et al.,

LightPROF: A Lightweight Reasoning Framework for Large Language Model on Knowledge Graph

Simple Is Effective: The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation

Knowledge Graph-Guided Retrieval Augmented Generation

MedRAG: Enhancing Retrieval-augmented Generation with Knowledge Graph-Elicited Reasoning for Healthcare Copilot

Mitigating Large Language Model Hallucinations via Autonomous Knowledge Graph-based Retrofitting, KGR et al.,

In-depth Analysis of Graph-based RAG in a Unified Framework

RAPTOR: Recursive Abstractive Processing for Tree-Organized Retrieval, Parth Sarthi et al.,

TableRAG: Million-Token Table Understanding with Language Models, Si-An Chen et al.,

KAG: Boosting LLMs in Professional Domains via Knowledge Augmented Generation, Lei Liang et al.,

GFM-RAG: Graph Foundation Model for Retrieval Augmented Generation, Luo et al., HybridRAG: A Hybrid Retrieval System for RAG Combining Vector and Graph Search, Sarabesh,

Agentic RAG

From RAG to Memory: Non-Parametric Continual Learning for Large Language Models, Bernal Jiménez Gutiérrez et al.,

HippoRAG: Neurobiologically Inspired Long-Term Memory for Large Language Models, Bernal Jiménez Gutiérrez et al.,

GraphReader: Building Graph-based Agent to Enhance Long-Context Abilities of Large Language Models, Shilong Li et al.,

PlanRAG: A Plan-then-Retrieval Augmented Generation for Generative Large Language Models as Decision Makers, Myeonghwa Lee et al.,

Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection, Akari Asai et al.,

DeepRAG: Thinking to Retrieve Step by Step for Large Language Models, Xinyan Guan et al.,

Paperqa: Retrieval-augmented generative agent for scientific research, Jakub Lála et al.,

Large Language Models as Source Planner for Personalized Knowledge-grounded Dialogues, Hongru Wang et al.,

PRCA: Fitting Black-Box Large Language Models for Retrieval Question Answering via Pluggable Reward-Driven Contextual Adapter, Haoyan Yang et al.,

SELF-RAG: LEARNING TO RETRIEVE, GENERATE, AND CRITIQUE THROUGH SELF-REFLECTION, Akari Asai et al.,

RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Horizon Generation, Zihao Wang et al.,

Chain-of-verification reduces hallucination in large language models, Shehzaad Dhuliawala et al.,

HM-RAG: Hierarchical Multi-Agent Multimodal Retrieval Augmented Generation, Liu et al., MultiHop-RAG: Benchmarking Retrieval-Augmented Generation for Multi-Hop Queries, Tang & Yang, MMOA-RAG: Improving Retrieval-Augmented Generation through Multi-Agent Reinforcement Learning, Chen et al., Search-in-the-Chain: Towards Accurate, Credible, and Up-to-Date Large Language Models, Menick et al.,

Real-Time and Streaming RAG

StreamingRAG: Real-time Contextual Retrieval and Generation Framework, Sankaradas et al., Multi-task Retriever Fine-tuning for Domain-Specific and Efficient RAG, Authors,

2. Memory Systems

Runtime Memory Design Patterns

Modern memory systems are no longer a single retrieval store. Production agents increasingly separate:

  • Session / thread state for active work in progress
  • Long-term semantic memory for user or project facts
  • Episodic memory for trajectories, past actions, and reusable experiences
  • Procedural memory for learned workflows, instructions, and stable operating preferences

Memory Design References

LangGraph Memory Overview, LangChain, Letta Memory Blocks, Letta, Claude Code Memory, Anthropic,

Project Memory and Instruction Artifacts

Coding agents have made project memory concrete. In practice, memory now often lives in artifacts such as repository instruction files, scoped rules, reusable skills, and long-lived project notes rather than only in vector stores.

Project Memory References

Introducing Codex, OpenAI, Claude Code Memory, Anthropic, Claude Code Subagents, Anthropic, LangChain Deep Agents Overview, LangChain,

Persistent Memory Architecture

MemGPT: Towards LLMs as Operating Systems, Packer et al., Mem0: Building Production-Ready AI Agents with Scalable Long-Term Memory, Taranjeet et al., MemoryLLM: Towards Self-Updatable Large Language Models, Wang et al., Infinite-LLM: Efficient LLM Service for Long Context with DistAttention and Distributed KVCache, Anonymous et al.,

Memory-Augmented Generative Adversarial Transformers, Anonymous et al.,

Memory Interchange Standards

PAM (Portable AI Memory): An Open Interchange Format for AI User Memories, Daniel Gines,

Memory-Augmented Neural Networks

Survey on Memory-Augmented Neural Networks: Cognitive Insights to AI Applications, Khosla et al.,

A Machine with Short-Term, Episodic, and Semantic Memory Systems, Kim et al., From Human Memory to AI Memory: A Survey on Memory Mechanisms in the Era of LLMs, Wu et al.,

Episodic Memory and Context Persistence

The Role of Memory in LLMs: Persistent Context for Smarter Conversations, Porcu,

Episodic Memory in AI Agents Poses Risks that Should Be Studied and Mitigated, Christiano et al.,

Larimar: Large Language Models with Episodic Memory Control, Goyal et al.,

EM-LLM: Human-like Episodic Memory for Infinite Context LLMs, Anonymous et al., Large Language Models with Controllable Working Memory, Goyal et al.,

Empowering Working Memory for Large Language Model Agents, Anonymous et al.,

Continual Learning and Memory Consolidation

Prediction Error-Driven Memory Consolidation for Continual Learning, Anonymous et al.,

Overcoming Catastrophic Forgetting in Continual Learning by Exploring Eigenvalues of Hessian Matrix, Anonymous et al.,

Probabilistic Metaplasticity for Continual Learning with Memristors in Spiking Networks, Anonymous et al.,

Conversational Memory

MemoChat: Tuning LLMs to Use Memos for Consistent Long-Range Open-Domain Conversation, Anonymous et al.,

Think-in-Memory: Recalling and Post-thinking Enable LLMs with Long-Term Memory, Anonymous et al.,

Generative Agents: Interactive Simulacra of Human Behavior, Park et al.,

Self-Controlled Memory Framework for Large Language Models, Anonymous et al.,

Personalization and Memory

Personalized LLM Response Generation with Parameterized User Memory Injection, Anonymous et al.,

Soul-Driven Interaction Design: A Position Paper on Declarative Persona Specifications for AI Agents, Lee,

Soul Spec — Open Specification for AI Agent Persona Packages, ClawSouls, <a href="https://github.com/clawsouls/soul-spec-mcp" target="_