yzfly/awesome-context-engineering

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

145

96 commits

updated Sep 20, 2026

See the code

README

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

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.

The New Skill in AI is Not Prompting, It's Context Engineering (Philipp Schmid)

Argues most agent failures stem from poor context, not the model; breaks context into instructions, history, long-term memory, RAG, tools, and output format.

Context Engineering (Simon Willison)

Why "context engineering" is a better framing than "prompt engineering", curating the foundational discussion of the term.

Wide Research: Beyond the Context Window (Manus)

Parallel sub-agent architecture that avoids fabrication when processing many items, by decomposing tasks across dedicated sub-agents instead of one overloaded context window.

SWE-grep: RL for Fast Context Retrieval (Cognition)

RL-trained models that run up to 8 parallel searches per turn to retrieve code context an order of magnitude faster while minimizing context pollution.

Compaction Is a Lossy Operation

Why compacting an agent's context is lossy compression, not free summarization — what survives, what silently drops, and how it degrades long multi-turn runs.

📑 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.

Harness Engineering for Language Agents: The Harness Layer as Control, Agency, and Runtime

  • 📄 Preprints: 202603.1756
  • 📊 Audits 63 harness-relevant works across academia and public engineering practice
  • 🎯 Decomposes the agent harness layer into Control, Agency, and Runtime (CAR); proposes HarnessCard as a reporting artifact

Situates harness engineering in the arc from software engineering through prompt and context engineering, arguing that the harness — the runtime loop wrapping tool execution, control, and agency around an LLM — is a first-class layer whose effects are often mistaken for model-driven gains.

Context Engineering 2.0: The Context of Context Engineering

  • 📄 arXiv: 2510.26493
  • 🎯 Traces context engineering back two decades and proposes a systematic definition and design principles across the human-computer to human-agent evolution

Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models

  • 📄 arXiv: 2510.04618
  • 🎯 Treats context as an evolving playbook (Generator/Reflector/Curator) to prevent context collapse; reports +10.6% on agents and +8.6% on finance tasks (ICLR 2026)

Memory in the Age of AI Agents: A Survey

  • 📄 arXiv: 2512.13564
  • 🎯 A "forms-functions-dynamics" taxonomy of agent memory, distinguishing it from RAG and context engineering

PerspectiveGap: A Benchmark for Multi-Agent Orchestration Prompting

  • 📄 arXiv: 2606.08878
  • 📊 110 scenarios across 10 topologies, testing how LLMs allocate context fragments to sub-agent roles
  • 🎯 The first benchmark for multi-agent orchestration prompt writing; 33 commercial models average 17.2% pass rate on role-fragment assignment

Evaluates LLMs' ability to assign information fragments to sub-agent roles in multi-agent orchestration scenarios. Scoring uses strict pass (zero omissions and zero leaks) plus partial-credit metrics. Data covers 10 loop-centered topologies across 100 professional domains.

Core Research Areas

🛠️ Tools & Projects

Comprehensive Resources

  1. Prompt Engineering Guide

    • Comprehensive guide to prompt engineering, context engineering, RAG, and AI agents
    • Covers techniques, papers, tools, and best practices
    • Widely-used educational resource
  2. Awesome Context Engineering Survey

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

    • Practical guide for AI coding assistants
    • Claude Code centered approach
    • Hands-on implementation strategies
  4. Context-Engineering (davidkimai)

    • First-principles handbook for context engineering
    • From foundations to advanced techniques
  5. Context-Engineering (jasontang-ai)

    • Karpathy-inspired first-principles handbook
    • From prompt engineering toward context design, orchestration, and optimization
  6. The Context Course (HuggingFace)

    • HuggingFace course on context engineering for code agents
    • Covers skills, MCP, plugins, subagents, hooks, and building your own agent
    • Reference agents: Claude Code, Codex, OpenCode
  7. Agent Systems Handbook

    • Practical AI agents handbook covering agentic workflows and multi-agent architecture
    • Spans LangGraph, MCP/A2A, context engineering, agent memory, evaluation, and observability

