M

Foundations · Days 14-20

Context Engineering

Context engineering is the discipline of managing system prompts, conversation history, memory, tool results, retrieval, and compression under real context-window limits.

Intermediate 7 subtopics 7 daily blocks

Outcome

Budget, compress, prune, cache, and arrange context so the model receives the right information at the right time.

Practice builds

Context budget visualizerRolling memory chat prototypeTool output compressor

What to learn

Context window budgeting across system, history, tools, and retrieval
Conversation summarization and rolling memory
Prompt caching strategies for Anthropic and OpenAI-style APIs
Hierarchical memory: short-term, long-term, episodic
Context compression and pruning
Tool result truncation strategies
Lost in the middle problem and mitigation

Daily study plan

Day 14: Draw a context budget for a real chat feature.
Day 15: Implement rolling conversation summaries.
Day 16: Separate short-term, long-term, and episodic memory responsibilities.
Day 17: Add truncation rules for large tool outputs.
Day 18: Compare prompt caching opportunities and stable prompt sections.
Day 19: Test lost-in-the-middle behavior with long context examples.
Day 20: Build a context assembly function with explicit priorities.

Resources