chapter four

4 Agent: Stop telling AI what to read. Let it decide.

 

This chapter covers

  • Agents: the decide-act-observe loop
  • Interrogating agents with scoped prompts
  • Flow tracing with zero guidance
  • Understanding tests as mental model proof
  • Skill files: knowledge that compounds

Everyone raves about AI agents. Cursor, Claude Code, Codex, Copilot: just point them at a codebase and they'll figure everything out. So you point one at VS Code and ask it to summarize the architecture. It reads 25 files, skims 83 lines each on average, and comes back with type signatures that a $2 pipeline described better in chapter 3. The most hyped tool in AI coding is worse than a script at the most obvious thing you'd try it on. That's not a defect. That's what happens when you ask an agent the wrong question.

A workflow follows a fixed pipeline: crawl, analyze, write. It can't deviate, and it doesn't need to, because each step gets a fresh context window with a full budget for deep reading. An agent is the opposite: it decides its next move at every step. Under the hood, every agent is the same loop: read context, decide the next action, execute it, read the result, repeat. Claude Code greps for a class name, reads the file it finds, notices an import, follows it to another file, hits a dead end, and backtracks. That flexibility is its superpower, but every iteration eats from the same shared context window. The more files it opens, the less room it has to think deeply about any of them.

4.1 Broad questions: Your agent skimmed 25 files and missed everything

4.2 Flow trace: One question, 15 files, zero guidance

4.3 Understanding tests: One failure taught more than 25 successes

4.4 Build and run: Ground truth over guesses

4.5 Skill file: Make the agent document what it learned

4.6 Summary