Level 8Lesson 0โฑ๏ธ 120 min

Level 8 Capstone

Design a real context pipeline - decide what the model sees, in what order, and what gets thrown away - with an interactive budget planner

Engineer the Desk, Not Just the Prompt

Over eight lessons you learned to treat context as a finite resource and design the four pillars - instructions, retrieval, memory, and tools - into one tight, high-signal context window. This capstone has you do it for a real agent task, end to end.

No code required. The deliverable is a context plan: a clear, defensible design for what your agent sees on every turn, why, and what it prunes.

Your Mission

Pick an agent task you care about, then produce a complete context design with five parts:

1. THE TASK & BUDGET - what the agent does + a token budget split
                       across the four pillars (use the planner below)

2. INSTRUCTIONS      - a system prompt at the "right altitude":
                       clear heuristics, not brittle rules or vague fluff

3. RETRIEVAL         - what to fetch, when (up-front / just-in-time /
                       hybrid), and how you keep it fresh

4. MEMORY            - how the agent stays coherent over a long task
                       (compaction, notes, or sub-agents)

5. PRUNING & FAILURES- your re-ranking + ordering plan, and which
                       context failure you're most at risk of + the fix

๐Ÿ† Capstone Project Helper

Use the Context Budget Planner to build parts 1, 3, and the spine of your design. Set a total budget, split it across the four pillars, and watch the "desk" fill - it warns you when you blow the budget, starve the model of headroom, or let one pillar hog the window. Answer the four questions and it generates a copy-paste context-plan.md.

๐Ÿงฎ Context Budget Planner

Allocate a token budget across the four pillars, watch the desk fill up, and generate a context plan you can copy out.

Instructions
Retrieval
Memory
Tools
The desk (50,000 tokens)28,000 used ยท 22,000 headroom
InstructionsRetrievalMemoryToolsHeadroom
Name your task to get a verdict.
context-plan.md
# Context Plan - (your task)

## Budget (50,000 tokens)
- Instructions : 4,000
- Retrieval    : 16,000
- Memory       : 6,000
- Tools        : 2,000
- Headroom     : 22,000   (room for the model to reason + reply)

## The four questions
1. WHAT to fetch    : (which docs / files / facts?)
2. WHEN to fetch    : Hybrid (rules up front, files just-in-time)
3. HOW to compress  : (summarize? truncate? re-rank to top-k?)
4. WHEN to discard  : (evict stale or finished context when?)

## Pruning checklist
- [ ] Re-rank retrieved candidates down to a tight top-k
- [ ] Highest-signal material placed at the top or bottom (avoid the middle)
- [ ] Tool set is minimal and non-overlapping
- [ ] Old tool results / finished context cleared each turn
- [ ] Token budget tracked per task, with an alert on overrun
Read the warnings as lessons: if the planner says "Retrieval is over 40% of the budget," that's the exact instinct (dump everything) the whole level warns against. A balanced desk with real headroom is the goal.

Finish the Other Parts

Part 2 - Instructions (from Lesson 67)

Write the actual system prompt at the right altitude. Include role, key heuristics, output format, and one canonical example. Avoid the brittle-rules and vague-fluff traps.

Part 4 - Memory (from Lesson 69)

State how your agent survives a long task: compaction, a NOTES.md, sub-agents - or a mix - and what must never be lost in a summary.

Part 5 - Pruning & failures (from Lessons 71-72)

Describe your re-rank + ordering plan, then name the one context failure you're most exposed to (overload? stale? lost-in-the-middle?) and your defense.

What "Great" Looks Like

A strong submission:
  • Treats context as a budget - every pillar earns its tokens, with real headroom left for the model to think.
  • Chooses retrieval timing deliberately and has a freshness answer.
  • Has a concrete memory plan for long tasks, not "the model will remember."
  • Keeps tools few, clear, and non-overlapping.
  • Names its biggest context-failure risk by symptom and gives the matching fix.

What You Have Learned in Level 8

  • L65 - From wording to wiring; context is everything the model sees
  • L66 - The attention budget; context rot and lost-in-the-middle
  • L67 - Pillar 1: instructions at the right altitude
  • L68 - Pillar 2: retrieval, up-front vs just-in-time
  • L69 - Pillar 3: memory, compaction, notes, sub-agents
  • L70 - Pillar 4: few, clear, non-overlapping tools
  • L71 - Assembling context: the pipeline, re-ranking, token budgets
  • L72 - When context goes wrong: the failure list and fixes
You can now see the context window - and engineer it. When an agent misbehaves, you'll reach past "use a bigger model" and ask the better question: what does it have on its desk right now, and is it the smallest high-signal set that does the job?That question is the whole discipline, and it's yours now.

๐Ÿง  Check your understanding

5 quick questions on Level 8. Answer each, then check your score.

1. Context engineering differs from prompting because it...
2. The "attention budget" / context rot means...
3. What are the four pillars of context?
4. "Lost in the middle" refers to...
5. The retrieval pillar is about...
๐Ÿ’ฌ

How was Level 8?

Your feedback helps improve this course. Takes 30 seconds.

Overall rating *

Select a star rating to submit.

โ† When Context Goes Wrong