更新policy.md

This commit is contained in:
朱潮 2026-05-12 12:23:20 +08:00
parent 12e6b4b3c4
commit 2a83d0fa05
2 changed files with 32 additions and 8 deletions

View File

@ -1,5 +1,5 @@
{ {
"name": "ragflow-loader", "name": "ragflow-loader3",
"description": "知识库检索服务", "description": "知识库检索服务",
"hooks": { "hooks": {
"PrePrompt": [ "PrePrompt": [

View File

@ -22,6 +22,13 @@ For knowledge retrieval tasks, **this policy overrides generic codebase explorat
- `rag_retrieve` is the only knowledge source. - `rag_retrieve` is the only knowledge source.
- Do NOT answer from model knowledge first. - Do NOT answer from model knowledge first.
## 2.5 First-Call Success Principle
- The first `rag_retrieve` call is expected to return sufficient results for most questions.
- Your default assumption should be: **one call is enough**.
- Additional calls are the exception, not the norm. Only retry when results are genuinely useless (empty, error, completely off-topic).
- **Never retry just to "find better results" or "get more comprehensive coverage".** Good enough is sufficient.
## 3. Query Preparation ## 3. Query Preparation
- Do NOT pass the raw user question unless it already works well for retrieval. - Do NOT pass the raw user question unless it already works well for retrieval.
@ -41,14 +48,30 @@ For knowledge retrieval tasks, **this policy overrides generic codebase explorat
**Maximum 3 retrieval calls per question.** After each call, evaluate immediately: **Maximum 3 retrieval calls per question.** After each call, evaluate immediately:
### Sufficient — answer now ### Sufficient — answer immediately, no more calls
- 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 ANY of the following means results are sufficient — STOP and answer now:
- Empty, `Error:`, off-topic, missing core entity/scope, no usable evidence at all. - The core entity/topic in the user's question appears in the results.
- There is ANY direct or indirect evidence relevant to the user's question.
- Results are partially relevant, even if not perfectly comprehensive.
- You can compose a meaningful answer (even a partial one) from the retrieved content.
**Anti-patterns — do NOT do these:**
- ❌ "The results are good, but maybe different keywords could find something better."
- ❌ "I have enough to answer, but let me try one more query to be thorough."
- ❌ "The answer is here, but I want to double-check with a different query."
- ❌ Calling `rag_retrieve` again after you have already identified the answer in previous results.
**If you can answer the question with current results, you MUST answer immediately. Period.**
### Insufficient — the ONLY valid reasons to retry
- Results are completely empty or contain only `Error:` messages.
- ALL results are entirely off-topic with zero relevance to the user's question.
- No usable evidence exists at all — you cannot form even a partial answer.
**"Results are not detailed enough" is NOT a valid reason to retry.**
**"Results might be incomplete" is NOT a valid reason to retry.**
## 6. Fallback and Sequential Retry ## 6. Fallback and Sequential Retry
@ -88,6 +111,7 @@ Before replying to a knowledge retrieval task, verify:
- Used only `rag_retrieve` — no local filesystem inspection? - Used only `rag_retrieve` — no local filesystem inspection?
- Called `rag_retrieve` at most 3 times (not more)? - Called `rag_retrieve` at most 3 times (not more)?
- Answered immediately when results were sufficient (did NOT call again unnecessarily)? - Answered immediately when results were sufficient (did NOT call again unnecessarily)?
- Called `rag_retrieve` exactly once when first results were sufficient (did NOT retry 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.