awesome-context-engineering

skill
Security Audit
Warn
Health Pass
  • License — License: CC0-1.0
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Community trust — 107 GitHub stars
Code Warn
  • Code scan incomplete — No supported source files were scanned during light audit
Permissions Pass
  • Permissions — No dangerous permissions requested

No AI report is available for this listing yet.

SUMMARY

A curated collection of resources, papers, tools, and best practices for Context Engineering in AI agents and Large Language Models (LLMs).

README.md

Awesome Context Engineering

Awesome
GitHub stars
GitHub forks

A curated collection of resources, papers, tools, and best practices for Context Engineering in AI agents and Large Language Models (LLMs).

Context engineering is the art and science of filling the context window with just the right information at each step of an agent's trajectory.

中文版本 | English

📚 Table of Contents

What is Context Engineering?

Context Engineering is the systematic optimization of information payloads for Large Language Models (LLMs). It encompasses:

  • Context Retrieval & Generation: Selecting and creating relevant information
  • Context Processing: Organizing and structuring context for optimal consumption
  • Context Management: Handling context windows, memory, and state across interactions
  • Context Compression: Reducing token usage while preserving essential information
  • Context Isolation: Separating concerns across different context spaces

📖 Featured Articles

Context Rot: How Increasing Input Tokens Impacts LLM Performance

Manus Context Engineering

Context Engineering for AI Agents: Lessons from Building Manus

Key insights from building a production AI agent:

  • Design around KV-Cache for performance optimization
  • Mask, don't remove tools for better action selection
  • Use file system as external context memory
  • Manipulate attention through recitation techniques

Claude Code Best Practices

Claude Code Best Practices

Anthropic / Claude

LangChain Context Engineering

Context Engineering for Agents

Comprehensive guide covering four key strategies:

  • Write Context: Saving information outside context window
  • Select Context: Pulling relevant information into context
  • Compress Context: Retaining only necessary tokens
  • Isolate Context: Splitting context across different spaces

dbreunig Context Engineering Series

How Long Contexts Fail and How to Fix Them

Deep dive into context failure modes and management strategies:

  • Context poisoning, distraction, confusion, and clash patterns
  • RAG, tool loadout, context quarantine, pruning, summarization, and offloading techniques

Advanced Context Engineering for Coding Agents

Guide for using AI to solve hard problems in complex codebases.

Don't Build Multi-Agents (Cognition)

Principles for building reliable agents: share full context and avoid fragile parallel multi-agent architectures.

📑 Research Papers

Survey Papers

A Survey of Context Engineering for Large Language Models

  • 📄 arXiv: 2507.13334
  • 📊 Comprehensive analysis of 1400+ research papers
  • 🎯 Establishes formal taxonomy of context engineering components

The performance of Large Language Models (LLMs) is fundamentally determined by the contextual information provided during inference. This survey introduces Context Engineering, a formal discipline that transcends simple prompt design to encompass the systematic optimization of information payloads for LLMs.

Core Research Areas

🛠️ Tools & Projects

Comprehensive Resources

  1. Awesome Context Engineering Survey

    • Comprehensive survey of context engineering techniques
    • Methodologies and applications overview
    • Academic research focus
  2. Context Engineering Intro

    • Practical guide for AI coding assistants
    • Claude Code centered approach
    • Hands-on implementation strategies

Development Frameworks

  • LangGraph: Low-level orchestration framework for context management
  • LangSmith: Agent tracing and evaluation platform
  • LangMem: Memory management abstractions

Memory & Compression

  • Letta (MemGPT): Framework for building stateful agents with long-term memory
  • Mem0: Memory layer for AI agents and assistants
  • LLMLingua: Prompt compression for accelerated and cost-efficient LLM inference

Production Tools

  • Claude Code: Auto-compact context management
  • ChatGPT: Long-term cross-session memory
  • Cursor: Rules-based context engineering
  • Windsurf: Advanced code context retrieval

💡 Expert Insights

Industry Leaders

Andrej Karpathy (OpenAI)

+1 for "context engineering" over "prompt engineering".

People associate prompts with short task descriptions you'd give an LLM in your day-to-day use. When in every industrial-strength LLM app, context engineering is the delicate art and science of filling the context window with just the right information for the next step. Science because doing this right involves task descriptions and explanations, few shot examples, RAG, related (possibly multimodal) data, tools, state and history, compacting... Too little or of the wrong form and the LLM doesn't have the right context for optimal performance. Too much or too irrelevant and the LLM costs might go up and performance might come down. Doing this well is highly non-trivial. And art because of the guiding intuition around LLM psychology of people spirits.

On top of context engineering itself, an LLM app has to:
- break up problems just right into control flows
- pack the context windows just right
- dispatch calls to LLMs of the right kind and capability
- handle generation-verification UIUX flows
- a lot more - guardrails, security, evals, parallelism, prefetching, ...

So context engineering is just one small piece of an emerging thick layer of non-trivial software that coordinates individual LLM calls (and a lot more) into full LLM apps. The term "ChatGPT wrapper" is tired and really, really wrong.

Key Principles

  1. KV-Cache Optimization: Design for cache hit rates to reduce latency and cost
  2. Append-Only Context: Avoid modifying previous context to maintain cache validity
  3. External Memory: Use file systems and databases as extended context storage
  4. Error Preservation: Keep failure traces for model learning and adaptation
  5. Diversity Over Uniformity: Avoid repetitive patterns that lead to model drift

🔗 Model Context Protocol (MCP)

Context7 MCP Server

Up-to-date code documentation for LLMs and AI code editors

  • 🔗 Repository: upstash/context7
  • 🎯 Real-time code context for development workflows
  • 🚀 Integration with popular AI coding assistants

MCP Ecosystem

🤝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

How to Contribute

  1. Add Resources: Submit papers, tools, or articles related to context engineering
  2. Improve Translations: Help translate content to different languages
  3. Share Insights: Contribute expert opinions and best practices
  4. Report Issues: Help us maintain accuracy and relevance

Contribution Categories

  • 📄 Research Papers
  • 🛠️ Tools & Libraries
  • 📖 Articles & Tutorials
  • 💡 Expert Insights
  • 🔧 Implementation Examples
  • 🌐 Translations

⭐ Star History

Star History Chart

📄 License

This project is licensed under the CC0 1.0.

🙏 Acknowledgments

Special thanks to all contributors and the research community advancing the field of context engineering.


Maintained by: yzfly | 云中江树(微信公众号: 云中江树)

If you find this repository helpful, please consider giving it a ⭐!

Reviews (0)

No results found