Context engineering is the new vibe coding — how to feed AI coding assistants the right context, centered on Claude Code.
Context Engineering 艺术
Overview
Who it's for
Learners already familiar with prompt engineering who want to level up to designing the whole context window; the repo offers a path from a 5-minute primer to frontier research.
What you'll learn
01Core idea: Prompt Engineering vs Context Engineering
The repo opens with Karpathy: 'Context engineering is the delicate art and science of filling the context window with just the right information for the next step.' It draws a sharp line: Prompt Engineering is 'what you say' (a single instruction); Context Engineering is 'everything else the model sees' — examples, memory, retrieval, tools, state and control flow, i.e. the complete information payload. By analogy: a prompt is one line of dialogue, context is the set, lighting, backstory and staging.
02A systematized learning path: from zero to frontier
It's a progressive course, not scattered tricks: 00_foundations covers theory and core concepts, 10_guides_zero_to_hero offers runnable walkthroughs (e.g. min_prompt.py), 20_templates gives copy-paste templates, 30_examples holds increasingly complex real projects, 40_reference provides deep dives and an eval cookbook, and 50_contrib collects community contributions. Beginners are told to start with a 5-minute read on why a single prompt often underperforms, then run a minimal example.
03Measurable context components: budget, few-shot, memory, retrieval, pruning
The repo decomposes context engineering into quantifiable components: Token Budget (optimize every token — it drives cost and latency), Few-Shot Learning (showing examples often beats explaining), Memory Systems (persist across turns for stateful interactions), Retrieval Augmentation (inject relevant documents to ground answers and reduce hallucination), Control Flow (split hard tasks into steps) and Context Pruning (ruthlessly delete what's irrelevant). The methodology insists you 'measure everything': token cost, latency and quality scores.
04From atoms to semantic fields: levels of context
The repo uses a biological metaphor for cognitive levels: atoms (single instructions, simple constraints) → molecules (few-shot example pairs) → cells (memory, state, context-window management) → organs (multi-step flows, specialists, system orchestration) → neural systems (reasoning frameworks, verification tools, cognitive tools) → neural and semantic field theory (continuous meaning, attractors and resonance). The metaphor helps you see context not as one prompt but as a system that can be layered and evolved like an organism.
05Research evidence and multi-agent context
The repo grounds theory in frontier research: IBM Zurich showed that giving GPT-4.1 'cognitive tools' (modular prompt templates invoked as reasoning steps) lifted AIME2024 pass@1 from 26.7% to 43.3%; Singapore-MIT's MEM1 uses reasoning-driven memory consolidation to fight context bloat in long-horizon agents; ICML Princeton revealed that symbolic mechanisms emerge inside LLMs — one reason structured formats like Markdown/JSON parse more reliably. It also ships Agent Commands for Claude Code, OpenCode, Codex, Gemini CLI and more, making multi-agent context orchestration directly usable.
Practice tips
- Start with 00_foundations/01_atoms_prompting.md (about 5 minutes) to understand why a single prompt often underperforms.
- Run 10_guides_zero_to_hero/01_min_prompt.py, then copy 20_templates/minimal_context.yaml into your own project.
- Using the 'What You'll Learn' table, pick your weakest component (e.g. context pruning), practice it deliberately, and measure the effect.
- Read one research evidence item closely (e.g. cognitive tools) and use its method to rework a prompt you're working on, then compare output quality.
Companion workflows
Related resources
A comprehensive survey of Context Engineering: hundreds of resources from prompt engineering to production AI systems.
Get Shit Done (GSD)
64.8kA lightweight, powerful meta-prompting and spec-driven development system — spec-first context engineering for Claude.