更新retrieval-policy.md

This commit is contained in:
朱潮 2026-05-11 16:46:26 +08:00
parent 84844933b9
commit 12e6b4b3c4

View File

@ -32,25 +32,33 @@ For knowledge retrieval tasks, **this policy overrides generic codebase explorat
## 4. Retrieval Breadth (`top_k`) ## 4. Retrieval Breadth (`top_k`)
- Apply `top_k` only to `rag_retrieve`. Use the smallest sufficient value, then expand only if coverage is insufficient. - Apply `top_k` only to `rag_retrieve`. Choose the appropriate value upfront to maximize first-call success.
- Use `30` for simple fact lookup. - Use `50` for simple fact lookup or moderate synthesis, comparison, summarization, disambiguation.
- Use `50` for moderate synthesis, comparison, summarization, or disambiguation.
- Use `100` for broad recall, such as comprehensive analysis, scattered knowledge, multiple entities or periods, or list / catalog / timeline / roster / overview requests. - Use `100` for broad recall, such as comprehensive analysis, scattered knowledge, multiple entities or periods, or list / catalog / timeline / roster / overview requests.
- Raise `top_k` when keyword branches are many or results are too few, repetitive, incomplete, sparse, or too narrow. - If unsure, use `50`. Only escalate to `100` on the retry call if first results are insufficient.
- Use this expansion order: `30 → 50 → 100`. If unsure, use `100`.
## 5. Result Evaluation ## 5. Result Evaluation
Treat as insufficient if: empty, `Error:`, off-topic, missing core entity/scope, no usable evidence, partial coverage, or truncated results. **Maximum 3 retrieval calls per question.** After each call, evaluate immediately:
### Sufficient — answer now
- The core entity/topic in the user's question has been hit.
- There is direct evidence supporting the main intent of the question.
- Partial but usable coverage is sufficient — you do NOT need exhaustive or perfect coverage to answer.
- **When results are sufficient, compose the answer immediately. Do NOT call `rag_retrieve` again to "double-check" or "get more context".**
### Insufficient — retry once
- Empty, `Error:`, off-topic, missing core entity/scope, no usable evidence at all.
## 6. Fallback and Sequential Retry ## 6. Fallback and Sequential Retry
On insufficient results, follow this sequence: On insufficient results, you may retry **up to 2 more times** (3 calls total):
1. Rewrite query, retry `rag_retrieve` (once) 1. 1st retry: rewrite the query (different keywords, synonyms, broader scope), retry `rag_retrieve` with `top_k: 100`.
2. Expand `top_k`: `30 → 50 → 100` 2. 2nd retry: further rewrite or broaden the query.
3. Say "no relevant information was found" **only after** exhausting all retries. 3. If still insufficient, say "no relevant information was found".
- Do NOT switch to local filesystem inspection at any point. - Do NOT switch to local filesystem inspection at any point.
- Do NOT call `rag_retrieve` more than 3 times.
## 7. Image Handling ## 7. Image Handling
@ -78,7 +86,8 @@ This section applies only when self-knowledge is enabled.
Before replying to a knowledge retrieval task, verify: Before replying to a knowledge retrieval task, verify:
- Used only `rag_retrieve` — no local filesystem inspection? - Used only `rag_retrieve` — no local filesystem inspection?
- Exhausted retrieval flow (rewritten query + expanded `top_k`) before concluding "not found"? - Called `rag_retrieve` at most 3 times (not more)?
- Answered immediately when results were sufficient (did NOT call again unnecessarily)?
- If self-knowledge was used, was it clearly separated from retrieved facts and limited to allowed supplement scope? - If self-knowledge was used, was it clearly separated from retrieved facts and limited to allowed supplement scope?
If any answer is "no", correct the process first. If any answer is "no", correct the process first.