通过渐进式上下文检索优化子代理信息获取与任务完成质量。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "iterative-retrieval" 技能: 1. 下载 https://raw.githubusercontent.com/affaan-m/ECC/main/docs/ko-KR/skills/iterative-retrieval/SKILL.md 2. 保存为 ~/.claude/skills/iterative-retrieval/SKILL.md 3. 装好后重载技能,告诉我可以用了
请把 iterative-retrieval 模式用于我的代码排障流程:先根据报错信息检索最小必要上下文,再逐轮补充相关文件、依赖和日志,直到子代理能定位根因,并给出每轮应检索什么信息。
一套分阶段的检索与补充上下文方案,帮助子代理逐步定位代码问题。
请设计一个 iterative-retrieval 提示模板,用于文档问答子代理。要求先检索目录和摘要,再按问题逐步拉取章节、术语定义和引用内容,避免一次塞入过多上下文。
一个可复用的提示模板与检索顺序,适合文档问答场景下的渐进式上下文获取。
我在做资料研究时,子代理经常漏掉关键背景。请用 iterative-retrieval 模式设计一个流程:先收集主题概览,再补充时间线、核心概念、争议点和来源,直到输出足够完整。
一个面向研究任务的递进式检索流程,减少遗漏并提升结论完整性。
서브에이전트가 작업을 시작하기 전까지 필요한 컨텍스트를 알 수 없는 멀티 에이전트 워크플로우의 "컨텍스트 문제"를 해결합니다.
서브에이전트는 제한된 컨텍스트로 생성됩니다. 다음을 알 수 없습니다:
표준 접근법의 실패:
컨텍스트를 점진적으로 개선하는 4단계 루프:
┌─────────────────────────────────────────────┐
│ │
│ ┌──────────┐ ┌──────────┐ │
│ │ DISPATCH │─────│ EVALUATE │ │
│ └──────────┘ └──────────┘ │
│ ▲ │ │
│ │ ▼ │
│ ┌──────────┐ ┌──────────┐ │
│ │ LOOP │─────│ REFINE │ │
│ └──────────┘ └──────────┘ │
│ │
│ Max 3 cycles, then proceed │
└─────────────────────────────────────────────┘
후보 파일을 수집하기 위한 초기 광범위 쿼리:
// 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;
}
Task: "Fix the authentication token expiry bug"
Cycle 1:
DISPATCH: Search for "token", "auth", "expiry" in src/**
EVALUATE: Found auth.ts (0.9), tokens.ts (0.8), user.ts (0.3)
REFINE: Add "refresh", "jwt" keywords; exclude user.ts
Cycle 2:
DISPATCH: Search refined terms
EVALUATE: Found session-manager.ts (0.95), jwt-utils.ts (0.85)
REFINE: Sufficient context (2 high-relevance files)
Result: auth.ts, tokens.ts, session-manager.ts, jwt-utils.ts
Task: "Add rate limiting to API endpoints"
Cycle 1:
DISPATCH: Search "rate", "limit", "api" in routes/**
…
帮助开发者为代码代理配置性能优化、安全防护与研究优先工作流。
提供数据库迁移、回滚与零停机发布的最佳实践指导,适用于多种 ORM 与 SQL 数据库。
通过双评审智能体对结果进行对抗式校验,提升输出发布前的可靠性
帮助你掌握地道 Rust 模式、所有权与并发实践,编写安全高性能应用。
基于 C++ Core Guidelines 编写、审查并重构更安全现代的 C++ 代码。
为 Claude Code 会话提供系统化校验流程,帮助检查结果正确性与质量。
通过分阶段优化上下文检索,帮助子代理获得更准确完整的任务信息
通过逐步细化检索上下文,提升子代理任务理解与结果质量。
通过为每个任务分派独立子代理并穿插代码审查,稳步推进实现计划。
用于在当前会话中拆分并并行推进独立实现任务,加快开发执行效率。
并行分派多个智能体,同时调查并修复彼此独立的问题
用于多轮推演与递归决策,保留可追溯证据链并比较多种方案。