{"id":93766,"url":"https://github.com/yzfly/awesome-context-engineering","name":"awesome-context-engineering","description":"A curated collection of resources, papers, tools, and best practices for Context Engineering in AI agents and Large Language Models (LLMs).","projects_count":67,"last_synced_at":"2026-07-01T01:00:32.631Z","repository":{"id":306861047,"uuid":"1027450759","full_name":"yzfly/awesome-context-engineering","owner":"yzfly","description":"A curated collection of resources, papers, tools, and best practices for Context Engineering in AI agents and Large Language Models (LLMs).","archived":false,"fork":false,"pushed_at":"2026-06-29T22:08:00.000Z","size":1989,"stargazers_count":109,"open_issues_count":16,"forks_count":20,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-30T00:08:50.094Z","etag":null,"topics":["awesome-context","awesome-context-engineering","claude","claude-code","context-engineering","manus","prompt-engineering","prompt-engineering-techniques"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yzfly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-28T03:13:11.000Z","updated_at":"2026-06-29T22:08:04.000Z","dependencies_parsed_at":"2025-11-22T14:04:25.739Z","dependency_job_id":null,"html_url":"https://github.com/yzfly/awesome-context-engineering","commit_stats":null,"previous_names":["yzfly/context-engineering"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yzfly/awesome-context-engineering","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzfly%2Fawesome-context-engineering","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzfly%2Fawesome-context-engineering/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzfly%2Fawesome-context-engineering/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzfly%2Fawesome-context-engineering/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yzfly","download_url":"https://codeload.github.com/yzfly/awesome-context-engineering/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzfly%2Fawesome-context-engineering/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34988714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-30T02:00:05.919Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"created_at":"2025-08-30T13:37:50.575Z","updated_at":"2026-07-01T01:00:32.631Z","primary_language":null,"list_of_lists":false,"displayable":true,"categories":["📑 Research Papers","🙏 Acknowledgments","🛠️ Tools \u0026 Projects","📖 Featured Articles","🔗 Model Context Protocol (MCP)","⭐ Star History"],"sub_categories":["Core Research Areas","Contribution Categories","Comprehensive Resources","Memory \u0026 Compression","Advanced Context Engineering for Coding Agents","Development Frameworks","MCP Ecosystem","Context7 MCP Server","Context Engineering Systems \u0026 Kits","Claude Code Best Practices","Survey Papers","LangChain Context Engineering","Don't Build Multi-Agents (Cognition)","Manus Context Engineering","dbreunig Context Engineering Series","Anthropic / Claude"],"readme":"# Awesome Context Engineering\n\n[![Awesome](https://awesome.re/badge.svg)](https://awesome.re)\n[![GitHub stars](https://img.shields.io/github/stars/yzfly/awesome-context-engineering.svg?style=social\u0026label=Star)](https://github.com/yzfly/awesome-context-engineering)\n[![GitHub forks](https://img.shields.io/github/forks/yzfly/awesome-context-engineering.svg?style=social\u0026label=Fork)](https://github.com/yzfly/awesome-context-engineering)\n\nA curated collection of resources, papers, tools, and best practices for **Context Engineering** in AI agents and Large Language Models (LLMs).\n\n\u003e 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. \n\n[中文版本](README_CN.md) | [English](README.md)\n\n## 📚 Table of Contents\n\n- [What is Context Engineering?](#what-is-context-engineering)\n- [Featured Articles](#featured-articles)\n- [Research Papers](#research-papers)\n- [Tools \u0026 Projects](#tools--projects)\n- [Expert Insights](#expert-insights)\n- [Model Context Protocol (MCP)](#model-context-protocol-mcp)\n- [Contributing](#contributing)\n- [Star History](#star-history)\n\n## What is Context Engineering?\n\nContext Engineering is the systematic optimization of information payloads for Large Language Models (LLMs). It encompasses:\n\n- **Context Retrieval \u0026 Generation**: Selecting and creating relevant information\n- **Context Processing**: Organizing and structuring context for optimal consumption\n- **Context Management**: Handling context windows, memory, and state across interactions\n- **Context Compression**: Reducing token usage while preserving essential information\n- **Context Isolation**: Separating concerns across different context spaces\n\n## 📖 Featured Articles\n\n### Context Rot: How Increasing Input Tokens Impacts LLM Performance\n- https://research.trychroma.com/context-rot\n\n### Manus Context Engineering\n**Context Engineering for AI Agents: Lessons from Building Manus**\n- 📄 Original: [Manus Blog](https://manus.im/blog/Context-Engineering-for-AI-Agents-Lessons-from-Building-Manus)\n- 🇨🇳 Chinese Translation: [docs/manus/AI智能体的Context工程：构建Manus的经验教训.md](docs/manus/AI智能体的Context工程：构建Manus的经验教训.md)\n\nKey insights from building a production AI agent:\n- Design around KV-Cache for performance optimization\n- Mask, don't remove tools for better action selection\n- Use file system as external context memory\n- Manipulate attention through recitation techniques\n\n### Claude Code Best Practices\n**Claude Code Best Practices**\n- 📄 Original: [Anthropic Engineering](https://www.anthropic.com/engineering/claude-code-best-practices)\n- 🇨🇳 Chinese Translation: [docs/claudecode/claude-code-best-practices-zh.md](docs/claudecode/claude-code-best-practices-zh.md)\n\n### Anthropic / Claude\n\n- [Effective context engineering for AI agents](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents)\n- [AI智能体的有效上下文工程](docs/claudecode/effective-context-engineering-for-ai-agents.md)\n- [Context editing and the memory tool](https://www.anthropic.com/news/context-management)\n\n\n### LangChain Context Engineering\n**Context Engineering for Agents**\n- 📄 Original: [LangChain Blog](https://blog.langchain.com/context-engineering-for-agents/)\n- 🇨🇳 Chinese Translation: [智能体的Context工程-中文版](docs/langchain/智能体的Context工程-中文版.md)\n\nComprehensive guide covering four key strategies:\n- **Write Context**: Saving information outside context window\n- **Select Context**: Pulling relevant information into context\n- **Compress Context**: Retaining only necessary tokens\n- **Isolate Context**: Splitting context across different spaces\n\n### dbreunig Context Engineering Series\n**How Long Contexts Fail and How to Fix Them**\n- 📄 Original Part 1: [How Long Contexts Fail](https://www.dbreunig.com/2025/06/22/how-contexts-fail-and-how-to-fix-them.html)\n- 🇨🇳 Chinese Translation: [长上下文的失效原理及解决方案](docs/dbreunig/长上下文的失效原理及解决方案.md)\n- 📄 Original Part 2: [How to Fix Your Context](https://www.dbreunig.com/2025/06/26/how-to-fix-your-context.html)\n- 🇨🇳 Chinese Translation: [上下文修复的实用指南](docs/dbreunig/上下文修复的实用指南.md)\n\nDeep dive into context failure modes and management strategies:\n- Context poisoning, distraction, confusion, and clash patterns\n- RAG, tool loadout, context quarantine, pruning, summarization, and offloading techniques\n\n### Advanced Context Engineering for Coding Agents\n\n- [GitHub](https://github.com/humanlayer/humanlayer)\n- [YouTube](https://humanlayer.dev/youtube)\n\nGuide for using AI to solve hard problems in complex codebases.\n\n### Don't Build Multi-Agents (Cognition)\n\n- 📄 Original: [Cognition Blog](https://cognition.ai/blog/dont-build-multi-agents)\n\nPrinciples for building reliable agents: share full context and avoid fragile parallel multi-agent architectures.\n\n## 📑 Research Papers\n\n### Survey Papers\n\n**A Survey of Context Engineering for Large Language Models**\n- 📄 arXiv: [2507.13334](https://arxiv.org/abs/2507.13334)\n- 📊 Comprehensive analysis of 1400+ research papers\n- 🎯 Establishes formal taxonomy of context engineering components\n\n\u003e *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.*\n\n### Core Research Areas\n\n- **Memory Systems**: [Reflexion](https://arxiv.org/abs/2303.11366), [Generative Agents](https://ar5iv.labs.arxiv.org/html/2304.03442)\n- **Retrieval-Augmented Generation**: [RAG Survey](https://github.com/langchain-ai/rag-from-scratch)\n- **Tool Integration**: [Tool Selection](https://arxiv.org/abs/2410.14594), [BigTool](https://arxiv.org/abs/2505.03275)\n- **Context Compression**: [Recursive Summarization](https://arxiv.org/pdf/2308.15022), [Context Pruning](https://arxiv.org/abs/2501.16214)\n- **Long-Context Limitations**: [Lost in the Middle](https://arxiv.org/abs/2307.03172)\n\n## 🛠️ Tools \u0026 Projects\n\n### Comprehensive Resources\n\n1. **[Prompt Engineering Guide](https://github.com/dair-ai/Prompt-Engineering-Guide)**\n   - Comprehensive guide to prompt engineering, context engineering, RAG, and AI agents\n   - Covers techniques, papers, tools, and best practices\n   - Widely-used educational resource\n\n2. **[Awesome Context Engineering Survey](https://github.com/Meirtz/Awesome-Context-Engineering)**\n   - Comprehensive survey of context engineering techniques\n   - Methodologies and applications overview\n   - Academic research focus\n\n3. **[Context Engineering Intro](https://github.com/coleam00/context-engineering-intro)**\n   - Practical guide for AI coding assistants\n   - Claude Code centered approach\n   - Hands-on implementation strategies\n\n4. **[Context-Engineering (davidkimai)](https://github.com/davidkimai/Context-Engineering)**\n   - First-principles handbook for context engineering\n   - From foundations to advanced techniques\n\n5. **[Context-Engineering (jasontang-ai)](https://github.com/jasontang-ai/Context-Engineering)**\n   - Karpathy-inspired first-principles handbook\n   - From prompt engineering toward context design, orchestration, and optimization\n\n6. **[The Context Course (HuggingFace)](https://github.com/huggingface/context-course)**\n   - HuggingFace course on context engineering for code agents\n   - Covers skills, MCP, plugins, subagents, hooks, and building your own agent\n   - Reference agents: Claude Code, Codex, OpenCode\n\n7. **[Agent Systems Handbook](https://github.com/Prompthon-IO/agent-systems-handbook)**\n   - Practical AI agents handbook covering agentic workflows and multi-agent architecture\n   - Spans LangGraph, MCP/A2A, context engineering, agent memory, evaluation, and observability\n\n### Context Engineering Systems \u0026 Kits\n\n- **[Prompt Engineering Guide](https://github.com/dair-ai/Prompt-Engineering-Guide)** ⭐76.1k: Comprehensive guide and resources for prompt engineering, context engineering, RAG, and AI agents\n- **[get-shit-done (GSD)](https://github.com/gsd-build/get-shit-done)** ⭐64.5k: Meta-prompting, context engineering and spec-driven development system for Claude Code\n- **[Agent Skills for Context Engineering](https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering)** ⭐16.7k: Collection of Agent Skills for context engineering and multi-agent architectures\n- **[Context Engineering Intro](https://github.com/coleam00/context-engineering-intro)** ⭐13.5k: Context engineering introduction and methodology for AI coding assistants\n- **[Context-Engineering (jasontang-ai)](https://github.com/jasontang-ai/Context-Engineering)** ⭐9.1k: Karpathy-inspired first-principles handbook for context engineering\n- **[GSD-2](https://github.com/gsd-build/gsd-2)** ⭐7.7k: Meta-prompting / context engineering system enabling long-running autonomous agent work\n- **[MineContext](https://github.com/volcengine/MineContext)** ⭐5.4k: Volcengine's proactive, context-aware AI companion\n- **[Awesome-Context-Engineering (Meirtz)](https://github.com/Meirtz/Awesome-Context-Engineering)** ⭐3.2k: Comprehensive survey of context engineering\n- **[how-claude-code-works](https://github.com/Windy3f3f3f3f/how-claude-code-works)** ⭐2.7k: Deep dive into Claude Code source: architecture, agent loop, and context engineering\n- **[pro-workflow](https://github.com/rohitg00/pro-workflow)** ⭐2.3k: Self-correcting memory Claude Code workflow, including context engineering\n- **[Advanced Context Engineering for Coding Agents](https://github.com/humanlayer/advanced-context-engineering-for-coding-agents)** ⭐1.7k: Advanced context engineering techniques for coding agents\n- **[Context Engineering Kit](https://github.com/NeoLabHQ/context-engineering-kit)** ⭐1.2k: A context engineering skills toolkit\n- **[ACE (Agentic Context Engineering)](https://github.com/ace-agent/ace)** ⭐1.2k: Evolving language agents through agentic context engineering (ACE)\n- **[Practical Guide to Context Engineering](https://github.com/WakeUp-Jin/Practical-Guide-to-Context-Engineering)** ⭐708: A practical, hands-on guide (in Chinese) to context engineering for LLM applications\n- **[get-shit-done (GSD)](https://github.com/gsd-build/get-shit-done)**: Meta-prompting and spec-driven development / context engineering system for Claude Code\n- **[GSD-2](https://github.com/gsd-build/gsd-2)**: Meta-prompting / context engineering system enabling long-running autonomous agent work\n- **[how-claude-code-works](https://github.com/Windy3f3f3f3f/how-claude-code-works)**: Deep dive into Claude Code source: architecture, agent loop, and context engineering\n- **[Agent Skills for Context Engineering](https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering)**: Collection of Agent Skills for context engineering and multi-agent architectures\n- **[Advanced Context Engineering for Coding Agents](https://github.com/humanlayer/advanced-context-engineering-for-coding-agents)**: Advanced context engineering techniques for coding agents\n- **[ACE (Agentic Context Engineering)](https://github.com/ace-agent/ace)**: Evolving language agents through agentic context engineering\n- **[Context Engineering Kit](https://github.com/NeoLabHQ/context-engineering-kit)**: A toolkit for context engineering\n- **[MineContext](https://github.com/volcengine/MineContext)**: Volcengine's proactive, context-aware AI companion\n- **[pro-workflow](https://github.com/rohitg00/pro-workflow)**: Self-correcting memory system that lets Claude Code learn from its mistakes, covering context engineering, parallel worktrees, agent teams, and 17 skills\n- **[kit](https://github.com/cased/kit)**: Context engineering toolkit for AI dev tools, providing codebase mapping, symbol extraction, and code search\n- **[RepoPrompt CE](https://github.com/repoprompt/repoprompt-ce)**: Community edition of RepoPrompt, a native macOS context engineering app for AI coding agents, with an MCP CLI\n- **[context-engineering (outcomeops)](https://github.com/outcomeops/context-engineering)**: Working reference implementation of context engineering with five components (corpus, retrieval, injection, output, enforcement), running end-to-end on Amazon Bedrock\n- **[Project Context Records (PCR)](https://github.com/hyf0/project-context-records)**: A context-engineering methodology that keeps a durable, repo-versioned archive of a project's meta-context (the why, architecture, and maintainer decisions) so AI collaborators inherit its judgment instead of re-deriving it\n- **[interview-prep-template](https://github.com/AbhiK189/interview-prep-template)**: A three-layer context-engineering template (immutable sources → agent-maintained wiki → operating-manual file) where the agent synthesizes raw material into reusable answers, frameworks, and scored debriefs that compound over time\n- **[Practical Guide to Context Engineering](https://github.com/WakeUp-Jin/Practical-Guide-to-Context-Engineering)**: A practical, hands-on guide (in Chinese) to context engineering for LLM applications\n\n### Development Frameworks\n\n- **[LangGraph](https://langchain-ai.github.io/langgraph/)**: Low-level orchestration framework for context management\n- **[LangSmith](https://docs.smith.langchain.com/)**: Agent tracing and evaluation platform\n- **[LangMem](https://langchain-ai.github.io/langmem/)**: Memory management abstractions\n\n### Memory \u0026 Compression\n\n- **[claude-mem](https://github.com/thedotmack/claude-mem)**: Persistent cross-session memory for Claude Code that automatically captures, compresses, and re-injects context across sessions\n- **[LeanCTX (lean-ctx)](https://github.com/yvgude/lean-ctx)**: Context intelligence layer for AI agents — a single local Rust binary that decides what agents read, remember, and save; 60–90% fewer tokens, with 76 MCP tools and local-first design\n- **[headroom](https://github.com/chopratejas/headroom)**: Compresses tool outputs/logs before they reach the LLM, saving 60-95% of tokens\n- **[Accordion](https://github.com/a-Fig/Accordion)**: A pi extension that renders an agent's entire context window as a live \"map\" and folds (reversibly compacts) less-relevant blocks in the background via pluggable \"conductors\" that rank block relevance, instead of lossy all-or-nothing compaction\n- **[Letta (MemGPT)](https://github.com/letta-ai/letta)**: Framework for building stateful agents with long-term memory\n- **[Mem0](https://github.com/mem0ai/mem0)**: Memory layer for AI agents and assistants\n- **[LLMLingua](https://github.com/microsoft/LLMLingua)**: Prompt compression for accelerated and cost-efficient LLM inference\n\n### Production Tools\n\n- **Claude Code**: Auto-compact context management\n- **ChatGPT**: Long-term cross-session memory\n- **Cursor**: Rules-based context engineering\n- **Windsurf**: Advanced code context retrieval\n\n## 💡 Expert Insights\n\n### Industry Leaders\n\n**Andrej Karpathy** (OpenAI)\n~~~\n+1 for \"context engineering\" over \"prompt engineering\".\n\nPeople 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.\n\nOn top of context engineering itself, an LLM app has to:\n- break up problems just right into control flows\n- pack the context windows just right\n- dispatch calls to LLMs of the right kind and capability\n- handle generation-verification UIUX flows\n- a lot more - guardrails, security, evals, parallelism, prefetching, ...\n\nSo 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.\n~~~\n\n### Key Principles\n\n1. **KV-Cache Optimization**: Design for cache hit rates to reduce latency and cost\n2. **Append-Only Context**: Avoid modifying previous context to maintain cache validity\n3. **External Memory**: Use file systems and databases as extended context storage\n4. **Error Preservation**: Keep failure traces for model learning and adaptation\n5. **Diversity Over Uniformity**: Avoid repetitive patterns that lead to model drift\n\n## 🔗 Model Context Protocol (MCP)\n\n### Context7 MCP Server\n**Up-to-date code documentation for LLMs and AI code editors**\n- 🔗 Repository: [upstash/context7](https://github.com/upstash/context7)\n- 🎯 Real-time code context for development workflows\n- 🚀 Integration with popular AI coding assistants\n\n### MCP Ecosystem\n- **[Model Context Protocol](https://modelcontextprotocol.io/introduction)**: Standardized context sharing\n- **[Filesystem Server](https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem)**: File-based context management\n- **Tool Integration**: Seamless context flow between tools\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.\n\n### How to Contribute\n\n1. **Add Resources**: Submit papers, tools, or articles related to context engineering\n2. **Improve Translations**: Help translate content to different languages\n3. **Share Insights**: Contribute expert opinions and best practices\n4. **Report Issues**: Help us maintain accuracy and relevance\n\n### Contribution Categories\n\n- 📄 Research Papers\n- 🛠️ Tools \u0026 Libraries\n- 📖 Articles \u0026 Tutorials\n- 💡 Expert Insights\n- 🔧 Implementation Examples\n- 🌐 Translations\n\n## ⭐ Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=yzfly/awesome-context-engineering\u0026type=Date)](https://star-history.com/#yzfly/awesome-context-engineering\u0026Date)\n\n## 📄 License\n\nThis project is licensed under the [CC0 1.0](LICENSE).\n\n## 🙏 Acknowledgments\n\nSpecial thanks to all contributors and the research community advancing the field of context engineering.\n\n---\n\n**Maintained by**: [yzfly](https://github.com/yzfly) | **云中江树（微信公众号: 云中江树）**\n\n*If you find this repository helpful, please consider giving it a ⭐!*\n\n","projects_url":"https://awesome.ecosyste.ms/api/v1/lists/yzfly%2Fawesome-context-engineering/projects"}