Context Engineering Lessons
Step-by-step lessons to build your understanding.
- What Is Context? Context Windows & Tokens for LLMs
Explain why an LLM cannot see your whole codebase, what actually fills the context window, and why context retrieval — not the model — is where modern AI systems win or lose.
8 min - Context Retrieval: Lexical vs Semantic vs Hybrid
Explain how a system decides what to send to the model, and compare lexical, semantic, hybrid search, ranking and re-ranking by purpose, advantages, disadvantages, and failure modes.
13 min - RAG, Chunking & Codebase Context Explained
Explain how Cursor and Claude Code understand large repos, why chunking exists and how it fails, and how RAG works from first principles — and why most RAG bugs are retrieval bugs.
12 min - LLM Memory, Context Compression & Failure Modes
Distinguish memory from a knowledge base, manage a long-running agent's context with summarization and sliding windows, and diagnose the five ways context systems fail — missing, wrong, outdated, conflicting, excessive.
12 min - Context Engineering: Architecture & Production Design
The capstone: review real AI products (Cursor, Claude Code, ChatGPT, Copilot) by their context strategy, design production agents (billing, support, engineering, research), and walk away with the Principal's toolkit — cheat sheet, checklists, and interview banks.
18 min - RAG Evaluation: recall@k, RAGAS & Observability
Measure retrieval separately from generation, name recall@k / precision@k / MRR / nDCG and the RAGAS-style answer-quality metrics, and explain golden sets, offline vs online eval, and the tracing that tells you which stage failed.
10 min - Advanced RAG: HyDE, GraphRAG & Agentic Retrieval
Transform the query before you retrieve, match the retrieval structure to the question shape, and know when to graduate from a static pipeline to a self-correcting agentic loop.
12 min - Embeddings, Vector Indexes (HNSW/IVF/PQ) & Cost
Explain what an embedding actually is, how vector indexes (HNSW / IVF / PQ) trade recall for speed and memory, and how to model the real token and dollar cost of a retrieval pipeline.
13 min - LLM Prompt Caching, Context Ordering & Security
Structure a prompt for KV/prompt caching, order the window so the model actually reads what matters, and defend a retrieval pipeline against prompt injection and cross-tenant leaks.
12 min