chapter three

3 Perception: What your agent sees determines what it does

 

This chapter covers

  • Diagnosing perception as the primary agent failure bottleneck
  • Prioritizing inputs with Context Triage
  • Compressing context via Semantic Compaction
  • Navigating unfamiliar codebases with Progressive Discovery
  • Upgrading Argus with observability
"Context engineering is the delicate art of filling the context window with just the right information at just the right time."

—Anthropic, Effective Context Engineering for AI Agents (2025)

The pull request looked easy: 180 lines across four files, adding a caching layer to a FastAPI endpoint. I gave the agent the diff, the full source of every file in the repository (about 2,000 files), the project documentation, and three weeks of Git history for good measure. I wanted thorough. I got a catastrophe.

The agent spent most of its output hallucinating a SQL injection vulnerability in a utility file that was not even part of the PR, writing four confident paragraphs about a risk that did not exist. Meanwhile, it missed the actual bug: a cache invalidation race condition that would have caused stale data in production. A senior engineer on my team spent two hours chasing the phantom SQL issue before someone thought to check the test file. The race condition sailed into staging that afternoon.

3.1 The context window is not what you think

3.1.1 Attention is not uniform

3.1.2 The three-way squeeze

3.1.3 How production agents solve this

3.1.4 Measuring perception quality

3.1.5 The four patterns ahead

3.2 Pattern: Context Triage

3.2.1 The emergency room

3.2.2 The four tiers

3.2.3 Context triage in Claude Code

3.2.4 Building it

3.2.5 When it breaks

3.3 Pattern: Semantic Compaction

3.3.1 The moment the window fills

3.3.2 Three levels of compression

3.3.3 The rule you must not break

3.3.4 Building it

3.3.5 When it breaks

3.4 Pattern: Progressive Discovery

3.4.1 The detective problem

3.4.2 Forage, then focus, then deepen

3.4.3 The production spectrum

3.4.4 Building it

3.4.5 The progressive disclosure connection

3.4.6 When it breaks

3.5 Pattern: Multi-Modal Fusion

3.5.1 When text is not enough

3.5.2 The representation decision