From 1be339ecc069c28c234ed2ce543589f47c0a7845 Mon Sep 17 00:00:00 2001 From: Fahad Date: Tue, 10 Jun 2025 14:59:18 +0400 Subject: [PATCH] enhance: improve tool prompts with better file request grounding and response guidance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update DEBUG_ISSUE_PROMPT to request files when diagnostics are irrelevant/incomplete - Clarify question field to specify what information is needed from Claude/user - Update chat tool format_response to ask Claude to continue with user's request - Update debug tool format_response to encourage implementing fixes when root cause identified - Fix line length formatting to comply with 120 char limit 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- prompts/tool_prompts.py | 5 +++-- tools/chat.py | 2 +- tools/debug.py | 7 ++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/prompts/tool_prompts.py b/prompts/tool_prompts.py index 7c85ca9..a980f99 100644 --- a/prompts/tool_prompts.py +++ b/prompts/tool_prompts.py @@ -137,8 +137,9 @@ DEBUG_ISSUE_PROMPT = """You are an expert debugger and problem solver. Your role trace issues to their root cause, and provide actionable solutions. IMPORTANT: If you lack critical information to proceed (e.g., missing files, ambiguous error details, -insufficient context), you MUST respond ONLY with this JSON format: -{"status": "requires_clarification", "question": "Your specific question", "files_needed": ["file1.py", "file2.py"]} +insufficient context), OR if the provided diagnostics (log files, crash reports, stack traces) appear irrelevant, +incomplete, or insufficient for proper analysis, you MUST respond ONLY with this JSON format: +{"status": "requires_clarification", "question": "What specific information you need from Claude or the user to proceed with debugging", "files_needed": ["file1.py", "file2.py"]} CRITICAL: Your primary objective is to identify the root cause of the specific issue at hand and suggest the minimal fix required to resolve it. Stay focused on the main problem - avoid suggesting extensive refactoring, diff --git a/tools/chat.py b/tools/chat.py index c830851..faec5be 100644 --- a/tools/chat.py +++ b/tools/chat.py @@ -143,4 +143,4 @@ Please provide a thoughtful, comprehensive response:""" def format_response(self, response: str, request: ChatRequest) -> str: """Format the chat response with actionable guidance""" - return f"{response}\n\n---\n\n**Claude's Turn:** Evaluate this perspective alongside your analysis to form a comprehensive solution." + return f"{response}\n\n---\n\n**Claude's Turn:** Evaluate this perspective alongside your analysis to form a comprehensive solution and continue with the user's request and task at hand." diff --git a/tools/debug.py b/tools/debug.py index 1d9a549..eca9cc0 100644 --- a/tools/debug.py +++ b/tools/debug.py @@ -186,4 +186,9 @@ Focus on finding the root cause and providing actionable solutions.""" def format_response(self, response: str, request: DebugIssueRequest) -> str: """Format the debugging response""" - return f"Debug Analysis\n{'=' * 50}\n\n{response}\n\n---\n\n**Next Steps:** Evaluate Gemini's recommendations, synthesize the best fix considering potential regressions, test thoroughly, and ensure the solution doesn't introduce new issues." + return ( + f"Debug Analysis\n{'=' * 50}\n\n{response}\n\n---\n\n" + "**Next Steps:** Evaluate Gemini's recommendations, synthesize the best fix considering potential " + "regressions, and if the root cause has been clearly identified, proceed with implementing the " + "potential fixes." + )