This skill should be used when the user asks to "explore the codebase", "research the code", "gather context", or when spawning Explore agents where single-pass results may miss critical details. Dispatches subagents with automatic refinement loops.
View on GitHubJanuary 20, 2026
Select agents to install to:
npx add-skill https://github.com/settlemint/agent-marketplace/blob/main/plan-mode/skills/iterative-retrieval/SKILL.md -a claude-code --skill iterative-retrievalInstallation paths:
.claude/skills/iterative-retrieval/# Iterative Subagent Retrieval Protocol
A systematic approach to gathering context through subagents that ensures sufficient information before proceeding. Instead of accepting single-pass results, the orchestrator evaluates sufficiency and asks follow-up questions until confident.
## Core Insight
**Orchestrators have semantic context that subagents lack.**
When you dispatch a subagent, you know the purpose behind the request—the decision or action the information will support. The subagent only knows the literal query. Single-pass summaries often miss key details because the subagent lacks this implicit context.
**Solution:** Evaluate every subagent return and ask follow-up questions before accepting it. Loop until sufficient.
## When to Use
- Spawning Explore agents for codebase research
- Gathering context before planning decisions
- Investigating unfamiliar code areas
- Researching external documentation
- Any context-gathering task where completeness matters
## When NOT to Use
- Simple, targeted queries with clear answers
- Time-critical operations where latency matters
- Queries where the first result is definitionally sufficient
- Follow-up operations on already-gathered context
## The 4-Phase Protocol
### Phase 1: Initial Dispatch
Before dispatching, explicitly define your context needs:
1. **Define PRIMARY OBJECTIVE** - What decision or action does this information support?
2. **Define INITIAL QUERIES** - Specific items to retrieve
3. **Dispatch with BOTH** - Include queries AND objective context in the prompt
4. **Store agent ID** - Returned by Task tool for potential resumption
```javascript
// Example: Explore agent for understanding auth system
const result = Task({
subagent_type: "Explore",
description: "Research auth system",
prompt: `OBJECTIVE: Planning implementation of OAuth2 refresh tokens
QUERIES:
1. Where is authentication currently handled?
2. What token formats are used?
3. How are sessions managed?
WHY: Need to