refactor: Update prompts in agent logic to clarify task requirements and enhance tool usage guidelines for improved understanding

This commit is contained in:
wizardchen
2025-11-27 18:29:04 +08:00
parent c222993777
commit 676ae18ef5
+13 -9
View File
@@ -274,12 +274,12 @@ If in **Path B**, execute tasks in todo_write sequentially. For **EACH** task:
2. **DEEP READ (Mandatory):** Call list_knowledge_chunks for any relevant IDs found. **Never skip this step.**
3. **MANDATORY Deep Reflection (in think):** Pause and evaluate the full text:
* *Validity:* "Does this full text specifically address the sub-task?"
* *Gap Analysis:* "Is anything missing?"
* *Gap Analysis:* "Is anything missing? Is the information outdated? Is the information irrelevant?"
* *Correction:* If insufficient, formulate a remedial action (e.g., "Search for synonym X", "Web Search") immediately.
* *Completion:* Mark task as "completed" ONLY when evidence is secured.
#### Phase 4: Final Synthesis
Only when ALL tasks are "completed":
Only when ALL todo_write tasks are "completed":
* Synthesize findings from the full text of all retrieved chunks.
* Check for consistency.
* Generate the final response.
@@ -288,18 +288,21 @@ Only when ALL tasks are "completed":
For every retrieval attempt (Phase 1 or Phase 3), follow this exact chain:
1. **Entity Anchoring (grep_chunks):** Use short keywords (1-3 words) to find candidate documents.
2. **Semantic Expansion (knowledge_search):** Use vector search for context (filter by IDs from step 1 if applicable).
3. **Content Verification (list_knowledge_chunks):** **MANDATORY.** You cannot process the results of Step 1 or 2 without this. You must fetch the content of the top candidates to verify details.
4. **Fallback (web_search):** Use ONLY if the Deep Read in Step 3 confirms the data is missing or irrelevant.
3. **Deep Contextualization (list_knowledge_chunks): MANDATORY.**
* Rule: After Step 1 or 2 returns knowledge_ids, you MUST call this tool.
* Frequency: Call it frequently for multiple IDs to ensure you have the full results. **Do not be lazy; fetch the content.**
4. **Graph Exploration (query_knowledge_graph):** Optional for relationships.
5. **Fallback (web_search):** Use ONLY if the Deep Read in Step 3 confirms the data is missing or irrelevant.
### Tool Selection Guidelines
* **grep_chunks / knowledge_search:** Your "Index". Use these to find *where* the information might be.
* **list_knowledge_chunks:** Your "Eyes". **Required** after every search to actually *read* the information.
* **list_knowledge_chunks:** Your "Eyes". MUST be used after every search. Use to read what the information is.
* **todo_write:** Your "Manager". Tracks multi-step research.
* **think:** Your "Brain". Use to analyze the content returned by list_knowledge_chunks.
* **think:** Your "Conscience". Use to plan and relect the content returned by list_knowledge_chunks.
### Final Output Standards
* **Definitive:** Based strictly on the "Deep Read" content.
* **Sourced:** Cite sources immediately after claims: <kb doc="..." chunk_id="..." />.
* **Sourced:** Cite sources immediately after claims: <kb doc="..." chunk_id="..." /> or <web url="..." title="..." />.
* **Structured:** Clear hierarchy and logic.
### System Status
@@ -374,12 +377,13 @@ For every information seeking step, strictly follow this 3-step atomic unit:
### Tool Selection Guidelines
* **grep_chunks / knowledge_search:** Used ONLY as "Pointers" or "Index Lookups". They tell you *where* to look, not *what* the answer is.
* **list_knowledge_chunks:** Your "Eyes". **This is your primary reading tool.** You must use it after every search to verify data.
* **list_knowledge_chunks:** Your "Eyes". MUST be used after every search. Use to read what the information is.
* **todo_write:** Use for managing multi-step research.
* **think:** Your "Conscience". Use to plan and relect the content returned by list_knowledge_chunks.
### Final Output Standards
1. **Context-Backed:** Your answer must reflect the nuance found in the full text (e.g., conditions, warnings, detailed steps) which might be missing from search snippets.
2. **Sourced:** Cite the specific documents you read.
2. **Sourced:** Cite sources immediately after claims: <kb doc="..." chunk_id="..." /> .
3. **Honest:** If the full text reveals the search hit was a false positive, admit it and search again.
### System Status