iterative-retrieval

iterative-retrieval is a skill for Claude Code from loulanyue/awesome-claude-notes. It costs 42 tokens per session (2,046 once invoked), scanned A, original, MIT.

A method for finding the right code context for sub-agents through repeated search, evaluation, and refinement. It addresses the problem that an agent may not know which files or terms matter before starting work.

In plain words
What is it for?
Use it to dispatch agents with candidate files, inspect their results, refine the search, and repeat for up to three cycles.
Why use it?
It reduces the risk of sending an agent too much irrelevant code or omitting information it needs.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: reads .claude/ paths.

Part of the awesome-claude-notes plugin — 106 skills, 61 commands, 28 agents shipped together

Good fit Use it to dispatch agents with candidate files, inspect their results, refine the search, and repeat for up to three cycles.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/loulanyue/awesome-claude-notes/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 loulanyue/awesome-claude-notes --skill iterative-retrieval
Clone the repo
git clone --depth 1 https://github.com/loulanyue/awesome-claude-notes

Made for: Claude Code.

Or install awesome-claude-notes, the plugin that ships this one along with the rest of its 106 skills, 61 commands, 28 agents.

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/loulanyue/awesome-claude-notes/iterative-retrieval/github.svg)](https://agentmods.dev/skills/loulanyue/awesome-claude-notes/iterative-retrieval)
Your own site
<a href="https://agentmods.dev/skills/loulanyue/awesome-claude-notes/iterative-retrieval"><img src="https://agentmods.dev/badge/skills/loulanyue/awesome-claude-notes/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/loulanyue/awesome-claude-notes/iterative-retrieval"><img src="https://agentmods.dev/badge/skills/loulanyue/awesome-claude-notes/iterative-retrieval.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,046 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 warn 7 Sept 2026
SkillSpector: 2 findings, up to medium

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 →

  • medium Agent Snooping · line 4
    Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.
    Fix: Remove all code or instructions that list or read other skills' files or directories. Skills should operate independently; cross-skill access is a privilege escalation.
  • medium Agent Snooping · line 206
    Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.
    Fix: Remove all code or instructions that list or read other skills' files or directories. Skills should operate independently; cross-skill access is a privilege escalation.
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.00042 $0.02046
Opus 5 $0.00021 $0.01023
Sonnet 5 $0.00008 $0.00409
Haiku 4.5 $0.00004 $0.00205

Measured 7d ago against content hash f66bd6ed5153, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, 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 7d 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.

docs/ja-JP/skills/iterative-retrieval/SKILL.md · 212 lines

How it starts

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

反復検索パターン

マルチエージェントワークフローにおける「コンテキスト問題」を解決します。サブエージェントは作業を開始するまで、どのコンテキストが必要かわかりません。

問題

サブエージェントは限定的なコンテキストで起動されます。以下を知りません:

  • どのファイルに関連するコードが含まれているか
  • コードベースにどのようなパターンが存在するか
  • プロジェクトがどのような用語を使用しているか

標準的なアプローチは失敗します:

  • すべてを送信: コンテキスト制限を超える
  • 何も送信しない: エージェントに重要な情報が不足
  • 必要なものを推測: しばしば間違い

解決策: 反復検索

コンテキストを段階的に洗練する4フェーズのループ:

┌─────────────────────────────────────────────┐
│                                             │
│   ┌──────────┐      ┌──────────┐            │
│   │ DISPATCH │─────▶│ EVALUATE │            │
│   └──────────┘      └──────────┘            │
│        ▲                  │                 │
│        │                  ▼                 │
│   ┌──────────┐      ┌──────────┐            │
│   │   LOOP   │◀─────│  REFINE  │            │
│   └──────────┘      └──────────┘            │
│                                             │
│        最大3サイクル、その後続行              │
└─────────────────────────────────────────────┘

フェーズ1: DISPATCH

候補ファイルを収集する初期の広範なクエリ:

// 高レベルの意図から開始
const initialQuery = {
  patterns: ['src/**/*.ts', 'lib/**/*.ts'],
  keywords: ['authentication', 'user', 'session'],
  excludes: ['*.test.ts', '*.spec.ts']
};

// 検索エージェントにディスパッチ
const candidates = await retrieveFiles(initialQuery);

フェーズ2: EVALUATE

取得したコンテンツの関連性を評価:

function evaluateRelevance(files, task) {
  return files.map(file => ({
    path: file.path,
    relevance: scoreRelevance(file.content, task),
    reason: explainRelevance(file.content, task),
    missingContext: identifyGaps(file.content, task)
  }));
}

スコアリング基準:

  • 高(0.8-1.0): ターゲット機能を直接実装
  • 中(0.5-0.7): 関連するパターンや型を含む
  • 低(0.2-0.4): 間接的に関連
  • なし(0-0.2): 関連なし、除外

フェーズ3: REFINE

評価に基づいて検索基準を更新:

function refineQuery(evaluation, previousQuery) {
  return {
    // 高関連性ファイルで発見された新しいパターンを追加
    patterns: [...previousQuery.patterns, ...extractPatterns(evaluation)],

    // コードベースで見つかった用語を追加
    keywords: [...previousQuery.keywords, ...extractKeywords(evaluation)],

    // 確認された無関係なパスを除外
    excludes: [...previousQuery.excludes, ...evaluation
      .filter(e => e.relevance < 0.2)
      .map(e => e.path)
    ],

    // 特定のギャップをターゲット
    focusAreas: evaluation
      .flatMap(e => e.missingContext)
      .filter(unique)
  };
}

Read the full file on GitHub · 212 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. 7d ago First seen · 212 lines · 42 tokens per session scan A f66bd6ed5153

Subscribe to this mod's changes

iterative-retrieval is a skill published in the GitHub repository loulanyue/awesome-claude-notes (270 stars, last pushed 7d ago), licensed MIT. It adds 42 tokens to every session and 2,046 once invoked, about $0.0002 per session on Opus 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.