Week 6 · Build the Clone

Context & Prompt Engineering

Own the context window

⏱ ~6 hours, hands-on🐍 Python / 🔷 TypeScript🛠 You ship: An agent that reads your project's rules
What this week is

The model has no memory. Everything it knows on any turn is something you put in the request. The API is stateless — there is no conversation on the server, no "it remembers."

This has a liberating consequence: whoever controls the context controls the agent. A mediocre model with excellent context beats a brilliant model fed garbage. Context engineering is the highest-leverage skill in this entire field, and it is almost entirely under your control.

Context = system prompt (who the agent is + project rules) + history (what has happened) + fetched material (files, search results) — assembled fresh for every request, within a fixed token budget. Your job is to spend that budget well.

The walkthrough

Each part adds one capability to the same growing codebase, and each is a runnable checkpoint.

  1. 01Assembling the system promptStatic identity plus dynamic facts, composed per request.
  2. 02Owning the whole context windowWhy representation is a design choice, not a detail.
  3. 03AGENTS.mdRules the agent reads itself — walk up the tree, nearest wins.
  4. 04Token budgetsDecide in advance what each part of the context is allowed to cost.
  5. 05CompactionSummarize old turns without losing the decision the next step depends on.

After this week you can

  • Assemble context deliberately instead of appending blindly
  • Give an agent project-specific rules it discovers on its own
  • Compact long sessions without breaking continuity