Best fit
- 逐步优化上下文检索以解决子代理上下文问题的模式
affaan-m/ECC
逐步优化上下文检索以解决子代理上下文问题的模式
npx skills add https://github.com/affaan-m/ECC --skill "docs/zh-CN/skills/iterative-retrieval"Source checked Jul 28, 2026·Refresh due Oct 26, 2026
Reorganized from the pinned upstream SKILL.md
According to the pinned SKILL.md from affaan-m/ECC: 解决多智能体工作流中的“上下文问题”,即子智能体在开始工作前不知道需要哪些上下文。
npx skills add https://github.com/affaan-m/ECC --skill "docs/zh-CN/skills/iterative-retrieval"Best fit
Bring this context
Expected outputs
Key source sections
Sections are extracted automatically from the pinned SKILL.md and link back to the source.
当需要生成需要代码库上下文但无法预先预测的子代理时 构建需要逐步完善上下文的多代理工作流时 在代理任务中遇到"上下文过大"或"缺少上下文"的失败时 为代码探索设计类似 RAG 的检索管道时 在代理编排中优化令牌使用时
哪些文件包含相关代码 代码库中存在哪些模式 项目使用什么术语
高 (0.8-1.0):直接实现目标功能 中 (0.5-0.7):包含相关模式或类型 低 (0.2-0.4):略微相关 无 (0-0.2):不相关,排除
Review the “阶段 1:调度” section in the pinned source before continuing.
高 (0.8-1.0):直接实现目标功能 中 (0.5-0.7):包含相关模式或类型 低 (0.2-0.4):略微相关 无 (0-0.2):不相关,排除
SkillSignal prompt templates
These prompts were written by SkillSignal from the source structure; they are not upstream text.
Task-start prompt
Confirm source fit, inputs, and outputs before acting.
Use iterative-retrieval to help me with: [specific task]. Context: [files, data, or background]. Constraints: [environment, scope, and prohibited actions]. Before acting, check the pinned SKILL.md and explain which sections apply, what inputs are still missing, and what you will deliver.
Source-guided execution
Make the Agent explicitly follow the key extracted sections.
Apply the pinned iterative-retrieval source to [task]. Pay particular attention to these source sections: “何时激活”, “问题”, “解决方案:迭代检索”, “阶段 1:调度”, “阶段 2:评估”. Preserve the important decision at each step. Mark facts not covered by the source as “needs confirmation” instead of inventing them. Then verify the result against my acceptance criteria: [criteria].
Result-review prompt
Check omissions, permissions, and source drift before delivery.
Review the current iterative-retrieval result: (1) does it satisfy the original task; (2) were any applicable steps or limits in the pinned SKILL.md missed; (3) did it perform any unauthorized file, command, network, or data action; and (4) which conclusions remain unverified? List issues first, then fix only what the source or user authorization supports.
Output checklist
The task matches the purpose documented in the SKILL.md.
The source section “何时激活” has been checked.
The source section “问题” has been checked.
The source section “解决方案:迭代检索” has been checked.
The source section “阶段 1:调度” has been checked.
Inputs, constraints, and acceptance criteria are explicit.
Unverified facts, compatibility, and outcome claims are clearly marked.
Any file, command, network, or data action has been reviewed.
Choose a different workflow
Pattern for progressively refining context retrieval to solve the subagent context problem
A separate implementation from affaan-m/ECC; compare its source, maintenance signals, and permission requirements.
Open source detail서브에이전트 컨텍스트 문제를 해결하기 위한 점진적 컨텍스트 검색 개선 패턴
A separate implementation from affaan-m/ECC; compare its source, maintenance signals, and permission requirements.
Open source detailPattern for progressively refining context retrieval to solve the subagent context problem
A separate implementation from affaan-m/ECC; compare its source, maintenance signals, and permission requirements.
Open source detailFAQ
解决多智能体工作流中的“上下文问题”,即子智能体在开始工作前不知道需要哪些上下文。
The catalog detected this source-specific install command: npx skills add https://github.com/affaan-m/ECC --skill "docs/zh-CN/skills/iterative-retrieval". Inspect the command and pinned source before running it.
No dedicated Agent platform is declared in the pinned source record.
Quality breakdown
Based on traceable docs and repository signals; stars are not treated as quality.
Compare before choosing
These links are selected from shared tasks, functions, stacks, platforms, and same-name variants. Compare the source owner, documentation, permissions, and maintenance signals.
Pattern for progressively refining context retrieval to solve the subagent context problem
서브에이전트 컨텍스트 문제를 해결하기 위한 점진적 컨텍스트 검색 개선 패턴
Pattern for progressively refining context retrieval to solve the subagent context problem
サブエージェントのコンテキスト問題を解決するために、コンテキスト取得を段階的に洗練するパターン
When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program
解决多智能体工作流中的“上下文问题”,即子智能体在开始工作前不知道需要哪些上下文。
子智能体被生成时上下文有限。它们不知道:
标准方法会失败:
一个逐步优化上下文的 4 阶段循环:
┌─────────────────────────────────────────────┐
│ │
│ ┌──────────┐ ┌──────────┐ │
│ │ 调度 │─────│ 评估 │ │
│ └──────────┘ └──────────┘ │
│ ▲ │ │
│ │ ▼ │
│ ┌──────────┐ ┌──────────┐ │
│ │ 循环 │─────│ 优化 │ │
│ └──────────┘ └──────────┘ │
│ │
│ 最多3次循环,然后继续 │
└─────────────────────────────────────────────┘
初始的广泛查询以收集候选文件:
// Start with high-level intent
const initialQuery = {
patterns: ['src/**/*.ts', 'lib/**/*.ts'],
keywords: ['authentication', 'user', 'session'],
excludes: ['*.test.ts', '*.spec.ts']
};
// Dispatch to retrieval agent
const candidates = await retrieveFiles(initialQuery);
评估检索到的内容的相关性:
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)
}));
}
评分标准:
根据评估结果更新搜索条件:
function refineQuery(evaluation, previousQuery) {
return {
// Add new patterns discovered in high-relevance files
patterns: [...previousQuery.patterns, ...extractPatterns(evaluation)],
// Add terminology found in codebase
keywords: [...previousQuery.keywords, ...extractKeywords(evaluation)],
// Exclude confirmed irrelevant paths
excludes: [...previousQuery.excludes, ...evaluation
.filter(e => e.relevance < 0.2)
.map(e => e.path)
],
// Target specific gaps
focusAreas: evaluation
.flatMap(e => e.missingContext)
.filter(unique)
};
}
使用优化后的条件重复(最多 3 个周期):
async function iterativeRetrieve(task, maxCycles = 3) {
let query = createInitialQuery(task);
let bestContext = [];
for (let cycle = 0; cycle < maxCycles; cycle++) {
const candidates = await retrieveFiles(query);
const evaluation = evaluateRelevance(candidates, task);
// Check if we have sufficient context
const highRelevance = evaluation.filter(e => e.relevance >= 0.7);
if (highRelevance.length >= 3 && !hasCriticalGaps(evaluation)) {
return highRelevance;
}
// Refine and continue
query = refineQuery(evaluation, query);
bestContext = mergeContext(bestContext, highRelevance);
}
return bestContext;
}
任务:"修复身份验证令牌过期错误"
循环 1:
分发:在 src/** 中搜索 "token"、"auth"、"expiry"
评估:找到 auth.ts (0.9)、tokens.ts (0.8)、user.ts (0.3)
优化:添加 "refresh"、"jwt" 关键词;排除 user.ts
循环 2:
分发:搜索优化后的关键词
评估:找到 session-manager.ts (0.95)、jwt-utils.ts (0.85)
优化:上下文已充分(2 个高相关文件)
结果:auth.ts、tokens.ts、session-manager.ts、jwt-utils.ts
任务:"为API端点添加速率限制"
周期 1:
分发:在 routes/** 中搜索 "rate"、"limit"、"api"
评估:无匹配项 - 代码库使用 "throttle" 术语
优化:添加 "throttle"、"middleware" 关键词
周期 2:
分发:搜索优化后的术语
评估:找到 throttle.ts (0.9)、middleware/index.ts (0.7)
优化:需要路由模式
周期 3:
分发:搜索 "router"、"express" 模式
评估:找到 router-setup.ts (0.8)
优化:上下文已足够
结果:throttle.ts、middleware/index.ts、router-setup.ts
在智能体提示中使用:
在为该任务检索上下文时:
1. 从广泛的关键词搜索开始
2. 评估每个文件的相关性(0-1 分制)
3. 识别仍缺失哪些上下文
4. 优化搜索条件并重复(最多 3 个循环)
5. 返回相关性 >= 0.7 的文件
continuous-learning 技能 - 适用于随时间改进的模式agents/)