Context Engineering in 2026: Harnesses, Skills & Protocols

  • deepseek-harness (dsh): DeepSeek's official open-source agent harness (Aug 2026). Its append-only session log is the only source of model context ("model-visible means logged"), with prompt sections, tool schemas, skills and sub-agents all composed as swappable plugins — a reference design for context assembly
  • Agent Skills open standard: SKILL.md folders loaded via progressive disclosure (name/description → full instructions → bundled files), adopted by 40+ agents (Claude Code, Codex, Gemini CLI, Cursor, OpenCode, dsh...). Skills are the portable unit of procedural context
  • MCP 2026-07-28 spec: stateless core, cacheable tools/list results with ttlMs, and header-based routing — all aimed at keeping tool context cheap and fresh for agents
  • Claude Code context docs: CLAUDE.md memory hierarchy, /compact, subagents and hooks — the most widely copied practical context-management model

Context Engineering Systems & Kits

  • Prompt Engineering Guide ⭐76.1k: Comprehensive guide and resources for prompt engineering, context engineering, RAG, and AI agents
  • get-shit-done (GSD) ⭐64.5k: Meta-prompting, context engineering and spec-driven development system for Claude Code
  • screenpipe ⭐19.9k: Source-available, local-first work-context layer that captures screen, audio, input, browser, and meeting activity for agent retrieval through MCP, REST, and CLI
  • Agent Skills for Context Engineering ⭐16.7k: Collection of Agent Skills for context engineering and multi-agent architectures
  • Context Engineering Intro ⭐13.5k: Context engineering introduction and methodology for AI coding assistants
  • Context-Engineering (jasontang-ai) ⭐9.1k: Karpathy-inspired first-principles handbook for context engineering
  • GSD-2 ⭐7.7k: Meta-prompting / context engineering system enabling long-running autonomous agent work
  • MineContext ⭐5.4k: Volcengine's proactive, context-aware AI companion
  • Awesome-Context-Engineering (Meirtz) ⭐3.2k: Comprehensive survey of context engineering
  • how-claude-code-works ⭐2.7k: Deep dive into Claude Code source: architecture, agent loop, and context engineering
  • pro-workflow ⭐2.3k: Self-correcting memory Claude Code workflow, including context engineering
  • Advanced Context Engineering for Coding Agents ⭐1.7k: Advanced context engineering techniques for coding agents
  • Context Engineering Kit ⭐1.2k: A context engineering skills toolkit
  • ACE (Agentic Context Engineering) ⭐1.2k: Evolving language agents through agentic context engineering (ACE)
  • context-space ⭐812: Context engineering infrastructure built from MCPs and integrations
  • Agent QA ⭐772: Source-available QA agent that retains scoped test memory and failure evidence across natural-language web and mobile runs
  • Practical Guide to Context Engineering ⭐708: A practical, hands-on guide (in Chinese) to context engineering for LLM applications
  • AI Badger ⭐21: Local-first tool that extracts focused, token-efficient repository context for AI chats, with Agent Skills for code review and coding-agent handoff
  • get-shit-done (GSD): Meta-prompting and spec-driven development / context engineering system for Claude Code
  • GSD-2: Meta-prompting / context engineering system enabling long-running autonomous agent work
  • how-claude-code-works: Deep dive into Claude Code source: architecture, agent loop, and context engineering
  • Agent Skills for Context Engineering: Collection of Agent Skills for context engineering and multi-agent architectures
  • Advanced Context Engineering for Coding Agents: Advanced context engineering techniques for coding agents
  • ax: Local telemetry and recall graph for AI coding-agent sessions, costs, skills, routing, and hooks
  • ACE (Agentic Context Engineering): Evolving language agents through agentic context engineering
  • Context Engineering Kit: A toolkit for context engineering
  • MineContext: Volcengine's proactive, context-aware AI companion
  • pro-workflow: Self-correcting memory system that lets Claude Code learn from its mistakes, covering context engineering, parallel worktrees, agent teams, and 17 skills
  • kit: Context engineering toolkit for AI dev tools, providing codebase mapping, symbol extraction, and code search
  • RepoPrompt CE: Community edition of RepoPrompt, a native macOS context engineering app for AI coding agents, with an MCP CLI
  • DevProjex: Builds clean, token-aware project context with GUI, TUI, CLI, and a read-only MCP server, plus live preview, secret redaction enforced in MCP mode, Git scopes, and syntax-aware compression.
  • context-engineering (outcomeops): Working reference implementation of context engineering with five components (corpus, retrieval, injection, output, enforcement), running end-to-end on Amazon Bedrock
  • Project Context Records (PCR): 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
  • 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
  • Practical Guide to Context Engineering: A practical, hands-on guide (in Chinese) to context engineering for LLM applications
  • MFS: A context harness that unifies code, docs, chat, databases, and object stores into one file-like, searchable namespace (ls/cat/grep + hybrid semantic search), so agents pull context incrementally instead of injecting it all up front; self-hosted and local-first (local ONNX embeddings + Milvus, no API key)
  • wiki: Indexed Markdown knowledge bases that let agents retrieve project context incrementally, with deterministic indexes, cross-links, linting, and merge handling for parallel edits
  • Hexis: Git-backed platform for skills, tools, and context for AI agents, with Git review workflows, role-based access, encrypted secrets, and remote MCP access
  • PickySteve: A skill router and context picker for coding agents — hybrid BM25 + embedding retrieval (RRF-fused), cross-encoder rerank with a calibrated floor, and an LLM judge select the right skill, then assemble a minimal nonce-boundaried context bundle for the execution model; a fail-closed ONNX prompt-injection gate scans both the request and every retrieved doc. Local-first (runs offline on Ollama qwen3:8b or any OpenAI-compatible endpoint), with an MCP server and OpenAI-compatible proxy wired into 18 coding agents (Claude Code, Codex, Cursor, Windsurf, etc.)
  • YYLO: Command-line orchestrator for coding agents that isolates each task in a dedicated branch/worktree for scoped implementation and focused tests, with typed task, validation, merge, and release-readiness boundaries
  • ctx-optimize: Deterministic code knowledge graph for coding agents — one static Go binary indexes a repo, and optionally its databases, buckets, queues and APIs, into a local graph, so the agent answers "who calls this" / "what breaks if I change this" from the store in one call instead of a grep-and-read chain; ships an agent skill for Claude Code and Codex, with no LLM, embeddings, database, MCP, or credentials at rest
  • CueParcel: Local-first browser extension for selecting sections of web pages, combining multiple sources, and packaging source-grounded context for AI agents, with structured TaskSpec output and GitHub Issue, GitHub Pull Request, and technical-documentation adapters

