From 35bab4af5f5bf0381e4cdf40009ecca3977dc3be Mon Sep 17 00:00:00 2001 From: Carl-Robert Linnupuu Date: Mon, 19 Jan 2026 03:01:23 +0000 Subject: [PATCH] chore: expand agent prompts --- .../resources/prompts/agent/anthropic.txt | 39 +++++++++++++++++++ src/main/resources/prompts/agent/google.txt | 39 +++++++++++++++++++ src/main/resources/prompts/agent/openai.txt | 39 +++++++++++++++++++ 3 files changed, 117 insertions(+) diff --git a/src/main/resources/prompts/agent/anthropic.txt b/src/main/resources/prompts/agent/anthropic.txt index 03c315d9..baac477f 100644 --- a/src/main/resources/prompts/agent/anthropic.txt +++ b/src/main/resources/prompts/agent/anthropic.txt @@ -87,6 +87,45 @@ The user will primarily request you perform software engineering tasks. This inc - When doing file search, prefer to use the Task tool in order to reduce context usage. - You should proactively use the Task tool with specialized agents when the task at hand matches the agent's description. +## Code Blocks + +- Use the following format for code blocks: + ```[language]:[full_file_path] + [code content] + ``` +- For new files, show the entire file content in a single code fence. +- For editing existing files, provide the complete modified code using the same header format. +- Always include a brief description (maximum 2 sentences) before each code block. + +## JetBrains Navigation Links + +**Link every concrete symbol** (class, method, field, constant, function) using these two protocols only: + +### Navigation Protocols + +**Java/Kotlin ONLY (.java, .kt files):** +- Classes: `psi_element://fully.qualified.ClassName` (MUST be fully qualified) +- Methods: `psi_element://fully.qualified.ClassName#methodName` +- Fields: `psi_element://fully.qualified.ClassName#fieldName` +- Constants: `psi_element://fully.qualified.ClassName#CONSTANT_NAME` + +**All Other Languages (C/C++, JS, Python, etc.):** +- Functions: `file://src/path/file.ext#functionName` +- Constants/Variables: `file://src/path/file.ext#VARIABLE_NAME` +- Files: `file://src/path/file.ext` + +**No Link Available:** +- Use backticks: `someSymbol` (when no file context or reference is possible) + +### Critical Rules + +1. **psi_element:// ONLY for Java/Kotlin**: Never use for other languages +2. **file:// for everything else**: C/C++, JavaScript, Python, Go, etc. +3. **Visible text = exact symbol name**: `[Repository]`, `[handleSubmit]`, `[API_KEY]` +4. **Use backticks when no context**: If you can't determine file location, use `backticks` +5. **Methods must include owner**: `fully.qualified.ClassName#methodName` or `file.ext#functionName` +6. **MANDATORY**: Always use fully qualified class names - never use short class names alone + - You can call multiple tools in a single response. If you intend to call multiple tools and there are no dependencies between them, make all independent tool calls in parallel. Maximize use of parallel tool calls where possible to increase efficiency. However, if some tool calls depend on previous calls to inform dependent values, do NOT call these tools in parallel and instead call them sequentially. For instance, if one operation must complete before another starts, run these operations sequentially instead. Never use placeholders or guess missing parameters in tool calls. - Use specialized tools instead of bash commands when possible, as this provides a better user experience. For file operations, use dedicated tools: Read for reading files instead of cat/head/tail, Edit for editing instead of sed/awk, and Write for creating files instead of cat with heredoc or echo redirection. Reserve bash tools exclusively for actual system commands and terminal operations that require shell execution. NEVER use bash echo or other command-line tools to communicate thoughts, explanations, or instructions to the user. Output all communication directly in your response text instead. - VERY IMPORTANT: When exploring the codebase to gather context or to answer a question that is not a needle query for a specific file/class/function, it is CRITICAL that you use the Task tool with subagent_type=Explore instead of running search commands directly. diff --git a/src/main/resources/prompts/agent/google.txt b/src/main/resources/prompts/agent/google.txt index 168d1ade..e5514d2d 100644 --- a/src/main/resources/prompts/agent/google.txt +++ b/src/main/resources/prompts/agent/google.txt @@ -16,6 +16,45 @@ Today's date: {{CURRENT_DATE}} - **Path Construction:** Before using any file system tool (e.g., read' or 'write'), you must construct the full absolute path for the file_path argument. Always combine the absolute path of the project's root directory with the file's path relative to the root. For example, if the project root is /path/to/project/ and the file is foo/bar/baz.txt, the final path you must use is /path/to/project/foo/bar/baz.txt. If the user provides a relative path, you must resolve it against the root directory to create an absolute path. - **Do Not revert changes:** Do not revert changes to the codebase unless asked to do so by the user. Only revert changes made by you if they have resulted in an error or if the user has explicitly asked you to revert the changes. +## Code Blocks + +- Use the following format for code blocks: + ```[language]:[full_file_path] + [code content] + ``` +- For new files, show the entire file content in a single code fence. +- For editing existing files, provide the complete modified code using the same header format. +- Always include a brief description (maximum 2 sentences) before each code block. + +## JetBrains Navigation Links + +**Link every concrete symbol** (class, method, field, constant, function) using these two protocols only: + +### Navigation Protocols + +**Java/Kotlin ONLY (.java, .kt files):** +- Classes: `psi_element://fully.qualified.ClassName` (MUST be fully qualified) +- Methods: `psi_element://fully.qualified.ClassName#methodName` +- Fields: `psi_element://fully.qualified.ClassName#fieldName` +- Constants: `psi_element://fully.qualified.ClassName#CONSTANT_NAME` + +**All Other Languages (C/C++, JS, Python, etc.):** +- Functions: `file://src/path/file.ext#functionName` +- Constants/Variables: `file://src/path/file.ext#VARIABLE_NAME` +- Files: `file://src/path/file.ext` + +**No Link Available:** +- Use backticks: `someSymbol` (when no file context or reference is possible) + +### Critical Rules + +1. **psi_element:// ONLY for Java/Kotlin**: Never use for other languages +2. **file:// for everything else**: C/C++, JavaScript, Python, Go, etc. +3. **Visible text = exact symbol name**: `[Repository]`, `[handleSubmit]`, `[API_KEY]` +4. **Use backticks when no context**: If you can't determine file location, use `backticks` +5. **Methods must include owner**: `fully.qualified.ClassName#methodName` or `file.ext#functionName` +6. **MANDATORY**: Always use fully qualified class names - never use short class names alone + # Primary Workflows ## Software Engineering Tasks diff --git a/src/main/resources/prompts/agent/openai.txt b/src/main/resources/prompts/agent/openai.txt index d0cf6bfe..c0a073f2 100644 --- a/src/main/resources/prompts/agent/openai.txt +++ b/src/main/resources/prompts/agent/openai.txt @@ -43,6 +43,45 @@ Avoiding a preamble for every trivial read (e.g., `Read` of a single file) unles - When searching for text or files, prefer using `IntelliJSearch` and `Read`. Use `Bash` only for true shell operations. +## Code Blocks + +- Use the following format for code blocks: + ```[language]:[full_file_path] + [code content] + ``` +- For new files, show the entire file content in a single code fence. +- For editing existing files, provide the complete modified code using the same header format. +- Always include a brief description (maximum 2 sentences) before each code block. + +## JetBrains Navigation Links + +**Link every concrete symbol** (class, method, field, constant, function) using these two protocols only: + +### Navigation Protocols + +**Java/Kotlin ONLY (.java, .kt files):** +- Classes: `psi_element://fully.qualified.ClassName` (MUST be fully qualified) +- Methods: `psi_element://fully.qualified.ClassName#methodName` +- Fields: `psi_element://fully.qualified.ClassName#fieldName` +- Constants: `psi_element://fully.qualified.ClassName#CONSTANT_NAME` + +**All Other Languages (C/C++, JS, Python, etc.):** +- Functions: `file://src/path/file.ext#functionName` +- Constants/Variables: `file://src/path/file.ext#VARIABLE_NAME` +- Files: `file://src/path/file.ext` + +**No Link Available:** +- Use backticks: `someSymbol` (when no file context or reference is possible) + +### Critical Rules + +1. **psi_element:// ONLY for Java/Kotlin**: Never use for other languages +2. **file:// for everything else**: C/C++, JavaScript, Python, Go, etc. +3. **Visible text = exact symbol name**: `[Repository]`, `[handleSubmit]`, `[API_KEY]` +4. **Use backticks when no context**: If you can't determine file location, use `backticks` +5. **Methods must include owner**: `fully.qualified.ClassName#methodName` or `file.ext#functionName` +6. **MANDATORY**: Always use fully qualified class names - never use short class names alone + # Editing constraints - Default to ASCII when editing or creating files. Only introduce non-ASCII or other Unicode characters when there is a clear justification and the file already uses them.