[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M730JSBN5H70JMCADMSB8GFG":3,"skill-same:01M730JSBN5H70JMCADMSB8GFG":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M730JSBN5H70JMCADMSB8GFG","iterative-retrieval",null,"Pattern for progressively refining context retrieval to solve the subagent context problem","SriramGandhiS\u002FSkills","SriramGandhiS","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F211849986?v=4","01M72WQCW12BYX71C6WN584TTA","Sriram S","01M72WQCWTJ2RD0ET1X31AF1RC",1,"MIT","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fskills\u002Feverything-claude-code\u002Fskills\u002Fiterative-retrieval\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: iterative-retrieval\ndescription: Pattern for progressively refining context retrieval to solve the subagent context problem\norigin: ECC\n---\n\n# Iterative Retrieval Pattern\n\nSolves the \"context problem\" in multi-agent workflows where subagents don't know what context they need until they start working.\n\n## When to Activate\n\n- Spawning subagents that need codebase context they cannot predict upfront\n- Building multi-agent workflows where context is progressively refined\n- Encountering \"context too large\" or \"missing context\" failures in agent tasks\n- Designing RAG-like retrieval pipelines for code exploration\n- Optimizing token usage in agent orchestration\n\n## The Problem\n\nSubagents are spawned with limited context. They don't know:\n- Which files contain relevant code\n- What patterns exist in the codebase\n- What terminology the project uses\n\nStandard approaches fail:\n- **Send everything**: Exceeds context limits\n- **Send nothing**: Agent lacks critical information\n- **Guess what's needed**: Often wrong\n\n## The Solution: Iterative Retrieval\n\nA 4-phase loop that progressively refines context:\n\n```\n┌─────────────────────────────────────────────┐\n│                                             │\n│   ┌──────────┐      ┌──────────┐            │\n│   │ DISPATCH │─────│ EVALUATE │            │\n│   └──────────┘      └──────────┘            │\n│        ▲                  │                 │\n│        │                  ▼                 │\n│   ┌──────────┐      ┌──────────┐            │\n│   │   LOOP   │─────│  REFINE  │            │\n│   └──────────┘      └──────────┘            │\n│                                             │\n│        Max 3 cycles, then proceed           │\n└─────────────────────────────────────────────┘\n```\n\n### Phase 1: DISPATCH\n\nInitial broad query to gather candidate files:\n\n```javascript\n\u002F\u002F Start with high-level intent\nconst initialQuery = {\n  patterns: ['src\u002F**\u002F*.ts', 'lib\u002F**\u002F*.ts'],\n  keywords: ['authentication', 'user', 'session'],\n  excludes: ['*.test.ts', '*.spec.ts']\n};\n\n\u002F\u002F Dispatch to retrieval agent\nconst candidates = await retrieveFiles(initialQuery);\n```\n\n### Phase 2: EVALUATE\n\nAssess retrieved content for relevance:\n\n```javascript\nfunction evaluateRelevance(files, task) {\n  return files.map(file => ({\n    path: file.path,\n    relevance: scoreRelevance(file.content, task),\n    reason: explainRelevance(file.content, task),\n    missingContext: identifyGaps(file.content, task)\n  }));\n}\n```\n\nScoring criteria:\n- **High (0.8-1.0)**: Directly implements target functionality\n- **Medium (0.5-0.7)**: Contains related patterns or types\n- **Low (0.2-0.4)**: Tangentially related\n- **None (0-0.2)**: Not relevant, exclude\n\n### Phase 3: REFINE\n\nUpdate search criteria based on evaluation:\n\n```javascript\nfunction refineQuery(evaluation, previousQuery) {\n  return {\n    \u002F\u002F Add new patterns discovered in high-relevance files\n    patterns: [...previousQuery.patterns, ...extractPatterns(evaluation)],\n\n    \u002F\u002F Add terminology found in codebase\n    keywords: [...previousQuery.keywords, ...extractKeywords(evaluation)],\n\n    \u002F\u002F Exclude confirmed irrelevant paths\n    excludes: [...previousQuery.excludes, ...evaluation\n      .filter(e => e.relevance \u003C 0.2)\n      .map(e => e.path)\n    ],\n\n    \u002F\u002F Target specific gaps\n    focusAreas: evaluation\n      .flatMap(e => e.missingContext)\n      .filter(unique)\n  };\n}\n```\n\n### Phase 4: LOOP\n\nRepeat with refined criteria (max 3 cycles):\n\n```javascript\nasync function iterativeRetrieve(task, maxCycles = 3) {\n  let query = createInitialQuery(task);\n  let bestContext = [];\n\n  for (let cycle = 0; cycle \u003C maxCycles; cycle++) {\n    const candidates = await retrieveFiles(query);\n    const evaluation = evaluateRelevance(candidates, task);\n\n    \u002F\u002F Check if we have sufficient context\n    const highRelevance = evaluation.filter(e => e.relevance >= 0.7);\n    if (highRelevance.length >= 3 && !hasCriticalGaps(evaluation)) {\n      return highRelevance;\n    }\n\n    \u002F\u002F Refine and continue\n    query = refineQuery(evaluation, query);\n    bestContext = mergeContext(bestContext, highRelevance);\n  }\n\n  return bestContext;\n}\n```\n\n## Practical Examples\n\n### Example 1: Bug Fix Context\n\n```\nTask: \"Fix the authentication token expiry bug\"\n\nCycle 1:\n  DISPATCH: Search for \"token\", \"auth\", \"expiry\" in src\u002F**\n  EVALUATE: Found auth.ts (0.9), tokens.ts (0.8), user.ts (0.3)\n  REFINE: Add \"refresh\", \"jwt\" keywords; exclude user.ts\n\nCycle 2:\n  DISPATCH: Search refined terms\n  EVALUATE: Found session-manager.ts (0.95), jwt-utils.ts (0.85)\n  REFINE: Sufficient context (2 high-relevance files)\n\nResult: auth.ts, tokens.ts, session-manager.ts, jwt-utils.ts\n```\n\n### Example 2: Feature Implementation\n\n```\nTask: \"Add rate limiting to API endpoints\"\n\nCycle 1:\n  DISPATCH: Search \"rate\", \"limit\", \"api\" in routes\u002F**\n  EVALUATE: No matches - codebase uses \"throttle\" terminology\n  REFINE: Add \"throttle\", \"middleware\" keywords\n\nCycle 2:\n  DISPATCH: Search refined terms\n  EVALUATE: Found throttle.ts (0.9), middleware\u002Findex.ts (0.7)\n  REFINE: Need router patterns\n\nCycle 3:\n  DISPATCH: Search \"router\", \"express\" patterns\n  EVALUATE: Found router-setup.ts (0.8)\n  REFINE: Sufficient context\n\nResult: throttle.ts, middleware\u002Findex.ts, router-setup.ts\n```\n\n## Integration with Agents\n\nUse in agent prompts:\n\n```markdown\nWhen retrieving context for this task:\n1. Start with broad keyword search\n2. Evaluate each file's relevance (0-1 scale)\n3. Identify what context is still missing\n4. Refine search criteria and repeat (max 3 cycles)\n5. Return files with relevance >= 0.7\n```\n\n## Best Practices\n\n1. **Start broad, narrow progressively** - Don't over-specify initial queries\n2. **Learn codebase terminology** - First cycle often reveals naming conventions\n3. **Track what's missing** - Explicit gap identification drives refinement\n4. **Stop at \"good enough\"** - 3 high-relevance files beats 10 mediocre ones\n5. **Exclude confidently** - Low-relevance files won't become relevant\n\n## Related\n\n- [The Longform Guide](https:\u002F\u002Fx.com\u002Faffaanmustafa\u002Fstatus\u002F2014040193557471352) - Subagent orchestration section\n- `continuous-learning` skill - For patterns that improve over time\n- Agent definitions bundled with ECC (manual install path: `agents\u002F`)\n","# Iterative Retrieval Pattern\n\nSolves the \"context problem\" in multi-agent workflows where subagents don't know what context they need until they start working.\n\n## When to Activate\n\n- Spawning subagents that need codebase context they cannot predict upfront\n- Building multi-agent workflows where context is progressively refined\n- Encountering \"context too large\" or \"missing context\" failures in agent tasks\n- Designing RAG-like retrieval pipelines for code exploration\n- Optimizing token usage in agent orchestration\n\n## The Problem\n\nSubagents are spawned with limited context. They don't know:\n- Which files contain relevant code\n- What patterns exist in the codebase\n- What terminology the project uses\n\nStandard approaches fail:\n- **Send everything**: Exceeds context limits\n- **Send nothing**: Agent lacks critical information\n- **Guess what's needed**: Often wrong\n\n## The Solution: Iterative Retrieval\n\nA 4-phase loop that progressively refines context:\n\n```\n┌─────────────────────────────────────────────┐\n│                                             │\n│   ┌──────────┐      ┌──────────┐            │\n│   │ DISPATCH │─────│ EVALUATE │            │\n│   └──────────┘      └──────────┘            │\n│        ▲                  │                 │\n│        │                  ▼                 │\n│   ┌──────────┐      ┌──────────┐            │\n│   │   LOOP   │─────│  REFINE  │            │\n│   └──────────┘      └──────────┘            │\n│                                             │\n│        Max 3 cycles, then proceed           │\n└─────────────────────────────────────────────┘\n```\n\n### Phase 1: DISPATCH\n\nInitial broad query to gather candidate files:\n\n```javascript\n\u002F\u002F Start with high-level intent\nconst initialQuery = {\n  patterns: ['src\u002F**\u002F*.ts', 'lib\u002F**\u002F*.ts'],\n  keywords: ['authentication', 'user', 'session'],\n  excludes: ['*.test.ts', '*.spec.ts']\n};\n\n\u002F\u002F Dispatch to retrieval agent\nconst candidates = await retrieveFiles(initialQuery);\n```\n\n### Phase 2: EVALUATE\n\nAssess retrieved content for relevance:\n\n```javascript\nfunction evaluateRelevance(files, task) {\n  return files.map(file => ({\n    path: file.path,\n    relevance: scoreRelevance(file.content, task),\n    reason: explainRelevance(file.content, task),\n    missingContext: identifyGaps(file.content, task)\n  }));\n}\n```\n\nScoring criteria:\n- **High (0.8-1.0)**: Directly implements target functionality\n- **Medium (0.5-0.7)**: Contains related patterns or types\n- **Low (0.2-0.4)**: Tangentially related\n- **None (0-0.2)**: Not relevant, exclude\n\n### Phase 3: REFINE\n\nUpdate search criteria based on evaluation:\n\n```javascript\nfunction refineQuery(evaluation, previousQuery) {\n  return {\n    \u002F\u002F Add new patterns discovered in high-relevance files\n    patterns: [...previousQuery.patterns, ...extractPatterns(evaluation)],\n\n    \u002F\u002F Add terminology found in codebase\n    keywords: [...previousQuery.keywords, ...extractKeywords(evaluation)],\n\n    \u002F\u002F Exclude confirmed irrelevant paths\n    excludes: [...previousQuery.excludes, ...evaluation\n      .filter(e => e.relevance \u003C 0.2)\n      .map(e => e.path)\n    ],\n\n    \u002F\u002F Target specific gaps\n    focusAreas: evaluation\n      .flatMap(e => e.missingContext)\n      .filter(unique)\n  };\n}\n```\n\n### Phase 4: LOOP\n\nRepeat with refined criteria (max 3 cycles):\n\n```javascript\nasync function iterativeRetrieve(task, maxCycles = 3) {\n  let query = createInitialQuery(task);\n  let bestContext = [];\n\n  for (let cycle = 0; cycle \u003C maxCycles; cycle++) {\n    const candidates = await retrieveFiles(query);\n    const evaluation = evaluateRelevance(candidates, task);\n\n    \u002F\u002F Check if we have sufficient context\n    const highRelevance = evaluation.filter(e => e.relevance >= 0.7);\n    if (highRelevance.length >= 3 && !hasCriticalGaps(evaluation)) {\n      return highRelevance;\n    }\n\n    \u002F\u002F Refine and continue\n    query = refineQuery(evaluation, query);\n    bestContext = mergeContext(bestContext, highRelevance);\n  }\n\n  return bestContext;\n}\n```\n\n## Practical Examples\n\n### Example 1: Bug Fix Context\n\n```\nTask: \"Fix the authentication token expiry bug\"\n\nCycle 1:\n  DISPATCH: Search for \"token\", \"auth\", \"expiry\" in src\u002F**\n  EVALUATE: Found auth.ts (0.9), tokens.ts (0.8), user.ts (0.3)\n  REFINE: Add \"refresh\", \"jwt\" keywords; exclude user.ts\n\nCycle 2:\n  DISPATCH: Search refined terms\n  EVALUATE: Found session-manager.ts (0.95), jwt-utils.ts (0.85)\n  REFINE: Sufficient context (2 high-relevance files)\n\nResult: auth.ts, tokens.ts, session-manager.ts, jwt-utils.ts\n```\n\n### Example 2: Feature Implementation\n\n```\nTask: \"Add rate limiting to API endpoints\"\n\nCycle 1:\n  DISPATCH: Search \"rate\", \"limit\", \"api\" in routes\u002F**\n  EVALUATE: No matches - codebase uses \"throttle\" terminology\n  REFINE: Add \"throttle\", \"middleware\" keywords\n\nCycle 2:\n  DISPATCH: Search refined terms\n  EVALUATE: Found throttle.ts (0.9), middleware\u002Findex.ts (0.7)\n  REFINE: Need router patterns\n\nCycle 3:\n  DISPATCH: Search \"router\", \"express\" patterns\n  EVALUATE: Found router-setup.ts (0.8)\n  REFINE: Sufficient context\n\nResult: throttle.ts, middleware\u002Findex.ts, router-setup.ts\n```\n\n## Integration with Agents\n\nUse in agent prompts:\n\n```markdown\nWhen retrieving context for this task:\n1. Start with broad keyword search\n2. Evaluate each file's relevance (0-1 scale)\n3. Identify what context is still missing\n4. Refine search criteria and repeat (max 3 cycles)\n5. Return files with relevance >= 0.7\n```\n\n## Best Practices\n\n1. **Start broad, narrow progressively** - Don't over-specify initial queries\n2. **Learn codebase terminology** - First cycle often reveals naming conventions\n3. **Track what's missing** - Explicit gap identification drives refinement\n4. **Stop at \"good enough\"** - 3 high-relevance files beats 10 mediocre ones\n5. **Exclude confidently** - Low-relevance files won't become relevant\n\n## Related\n\n- [The Longform Guide](https:\u002F\u002Fx.com\u002Faffaanmustafa\u002Fstatus\u002F2014040193557471352) - Subagent orchestration section\n- `continuous-learning` skill - For patterns that improve over time\n- Agent definitions bundled with ECC (manual install path: `agents\u002F`)\n",{"name":5,"origin":24,"description":7},"ECC","master","d6ca01da0f24a3b0e26e4a8b7b66cbd25d429f5d","skills\u002Feverything-claude-code\u002Fskills\u002Fiterative-retrieval",0,"https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills","https:\u002F\u002Fgithub.com\u002FSriramGandhiS","https:\u002F\u002Fsriram.website\u002F","Curious guy who keeps tinkering until something works","2026-05-20 16:21:34",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add SriramGandhiS\u002FSkills --skill iterative-retrieval",{"tool":40,"command":41},"bunx","bunx skills add SriramGandhiS\u002FSkills --skill iterative-retrieval",{"tool":43,"command":44},"pnpm","pnpm dlx skills add SriramGandhiS\u002FSkills --skill iterative-retrieval","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fskills\u002Feverything-claude-code\u002Fskills\u002Fiterative-retrieval\u002FSKILL.md",true,[],[49,56,61,67,74,81],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M732609EPJWV13PVTX3GT4TM","webgpu-threejs-tsl","Comprehensive guide for developing WebGPU-enabled Three.js applications using TSL (Three.js Shading Language). Covers WebGPU renderer setup, TSL syntax and node materials, compute shaders, post-processing effects, and WGSL integration. Use this skill when working with Three.js WebGPU, TSL shaders, node materials, or GPU compute in Three.js.","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fwebgpu-threejs-tsl\u002Fskills\u002Fwebgpu-threejs-tsl\u002FSKILL.md",[],[],{"skillNo":57,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M7325XM47AGWB6K6C4VXKE6B","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fwebgpu-threejs-tsl\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M7325WP6DES69JKC840VMFEP","verification-loop","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fweb-assets\u002Fdocs\u002Fzh-TW\u002Fskills\u002Fverification-loop\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M7325TFQF1DZTQ6J3WGQQ1VR","tdd-workflow","Use this skill when writing new features, fixing bugs, or refactoring code. Enforces test-driven development with 80%+ coverage including unit, integration, and E2E tests.","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fweb-assets\u002Fdocs\u002Fzh-TW\u002Fskills\u002Ftdd-workflow\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7325RGV9AY9PK92D2V8KKPW","strategic-compact","Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fweb-assets\u002Fdocs\u002Fzh-TW\u002Fskills\u002Fstrategic-compact\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M7325MZC28SE86E7NMCNEFS4","security-review","Use this skill when adding authentication, handling user input, working with secrets, creating API endpoints, or implementing payment\u002Fsensitive features. Provides comprehensive security checklist and patterns.","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fweb-assets\u002Fdocs\u002Fzh-TW\u002Fskills\u002Fsecurity-review\u002FSKILL.md",[],[]]