iterative-retrieval by closedloop-ai/claude-plugins
npx skills add https://github.com/closedloop-ai/claude-plugins --skill iterative-retrieval此技能使协调器能够通过后续问题迭代优化子代理查询,确保子代理在协调器接受其输出前收集足够的上下文。这解决了协调器拥有子代理所缺乏的语义上下文,导致摘要不完整的问题。
此技能专为 仅限 /code 协调器(code.md 斜杠命令)设计。子代理不使用此技能——它们仅响应查询。协调器负责评估响应并决定是否继续后续提问。
注意: 子代理在其上下文中看不到此技能文档。只有协调器可以调用并遵循此协议。子代理不知道它们是迭代检索循环的一部分——它们只是像处理普通请求一样响应查询和后续问题。
此技能是可选且需要手动启用的。并非每个子代理调用都能从迭代优化中受益——简单的查找或定义明确的查询不需要它。当您预见到由于语义差距,子代理可能返回不完整的上下文时,请调用此技能。
此协议为迭代上下文收集提供了一种结构化方法。所有 4 个阶段代表了推荐的工作流程,但如果初始响应足够,第 2-4 阶段是可选的。请运用判断力——如果第 2 阶段的评估显示第一轮上下文已足够,则不需要第 3-4 阶段。
定义并派发包含完整上下文的初始查询:
使用以下检查清单评估子代理的响应是否提供了足够的上下文。如果上下文足够,直接跳转到输出(不需要第 3-4 阶段)。如果存在差距,则进入第 3 阶段。
问自己以下 4 个问题:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
如果对问题 1 或 4 的回答是“否”,或者对问题 2 或 3 的回答是“是”,则上下文很可能不充分——进入第 3 阶段。
通过有针对性的后续问题恢复子代理对话:
重复阶段 2-3,直到满足以下任一条件:
建议的最大值为 3 次优化循环(初始派发 + 2 次后续提问)。这能在彻底性与成本和延迟之间取得平衡。
重要提示:这是一个建议,而非强制限制。作为指南文档,此技能无法强制执行限制——协调器拥有最终判断权。然而,超过 3 次循环通常表明:
当迭代检索完成时,报告:
示例:
迭代检索摘要:
- 使用的循环数:2(初始 + 1 次后续提问)
- 收集到的额外上下文:错误处理模式、重试逻辑实现、超时配置
- 代理 ID:agent-abc123(可用于恢复)
有关详细使用示例,请参阅 references/examples.md(如果可用)。
每周安装数
1
代码仓库
GitHub 星标数
71
首次出现
今天
安全审计
安装于
windsurf1
amp1
cline1
openclaw1
opencode1
cursor1
This skill enables orchestrators to iteratively refine sub-agent queries through follow-up questions, ensuring sub-agents gather sufficient context before the orchestrator accepts their output. This addresses the problem where orchestrators have semantic context that sub-agents lack, leading to incomplete summaries.
This skill is designed for the/code orchestrator only (code.md slash command). Sub-agents do not use this skill - they simply respond to queries. The orchestrator is responsible for evaluating responses and deciding whether to resume with follow-ups.
Note: Sub-agents do NOT see this skill documentation in their context. Only the orchestrator can invoke and follow the protocol. Sub-agents are unaware they're part of an iterative retrieval loop - they just respond to queries and follow-ups as normal requests.
This skill is optional and opt-in. Not every sub-agent call benefits from iterative refinement - simple lookups or well-defined queries don't need it. Invoke this skill when you anticipate that a sub-agent may return incomplete context due to semantic gaps.
This protocol provides a structured approach to iterative context gathering. All 4 phases represent the recommended workflow , but phases 2-4 are optional if the initial response is sufficient. Exercise judgment - if Phase 2 evaluation shows context is sufficient on first pass, phases 3-4 aren't needed.
Define and dispatch the initial query with full context:
Evaluate whether the sub-agent's response provides sufficient context using the checklist below. If context is sufficient, skip to output (phases 3-4 not needed). If gaps exist, proceed to Phase 3.
Ask yourself these 4 questions:
If you answer "no" to question 1 or 4, OR "yes" to questions 2 or 3, the context is likely insufficient - proceed to Phase 3.
Resume the sub-agent with targeted follow-up questions:
Repeat Phases 2-3 until one of these conditions is met:
The recommended maximum is 3 refinement cycles (initial dispatch + 2 follow-ups). This balances thoroughness against cost and latency.
Important : This is a recommendation, not an enforced limit. As guidance documentation, this skill cannot enforce limits - the orchestrator has final judgment. However, exceeding 3 cycles often indicates:
When iterative retrieval completes, report:
Example:
Iterative Retrieval Summary:
- Cycles used: 2 (initial + 1 follow-up)
- Additional context gathered: Error handling patterns, retry logic implementation, timeout configuration
- Agent ID: agent-abc123 (available for resumption)
For detailed usage examples, see references/examples.md (if available).
Weekly Installs
1
Repository
GitHub Stars
71
First Seen
Today
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
windsurf1
amp1
cline1
openclaw1
opencode1
cursor1
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
60,400 周安装