Development Frameworks

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

Memory & Compression

  • claude-mem: Persistent cross-session memory for Claude Code that automatically captures, compresses, and re-injects context across sessions
  • Data Olympus: Governed project memory for coding agents. Agents can propose context, humans promote accepted rules, and retrieval serves only in-force knowledge after validity-window and supersession checks
  • GoodMemory: Local-first, auditable memory layer for AI apps and coding agents, with Codex/Claude Code host integration, a standalone MCP server, TypeScript/Python clients, and SQLite or Postgres storage
  • LeanCTX (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
  • headroom: Compresses tool outputs/logs before they reach the LLM, saving 60-95% of tokens
  • 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
  • Mnemoverse: Hosted persistent memory reachable over MCP from Claude Code, Cursor, VS Code and ChatGPT with one key; recall is re-ranked by whether a recalled memory helped or misled
  • Letta (MemGPT): Framework for building stateful agents with long-term memory
  • Mem0: Memory layer for AI agents and assistants
  • Vestige: "Local-first MCP memory server (single ~23MB Rust binary, data stays on-device) with entity/causal retrieval — links memories by shared file/env-var/service/symbol to recall the earlier change behind a later failure that similarity search can miss"
  • Tree Ring Memory: Lifecycle-aware local-first memory framework for AI agents with recall, audit, forgetting, consolidation, and project-scoped .tree-ring storage
  • LLMLingua: Prompt compression for accelerated and cost-efficient LLM inference
  • Cognee: Open-source AI memory platform giving agents persistent long-term memory via a self-hosted knowledge-graph engine
  • Graphiti: Framework for building real-time, temporal knowledge graphs for AI agents (the engine behind Zep's memory)
  • Supermemory: Fast, scalable memory + context engine with a single Memory API; supports fully local runs
  • skillreaper: Measures what share of an agent's loaded context ever actually fires — skills, MCP servers, subagents, hooks — from session transcripts, then prunes the unused parts reversibly
  • LWC: Proactive, source-grounded project memory for coding agents, preserving immutable sources, citations, provenance, and atomic changesets with SQLite/FTS5 retrieval, optional document/code graphs, lifecycle hooks, and a bounded one-tool MCP interface
  • billion-context-dsh: Model-driven context compression (Active Context Pruning) for the DeepSeek Harness — the model decides when and what to compress
  • TekMyra: Governed context compression for LLM pipelines that verifies protected spans are present exactly once before emitting and counts refusals against its published numbers
  • trace-mcp: Local MCP server that serves a precomputed cross-language code graph instead of file reads — framework-aware edges link a PHP controller to the Vue page it renders, a DI decorator to its provider, an ORM call to the migration that defines the table (81 languages, 87 framework integrations), plus code-linked decision memory across sessions; on 60 merged PRs from six third-party repositories, review context drops from a median 13,595 to 1,326 input tokens
  • langstate: Compresses long LLM conversations into an inspectable [SCAFFOLD STATE] message instead of an opaque summary — keeps system messages and recent turns verbatim, and validate() returns a deterministic receipt for named facts
  • Caura: Governed shared memory for AI agent fleets — scoped recall across agents and tenants, trust tiers, keystone policies, audit trails, and a knowledge graph, exposed over MCP
  • Ctxlens: Context-window profiler for AI agents: shows what is eating your tokens
  • tokencut: Measures and cuts the token cost of LLM and agent message payloads
  • contextpress: Deterministic context compression for LLM chat, RAG, and agent pipelines (pip install contextpress) — Tier-1 NLP stages, no API key; optional Tier-2 LLM backends

Production Tools

  • Claude Code: Auto-compact context management
  • ChatGPT: Long-term cross-session memory
  • Puppyone: File-system-based context storage for agents
  • Cursor: Rules-based context engineering
  • Windsurf: Advanced code context retrieval
  • OrcaReplay: Records the context an agent actually sent, turn by turn, and replays it offline

💡 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 ⭐!

awesome-context
awesome-context-engineering
claude
claude-code
context-engineering
manus
prompt-engineering
prompt-engineering-techniques

Contributors

(top 30 of 32)

zphyix

32 commits

yzfly

27 commits

Avazbek22

4 commits

samvallad33

2 commits

yzfly/awesome-context-engineering

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

145

96 commits

updated Sep 20, 2026

See the code

README

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

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.

The New Skill in AI is Not Prompting, It's Context Engineering (Philipp Schmid)

Argues most agent failures stem from poor context, not the model; breaks context into instructions, history, long-term memory, RAG, tools, and output format.

Context Engineering (Simon Willison)

Why "context engineering" is a better framing than "prompt engineering", curating the foundational discussion of the term.

Wide Research: Beyond the Context Window (Manus)

Parallel sub-agent architecture that avoids fabrication when processing many items, by decomposing tasks across dedicated sub-agents instead of one overloaded context window.

SWE-grep: RL for Fast Context Retrieval (Cognition)

RL-trained models that run up to 8 parallel searches per turn to retrieve code context an order of magnitude faster while minimizing context pollution.

Compaction Is a Lossy Operation

Why compacting an agent's context is lossy compression, not free summarization — what survives, what silently drops, and how it degrades long multi-turn runs.

📑 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.

Harness Engineering for Language Agents: The Harness Layer as Control, Agency, and Runtime

  • 📄 Preprints: 202603.1756
  • 📊 Audits 63 harness-relevant works across academia and public engineering practice
  • 🎯 Decomposes the agent harness layer into Control, Agency, and Runtime (CAR); proposes HarnessCard as a reporting artifact

Situates harness engineering in the arc from software engineering through prompt and context engineering, arguing that the harness — the runtime loop wrapping tool execution, control, and agency around an LLM — is a first-class layer whose effects are often mistaken for model-driven gains.

Context Engineering 2.0: The Context of Context Engineering

  • 📄 arXiv: 2510.26493
  • 🎯 Traces context engineering back two decades and proposes a systematic definition and design principles across the human-computer to human-agent evolution

Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models

  • 📄 arXiv: 2510.04618
  • 🎯 Treats context as an evolving playbook (Generator/Reflector/Curator) to prevent context collapse; reports +10.6% on agents and +8.6% on finance tasks (ICLR 2026)

Memory in the Age of AI Agents: A Survey

  • 📄 arXiv: 2512.13564
  • 🎯 A "forms-functions-dynamics" taxonomy of agent memory, distinguishing it from RAG and context engineering

PerspectiveGap: A Benchmark for Multi-Agent Orchestration Prompting

  • 📄 arXiv: 2606.08878
  • 📊 110 scenarios across 10 topologies, testing how LLMs allocate context fragments to sub-agent roles
  • 🎯 The first benchmark for multi-agent orchestration prompt writing; 33 commercial models average 17.2% pass rate on role-fragment assignment

Evaluates LLMs' ability to assign information fragments to sub-agent roles in multi-agent orchestration scenarios. Scoring uses strict pass (zero omissions and zero leaks) plus partial-credit metrics. Data covers 10 loop-centered topologies across 100 professional domains.

Core Research Areas

🛠️ Tools & Projects

Comprehensive Resources

  1. Prompt Engineering Guide

    • Comprehensive guide to prompt engineering, context engineering, RAG, and AI agents
    • Covers techniques, papers, tools, and best practices
    • Widely-used educational resource
  2. Awesome Context Engineering Survey

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

    • Practical guide for AI coding assistants
    • Claude Code centered approach
    • Hands-on implementation strategies
  4. Context-Engineering (davidkimai)

    • First-principles handbook for context engineering
    • From foundations to advanced techniques
  5. Context-Engineering (jasontang-ai)

    • Karpathy-inspired first-principles handbook
    • From prompt engineering toward context design, orchestration, and optimization
  6. The Context Course (HuggingFace)

    • HuggingFace course on context engineering for code agents
    • Covers skills, MCP, plugins, subagents, hooks, and building your own agent
    • Reference agents: Claude Code, Codex, OpenCode
  7. Agent Systems Handbook

    • Practical AI agents handbook covering agentic workflows and multi-agent architecture
    • Spans LangGraph, MCP/A2A, context engineering, agent memory, evaluation, and observability

Context Engineering in 2026: Harnesses, Skills & Protocols

  • deepseek-harness (dsh): DeepSeek's official open-source agent harness (Aug 2026). Its append-only session log is the only source of model context ("model-visible means logged"), with prompt sections, tool schemas, skills and sub-agents all composed as swappable plugins — a reference design for context assembly
  • Agent Skills open standard: SKILL.md folders loaded via progressive disclosure (name/description → full instructions → bundled files), adopted by 40+ agents (Claude Code, Codex, Gemini CLI, Cursor, OpenCode, dsh...). Skills are the portable unit of procedural context
  • MCP 2026-07-28 spec: stateless core, cacheable tools/list results with ttlMs, and header-based routing — all aimed at keeping tool context cheap and fresh for agents
  • Claude Code context docs: CLAUDE.md memory hierarchy, /compact, subagents and hooks — the most widely copied practical context-management model

Context Engineering Systems & Kits

  • Prompt Engineering Guide ⭐76.1k: Comprehensive guide and resources for prompt engineering, context engineering, RAG, and AI agents
  • get-shit-done (GSD) ⭐64.5k: Meta-prompting, context engineering and spec-driven development system for Claude Code
  • screenpipe ⭐19.9k: Source-available, local-first work-context layer that captures screen, audio, input, browser, and meeting activity for agent retrieval through MCP, REST, and CLI
  • Agent Skills for Context Engineering ⭐16.7k: Collection of Agent Skills for context engineering and multi-agent architectures
  • Context Engineering Intro ⭐13.5k: Context engineering introduction and methodology for AI coding assistants
  • Context-Engineering (jasontang-ai) ⭐9.1k: Karpathy-inspired first-principles handbook for context engineering
  • GSD-2 ⭐7.7k: Meta-prompting / context engineering system enabling long-running autonomous agent work
  • MineContext ⭐5.4k: Volcengine's proactive, context-aware AI companion
  • Awesome-Context-Engineering (Meirtz) ⭐3.2k: Comprehensive survey of context engineering
  • how-claude-code-works ⭐2.7k: Deep dive into Claude Code source: architecture, agent loop, and context engineering
  • pro-workflow ⭐2.3k: Self-correcting memory Claude Code workflow, including context engineering
  • Advanced Context Engineering for Coding Agents ⭐1.7k: Advanced context engineering techniques for coding agents
  • Context Engineering Kit ⭐1.2k: A context engineering skills toolkit
  • ACE (Agentic Context Engineering) ⭐1.2k: Evolving language agents through agentic context engineering (ACE)
  • context-space ⭐812: Context engineering infrastructure built from MCPs and integrations
  • Agent QA ⭐772: Source-available QA agent that retains scoped test memory and failure evidence across natural-language web and mobile runs
  • Practical Guide to Context Engineering ⭐708: A practical, hands-on guide (in Chinese) to context engineering for LLM applications
  • AI Badger ⭐21: Local-first tool that extracts focused, token-efficient repository context for AI chats, with Agent Skills for code review and coding-agent handoff
  • get-shit-done (GSD): Meta-prompting and spec-driven development / context engineering system for Claude Code
  • GSD-2: Meta-prompting / context engineering system enabling long-running autonomous agent work
  • how-claude-code-works: Deep dive into Claude Code source: architecture, agent loop, and context engineering
  • Agent Skills for Context Engineering: Collection of Agent Skills for context engineering and multi-agent architectures
  • Advanced Context Engineering for Coding Agents: Advanced context engineering techniques for coding agents
  • ax: Local telemetry and recall graph for AI coding-agent sessions, costs, skills, routing, and hooks
  • ACE (Agentic Context Engineering): Evolving language agents through agentic context engineering
  • Context Engineering Kit: A toolkit for context engineering
  • MineContext: Volcengine's proactive, context-aware AI companion
  • pro-workflow: Self-correcting memory system that lets Claude Code learn from its mistakes, covering context engineering, parallel worktrees, agent teams, and 17 skills
  • kit: Context engineering toolkit for AI dev tools, providing codebase mapping, symbol extraction, and code search
  • RepoPrompt CE: Community edition of RepoPrompt, a native macOS context engineering app for AI coding agents, with an MCP CLI
  • DevProjex: Builds clean, token-aware project context with GUI, TUI, CLI, and a read-only MCP server, plus live preview, secret redaction enforced in MCP mode, Git scopes, and syntax-aware compression.
  • context-engineering (outcomeops): Working reference implementation of context engineering with five components (corpus, retrieval, injection, output, enforcement), running end-to-end on Amazon Bedrock
  • Project Context Records (PCR): 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
  • 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
  • Practical Guide to Context Engineering: A practical, hands-on guide (in Chinese) to context engineering for LLM applications
  • MFS: A context harness that unifies code, docs, chat, databases, and object stores into one file-like, searchable namespace (ls/cat/grep + hybrid semantic search), so agents pull context incrementally instead of injecting it all up front; self-hosted and local-first (local ONNX embeddings + Milvus, no API key)
  • wiki: Indexed Markdown knowledge bases that let agents retrieve project context incrementally, with deterministic indexes, cross-links, linting, and merge handling for parallel edits
  • Hexis: Git-backed platform for skills, tools, and context for AI agents, with Git review workflows, role-based access, encrypted secrets, and remote MCP access
  • PickySteve: A skill router and context picker for coding agents — hybrid BM25 + embedding retrieval (RRF-fused), cross-encoder rerank with a calibrated floor, and an LLM judge select the right skill, then assemble a minimal nonce-boundaried context bundle for the execution model; a fail-closed ONNX prompt-injection gate scans both the request and every retrieved doc. Local-first (runs offline on Ollama qwen3:8b or any OpenAI-compatible endpoint), with an MCP server and OpenAI-compatible proxy wired into 18 coding agents (Claude Code, Codex, Cursor, Windsurf, etc.)
  • YYLO: Command-line orchestrator for coding agents that isolates each task in a dedicated branch/worktree for scoped implementation and focused tests, with typed task, validation, merge, and release-readiness boundaries
  • ctx-optimize: Deterministic code knowledge graph for coding agents — one static Go binary indexes a repo, and optionally its databases, buckets, queues and APIs, into a local graph, so the agent answers "who calls this" / "what breaks if I change this" from the store in one call instead of a grep-and-read chain; ships an agent skill for Claude Code and Codex, with no LLM, embeddings, database, MCP, or credentials at rest
  • CueParcel: Local-first browser extension for selecting sections of web pages, combining multiple sources, and packaging source-grounded context for AI agents, with structured TaskSpec output and GitHub Issue, GitHub Pull Request, and technical-documentation adapters

Development Frameworks

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

Memory & Compression

  • claude-mem: Persistent cross-session memory for Claude Code that automatically captures, compresses, and re-injects context across sessions
  • Data Olympus: Governed project memory for coding agents. Agents can propose context, humans promote accepted rules, and retrieval serves only in-force knowledge after validity-window and supersession checks
  • GoodMemory: Local-first, auditable memory layer for AI apps and coding agents, with Codex/Claude Code host integration, a standalone MCP server, TypeScript/Python clients, and SQLite or Postgres storage
  • LeanCTX (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
  • headroom: Compresses tool outputs/logs before they reach the LLM, saving 60-95% of tokens
  • 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
  • Mnemoverse: Hosted persistent memory reachable over MCP from Claude Code, Cursor, VS Code and ChatGPT with one key; recall is re-ranked by whether a recalled memory helped or misled
  • Letta (MemGPT): Framework for building stateful agents with long-term memory
  • Mem0: Memory layer for AI agents and assistants
  • Vestige: "Local-first MCP memory server (single ~23MB Rust binary, data stays on-device) with entity/causal retrieval — links memories by shared file/env-var/service/symbol to recall the earlier change behind a later failure that similarity search can miss"
  • Tree Ring Memory: Lifecycle-aware local-first memory framework for AI agents with recall, audit, forgetting, consolidation, and project-scoped .tree-ring storage
  • LLMLingua: Prompt compression for accelerated and cost-efficient LLM inference
  • Cognee: Open-source AI memory platform giving agents persistent long-term memory via a self-hosted knowledge-graph engine
  • Graphiti: Framework for building real-time, temporal knowledge graphs for AI agents (the engine behind Zep's memory)
  • Supermemory: Fast, scalable memory + context engine with a single Memory API; supports fully local runs
  • skillreaper: Measures what share of an agent's loaded context ever actually fires — skills, MCP servers, subagents, hooks — from session transcripts, then prunes the unused parts reversibly
  • LWC: Proactive, source-grounded project memory for coding agents, preserving immutable sources, citations, provenance, and atomic changesets with SQLite/FTS5 retrieval, optional document/code graphs, lifecycle hooks, and a bounded one-tool MCP interface
  • billion-context-dsh: Model-driven context compression (Active Context Pruning) for the DeepSeek Harness — the model decides when and what to compress
  • TekMyra: Governed context compression for LLM pipelines that verifies protected spans are present exactly once before emitting and counts refusals against its published numbers
  • trace-mcp: Local MCP server that serves a precomputed cross-language code graph instead of file reads — framework-aware edges link a PHP controller to the Vue page it renders, a DI decorator to its provider, an ORM call to the migration that defines the table (81 languages, 87 framework integrations), plus code-linked decision memory across sessions; on 60 merged PRs from six third-party repositories, review context drops from a median 13,595 to 1,326 input tokens
  • langstate: Compresses long LLM conversations into an inspectable [SCAFFOLD STATE] message instead of an opaque summary — keeps system messages and recent turns verbatim, and validate() returns a deterministic receipt for named facts
  • Caura: Governed shared memory for AI agent fleets — scoped recall across agents and tenants, trust tiers, keystone policies, audit trails, and a knowledge graph, exposed over MCP
  • Ctxlens: Context-window profiler for AI agents: shows what is eating your tokens
  • tokencut: Measures and cuts the token cost of LLM and agent message payloads
  • contextpress: Deterministic context compression for LLM chat, RAG, and agent pipelines (pip install contextpress) — Tier-1 NLP stages, no API key; optional Tier-2 LLM backends

Production Tools

  • Claude Code: Auto-compact context management
  • ChatGPT: Long-term cross-session memory
  • Puppyone: File-system-based context storage for agents
  • Cursor: Rules-based context engineering
  • Windsurf: Advanced code context retrieval
  • OrcaReplay: Records the context an agent actually sent, turn by turn, and replays it offline

💡 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 ⭐!

awesome-context
awesome-context-engineering
claude
claude-code
context-engineering
manus
prompt-engineering
prompt-engineering-techniques

Contributors

(top 30 of 32)

zphyix

32 commits

yzfly

27 commits

Avazbek22

4 commits

samvallad33

2 commits