The Research/Explore Agent

Claude Code Agents: Fundamentals

Chapter 10 · The Research/Explore Agent

Chapter 1 already used a search agent as its very first concrete example of context isolation. This chapter goes deeper into designing that agent type properly — the fastest, most narrowly-scoped agent in this course, built purely to locate code and answer structural questions, and calibrated by how broad a search actually needs to be.

What a Research/Explore Agent Is For

This agent answers "where is X handled" or "how is Y structured" questions by searching a codebase and reporting back file paths, patterns, and structure — nothing more. It's distinct from Chapter 4's teaching agent: a teaching agent explains a concept once it's found, building understanding; a research agent's job stops at finding and reporting where and how something is structured, without necessarily explaining the deeper conceptual "why" behind it.

Designing a Research Agent's Definition

"Use this agent to locate where something is implemented, or to answer a factual question about the codebase's structure — especially when you're not confident you'll find the right match yourself in just a few tries. Not for making changes, and not for deep conceptual explanation." Tools are the clearest, most direct example of Chapter 1's isolation principle in this entire course: Read, Grep, and Glob only — no Edit or Write whatsoever, since this agent's entire job is finding and reporting, never changing.

Model choice here is a genuine trade-off, unlike most other agents in this course. A quick, narrow lookup can often use a faster, lighter model perfectly well. A genuinely wide, ambiguous search across an unfamiliar codebase — where the right search terms aren't obvious upfront — benefits from a more capable model able to reason about where to look next as each search comes back.

Search Breadth: Quick vs. Medium vs. Thorough

Specifying how broad a search should be helps a research agent calibrate its own effort correctly:

  • Quick — a single targeted lookup, when you're fairly confident where the answer lives
  • Medium — moderate exploration across a few likely locations
  • Thorough — searching across multiple locations and naming conventions, for a genuinely uncertain or unfamiliar area of the codebase

Without this signal, a research agent might either under-search a genuinely hard question (stopping at the first plausible-looking match) or over-search a trivial one (spending effort exploring alternatives that were never really in doubt).

Writing the System Prompt for a Research Agent

A research agent's system prompt should instruct it to report exact file paths and line numbers — not vague locations like "somewhere in the auth folder" — to summarize findings concisely rather than dumping every raw search result verbatim, and to state honestly when it did not find a confident answer, rather than reporting an uncertain guess with unwarranted confidence.

Briefing a Research Agent Well

A good brief states the actual question clearly and, per the section above, the expected search breadth — "quick" for something you're fairly sure about, "thorough" for something genuinely unclear.

A Worked Example

"Find where rate limiting is implemented for the public API. I'm not sure whether it's applied per-endpoint or globally at the router level — a medium-depth search should be enough." This states the actual question, flags the genuine uncertainty driving the question (per-endpoint vs. global), and gives an explicit breadth expectation so the agent neither stops too early nor searches far wider than the question actually warrants.

AspectTeaching Agent (Ch.4)Research/Explore Agent
Job stops atUnderstanding — explains the concept once foundLocating — reports where/how, not necessarily deep "why"
Typical toolsRead, GrepRead, Grep, Glob — no Edit/Write, ever
Model choiceFavor a capable reasoning modelDepends on search breadth — light for quick lookups, capable for wide/ambiguous ones
State the search breadth explicitly
Saying "quick," "medium," or "thorough" up front is a small addition to a brief that meaningfully changes how the agent allocates its own effort — preventing both an overly shallow answer to a genuinely hard question and an unnecessarily wide search for something that was never really in doubt.
A confident answer is only as good as what the search actually covered
A research agent reporting "found it in file Y" is only as reliable as the search terms and locations it actually tried. If a codebase uses non-obvious naming, or the real answer lives somewhere the search never thought to look, the agent can miss the genuine answer entirely — and still sound just as confident about whatever it did find instead. Treating an unusually confident answer to a genuinely hard question with the same "trust but verify" instinct from Chapter 3 is worth applying here too.

Hands-On Exercises

Exercise 1

Explain why a research agent's ideal model choice is described in this chapter as a genuine trade-off, unlike most other agent types in this course.

📄 View solution
Exercise 2

A brief simply says "find the caching logic," with no stated search breadth. Explain what could go wrong in either direction (too shallow or too wide a search), and rewrite the brief to include an appropriate breadth signal.

📄 View solution
Exercise 3

A research agent confidently reports that a particular feature "is not implemented anywhere in the codebase." Using this chapter's own warning box, explain why this claim deserves some scrutiny before being accepted at face value.

📄 View solution

Chapter 10 Quick Reference

  • A research/explore agent locates code and structure — it doesn't explain deep concepts or make changes
  • Tools: Read, Grep, Glob only — the clearest isolation example in this course
  • Model choice is a genuine trade-off: lighter for quick lookups, more capable for wide/ambiguous searches
  • State search breadth explicitly — quick, medium, or thorough — so effort matches the actual question
  • It should report exact file paths/lines, summarize concisely, and admit when it didn't find a confident answer
  • A confident "found it" (or "not found anywhere") is only as good as what the search actually covered — treat it with a "trust but verify" instinct