From ec976f6a66d066ad131eddee36b7d3014cd3d709 Mon Sep 17 00:00:00 2001 From: Eric Wheeler Date: Thu, 22 May 2025 18:13:56 -0700 Subject: [PATCH] fix: ensure AI uses tools before asking user questions This change adds explicit instructions to the ask_followup_question tool to ensure the AI first attempts to use available tools like search_files and list_files to locate information before asking the user questions. Fixes #3873 Signed-off-by: Eric Wheeler --- src/core/prompts/tools/ask-followup-question.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/prompts/tools/ask-followup-question.ts b/src/core/prompts/tools/ask-followup-question.ts index 7ece1e311d..4e71b39ebc 100644 --- a/src/core/prompts/tools/ask-followup-question.ts +++ b/src/core/prompts/tools/ask-followup-question.ts @@ -1,6 +1,11 @@ export function getAskFollowupQuestionDescription(): string { return `## ask_followup_question Description: Ask the user a question to gather additional information needed to complete the task. This tool should be used when you encounter ambiguities, need clarification, or require more details to proceed effectively. It allows for interactive problem-solving by enabling direct communication with the user. Use this tool judiciously to maintain a balance between gathering necessary information and avoiding excessive back-and-forth. +IMPORTANT: Before asking the user for information: +1. YOU MUST FIRST use available tools (eg, search_files, list_files, ...) to locate any needed information +2. YOU MUST ONLY request user-provided details when those tools cannot retrieve them (eg, design specific considerations). +3. YOU MUST PRIORITIZE your own knowledge and ONLY ask the user if you lack the answer when multiple options are suitable and require human consideration. + Parameters: - question: (required) The question to ask the user. This should be a clear, specific question that addresses the information you need. - follow_up: (required) A list of 2-4 suggested answers that logically follow from the question, ordered by priority or logical sequence. Each suggestion must: