iterative-retrieval

iterative-retrieval is a skill for Claude Code, Codex from jnPiyush/AgentX. It costs 73 tokens per session (1,616 once invoked), scanned A, original, Apache-2.0.

A guide to refining the information given to a subagent through repeated search, filtering, and follow-up questions instead of sending it an entire repository or document set at once.

In plain words
What is it for?
It helps delegate code reading, research, and document questions while returning focused evidence from large files, repositories, or collections of search results.
Why use it?
Large context dumps waste the subagent's limits and can cause it to miss or invent evidence. Iterative retrieval keeps only the material needed to answer the current question.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents.

Good fit It helps delegate code reading, research, and document questions while returning focused evidence from large files, repositories, or collections of search results.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jnpiyush/agentx/iterative-retrieval
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add jnPiyush/AgentX --skill iterative-retrieval
Clone the repo
git clone --depth 1 https://github.com/jnPiyush/AgentX

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for iterative-retrieval

README.md
[![agentmods](https://agentmods.dev/badge/skills/jnpiyush/agentx/iterative-retrieval/github.svg)](https://agentmods.dev/skills/jnpiyush/agentx/iterative-retrieval)
Your own site
<a href="https://agentmods.dev/skills/jnpiyush/agentx/iterative-retrieval"><img src="https://agentmods.dev/badge/skills/jnpiyush/agentx/iterative-retrieval/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for iterative-retrieval

Your own site · 80×15
<a href="https://agentmods.dev/skills/jnpiyush/agentx/iterative-retrieval"><img src="https://agentmods.dev/badge/skills/jnpiyush/agentx/iterative-retrieval.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 73 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,616 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
SkillSpector: 1 finding, up to low

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • low Excessive Agency · line 128
    Skill's behavior or capabilities extend beyond its stated purpose. Scope creep allows an agent to perform actions unrelated to its documented functionality, increasing the attack surface.
    Fix: Limit the skill's scope to its documented purpose. Remove instructions that enable the agent to perform actions outside its stated functionality.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00073 $0.01616
Opus 5.5 $0.00029 $0.00646
Sonnet 5.5 $0.00015 $0.00323
Haiku 4.5 $0.00007 $0.00162

Measured 20d ago against content hash 689e72f24702, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

iterative-retrieval scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 20d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/skills/ai-systems/iterative-retrieval/SKILL.md · 158 lines

How it starts

The opening of the file, as written. The whole thing — 158 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Iterative Retrieval for Subagents

Purpose: Keep subagent context budgets small while still answering the parent agent's real question. Scope: Subagent delegation, RAG-style scoped reads, multi-pass code search, evidence extraction.


When to Use This Skill

  • Parent agent needs a subagent to read large files, long docs, or many search hits and return a short answer.
  • The naive approach ("here is the whole repo, summarize") will blow the subagent context.
  • The question is open enough that one search query will miss relevant evidence.
  • Answer must cite specific files, lines, or sections, not just produce a paraphrase.

When NOT to Use

  • Single-file edits where you can read the file directly.
  • Questions answerable from titles or filenames alone.
  • Tasks where the parent agent already has the relevant content in context.

The Anti-Pattern (One-Shot Context Dump)

Parent: "Read these 40 files and tell me where auth is handled."
  -> subagent loads 40 files
  -> hits context limit at file 17
  -> hallucinates the rest, or returns truncated nonsense

This fails because:

  • Subagent burns budget on irrelevant files before reaching the answer.
  • No evidence trail; parent cannot verify the claim.
  • Re-running with a refined query wastes the same budget again.

The Iterative Retrieval Pattern

Five phases, executed by the subagent under a strict turn budget (typically 5-8 turns).

Phase 1: Scope

The subagent restates the parent's question in its own words and lists what it does NOT need to know.

Question: "Where is authentication handled?"
In scope: middleware, login endpoints, token validation, session lifecycle.
Out of scope: UI login forms, password reset email templates, OAuth provider config.
Budget: 6 turns, 30 KB of file reads.

Phase 2: Broad Probe

Run one cheap, high-recall search to map the territory. Read filenames and one-line previews only.

Text search (regex): "authenticate|authorize|login|session|token"
File-name search (glob): "**/auth/**", "**/*auth*.ts"

Read the full file on GitHub · 158 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 20d ago Changed 689e72f24702
  2. 1mo ago Changed 605c8c78e7a9
  3. 1mo ago First seen · 158 lines · 73 tokens per session scan A d9e48f89e4f1

Subscribe to this mod's changes

iterative-retrieval is a skill published in the GitHub repository jnPiyush/AgentX (16 stars, last pushed 3d ago), licensed Apache-2.0. It adds 73 tokens to every session and 1,616 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

embeddings

Vector embeddings with HNSW indexing, sql.js persistence, and hyperbolic support. 75x faster with agentic-flow integration. Use when: semantic search, pattern matching, similarity queries, knowledge retrieval. Skip when: exact text matching, simple lookups, no semantic understanding needed.

ruvnet/ruflo · 62 tokens

agent-platform-rag-engine-management

Manage and query Agent Platform RAG Engine Corpora and retrieve grounded contexts using the Google GenAI SDK. Use when listing RAG corpora or files, inspecting a corpus, retrieving contexts, or generating content grounded in a RAG corpus. Do not use for standard database queries (use SQL/Spanner skills), Google…

google/skills · 85 tokens

llm-app-patterns

Production-ready patterns for building LLM applications. Covers RAG pipelines, agent architectures, prompt IDEs, and LLMOps monitoring. Use when designing AI applications, implementing RAG, building agents, or setting up LLM observability.

davila7/claude-code-templates · 54 tokens

9router-embeddings

Generate vector embeddings via 9Router /v1/embeddings using OpenAI / Gemini / Mistral / Voyage / Nvidia / GitHub embedding models for RAG, semantic search, similarity. Use when the user wants embeddings, vectors, RAG, semantic search, or to embed text.

decolua/9router · 66 tokens

similarity-search-patterns

Implement efficient similarity search with vector databases. Use when building semantic search, implementing nearest neighbor queries, or optimizing retrieval performance.

foryourhealth111-pixel/Vibe-Skills · 30 tokens

embedding-strategies

Select and optimize embedding models for semantic search and RAG applications. Use when choosing embedding models, implementing chunking strategies, or optimizing embedding quality for specific domains.

foryourhealth111-pixel/Vibe-Skills · 37 tokens