Updated instructions

This commit is contained in:
Fahad
2025-06-18 05:58:50 +04:00
parent e74e612de9
commit c3276595f9
10 changed files with 25 additions and 25 deletions

View File

@@ -16,7 +16,7 @@ from .base import BaseTool, ToolRequest
# Field descriptions to avoid duplication between Pydantic and JSON schema # Field descriptions to avoid duplication between Pydantic and JSON schema
ANALYZE_FIELD_DESCRIPTIONS = { ANALYZE_FIELD_DESCRIPTIONS = {
"files": "Files or directories to analyze (must be absolute paths)", "files": "Files or directories to analyze (must be FULL absolute paths to real files / folders - DO NOT SHORTEN)",
"prompt": "What to analyze or look for", "prompt": "What to analyze or look for",
"analysis_type": "Type of analysis to perform", "analysis_type": "Type of analysis to perform",
"output_format": "How to format the output", "output_format": "How to format the output",

View File

@@ -89,7 +89,7 @@ class ToolRequest(BaseModel):
images: Optional[list[str]] = Field( images: Optional[list[str]] = Field(
None, None,
description=( description=(
"Optional image(s) for visual context. Accepts absolute file paths or " "Optional image(s) for visual context. Accepts absolute file paths (must be FULL absolute paths to real files / folders - DO NOT SHORTEN) or "
"base64 data URLs. Only provide when user explicitly mentions images. " "base64 data URLs. Only provide when user explicitly mentions images. "
"When including images, please describe what you believe each image contains " "When including images, please describe what you believe each image contains "
"(e.g., 'screenshot of error dialog', 'architecture diagram', 'code snippet') " "(e.g., 'screenshot of error dialog', 'architecture diagram', 'code snippet') "
@@ -955,18 +955,18 @@ When recommending searches, be specific about what information you need and why
for file_path in request.files: for file_path in request.files:
if not os.path.isabs(file_path): if not os.path.isabs(file_path):
return ( return (
f"Error: All file paths must be absolute. " f"Error: All file paths must be FULL absolute paths to real files / folders - DO NOT SHORTEN. "
f"Received relative path: {file_path}\n" f"Received relative path: {file_path}\n"
f"Please provide the full absolute path starting with '/'" f"Please provide the full absolute path starting with '/' (must be FULL absolute paths to real files / folders - DO NOT SHORTEN)"
) )
# Check if request has 'path' attribute (used by review_changes tool) # Check if request has 'path' attribute (used by review_changes tool)
if hasattr(request, "path") and request.path: if hasattr(request, "path") and request.path:
if not os.path.isabs(request.path): if not os.path.isabs(request.path):
return ( return (
f"Error: Path must be absolute. " f"Error: Path must be FULL absolute paths to real files / folders - DO NOT SHORTEN. "
f"Received relative path: {request.path}\n" f"Received relative path: {request.path}\n"
f"Please provide the full absolute path starting with '/'" f"Please provide the full absolute path starting with '/' (must be FULL absolute paths to real files / folders - DO NOT SHORTEN)"
) )
return None return None
@@ -1014,7 +1014,7 @@ When recommending searches, be specific about what information you need and why
f"MANDATORY ACTION REQUIRED: The prompt is too large for MCP's token limits (>{MCP_PROMPT_SIZE_LIMIT:,} characters). " f"MANDATORY ACTION REQUIRED: The prompt is too large for MCP's token limits (>{MCP_PROMPT_SIZE_LIMIT:,} characters). "
"YOU MUST IMMEDIATELY save the prompt text to a temporary file named 'prompt.txt' in the working directory. " "YOU MUST IMMEDIATELY save the prompt text to a temporary file named 'prompt.txt' in the working directory. "
"DO NOT attempt to shorten or modify the prompt. SAVE IT AS-IS to 'prompt.txt'. " "DO NOT attempt to shorten or modify the prompt. SAVE IT AS-IS to 'prompt.txt'. "
"Then resend the request with the absolute file path to 'prompt.txt' in the files parameter, " "Then resend the request with the absolute file path to 'prompt.txt' in the files parameter (must be FULL absolute path - DO NOT SHORTEN), "
"along with any other files you wish to share as context. Leave the prompt text itself empty or very brief in the new request. " "along with any other files you wish to share as context. Leave the prompt text itself empty or very brief in the new request. "
"This is the ONLY way to handle large prompts - you MUST follow these exact steps." "This is the ONLY way to handle large prompts - you MUST follow these exact steps."
), ),

View File

@@ -23,7 +23,7 @@ CHAT_FIELD_DESCRIPTIONS = {
"kind of response would be most helpful. The more context and detail you provide, the more " "kind of response would be most helpful. The more context and detail you provide, the more "
"valuable and targeted the response will be." "valuable and targeted the response will be."
), ),
"files": "Optional files for context (must be absolute paths)", "files": "Optional files for context (must be FULL absolute paths to real files / folders - DO NOT SHORTEN)",
"images": ( "images": (
"Optional images for visual context. Useful for UI discussions, diagrams, visual problems, " "Optional images for visual context. Useful for UI discussions, diagrams, visual problems, "
"error screens, or architectural mockups." "error screens, or architectural mockups."

View File

@@ -25,7 +25,7 @@ from .base import BaseTool, ToolRequest
# Field descriptions to avoid duplication between Pydantic and JSON schema # Field descriptions to avoid duplication between Pydantic and JSON schema
CODEREVIEW_FIELD_DESCRIPTIONS = { CODEREVIEW_FIELD_DESCRIPTIONS = {
"files": "Code files or directories to review (must be absolute paths)", "files": "Code files or directories to review (must be FULL absolute paths to real files / folders - DO NOT SHORTEN)",
"prompt": ( "prompt": (
"User's summary of what the code does, expected behavior, constraints, and review objectives. " "User's summary of what the code does, expected behavior, constraints, and review objectives. "
"IMPORTANT: Before using this tool, Claude should first perform its own preliminary review - " "IMPORTANT: Before using this tool, Claude should first perform its own preliminary review - "

View File

@@ -63,7 +63,7 @@ class ConsensusRequest(ToolRequest):
) )
files: Optional[list[str]] = Field( files: Optional[list[str]] = Field(
default_factory=list, default_factory=list,
description="Optional files or directories for additional context (must be absolute paths)", description="Optional files or directories for additional context (must be FULL absolute paths - DO NOT SHORTEN)",
) )
images: Optional[list[str]] = Field( images: Optional[list[str]] = Field(
default_factory=list, default_factory=list,
@@ -148,7 +148,7 @@ class ConsensusTool(BaseTool):
"files": { "files": {
"type": "array", "type": "array",
"items": {"type": "string"}, "items": {"type": "string"},
"description": "Optional files or directories for additional context (must be absolute paths)", "description": "Optional files or directories for additional context (must be FULL absolute paths - DO NOT SHORTEN)",
}, },
"images": { "images": {
"type": "array", "type": "array",

View File

@@ -45,10 +45,10 @@ DEBUG_FIELD_DESCRIPTIONS = {
"contain the problematic code, or are necessary for understanding the root cause. " "contain the problematic code, or are necessary for understanding the root cause. "
"This can include any relevant log files, error description documents, investigation documents, " "This can include any relevant log files, error description documents, investigation documents, "
"claude's own findings as a document, related code that may help with analysis." "claude's own findings as a document, related code that may help with analysis."
"DO NOT include every file scanned during investigation (must be absolute paths)." "DO NOT include every file scanned during investigation (must be FULL absolute paths - DO NOT SHORTEN)."
), ),
"error_context": "Stack trace, snippet from logs, or additional error context. For very large text you MUST instead" "error_context": "Stack trace, snippet from logs, or additional error context. For very large text you MUST instead"
"save the context as a temporary file within the project folder and share it as an absolute file path" "save the context as a temporary file within the project folder and share it as a FULL absolute file path - DO NOT SHORTEN"
"reference to the files parameter.", "reference to the files parameter.",
"images": "Optional images showing error screens, UI issues, logs displays, or visual debugging information", "images": "Optional images showing error screens, UI issues, logs displays, or visual debugging information",
} }

View File

@@ -32,7 +32,7 @@ class PrecommitRequest(ToolRequest):
path: str = Field( path: str = Field(
..., ...,
description="Starting directory to search for git repositories (must be absolute path).", description="Starting directory to search for git repositories (must be FULL absolute paths - DO NOT SHORTEN).",
) )
prompt: Optional[str] = Field( prompt: Optional[str] = Field(
None, None,
@@ -76,7 +76,7 @@ class PrecommitRequest(ToolRequest):
) )
files: Optional[list[str]] = Field( files: Optional[list[str]] = Field(
None, None,
description="Optional files or directories to provide as context (must be absolute paths). These files are not part of the changes but provide helpful context like configs, docs, or related code.", description="Optional files or directories to provide as context (must be FULL absolute paths - DO NOT SHORTEN). These files are not part of the changes but provide helpful context like configs, docs, or related code.",
) )
images: Optional[list[str]] = Field( images: Optional[list[str]] = Field(
None, None,
@@ -116,7 +116,7 @@ class Precommit(BaseTool):
"properties": { "properties": {
"path": { "path": {
"type": "string", "type": "string",
"description": "Starting directory to search for git repositories (must be absolute path).", "description": "Starting directory to search for git repositories (must be FULL absolute paths - DO NOT SHORTEN).",
}, },
"model": self.get_model_field_schema(), "model": self.get_model_field_schema(),
"prompt": { "prompt": {
@@ -172,7 +172,7 @@ class Precommit(BaseTool):
"files": { "files": {
"type": "array", "type": "array",
"items": {"type": "string"}, "items": {"type": "string"},
"description": "Optional files or directories to provide as context (must be absolute paths). These files are not part of the changes but provide helpful context like configs, docs, or related code.", "description": "Optional files or directories to provide as context (must be FULL absolute paths - DO NOT SHORTEN). These files are not part of the changes but provide helpful context like configs, docs, or related code.",
}, },
"images": { "images": {
"type": "array", "type": "array",

View File

@@ -32,12 +32,12 @@ logger = logging.getLogger(__name__)
# Field descriptions to avoid duplication between Pydantic and JSON schema # Field descriptions to avoid duplication between Pydantic and JSON schema
REFACTOR_FIELD_DESCRIPTIONS = { REFACTOR_FIELD_DESCRIPTIONS = {
"files": "Code files or directories to analyze for refactoring opportunities (must be absolute paths)", "files": "Code files or directories to analyze for refactoring opportunities (must be FULL absolute paths to real files / folders - DO NOT SHORTEN)",
"prompt": "Description of refactoring goals, context, and specific areas of focus", "prompt": "Description of refactoring goals, context, and specific areas of focus",
"refactor_type": "Type of refactoring analysis to perform", "refactor_type": "Type of refactoring analysis to perform",
"focus_areas": "Specific areas to focus on (e.g., 'performance', 'readability', 'maintainability', 'security')", "focus_areas": "Specific areas to focus on (e.g., 'performance', 'readability', 'maintainability', 'security')",
"style_guide_examples": ( "style_guide_examples": (
"Optional existing code files to use as style/pattern reference (must be absolute paths). " "Optional existing code files to use as style/pattern reference (must be FULL absolute paths to real files / folders - DO NOT SHORTEN). "
"These files represent the target coding style and patterns for the project." "These files represent the target coding style and patterns for the project."
), ),
} }

View File

@@ -39,7 +39,7 @@ class TestGenerationRequest(ToolRequest):
files: list[str] = Field( files: list[str] = Field(
..., ...,
description="Code files or directories to generate tests for (must be absolute paths)", description="Code files or directories to generate tests for (must be FULL absolute paths to real files / folders - DO NOT SHORTEN)",
) )
prompt: str = Field( prompt: str = Field(
..., ...,
@@ -48,7 +48,7 @@ class TestGenerationRequest(ToolRequest):
test_examples: Optional[list[str]] = Field( test_examples: Optional[list[str]] = Field(
None, None,
description=( description=(
"Optional existing test files or directories to use as style/pattern reference (must be absolute paths). " "Optional existing test files or directories to use as style/pattern reference (must be FULL absolute paths to real files / folders - DO NOT SHORTEN). "
"If not provided, the tool will determine the best testing approach based on the code structure. " "If not provided, the tool will determine the best testing approach based on the code structure. "
"For large test directories, only the smallest representative tests should be included to determine testing patterns. " "For large test directories, only the smallest representative tests should be included to determine testing patterns. "
"If similar tests exist for the code being tested, include those for the most relevant patterns." "If similar tests exist for the code being tested, include those for the most relevant patterns."
@@ -91,7 +91,7 @@ class TestGenerationTool(BaseTool):
"files": { "files": {
"type": "array", "type": "array",
"items": {"type": "string"}, "items": {"type": "string"},
"description": "Code files or directories to generate tests for (must be absolute paths)", "description": "Code files or directories to generate tests for (must be FULL absolute paths to real files / folders - DO NOT SHORTEN)",
}, },
"model": self.get_model_field_schema(), "model": self.get_model_field_schema(),
"prompt": { "prompt": {
@@ -102,7 +102,7 @@ class TestGenerationTool(BaseTool):
"type": "array", "type": "array",
"items": {"type": "string"}, "items": {"type": "string"},
"description": ( "description": (
"Optional existing test files or directories to use as style/pattern reference (must be absolute paths). " "Optional existing test files or directories to use as style/pattern reference (must be FULL absolute paths to real files / folders - DO NOT SHORTEN). "
"If not provided, the tool will determine the best testing approach based on the code structure. " "If not provided, the tool will determine the best testing approach based on the code structure. "
"For large test directories, only the smallest representative tests will be included to determine testing patterns. " "For large test directories, only the smallest representative tests will be included to determine testing patterns. "
"If similar tests exist for the code being tested, include those for the most relevant patterns." "If similar tests exist for the code being tested, include those for the most relevant patterns."

View File

@@ -31,7 +31,7 @@ class ThinkDeepRequest(ToolRequest):
) )
files: Optional[list[str]] = Field( files: Optional[list[str]] = Field(
None, None,
description="Optional file paths or directories for additional context (must be absolute paths)", description="Optional file paths or directories for additional context (must be FULL absolute paths to real files / folders - DO NOT SHORTEN)",
) )
images: Optional[list[str]] = Field( images: Optional[list[str]] = Field(
None, None,
@@ -85,7 +85,7 @@ class ThinkDeepTool(BaseTool):
"files": { "files": {
"type": "array", "type": "array",
"items": {"type": "string"}, "items": {"type": "string"},
"description": "Optional file paths or directories for additional context (must be absolute paths)", "description": "Optional file paths or directories for additional context (must be FULL absolute paths to real files / folders - DO NOT SHORTEN)",
}, },
"images": { "images": {
"type": "array", "type": "array",