iterative-retrieval
Skill3 starsChanged 7 months agoMITView on GitHub
Progressive context refinement pattern for subagents. Solves the problem of agents not knowing what context they need until they start working. Uses a 4-phase loop: DISPATCH, EVALUATE, REFINE, LOOP.
We split this skill into the rules it gives an agent
3 rules. 1 is common, 2 are distinctive, and 0 are very specific to this project.
1
Common
Most of the 35 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
When delegating to subagents, you face a dilemma:
- Common: line 57
Update search criteria based on evaluation:
- Distinctive: line 71
No critical gaps identified
“Common” is measured: kept by at least 6 in 10 of the 35 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Iterative Retrieval Pattern
Solve the subagent context problem: agents don't know what they need until they start looking.
The Problem
When delegating to subagents, you face a dilemma:
- Send everything: Context overflow, wasted tokens, confused agent
- Send nothing: Agent lacks context, produces poor results
- Guess what's needed: Often wrong, misses critical files
The Solution: 4-Phase Iterative Loop
Phase 1: DISPATCH
Send a broad initial query to gather candidate context:
Search for files related to: [topic]
Keywords: [initial keywords]
File patterns: [likely patterns]
Return: File paths with relevance scoresPhase 2: EVALUATE
Score each result for relevance (0.0 to 1.0):
| File | Relevance | Reason |
|------|-----------|--------|
| src/auth/login.ts | 0.9 | Core auth logic |
| src/utils/hash.ts | 0.7 | Used by auth |
| src/config.ts | 0.3 | Has auth config section |
| src/routes.ts | 0.2 | Only references auth path |Identify gaps:
- What terminology does this codebase use? (update search terms)
- What patterns are referenced but not found?
- What dependencies need exploration?
Phase 3: REFINE
Update search criteria based on evaluation:
Updated keywords: [refined keywords from codebase terminology]
New file patterns: [patterns discovered during evaluation]
Specific files to read: [high-relevance files]
Gaps to fill: [what's still missing]Phase 4: LOOP
Repeat phases 1-3 with refined criteria.
Stopping Criteria:
- 3+ files with relevance >= 0.7
- No critical gaps identified
- OR max 3 iterations reached (proceed with best available)
Example: Finding Auth Implementation
Iteration 1:
- DISPATCH: Search for "auth", "login", "session"
- EVALUATE: Found middleware but not the auth service
- REFINE: Codebase uses "identity" not "auth"
Iteration 2:
- DISPATCH: Search for "identity", "credential", "token"
- EVALUATE: Found IdentityService, TokenManager, SessionStore
- Result: 5 files with relevance >= 0.8 — stop and proceed
Implementation Pattern
async function iterativeRetrieve(topic: string, maxIterations = 3) {
let keywords = extractKeywords(topic);
let context: FileContext[] = [];
for (let i = 0; i < maxIterations; i++) {
// DISPATCH
const candidates = await searchCodebase(keywords);
// EVALUATE
const scored = await scoreRelevance(candidates, topic);
context = mergeContext(context, scored.filter(s => s.relevance >= 0.5));
// Check stopping criteria
const highRelevance = context.filter(c => c.relevance >= 0.7);
if (highRelevance.length >= 3) break;
// REFINE
keywords = refineKeywords(keywords, scored);
}
return context;
}When to Use
- Delegating research to a subagent
- Exploring unfamiliar codebases
- Gathering context for code review
- Building context for architectural analysis
When NOT to Use
- You already know exactly what files are needed
- The task is in a single file
- The codebase is small enough to read entirely
Other versions37 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 37
- github/gh-aw★ 5.5ksame name
- bradygaster/squad★ 3.3ksame name
- microsoft/Generative-AI-for-beginners-dotnet★ 3.2ksame name
- microsoft/waza★ 1.5ksame name
- loulanyue/awesome-claude-notes★ 272same name
- Azure/fleet★ 227same name
- kubefleet-dev/kubefleet★ 162same name
- Fmarzochi/EGC★ 61same name
- myths-labs/muse★ 37same name
- frankxai/agentic-creator-os★ 10same name
27 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use ralphinho-rfc-pipeline, configure-ecc and 7 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
junimnjwSkillralphinho-rfc-pipeline
RFC-driven multi-agent DAG execution pattern with quality gates, merge queues, and work unit orchestration.
Also in 8 projects that use this
royaluniondesign-sysSkillconfigure-ecc
Interactive installer for Everything Claude Code — guides users through selecting and installing skills and rules to user-level or project-level directories, verifies paths, and optionally optimizes installed files.
Also in 7 projects that use this
royaluniondesign-sysSkillcontent-hash-cache-pattern
Cache expensive file processing results using SHA-256 content hashes — path-independent, auto-invalidating, with service layer separation.
Also in 10 projects that use this
MicrosoftSkillsquad-commands
Categorized catalog of common Squad operations. Coordinator reads this file and presents it as an interactive menu when the user asks for available commands or help.
Also in 4 projects that use this
MicrosoftSkille2e-template-testing
End-to-end validation of coordinator and agent template changes
Also in 3 projects that use this
junimnjwSkillcontinuous-agent-loop
Patterns for continuous autonomous agent loops with quality gates, evals, and recovery controls.
Also in 10 projects that use this
- +2 more from microsoft
- +1 more from junimnjw
In this repository72 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- api-designerSkill
- backend-patternsSkill
- code-reviewerSkill
- debugging-assistantSkill
- golang-testingSkill
- project-guidelines-exampleSkill
- python-testingSkill
- refactoring-guideSkill
- spec-driven-developmentSkill
- tdd-workflowSkill
- verification-loopSkill
- update-docsSkill
- api-docsSkill
- changelog-writerSkill
- readme-generatorSkill
- django-patternsSkill
- django-securitySkill
- django-tddSkill
- django-verificationSkill
- fastapi-patternsSkill
- nextjs-patternsSkill
- react-patternsSkill
- springboot-patternsSkill
- springboot-securitySkill
- springboot-tddSkill
- branch-strategySkill
- changelogSkill
- commit-helperSkill
- pr-creatorSkill
- prSkill
- evolveSkill
- instinct-exportSkill
- instinct-importSkill
- instinct-statusSkill
- cleanupSkill
- lint-fixSkill
- refactor-cleanSkill
- update-depsSkill
- continuous-learningSkill
- continuous-learning-v2Skill
- eval-harnessSkill
- strategic-compactSkill
- golang-patternsSkill
- python-patternsSkill
- rust-patternsSkill
- typescript-patternsSkill
- accessibility-checkerSkill
- build-fixSkill
- code-reviewSkill
- e2eSkill
- performance-reviewerSkill
- security-auditorSkill
- security-reviewSkill
- test-coverageSkill
- checkpointSkill
- deploySkill
- evalSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

