iterative-retrieval

Refines codebase context retrieval for subagents through a four-phase dispatch-evaluate-refine loop.

Updated Apr 18, 2026
One-click install
npx skills add https://github.com/JohnRebellion/.claude-public --skill iterative-retrieval-johnrebellion
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: iterative-retrieval
Source: https://github.com/JohnRebellion/.claude-public/tree/main/claude/skills/iterative-retrieval
Command: npx skills add https://github.com/JohnRebellion/.claude-public --skill iterative-retrieval-johnrebellion

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Subagents in multi-agent workflows are spawned without knowing which files, patterns, or terminology they need, so sending everything blows context limits while sending nothing leaves them blind. This Skill provides a structured loop that progressively discovers the right context. ## Core Features & Use Cases - Four-Phase Retrieval Loop: Dispatch broad queries, evaluate file relevance on a 0-1 scale, refine search criteria from discovered terminology, and loop up to 3 cycles. - Relevance Scoring & Gap Tracking: Scores files as high/medium/low relevance and explicitly identifies missing context to drive the next refinement cycle. - Terminology Discovery: Learns codebase-specific naming conventions (e.g., "throttle" instead of "rate limit") during early cycles to improve later searches. - Use Case: When fixing an authentication token expiry bug, start with broad "auth/token" searches, discover jwt-utils and session-manager files through refinement, and stop once enough high-relevance files are gathered. ## Quick Start Use the iterative-retrieval pattern to find the right codebase context for this subagent task, starting broad and refining over up to three cycles.

Frequently Asked Questions about iterative-retrieval

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I give subagents the right codebase context?▼

Use an iterative retrieval loop: dispatch a broad keyword search, score each file's relevance from 0 to 1, identify missing context, then refine the query and repeat up to three cycles. Return files scoring 0.7 or higher.

How to fix context too large errors in agent workflows?▼

Stop sending entire codebases to agents. Instead, retrieve progressively: start with broad patterns, exclude low-relevance files after evaluation, and stop once roughly three high-relevance files are found, keeping token usage bounded.

What relevance score threshold should file retrieval use?▼

Files scoring 0.8-1.0 directly implement the target functionality, 0.5-0.7 contain related patterns, and anything below 0.2 should be excluded from future cycles. Sufficient context typically means at least three files at 0.7 or above.

Why does my first retrieval query miss relevant files?▼

Initial queries fail because they use your terminology rather than the codebase's conventions, such as searching "rate limit" when the code says "throttle". The first cycle exists to discover naming conventions, which the refine phase adds to subsequent queries.

When should I stop the iterative retrieval loop?▼

Stop when you have at least three high-relevance files and no critical context gaps, or after a hard maximum of three cycles. Three strong files outperform ten mediocre ones for agent context.