MITupdated 2mo ago
์๋ธ์์ด์ ํธ๊ฐ ์์ ์ ์์ํ๊ธฐ ์ ๊น์ง ํ์ํ ์ปจํ ์คํธ๋ฅผ ์ ์ ์๋ ๋ฉํฐ ์์ด์ ํธ ์ํฌํ๋ก์ฐ์ "์ปจํ ์คํธ ๋ฌธ์ "๋ฅผ ํด๊ฒฐํฉ๋๋ค.
What can you do with Iterative Retrieval?
name: iterative-retrieval description: ์๋ธ์์ด์ ํธ ์ปจํ ์คํธ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํ ์ ์ง์ ์ปจํ ์คํธ ๊ฒ์ ๊ฐ์ ํจํด origin: ECC
๋ฐ๋ณต์ ๊ฒ์ ํจํด
์๋ธ์์ด์ ํธ๊ฐ ์์ ์ ์์ํ๊ธฐ ์ ๊น์ง ํ์ํ ์ปจํ ์คํธ๋ฅผ ์ ์ ์๋ ๋ฉํฐ ์์ด์ ํธ ์ํฌํ๋ก์ฐ์ "์ปจํ ์คํธ ๋ฌธ์ "๋ฅผ ํด๊ฒฐํฉ๋๋ค.
ํ์ฑํ ์์
- ์ฌ์ ์ ์์ธกํ ์ ์๋ ์ฝ๋๋ฒ ์ด์ค ์ปจํ ์คํธ๊ฐ ํ์ํ ์๋ธ์์ด์ ํธ๋ฅผ ์์ฑํ ๋
- ์ปจํ ์คํธ๊ฐ ์ ์ง์ ์ผ๋ก ๊ฐ์ ๋๋ ๋ฉํฐ ์์ด์ ํธ ์ํฌํ๋ก์ฐ๋ฅผ ๊ตฌ์ถํ ๋
- ์์ด์ ํธ ์์ ์์ "์ปจํ ์คํธ ์ด๊ณผ" ๋๋ "์ปจํ ์คํธ ๋๋ฝ" ์คํจ๋ฅผ ๊ฒช์ ๋
- ์ฝ๋ ํ์์ ์ํ RAG ์ ์ฌ ๊ฒ์ ํ์ดํ๋ผ์ธ์ ์ค๊ณํ ๋
- ์์ด์ ํธ ์ค์ผ์คํธ๋ ์ด์ ์์ ํ ํฐ ์ฌ์ฉ๋์ ์ต์ ํํ ๋
๋ฌธ์
์๋ธ์์ด์ ํธ๋ ์ ํ๋ ์ปจํ ์คํธ๋ก ์์ฑ๋ฉ๋๋ค. ๋ค์์ ์ ์ ์์ต๋๋ค:
- ๊ด๋ จ ์ฝ๋๊ฐ ํฌํจ๋ ํ์ผ
- ์ฝ๋๋ฒ ์ด์ค์ ์กด์ฌํ๋ ํจํด
- ํ๋ก์ ํธ์์ ์ฌ์ฉํ๋ ์ฉ์ด
ํ์ค ์ ๊ทผ๋ฒ์ ์คํจ:
- ๋ชจ๋ ๊ฒ์ ์ ์ก: ์ปจํ ์คํธ ์ ํ ์ด๊ณผ
- ์๋ฌด๊ฒ๋ ์ ์กํ์ง ์์: ์์ด์ ํธ๊ฐ ์ค์ํ ์ ๋ณด๋ฅผ ๊ฐ์ง ๋ชปํจ
- ํ์ํ ๊ฒ์ ์ถ์ธก: ์ข ์ข ์๋ชป๋จ
ํด๊ฒฐ์ฑ : ๋ฐ๋ณต์ ๊ฒ์
์ปจํ ์คํธ๋ฅผ ์ ์ง์ ์ผ๋ก ๊ฐ์ ํ๋ 4๋จ๊ณ ๋ฃจํ:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ DISPATCH โโโโโโโ EVALUATE โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โฒ โ โ
โ โ โผ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ LOOP โโโโโโโ REFINE โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ
โ Max 3 cycles, then proceed โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1๋จ๊ณ: DISPATCH
ํ๋ณด ํ์ผ์ ์์งํ๊ธฐ ์ํ ์ด๊ธฐ ๊ด๋ฒ์ ์ฟผ๋ฆฌ:
// 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);
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 {
// 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)
};
}
4๋จ๊ณ: LOOP
๊ฐ์ ๋ ๊ธฐ์ค์ผ๋ก ๋ฐ๋ณต (์ต๋ 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: ๋ฒ๊ทธ ์์ ์ปจํ ์คํธ
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
์์ 2: ๊ธฐ๋ฅ ๊ตฌํ
Task: "Add rate limiting to API endpoints"
Cycle 1:
DISPATCH: Search "rate", "limit", "api" in routes/**
EVALUATE: No matches - codebase uses "throttle" terminology
REFINE: Add "throttle", "middleware" keywords
Cycle 2:
DISPATCH: Search refined terms
EVALUATE: Found throttle.ts (0.9), middleware/index.ts (0.7)
REFINE: Need router patterns
Cycle 3:
DISPATCH: Search "router", "express" patterns
EVALUATE: Found router-setup.ts (0.8)
REFINE: Sufficient context
Result: throttle.ts, middleware/index.ts, router-setup.ts
์์ด์ ํธ์์ ํตํฉ
์์ด์ ํธ ํ๋กฌํํธ์์ ์ฌ์ฉ:
When retrieving context for this task:
1. Start with broad keyword search
2. Evaluate each file's relevance (0-1 scale)
3. Identify what context is still missing
4. Refine search criteria and repeat (max 3 cycles)
5. Return files with relevance >= 0.7
๋ชจ๋ฒ ์ฌ๋ก
- ๊ด๋ฒ์ํ๊ฒ ์์ํ์ฌ ์ ์ง์ ์ผ๋ก ์ขํ๊ธฐ - ์ด๊ธฐ ์ฟผ๋ฆฌ๋ฅผ ๊ณผ๋ํ๊ฒ ์ง์ ํ์ง ์๊ธฐ
- ์ฝ๋๋ฒ ์ด์ค ์ฉ์ด ํ์ต - ์ฒซ ๋ฒ์งธ ์ฌ์ดํด์์ ์ฃผ๋ก ๋ค์ด๋ฐ ์ปจ๋ฒค์ ์ด ๋๋ฌ๋จ
- ๋๋ฝ๋ ๊ฒ ์ถ์ - ๋ช ์์ ๊ฒฉ์ฐจ ์๋ณ์ด ๊ฐ์ ์ ์ฃผ๋
- "์ถฉ๋ถํ ์ข์" ์์ค์์ ์ค๋จ - ๊ด๋ จ์ฑ ๋์ ํ์ผ 3๊ฐ๊ฐ ๋ณดํต ์์ค์ ํ์ผ 10๊ฐ๋ณด๋ค ๋์
- ์์ ์๊ฒ ์ ์ธ - ๊ด๋ จ์ฑ ๋ฎ์ ํ์ผ์ ๊ด๋ จ์ฑ์ด ๋์์ง์ง ์์
๊ด๋ จ ํญ๋ชฉ
- The Longform Guide - ์๋ธ์์ด์ ํธ ์ค์ผ์คํธ๋ ์ด์ ์น์
continuous-learning์คํฌ - ์๊ฐ์ด ์ง๋จ์ ๋ฐ๋ผ ๊ฐ์ ๋๋ ํจํด~/.claude/agents/์ ์์ด์ ํธ ์ ์
Install
Add Iterative Retrieval to your client. Pick the one you use.
npx skills add edp43273-glitch/181-skillsInstalls every skill in the repository, then prompts for which to keep.
/plugin marketplace add edp43273-glitch/181-skillsAdds the repository as a plugin marketplace; install individual plugins with `/plugin install`.
git clone https://github.com/edp43273-glitch/181-skills
cp -r docs/ko-KR/skills/iterative-retrieval ~/.claude/skills/A skill is a plain directory. Copy it into `.claude/skills/` in a project or in your home directory.
Score
70 / 100
Good