Groundings added

This commit is contained in:
Fahad
2025-06-10 14:39:14 +04:00
parent 40a5dfccde
commit 032e783efb
4 changed files with 30 additions and 16 deletions

View File

@@ -648,7 +648,7 @@ implementations or missing test coverage. Update the code based on gemini's find
**Parameters:** **Parameters:**
- `path`: Starting directory to search for repos (default: current directory) - `path`: Starting directory to search for repos (default: current directory)
- `original_request`: The requirements/ticket for context - `original_request`: The requirements for context
- `compare_to`: Compare against a branch/tag instead of local changes - `compare_to`: Compare against a branch/tag instead of local changes
- `review_type`: full|security|performance|quick - `review_type`: full|security|performance|quick
- `severity_filter`: Filter by issue severity - `severity_filter`: Filter by issue severity

View File

@@ -273,24 +273,38 @@ concrete examples and suggestions for improvement tailored to the specific techn
CHAT_PROMPT = """You are a senior development partner and collaborative thinking companion to Claude Code. CHAT_PROMPT = """You are a senior development partner and collaborative thinking companion to Claude Code.
You excel at brainstorming, validating ideas, and providing thoughtful second opinions on technical decisions. You excel at brainstorming, validating ideas, and providing thoughtful second opinions on technical decisions.
IMPORTANT: If Claude is discussing specific code, functions, or project components, and you need additional
context (e.g., related files, configuration, dependencies, test files) to provide meaningful collaboration,
you MUST respond ONLY with this JSON format:
{"status": "requires_clarification", "question": "Your specific question", "files_needed": ["file1.py", "config.py"]}
CRITICAL: Always understand the technology stack, programming languages,
frameworks, and development environment being discussed. Then ground your collaboration within that
specific technology ecosystem - focus on approaches, patterns, and solutions that are relevant and
appropriate for the actual project scope and constraints. Avoid suggesting technologies, frameworks,
or approaches that deviate significantly from the existing stack unless there's a compelling technical reason.
Focus on practical solutions that work within the current environment and constraints.
Your collaborative approach: Your collaborative approach:
1. Engage deeply with shared ideas - build upon, extend, and explore alternatives 1. Engage deeply with shared ideas - build upon, extend, and explore alternatives within the project context
2. Think through edge cases, failure modes, and unintended consequences 2. Think through edge cases, failure modes, and unintended consequences specific to the technology stack
3. Provide balanced perspectives considering trade-offs and implications 3. Provide balanced perspectives considering trade-offs and implications relevant to the current environment
4. Challenge assumptions constructively while respecting the existing approach 4. Challenge assumptions constructively while respecting the existing approach and technology choices
5. Offer concrete examples and actionable insights 5. Offer concrete examples and actionable insights that fit within the project's scope and constraints
When brainstorming or discussing: When brainstorming or discussing:
- Consider multiple angles and approaches - Consider multiple angles and approaches that are compatible with the existing technology stack
- Identify potential pitfalls early - Identify potential pitfalls early, especially those relevant to the specific frameworks/languages in use
- Suggest creative solutions and alternatives - Suggest creative solutions and alternatives that work within the current project constraints
- Think about scalability, maintainability, and real-world usage - Think about scalability, maintainability, and real-world usage within the existing architecture
- Draw from industry best practices and patterns - Draw from industry best practices and patterns specific to the technologies being used
- Focus on solutions that can be implemented with the current tools and infrastructure
Always approach discussions as a peer - be direct, technical, and thorough. Your goal is to be Always approach discussions as a peer - be direct, technical, and thorough. Your goal is to be
the ideal thinking partner who helps explore ideas deeply, validates approaches, and uncovers the ideal thinking partner who helps explore ideas deeply, validates approaches, and uncovers
insights that might be missed in solo analysis. Think step by step through complex problems insights that might be missed in solo analysis. Think step by step through complex problems
and don't hesitate to explore tangential but relevant considerations.""" and don't hesitate to explore tangential but relevant considerations that remain within the
project's technological and architectural boundaries."""
PRECOMMIT_PROMPT = """You are an expert code change analyst specializing in pre-commit review of git diffs. PRECOMMIT_PROMPT = """You are an expert code change analyst specializing in pre-commit review of git diffs.
Your role is to act as a seasoned senior developer performing a final review before code is committed. Your role is to act as a seasoned senior developer performing a final review before code is committed.
@@ -303,7 +317,7 @@ to provide thorough analysis, you MUST respond ONLY with this JSON format:
You will receive: You will receive:
1. Git diffs showing staged/unstaged changes or branch comparisons 1. Git diffs showing staged/unstaged changes or branch comparisons
2. The original request/ticket describing what should be implemented 2. The original request describing what should be implemented
3. File paths and repository structure context 3. File paths and repository structure context
CRITICAL: First analyze the changes to understand the technology stack, frameworks, and patterns in use. CRITICAL: First analyze the changes to understand the technology stack, frameworks, and patterns in use.

View File

@@ -134,7 +134,7 @@ class TestPrecommitTool:
result = await tool.prepare_prompt(request) result = await tool.prepare_prompt(request)
# Verify result structure # Verify result structure
assert "## Original Request/Ticket" in result assert "## Original Request" in result
assert "Add hello message" in result assert "Add hello message" in result
assert "## Review Parameters" in result assert "## Review Parameters" in result
assert "Review Type: security" in result assert "Review Type: security" in result

View File

@@ -27,7 +27,7 @@ class PrecommitRequest(ToolRequest):
) )
original_request: Optional[str] = Field( original_request: Optional[str] = Field(
None, None,
description="The original user request or ticket description for the changes. Provides critical context for the review.", description="The original user request description for the changes. Provides critical context for the review.",
) )
compare_to: Optional[str] = Field( compare_to: Optional[str] = Field(
None, None,
@@ -311,7 +311,7 @@ class Precommit(BaseTool):
# Add original request context if provided # Add original request context if provided
if request.original_request: if request.original_request:
prompt_parts.append(f"## Original Request/Ticket\n\n{request.original_request}\n") prompt_parts.append(f"## Original Request\n\n{request.original_request}\n")
# Add review parameters # Add review parameters
prompt_parts.append("## Review Parameters\n") prompt_parts.append("## Review Parameters\n")