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)

A pull request changed 180 lines across four files. To review it, 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. The assumption behind that choice was that more context could only help. It did not.

The agent spent most of its output analyzing a utility file that was not part of the pull request, producing four confident paragraphs about an irrelevant risk. Meanwhile, it missed the defect exposed by one of the relevant tests. That test had been in the context window the whole time. The cause was in how I had loaded the window. I had treated it like a database: throw everything in, let the model sort it out. A context window behaves more like a spotlight, and the beam has a shape: bright at the edges, dim in the middle [1]. The relevant test sat in the dim part of the beam, surrounded by 180,000 tokens of noise.

3.1 The context window as a treatment budget

3.1.1 How attention varies by position

3.1.2 The three-way squeeze

3.1.3 How production agents solve this

3.1.4 Measuring perception quality

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 Protect decision-critical evidence

3.3.4 Building it

3.3.5 When it breaks

3.4 Pattern: Progressive discovery

3.4.1 From an entry point to working context

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