Coders In Hoods
  • Courses
  • Roles
  • Blog
  • Setup

Coders In Hoods AI Academy

Every course is free. Sign in to start, and your progress, quiz scores and bookmarks follow you.

AI Academy

  • Courses
  • Paths
  • Setup guides
  • How we teach

Role roadmaps

  • AI Engineer
  • Forward Deployed Engineer
  • Machine Learning Engineer
  • All roles

Coders In Hoods

  • The agency
  • Coaching for teams
  • Blog
  • LinkedIn
  • X (Twitter)

Contact

codersinhoods@gmail.com

© Coders In Hoods · since 2019

Course overview

Agent Foundations

Free · sign in to start and track progress

1 · What agents are

  • 1What is an agent?
  • 2Tools and the agent-computer interface
  • 3Context engineering

    Exercise answers

    • Answer: Measure context and move procedure into a skill
    • Answer: Isolate lease reading in a subagent

2 · Making agents dependable

  • 4Structured outputs and grounding
  • 5Workflow patterns
  • 6Risk and first evals
CapstoneA document review agent in Claude CodeReference implementation

Module 1 · What agents are · Lesson 3

Context engineering

What an agent actually sees on each turn, why more context can make it worse, and how to manage long documents such as contracts, reports and forms.

75 min 1 video 3 exercises 7-question quiz Answers
Setup for the exercises:Install Claude CodeNode.js, pnpm and TypeScript

By the end of this lesson you can

  • List everything that occupies an agent's context window and estimate a token budget for a real contract pack
  • Explain context rot and the lost-in-the-middle effect, and what they imply for long documents
  • Write a system prompt at the right altitude, and decide what belongs in CLAUDE.md, a skill or a subagent
  • Choose between pre-loading documents and just-in-time retrieval, and explain how compaction and note-taking keep long tasks on track

On this page

  • What is in the context window
  • More context can make the model worse
  • A worked token budget for a contract pack
  • The system prompt: the right altitude
  • Where each kind of context belongs
  • Just-in-time retrieval
  • Long tasks: compaction and notes
  • Misconceptions and limits
  • Where this goes next
  • Summary
  • Sources & further reading
  • Quiz

In this lesson

  1. 01What is in the context window
  2. 02More context can make the model worse
  3. 03A worked token budget for a contract pack
  4. 04The system prompt: the right altitude
  5. 05Where each kind of context belongs
  6. 06Just-in-time retrieval
  7. 07Long tasks: compaction and notes
  8. 08Misconceptions and limits
  9. 09Where this goes next
  10. 10Summary

Sources & further reading

  • Lost in the Middle: How Language Models Use Long ContextsPaper · Liu et al. · Stanford · 2023Shows that models use information at the start and end of a long input better than information in the middle. Read the introduction and Figure 1.
  • Effective context engineering for AI agentsLab research · Prithvi Rajasekaran, Ethan Dixon, Carly Ryan, Jeremy Hadfield · Anthropic · 2025The main reading for this lesson. Covers the attention budget, system prompts at the right altitude, just-in-time retrieval, compaction, structured note-taking and sub-agents.
  • Prompting best practices (long context prompting)Docs · AnthropicAnthropic's advice for prompts over 20k tokens. Read the "Long context prompting" section on document placement, XML document tags and quoting before answering.
  • How the agent loop works (context window and compaction)Docs · AnthropicHow the context window fills during a Claude Code or Agent SDK run, and how automatic compaction works. Read "Context window" and "Automatic compaction".
  • How to read a title registerDocs · HM Land RegistryHM Land Registry's own guide to the property, proprietorship and charges registers. Read it once so you know what the documents in this lesson contain.
  • Context Rot: How Increasing Input Tokens Impacts LLM PerformanceArticle · Kelly Hong, Anton Troynikov, Jeff Huber · Chroma · 2025A systematic test of many models showing performance falls as input grows, even on simple tasks, and that distractors make it worse. Read the summary and the distractor experiments.
Free · sign in to start

Sign in to keep reading.

Free, no card. We use your account to save progress, quiz scores, bookmarks and occasionally send updates from our team.

  • 10 more sections
  • 3 hands-on exercises
  • A 7-question quiz
  • Progress, quiz scores and bookmarks