From 2a83d0fa05ed1677e5f4ea7c5eef09dc72746897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=BD=AE?= Date: Tue, 12 May 2026 12:23:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0policy.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ragflow-loader/.claude-plugin/plugin.json | 2 +- .../ragflow-loader/hooks/retrieval-policy.md | 38 +++++++++++++++---- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/skills/linggan/ragflow-loader/.claude-plugin/plugin.json b/skills/linggan/ragflow-loader/.claude-plugin/plugin.json index 02fbcb2..e8e3878 100644 --- a/skills/linggan/ragflow-loader/.claude-plugin/plugin.json +++ b/skills/linggan/ragflow-loader/.claude-plugin/plugin.json @@ -1,5 +1,5 @@ { - "name": "ragflow-loader", + "name": "ragflow-loader3", "description": "知识库检索服务", "hooks": { "PrePrompt": [ diff --git a/skills/linggan/ragflow-loader/hooks/retrieval-policy.md b/skills/linggan/ragflow-loader/hooks/retrieval-policy.md index 3125b8f..db3b179 100644 --- a/skills/linggan/ragflow-loader/hooks/retrieval-policy.md +++ b/skills/linggan/ragflow-loader/hooks/retrieval-policy.md @@ -22,6 +22,13 @@ For knowledge retrieval tasks, **this policy overrides generic codebase explorat - `rag_retrieve` is the only knowledge source. - 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 - 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: -### 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".** +### Sufficient — answer immediately, no more calls -### Insufficient — retry once -- Empty, `Error:`, off-topic, missing core entity/scope, no usable evidence at all. +ANY of the following means results are sufficient — STOP and answer now: +- 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 @@ -88,6 +111,7 @@ Before replying to a knowledge retrieval task, verify: - Used only `rag_retrieve` — no local filesystem inspection? - Called `rag_retrieve` at most 3 times (not more)? - 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 any answer is "no", correct the process first.