liveBook · Manning

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

What you will learn in chapter 4 of Crack Any Codebase with AI

This introduction explains why agents should investigate narrow, concrete questions after a workflow maps the codebase, then preview tracing, testing, running, and documenting their findings.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This introduction explains why agents should investigate narrow, concrete questions after a workflow maps the codebase, then preview tracing, testing, running, and documenting their findings.

Key terms: decide-act-observe loop, context window, shared window, workflow, agent, broad, shallow questions, narrow, deep questions, key abstractions, flow trace, understanding test

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

This section explains why broad architecture-mapping prompts make agents skim shallowly, and why workflows should handle predictable deep questions while agents handle focused, specific ones.

Key terms: broad mapping prompt, core abstractions, overall architecture, catalog of declarations, Language Intelligence, single context window, navigation, comprehension, overhead, context budget

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

This section shows how a single focused end-to-end question lets an agent autonomously trace a behavior across many files and reveal the codebase layers and shared gateways involved.

Key terms: agent, context budget, flow trace, linear walkthrough, grep, ExplorerView, tree.onDidOpen, editorService.openEditor, IEditorService, EditorGroupView

4.3 Understanding tests: One failure taught more than 25 successes

This section shows how an agent can write and run understanding tests to verify a code-reading hypothesis and expose behavior hidden in execution order.

Key terms: understanding test, mental model, hypothesis, URI.from(), URI constructor, validator, cleanup, validation, http scheme, execution trace

4.4 Build and run: Ground truth over guesses

This section shows how an agent can build and launch an unfamiliar codebase, recover from setup failures, and use the running system as ground truth for understanding it.

Key terms: failed build, error, .nvmrc, Node version, tree-sitter, nvm install, fresh clone, npm install, npm run compile, ./scripts/code.sh

4.5 Skill file: Make the agent document what it learned

This section establishes persistent agent memory through separate local and global skill files that capture discoveries and reusable codebase-reading methods after every session.

Key terms: skill file, codebase-specific file, global agent config, portable file, CLAUDE.md, .cursorrules, repository root, ~/.claude/CLAUDE.md, end-of-session prompt, high-signal

4.6 Summary

This summary presents a focused, evidence-driven agent workflow that compounds codebase understanding through tests, running systems, and a persistent skill file.

Where this is used later

Concepts explained in this chapter

← Chapter 3: Workflow: Build your own codebase knowledge builder Chapter 5: Product intent: Reverse-engineer the PRD →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.