iterative-retrieval

Refines codebase context retrieval through iterative dispatch, evaluate, and refine cycles.

Updated Mar 25, 2026
One-click install
npx skills add https://github.com/Femad-6/my-skills --skill iterative-retrieval-femad-6
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: iterative-retrieval
Source: https://github.com/Femad-6/my-skills/tree/main/.github/skills/iterative-retrieval
Command: npx skills add https://github.com/Femad-6/my-skills --skill iterative-retrieval-femad-6

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Subagents in multi-agent workflows are spawned with limited context and cannot predict which files or patterns they need upfront, leading to context overflow, missing information, or failed tasks. ## Core Features & Use Cases - Four-Phase Retrieval Loop: Implements DISPATCH, EVALUATE, REFINE, and LOOP phases that progressively narrow search criteria over a maximum of three cycles. - Relevance Scoring: Scores candidate files on a 0-1 scale and identifies missing context gaps to drive the next query refinement. - Terminology Discovery: Learns codebase-specific naming conventions (e.g., discovering "throttle" instead of "rate limit") to improve subsequent searches. - Use Case: When fixing an authentication token expiry bug, the loop starts with broad keyword searches, evaluates relevance of auth.ts and tokens.ts, refines with discovered terms like "jwt" and "refresh", and returns only high-relevance files. ## Quick Start Use the iterative-retrieval pattern to gather the right codebase context for this task, refining the search 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, evaluate each file's relevance on a 0-1 scale, identify missing context, then refine the query and repeat up to three cycles. Return only files scoring 0.7 or higher.

How to fix context too large errors in agent workflows?

Instead of sending everything, start with a broad query and progressively narrow it using relevance scoring. Exclude files scoring below 0.2 and stop once you have three high-relevance files, keeping token usage bounded.

What is iterative retrieval in multi-agent systems?

Iterative retrieval is a four-phase pattern (dispatch, evaluate, refine, loop) that progressively refines search criteria based on relevance feedback. It lets agents discover codebase terminology and patterns they could not predict upfront.

When should I stop refining retrieval queries?

Stop when you have at least three files with relevance scores of 0.7 or higher and no critical context gaps remain. The pattern caps iteration at three cycles to prevent diminishing returns.

What are the limitations of iterative context retrieval?

The approach depends on initial keyword choices and may need a full cycle just to learn codebase terminology. It also caps at three cycles, so highly obscure dependencies may still be missed if early queries miss entirely.