Skip to content

Chapter 5: Context Engineering

The same model can behave differently when its instructions, evidence, examples, and constraints change. Context engineering deliberately designs that task packet, while model capability, tools, and verification remain separate factors.

You'll build a CLAUDE.md that turns your agent from tourist to teammate, layer memory so nothing gets re-explained twice, grow a second brain your agent can read, and manage sessions so quality doesn't sag as work gets long. The reference points here are the same ones the top engineering teams use — translated for both lanes.

What you will learn

  • Explain why context quality dominates model quality in real-world results.
  • Write and iterate a CLAUDE.md that measurably changes agent behavior.
  • Use the memory layers: session context, project memory, user memory.
  • Build a second brain — decisions, style, research — that agents consult.
  • Keep long sessions sharp with scoping, /clear, and compaction awareness.
  • Scale all of it to large, messy, real codebases.

Builder principle

Your agent is exactly as good as what it can see. Feed it like a teammate, not like a search box.

Watch with this chapter

Real talk

In Lesson 4.5's retro you wrote down what your agent needed but did not have. Repeated missing context creates repeated clarification and rework. This chapter shows how to reduce that cost and measure whether the change helps.

Lessons in this chapter

Chapter checkpoint

Complete Chapter 5: Context experiment, save the evidence, then score your first attempt with the shared rubric.