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.