From 5595d12dc3afb149f6b8a70a640acdc1c2bb45ec Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Sat, 30 Aug 2025 22:41:24 -0700 Subject: [PATCH] fix (templated system prompt): add TASK_PROGRESS_PARAMETER to various tools and update descriptions (#5908) * Add TASK_PROGRESS_PARAMETER to various tools and update descriptions - Introduced TASK_PROGRESS_PARAMETER to enhance task tracking across multiple tools. - Updated tool descriptions for clarity and consistency, including detailed instructions and usage examples. - Adjusted existing parameters to improve user guidance and ensure proper tool functionality. * update snapshots * do not remove new lines within section around divider --------- Co-authored-by: abeatrix --- .../anthropic_claude_sonnet_4-basic.snap | 73 +++++++++++++------ .../anthropic_claude_sonnet_4-no-browser.snap | 50 ++++++++----- ...hropic_claude_sonnet_4-no-focus-chain.snap | 59 +++++++++------ .../anthropic_claude_sonnet_4-no-mcp.snap | 73 +++++++++++++------ .../lmstudio_qwen3_coder-basic.snap | 2 - .../lmstudio_qwen3_coder-no-browser.snap | 2 - .../lmstudio_qwen3_coder-no-focus-chain.snap | 2 - .../lmstudio_qwen3_coder-no-mcp.snap | 2 - .../__snapshots__/openai_gpt_3-basic.snap | 71 ++++++++++++------ .../openai_gpt_3-no-browser.snap | 48 +++++++----- .../openai_gpt_3-no-focus-chain.snap | 59 +++++++++------ .../__snapshots__/openai_gpt_3-no-mcp.snap | 71 ++++++++++++------ .../components/tool_use/examples.ts | 2 +- .../system-prompt/registry/PromptBuilder.ts | 19 ++++- .../tools/access_mcp_resource.ts | 19 ++--- .../tools/ask_followup_question.ts | 4 +- .../system-prompt/tools/attempt_completion.ts | 1 + .../system-prompt/tools/browser_action.ts | 42 +++++------ .../system-prompt/tools/execute_command.ts | 7 +- .../tools/list_code_definition_names.ts | 2 + .../prompts/system-prompt/tools/list_files.ts | 2 + .../tools/load_mcp_documentation.ts | 6 +- .../prompts/system-prompt/tools/new_task.ts | 2 +- .../system-prompt/tools/plan_mode_respond.ts | 3 +- .../prompts/system-prompt/tools/read_file.ts | 9 +-- .../system-prompt/tools/replace_in_file.ts | 9 +-- .../system-prompt/tools/search_files.ts | 2 + .../system-prompt/tools/use_mcp_tool.ts | 17 ++--- .../prompts/system-prompt/tools/web_fetch.ts | 2 + .../system-prompt/tools/write_to_file.ts | 10 +-- src/core/prompts/system-prompt/types.ts | 11 +++ 31 files changed, 417 insertions(+), 264 deletions(-) diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-basic.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-basic.snap index f9d4caa3..c9c23918 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-basic.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-basic.snap @@ -30,8 +30,8 @@ Always adhere to this format for the tool use to ensure proper parsing and execu ## execute_command Description: Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. For command chaining, use the appropriate chaining syntax for the user's shell. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory: /test/project Parameters: -- command: (required) The CLI command to execute... -- requires_approval: (required) A boolean indicating whether... +- command: (required) The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- requires_approval: (required) A boolean indicating whether this command requires explicit user approval before execution in case the user has auto-approve mode enabled. Set to 'true' for potentially impactful operations like installing/uninstalling packages, deleting/overwriting files, system configuration changes, network operations, or any commands that could have unintended side effects. Set to 'false' for safe operations like reading files/directories, running development servers, building projects, and other non-destructive operations. Usage: Your command here @@ -71,7 +71,6 @@ Parameters: ------- SEARCH [exact content to find] ======= - [new content to replace with] +++++++ REPLACE ``` @@ -105,11 +104,13 @@ Parameters: - path: (required) The path of the directory to search in (relative to the current working directory /test/project). This directory will be recursively searched. - regex: (required) The regular expression pattern to search for. Uses Rust regex syntax. - file_pattern: (optional) Glob pattern to filter files (e.g., '*.ts' for TypeScript files). If not provided, it will search all files (*). +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here Your regex pattern here file pattern here (optional) +Checklist here (optional) ## list_files @@ -117,19 +118,23 @@ Description: Request to list files and directories within the specified director Parameters: - path: (required) The path of the directory to list contents for (relative to the current working directory /test/project) - recursive: (optional) Whether to list files recursively. Use true for recursive listing, false or omit for top-level only. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here true or false (optional) +Checklist here (optional) ## list_code_definition_names Description: Request to list definition names (classes, functions, methods, etc.) used in source code files at the top level of the specified directory. This tool provides insights into the codebase structure and important constructs, encapsulating high-level concepts and relationships that are crucial for understanding the overall architecture. Parameters: - path: (required) The path of the directory (relative to the current working directory /test/project) to list top level source code definitions for. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here +Checklist here (optional) ## browser_action @@ -139,10 +144,25 @@ Description: Request to interact with a Puppeteer-controlled browser. Every acti - The browser window has a resolution of **1280x720** pixels. When performing any click actions, ensure the coordinates are within this resolution range. - Before clicking on any elements such as icons, links, or buttons, you must consult the provided screenshot of the page to determine the coordinates of the element. The click should be targeted at the **center of the element**, not on its edges. Parameters: -- action: (required) The action to perform. The available actions are: * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**. - Use with the `url` parameter to provide the URL. - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.) * click: Click at a specific x,y coordinate. - Use with the `coordinate` parameter to specify the location. - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot. * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text. - Use with the `text` parameter to provide the string to type. * scroll_down: Scroll down the page by one page height. * scroll_up: Scroll up the page by one page height. * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**. - Example: `close` -- url: (optional) Use this for providing the URL for the `launch` action. * Example: https://example.com -- coordinate: (optional) The X and Y coordinates for the `click` action. Coordinates should be within the **1280x720** resolution. * Example: 450,300 -- text: (optional) Use this for providing the text for the `type` action. * Example: Hello, world! +- action: (required) The action to perform. The available actions are: + * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**. + - Use with the `url` parameter to provide the URL. + - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.) + * click: Click at a specific x,y coordinate. + - Use with the `coordinate` parameter to specify the location. + - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot. + * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text. + - Use with the `text` parameter to provide the string to type. + * scroll_down: Scroll down the page by one page height. + * scroll_up: Scroll up the page by one page height. + * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**. + - Example: `close` +- url: (optional) Use this for providing the URL for the `launch` action. + * Example: https://example.com +- coordinate: (optional) The X and Y coordinates for the `click` action. Coordinates should be within the **1280x720** resolution. + * Example: 450,300 +- text: (optional) Use this for providing the text for the `type` action. + * Example: Hello, world! Usage: Action to perform (e.g., launch, click, type, scroll_down, scroll_up, close) @@ -162,9 +182,11 @@ Description: Fetches content from a specified URL and processes into markdown - This tool is read-only and does not modify any files Parameters: - url: (required) The URL to fetch content from +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: https://example.com/docs +Checklist here (optional) ## use_mcp_tool @@ -173,28 +195,30 @@ Parameters: - server_name: (required) The name of the MCP server providing the tool - tool_name: (required) The name of the tool to execute - arguments: (required) A JSON object containing the tool's input parameters, following the tool's input schema -- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: server name here tool name here -{ + +{ "param1": "value1", "param2": "value2" -} +} + Checklist here (optional) ## access_mcp_resource -Description: The name of the MCP server providing the resource. +Description: Request to access a resource provided by a connected MCP server. Resources represent data sources that can be used as context, such as files, API responses, or system information. Parameters: -- server_name: (required) server name here -- uri: (required) resource URI here +- server_name: (required) The name of the MCP server providing the resource +- uri: (required) The URI identifying the specific resource to access - task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: - - +server name here +resource URI here Checklist here (optional) @@ -202,11 +226,13 @@ Usage: 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. Parameters: - question: (required) The question to ask the user. This should be a clear, specific question that addresses the information you need. -- options: (optional) An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer. +- options: (optional) An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer. You may not always need to provide options, but it may be helpful in many cases where it can save the user from having to type out a response manually. IMPORTANT: NEVER include an option to toggle to Act mode, as this would be something you need to direct the user to do manually themselves if needed. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Your question here Array of options here (optional), e.g. ["Option 1", "Option 2", "Option 3"] +Checklist here (optional) ## attempt_completion @@ -225,7 +251,7 @@ Usage: ## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. +Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. Parameters: - context: (required) The context to preload the new task with. If applicable based on the current task, this should include: @@ -250,11 +276,15 @@ Usage: Your response here true or false (optional, but you MUST set to true if in you need to read files or use other exploration tools) -Checklist here (optional) +Checklist here (If you have presented the user with concrete steps or requirements, you can optionally include a todo list outlining these steps.) ## load_mcp_documentation Description: Load documentation about creating MCP servers. This tool should be used when the user requests to create or install an MCP server (the user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. You have the ability to create an MCP server and add it to a configuration file that will then expose the tools and resources for you to use with `use_mcp_tool` and `access_mcp_resource`). The documentation provides detailed information about the MCP server creation process, including setup instructions, best practices, and examples. +Parameters: None +Usage: + + # Tool Use Examples @@ -337,9 +367,7 @@ Description: Load documentation about creating MCP servers. This tool should be ------- SEARCH import React from 'react'; - ======= - import React, { useState } from 'react'; +++++++ REPLACE @@ -350,15 +378,12 @@ function handleSubmit() { } ======= - +++++++ REPLACE ------- SEARCH return (
- ======= - function handleSubmit() { saveData(); setLoading(false); @@ -396,7 +421,7 @@ return ( create_issue { - "owner": "octocat", + "owner": "octocat2", "repo": "hello-world", "title": "Found a bug", "body": "I'm having a problem with this.", diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-browser.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-browser.snap index 885cdb2b..475ffbe1 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-browser.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-browser.snap @@ -30,8 +30,8 @@ Always adhere to this format for the tool use to ensure proper parsing and execu ## execute_command Description: Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. For command chaining, use the appropriate chaining syntax for the user's shell. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory: /test/project Parameters: -- command: (required) The CLI command to execute... -- requires_approval: (required) A boolean indicating whether... +- command: (required) The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- requires_approval: (required) A boolean indicating whether this command requires explicit user approval before execution in case the user has auto-approve mode enabled. Set to 'true' for potentially impactful operations like installing/uninstalling packages, deleting/overwriting files, system configuration changes, network operations, or any commands that could have unintended side effects. Set to 'false' for safe operations like reading files/directories, running development servers, building projects, and other non-destructive operations. Usage: Your command here @@ -71,7 +71,6 @@ Parameters: ------- SEARCH [exact content to find] ======= - [new content to replace with] +++++++ REPLACE ``` @@ -105,11 +104,13 @@ Parameters: - path: (required) The path of the directory to search in (relative to the current working directory /test/project). This directory will be recursively searched. - regex: (required) The regular expression pattern to search for. Uses Rust regex syntax. - file_pattern: (optional) Glob pattern to filter files (e.g., '*.ts' for TypeScript files). If not provided, it will search all files (*). +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here Your regex pattern here file pattern here (optional) +Checklist here (optional) ## list_files @@ -117,19 +118,23 @@ Description: Request to list files and directories within the specified director Parameters: - path: (required) The path of the directory to list contents for (relative to the current working directory /test/project) - recursive: (optional) Whether to list files recursively. Use true for recursive listing, false or omit for top-level only. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here true or false (optional) +Checklist here (optional) ## list_code_definition_names Description: Request to list definition names (classes, functions, methods, etc.) used in source code files at the top level of the specified directory. This tool provides insights into the codebase structure and important constructs, encapsulating high-level concepts and relationships that are crucial for understanding the overall architecture. Parameters: - path: (required) The path of the directory (relative to the current working directory /test/project) to list top level source code definitions for. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here +Checklist here (optional) ## web_fetch @@ -143,9 +148,11 @@ Description: Fetches content from a specified URL and processes into markdown - This tool is read-only and does not modify any files Parameters: - url: (required) The URL to fetch content from +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: https://example.com/docs +Checklist here (optional) ## use_mcp_tool @@ -154,28 +161,30 @@ Parameters: - server_name: (required) The name of the MCP server providing the tool - tool_name: (required) The name of the tool to execute - arguments: (required) A JSON object containing the tool's input parameters, following the tool's input schema -- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: server name here tool name here -{ + +{ "param1": "value1", "param2": "value2" -} +} + Checklist here (optional) ## access_mcp_resource -Description: The name of the MCP server providing the resource. +Description: Request to access a resource provided by a connected MCP server. Resources represent data sources that can be used as context, such as files, API responses, or system information. Parameters: -- server_name: (required) server name here -- uri: (required) resource URI here +- server_name: (required) The name of the MCP server providing the resource +- uri: (required) The URI identifying the specific resource to access - task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: - - +server name here +resource URI here Checklist here (optional) @@ -183,11 +192,13 @@ Usage: 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. Parameters: - question: (required) The question to ask the user. This should be a clear, specific question that addresses the information you need. -- options: (optional) An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer. +- options: (optional) An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer. You may not always need to provide options, but it may be helpful in many cases where it can save the user from having to type out a response manually. IMPORTANT: NEVER include an option to toggle to Act mode, as this would be something you need to direct the user to do manually themselves if needed. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Your question here Array of options here (optional), e.g. ["Option 1", "Option 2", "Option 3"] +Checklist here (optional) ## attempt_completion @@ -206,7 +217,7 @@ Usage: ## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. +Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. Parameters: - context: (required) The context to preload the new task with. If applicable based on the current task, this should include: @@ -231,11 +242,15 @@ Usage: Your response here true or false (optional, but you MUST set to true if in you need to read files or use other exploration tools) -Checklist here (optional) +Checklist here (If you have presented the user with concrete steps or requirements, you can optionally include a todo list outlining these steps.) ## load_mcp_documentation Description: Load documentation about creating MCP servers. This tool should be used when the user requests to create or install an MCP server (the user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. You have the ability to create an MCP server and add it to a configuration file that will then expose the tools and resources for you to use with `use_mcp_tool` and `access_mcp_resource`). The documentation provides detailed information about the MCP server creation process, including setup instructions, best practices, and examples. +Parameters: None +Usage: + + # Tool Use Examples @@ -318,9 +333,7 @@ Description: Load documentation about creating MCP servers. This tool should be ------- SEARCH import React from 'react'; - ======= - import React, { useState } from 'react'; +++++++ REPLACE @@ -331,15 +344,12 @@ function handleSubmit() { } ======= - +++++++ REPLACE ------- SEARCH return (
- ======= - function handleSubmit() { saveData(); setLoading(false); @@ -377,7 +387,7 @@ return ( create_issue { - "owner": "octocat", + "owner": "octocat2", "repo": "hello-world", "title": "Found a bug", "body": "I'm having a problem with this.", diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-focus-chain.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-focus-chain.snap index 91ff744e..b28ffb75 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-focus-chain.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-focus-chain.snap @@ -27,8 +27,8 @@ Always adhere to this format for the tool use to ensure proper parsing and execu ## execute_command Description: Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. For command chaining, use the appropriate chaining syntax for the user's shell. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory: /test/project Parameters: -- command: (required) The CLI command to execute... -- requires_approval: (required) A boolean indicating whether... +- command: (required) The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- requires_approval: (required) A boolean indicating whether this command requires explicit user approval before execution in case the user has auto-approve mode enabled. Set to 'true' for potentially impactful operations like installing/uninstalling packages, deleting/overwriting files, system configuration changes, network operations, or any commands that could have unintended side effects. Set to 'false' for safe operations like reading files/directories, running development servers, building projects, and other non-destructive operations. Usage: Your command here @@ -64,7 +64,6 @@ Parameters: ------- SEARCH [exact content to find] ======= - [new content to replace with] +++++++ REPLACE ``` @@ -130,10 +129,25 @@ Description: Request to interact with a Puppeteer-controlled browser. Every acti - The browser window has a resolution of **1280x720** pixels. When performing any click actions, ensure the coordinates are within this resolution range. - Before clicking on any elements such as icons, links, or buttons, you must consult the provided screenshot of the page to determine the coordinates of the element. The click should be targeted at the **center of the element**, not on its edges. Parameters: -- action: (required) The action to perform. The available actions are: * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**. - Use with the `url` parameter to provide the URL. - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.) * click: Click at a specific x,y coordinate. - Use with the `coordinate` parameter to specify the location. - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot. * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text. - Use with the `text` parameter to provide the string to type. * scroll_down: Scroll down the page by one page height. * scroll_up: Scroll up the page by one page height. * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**. - Example: `close` -- url: (optional) Use this for providing the URL for the `launch` action. * Example: https://example.com -- coordinate: (optional) The X and Y coordinates for the `click` action. Coordinates should be within the **1280x720** resolution. * Example: 450,300 -- text: (optional) Use this for providing the text for the `type` action. * Example: Hello, world! +- action: (required) The action to perform. The available actions are: + * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**. + - Use with the `url` parameter to provide the URL. + - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.) + * click: Click at a specific x,y coordinate. + - Use with the `coordinate` parameter to specify the location. + - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot. + * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text. + - Use with the `text` parameter to provide the string to type. + * scroll_down: Scroll down the page by one page height. + * scroll_up: Scroll up the page by one page height. + * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**. + - Example: `close` +- url: (optional) Use this for providing the URL for the `launch` action. + * Example: https://example.com +- coordinate: (optional) The X and Y coordinates for the `click` action. Coordinates should be within the **1280x720** resolution. + * Example: 450,300 +- text: (optional) Use this for providing the text for the `type` action. + * Example: Hello, world! Usage: Action to perform (e.g., launch, click, type, scroll_down, scroll_up, close) @@ -168,28 +182,30 @@ Usage: server name here tool name here -{ + +{ "param1": "value1", "param2": "value2" -} +} + ## access_mcp_resource -Description: The name of the MCP server providing the resource. +Description: Request to access a resource provided by a connected MCP server. Resources represent data sources that can be used as context, such as files, API responses, or system information. Parameters: -- server_name: (required) server name here -- uri: (required) resource URI here +- server_name: (required) The name of the MCP server providing the resource +- uri: (required) The URI identifying the specific resource to access Usage: - - +server name here +resource URI here ## 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. Parameters: - question: (required) The question to ask the user. This should be a clear, specific question that addresses the information you need. -- options: (optional) An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer. +- options: (optional) An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer. You may not always need to provide options, but it may be helpful in many cases where it can save the user from having to type out a response manually. IMPORTANT: NEVER include an option to toggle to Act mode, as this would be something you need to direct the user to do manually themselves if needed. Usage: Your question here @@ -209,7 +225,7 @@ Usage: ## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. +Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. Parameters: - context: (required) The context to preload the new task with. If applicable based on the current task, this should include: @@ -237,6 +253,10 @@ Usage: ## load_mcp_documentation Description: Load documentation about creating MCP servers. This tool should be used when the user requests to create or install an MCP server (the user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. You have the ability to create an MCP server and add it to a configuration file that will then expose the tools and resources for you to use with `use_mcp_tool` and `access_mcp_resource`). The documentation provides detailed information about the MCP server creation process, including setup instructions, best practices, and examples. +Parameters: None +Usage: + + # Tool Use Examples @@ -307,9 +327,7 @@ Description: Load documentation about creating MCP servers. This tool should be ------- SEARCH import React from 'react'; - ======= - import React, { useState } from 'react'; +++++++ REPLACE @@ -320,15 +338,12 @@ function handleSubmit() { } ======= - +++++++ REPLACE ------- SEARCH return (
- ======= - function handleSubmit() { saveData(); setLoading(false); @@ -360,7 +375,7 @@ return ( create_issue { - "owner": "octocat", + "owner": "octocat2", "repo": "hello-world", "title": "Found a bug", "body": "I'm having a problem with this.", diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-mcp.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-mcp.snap index 18d11916..e5b77604 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-mcp.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/anthropic_claude_sonnet_4-no-mcp.snap @@ -30,8 +30,8 @@ Always adhere to this format for the tool use to ensure proper parsing and execu ## execute_command Description: Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. For command chaining, use the appropriate chaining syntax for the user's shell. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory: /test/project Parameters: -- command: (required) The CLI command to execute... -- requires_approval: (required) A boolean indicating whether... +- command: (required) The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- requires_approval: (required) A boolean indicating whether this command requires explicit user approval before execution in case the user has auto-approve mode enabled. Set to 'true' for potentially impactful operations like installing/uninstalling packages, deleting/overwriting files, system configuration changes, network operations, or any commands that could have unintended side effects. Set to 'false' for safe operations like reading files/directories, running development servers, building projects, and other non-destructive operations. Usage: Your command here @@ -71,7 +71,6 @@ Parameters: ------- SEARCH [exact content to find] ======= - [new content to replace with] +++++++ REPLACE ``` @@ -105,11 +104,13 @@ Parameters: - path: (required) The path of the directory to search in (relative to the current working directory /test/project). This directory will be recursively searched. - regex: (required) The regular expression pattern to search for. Uses Rust regex syntax. - file_pattern: (optional) Glob pattern to filter files (e.g., '*.ts' for TypeScript files). If not provided, it will search all files (*). +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here Your regex pattern here file pattern here (optional) +Checklist here (optional) ## list_files @@ -117,19 +118,23 @@ Description: Request to list files and directories within the specified director Parameters: - path: (required) The path of the directory to list contents for (relative to the current working directory /test/project) - recursive: (optional) Whether to list files recursively. Use true for recursive listing, false or omit for top-level only. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here true or false (optional) +Checklist here (optional) ## list_code_definition_names Description: Request to list definition names (classes, functions, methods, etc.) used in source code files at the top level of the specified directory. This tool provides insights into the codebase structure and important constructs, encapsulating high-level concepts and relationships that are crucial for understanding the overall architecture. Parameters: - path: (required) The path of the directory (relative to the current working directory /test/project) to list top level source code definitions for. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here +Checklist here (optional) ## browser_action @@ -139,10 +144,25 @@ Description: Request to interact with a Puppeteer-controlled browser. Every acti - The browser window has a resolution of **1280x720** pixels. When performing any click actions, ensure the coordinates are within this resolution range. - Before clicking on any elements such as icons, links, or buttons, you must consult the provided screenshot of the page to determine the coordinates of the element. The click should be targeted at the **center of the element**, not on its edges. Parameters: -- action: (required) The action to perform. The available actions are: * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**. - Use with the `url` parameter to provide the URL. - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.) * click: Click at a specific x,y coordinate. - Use with the `coordinate` parameter to specify the location. - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot. * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text. - Use with the `text` parameter to provide the string to type. * scroll_down: Scroll down the page by one page height. * scroll_up: Scroll up the page by one page height. * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**. - Example: `close` -- url: (optional) Use this for providing the URL for the `launch` action. * Example: https://example.com -- coordinate: (optional) The X and Y coordinates for the `click` action. Coordinates should be within the **1280x720** resolution. * Example: 450,300 -- text: (optional) Use this for providing the text for the `type` action. * Example: Hello, world! +- action: (required) The action to perform. The available actions are: + * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**. + - Use with the `url` parameter to provide the URL. + - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.) + * click: Click at a specific x,y coordinate. + - Use with the `coordinate` parameter to specify the location. + - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot. + * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text. + - Use with the `text` parameter to provide the string to type. + * scroll_down: Scroll down the page by one page height. + * scroll_up: Scroll up the page by one page height. + * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**. + - Example: `close` +- url: (optional) Use this for providing the URL for the `launch` action. + * Example: https://example.com +- coordinate: (optional) The X and Y coordinates for the `click` action. Coordinates should be within the **1280x720** resolution. + * Example: 450,300 +- text: (optional) Use this for providing the text for the `type` action. + * Example: Hello, world! Usage: Action to perform (e.g., launch, click, type, scroll_down, scroll_up, close) @@ -162,9 +182,11 @@ Description: Fetches content from a specified URL and processes into markdown - This tool is read-only and does not modify any files Parameters: - url: (required) The URL to fetch content from +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: https://example.com/docs +Checklist here (optional) ## use_mcp_tool @@ -173,28 +195,30 @@ Parameters: - server_name: (required) The name of the MCP server providing the tool - tool_name: (required) The name of the tool to execute - arguments: (required) A JSON object containing the tool's input parameters, following the tool's input schema -- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: server name here tool name here -{ + +{ "param1": "value1", "param2": "value2" -} +} + Checklist here (optional) ## access_mcp_resource -Description: The name of the MCP server providing the resource. +Description: Request to access a resource provided by a connected MCP server. Resources represent data sources that can be used as context, such as files, API responses, or system information. Parameters: -- server_name: (required) server name here -- uri: (required) resource URI here +- server_name: (required) The name of the MCP server providing the resource +- uri: (required) The URI identifying the specific resource to access - task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: - - +server name here +resource URI here Checklist here (optional) @@ -202,11 +226,13 @@ Usage: 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. Parameters: - question: (required) The question to ask the user. This should be a clear, specific question that addresses the information you need. -- options: (optional) An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer. +- options: (optional) An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer. You may not always need to provide options, but it may be helpful in many cases where it can save the user from having to type out a response manually. IMPORTANT: NEVER include an option to toggle to Act mode, as this would be something you need to direct the user to do manually themselves if needed. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Your question here Array of options here (optional), e.g. ["Option 1", "Option 2", "Option 3"] +Checklist here (optional) ## attempt_completion @@ -225,7 +251,7 @@ Usage: ## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. +Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. Parameters: - context: (required) The context to preload the new task with. If applicable based on the current task, this should include: @@ -250,11 +276,15 @@ Usage: Your response here true or false (optional, but you MUST set to true if in you need to read files or use other exploration tools) -Checklist here (optional) +Checklist here (If you have presented the user with concrete steps or requirements, you can optionally include a todo list outlining these steps.) ## load_mcp_documentation Description: Load documentation about creating MCP servers. This tool should be used when the user requests to create or install an MCP server (the user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. You have the ability to create an MCP server and add it to a configuration file that will then expose the tools and resources for you to use with `use_mcp_tool` and `access_mcp_resource`). The documentation provides detailed information about the MCP server creation process, including setup instructions, best practices, and examples. +Parameters: None +Usage: + + # Tool Use Examples @@ -337,9 +367,7 @@ Description: Load documentation about creating MCP servers. This tool should be ------- SEARCH import React from 'react'; - ======= - import React, { useState } from 'react'; +++++++ REPLACE @@ -350,15 +378,12 @@ function handleSubmit() { } ======= - +++++++ REPLACE ------- SEARCH return (
- ======= - function handleSubmit() { saveData(); setLoading(false); @@ -396,7 +421,7 @@ return ( create_issue { - "owner": "octocat", + "owner": "octocat2", "repo": "hello-world", "title": "Found a bug", "body": "I'm having a problem with this.", diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/lmstudio_qwen3_coder-basic.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/lmstudio_qwen3_coder-basic.snap index 149547a9..ea2c8c6f 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/lmstudio_qwen3_coder-basic.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/lmstudio_qwen3_coder-basic.snap @@ -57,9 +57,7 @@ Key: If output doesn’t stream, assume success unless critical; else ask user t ------- SEARCH console.log('Hi'); - ======= - console.log('Hello'); +++++++ REPLACE diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/lmstudio_qwen3_coder-no-browser.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/lmstudio_qwen3_coder-no-browser.snap index 149547a9..ea2c8c6f 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/lmstudio_qwen3_coder-no-browser.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/lmstudio_qwen3_coder-no-browser.snap @@ -57,9 +57,7 @@ Key: If output doesn’t stream, assume success unless critical; else ask user t ------- SEARCH console.log('Hi'); - ======= - console.log('Hello'); +++++++ REPLACE diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/lmstudio_qwen3_coder-no-focus-chain.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/lmstudio_qwen3_coder-no-focus-chain.snap index 149547a9..ea2c8c6f 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/lmstudio_qwen3_coder-no-focus-chain.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/lmstudio_qwen3_coder-no-focus-chain.snap @@ -57,9 +57,7 @@ Key: If output doesn’t stream, assume success unless critical; else ask user t ------- SEARCH console.log('Hi'); - ======= - console.log('Hello'); +++++++ REPLACE diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/lmstudio_qwen3_coder-no-mcp.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/lmstudio_qwen3_coder-no-mcp.snap index 149547a9..ea2c8c6f 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/lmstudio_qwen3_coder-no-mcp.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/lmstudio_qwen3_coder-no-mcp.snap @@ -57,9 +57,7 @@ Key: If output doesn’t stream, assume success unless critical; else ask user t ------- SEARCH console.log('Hi'); - ======= - console.log('Hello'); +++++++ REPLACE diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-basic.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-basic.snap index b9253803..7745d0d3 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-basic.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-basic.snap @@ -30,8 +30,8 @@ Always adhere to this format for the tool use to ensure proper parsing and execu ## execute_command Description: Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. For command chaining, use the appropriate chaining syntax for the user's shell. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory: /test/project Parameters: -- command: (required) The CLI command to execute... -- requires_approval: (required) A boolean indicating whether... +- command: (required) The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- requires_approval: (required) A boolean indicating whether this command requires explicit user approval before execution in case the user has auto-approve mode enabled. Set to 'true' for potentially impactful operations like installing/uninstalling packages, deleting/overwriting files, system configuration changes, network operations, or any commands that could have unintended side effects. Set to 'false' for safe operations like reading files/directories, running development servers, building projects, and other non-destructive operations. Usage: Your command here @@ -71,7 +71,6 @@ Parameters: ------- SEARCH [exact content to find] ======= - [new content to replace with] +++++++ REPLACE ``` @@ -105,11 +104,13 @@ Parameters: - path: (required) The path of the directory to search in (relative to the current working directory /test/project). This directory will be recursively searched. - regex: (required) The regular expression pattern to search for. Uses Rust regex syntax. - file_pattern: (optional) Glob pattern to filter files (e.g., '*.ts' for TypeScript files). If not provided, it will search all files (*). +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here Your regex pattern here file pattern here (optional) +Checklist here (optional) ## list_files @@ -117,19 +118,23 @@ Description: Request to list files and directories within the specified director Parameters: - path: (required) The path of the directory to list contents for (relative to the current working directory /test/project) - recursive: (optional) Whether to list files recursively. Use true for recursive listing, false or omit for top-level only. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here true or false (optional) +Checklist here (optional) ## list_code_definition_names Description: Request to list definition names (classes, functions, methods, etc.) used in source code files at the top level of the specified directory. This tool provides insights into the codebase structure and important constructs, encapsulating high-level concepts and relationships that are crucial for understanding the overall architecture. Parameters: - path: (required) The path of the directory (relative to the current working directory /test/project) to list top level source code definitions for. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here +Checklist here (optional) ## browser_action @@ -139,10 +144,25 @@ Description: Request to interact with a Puppeteer-controlled browser. Every acti - The browser window has a resolution of **1280x720** pixels. When performing any click actions, ensure the coordinates are within this resolution range. - Before clicking on any elements such as icons, links, or buttons, you must consult the provided screenshot of the page to determine the coordinates of the element. The click should be targeted at the **center of the element**, not on its edges. Parameters: -- action: (required) The action to perform. The available actions are: * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**. - Use with the `url` parameter to provide the URL. - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.) * click: Click at a specific x,y coordinate. - Use with the `coordinate` parameter to specify the location. - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot. * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text. - Use with the `text` parameter to provide the string to type. * scroll_down: Scroll down the page by one page height. * scroll_up: Scroll up the page by one page height. * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**. - Example: `close` -- url: (optional) Use this for providing the URL for the `launch` action. * Example: https://example.com -- coordinate: (optional) The X and Y coordinates for the `click` action. Coordinates should be within the **1280x720** resolution. * Example: 450,300 -- text: (optional) Use this for providing the text for the `type` action. * Example: Hello, world! +- action: (required) The action to perform. The available actions are: + * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**. + - Use with the `url` parameter to provide the URL. + - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.) + * click: Click at a specific x,y coordinate. + - Use with the `coordinate` parameter to specify the location. + - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot. + * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text. + - Use with the `text` parameter to provide the string to type. + * scroll_down: Scroll down the page by one page height. + * scroll_up: Scroll up the page by one page height. + * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**. + - Example: `close` +- url: (optional) Use this for providing the URL for the `launch` action. + * Example: https://example.com +- coordinate: (optional) The X and Y coordinates for the `click` action. Coordinates should be within the **1280x720** resolution. + * Example: 450,300 +- text: (optional) Use this for providing the text for the `type` action. + * Example: Hello, world! Usage: Action to perform (e.g., launch, click, type, scroll_down, scroll_up, close) @@ -157,28 +177,30 @@ Parameters: - server_name: (required) The name of the MCP server providing the tool - tool_name: (required) The name of the tool to execute - arguments: (required) A JSON object containing the tool's input parameters, following the tool's input schema -- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: server name here tool name here -{ + +{ "param1": "value1", "param2": "value2" -} +} + Checklist here (optional) ## access_mcp_resource -Description: The name of the MCP server providing the resource. +Description: Request to access a resource provided by a connected MCP server. Resources represent data sources that can be used as context, such as files, API responses, or system information. Parameters: -- server_name: (required) server name here -- uri: (required) resource URI here +- server_name: (required) The name of the MCP server providing the resource +- uri: (required) The URI identifying the specific resource to access - task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: - - +server name here +resource URI here Checklist here (optional) @@ -186,11 +208,13 @@ Usage: 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. Parameters: - question: (required) The question to ask the user. This should be a clear, specific question that addresses the information you need. -- options: (optional) An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer. +- options: (optional) An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer. You may not always need to provide options, but it may be helpful in many cases where it can save the user from having to type out a response manually. IMPORTANT: NEVER include an option to toggle to Act mode, as this would be something you need to direct the user to do manually themselves if needed. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Your question here Array of options here (optional), e.g. ["Option 1", "Option 2", "Option 3"] +Checklist here (optional) ## attempt_completion @@ -209,7 +233,7 @@ Usage: ## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. +Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. Parameters: - context: (required) The context to preload the new task with. If applicable based on the current task, this should include: @@ -234,11 +258,15 @@ Usage: Your response here true or false (optional, but you MUST set to true if in you need to read files or use other exploration tools) -Checklist here (optional) +Checklist here (If you have presented the user with concrete steps or requirements, you can optionally include a todo list outlining these steps.) ## load_mcp_documentation Description: Load documentation about creating MCP servers. This tool should be used when the user requests to create or install an MCP server (the user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. You have the ability to create an MCP server and add it to a configuration file that will then expose the tools and resources for you to use with `use_mcp_tool` and `access_mcp_resource`). The documentation provides detailed information about the MCP server creation process, including setup instructions, best practices, and examples. +Parameters: None +Usage: + + # Tool Use Examples @@ -321,9 +349,7 @@ Description: Load documentation about creating MCP servers. This tool should be ------- SEARCH import React from 'react'; - ======= - import React, { useState } from 'react'; +++++++ REPLACE @@ -334,15 +360,12 @@ function handleSubmit() { } ======= - +++++++ REPLACE ------- SEARCH return (
- ======= - function handleSubmit() { saveData(); setLoading(false); @@ -380,7 +403,7 @@ return ( create_issue { - "owner": "octocat", + "owner": "octocat2", "repo": "hello-world", "title": "Found a bug", "body": "I'm having a problem with this.", diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-browser.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-browser.snap index cf06c561..412e3318 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-browser.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-browser.snap @@ -30,8 +30,8 @@ Always adhere to this format for the tool use to ensure proper parsing and execu ## execute_command Description: Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. For command chaining, use the appropriate chaining syntax for the user's shell. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory: /test/project Parameters: -- command: (required) The CLI command to execute... -- requires_approval: (required) A boolean indicating whether... +- command: (required) The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- requires_approval: (required) A boolean indicating whether this command requires explicit user approval before execution in case the user has auto-approve mode enabled. Set to 'true' for potentially impactful operations like installing/uninstalling packages, deleting/overwriting files, system configuration changes, network operations, or any commands that could have unintended side effects. Set to 'false' for safe operations like reading files/directories, running development servers, building projects, and other non-destructive operations. Usage: Your command here @@ -71,7 +71,6 @@ Parameters: ------- SEARCH [exact content to find] ======= - [new content to replace with] +++++++ REPLACE ``` @@ -105,11 +104,13 @@ Parameters: - path: (required) The path of the directory to search in (relative to the current working directory /test/project). This directory will be recursively searched. - regex: (required) The regular expression pattern to search for. Uses Rust regex syntax. - file_pattern: (optional) Glob pattern to filter files (e.g., '*.ts' for TypeScript files). If not provided, it will search all files (*). +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here Your regex pattern here file pattern here (optional) +Checklist here (optional) ## list_files @@ -117,19 +118,23 @@ Description: Request to list files and directories within the specified director Parameters: - path: (required) The path of the directory to list contents for (relative to the current working directory /test/project) - recursive: (optional) Whether to list files recursively. Use true for recursive listing, false or omit for top-level only. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here true or false (optional) +Checklist here (optional) ## list_code_definition_names Description: Request to list definition names (classes, functions, methods, etc.) used in source code files at the top level of the specified directory. This tool provides insights into the codebase structure and important constructs, encapsulating high-level concepts and relationships that are crucial for understanding the overall architecture. Parameters: - path: (required) The path of the directory (relative to the current working directory /test/project) to list top level source code definitions for. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here +Checklist here (optional) ## use_mcp_tool @@ -138,28 +143,30 @@ Parameters: - server_name: (required) The name of the MCP server providing the tool - tool_name: (required) The name of the tool to execute - arguments: (required) A JSON object containing the tool's input parameters, following the tool's input schema -- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: server name here tool name here -{ + +{ "param1": "value1", "param2": "value2" -} +} + Checklist here (optional) ## access_mcp_resource -Description: The name of the MCP server providing the resource. +Description: Request to access a resource provided by a connected MCP server. Resources represent data sources that can be used as context, such as files, API responses, or system information. Parameters: -- server_name: (required) server name here -- uri: (required) resource URI here +- server_name: (required) The name of the MCP server providing the resource +- uri: (required) The URI identifying the specific resource to access - task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: - - +server name here +resource URI here Checklist here (optional) @@ -167,11 +174,13 @@ Usage: 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. Parameters: - question: (required) The question to ask the user. This should be a clear, specific question that addresses the information you need. -- options: (optional) An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer. +- options: (optional) An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer. You may not always need to provide options, but it may be helpful in many cases where it can save the user from having to type out a response manually. IMPORTANT: NEVER include an option to toggle to Act mode, as this would be something you need to direct the user to do manually themselves if needed. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Your question here Array of options here (optional), e.g. ["Option 1", "Option 2", "Option 3"] +Checklist here (optional) ## attempt_completion @@ -190,7 +199,7 @@ Usage: ## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. +Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. Parameters: - context: (required) The context to preload the new task with. If applicable based on the current task, this should include: @@ -215,11 +224,15 @@ Usage: Your response here true or false (optional, but you MUST set to true if in you need to read files or use other exploration tools) -Checklist here (optional) +Checklist here (If you have presented the user with concrete steps or requirements, you can optionally include a todo list outlining these steps.) ## load_mcp_documentation Description: Load documentation about creating MCP servers. This tool should be used when the user requests to create or install an MCP server (the user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. You have the ability to create an MCP server and add it to a configuration file that will then expose the tools and resources for you to use with `use_mcp_tool` and `access_mcp_resource`). The documentation provides detailed information about the MCP server creation process, including setup instructions, best practices, and examples. +Parameters: None +Usage: + + # Tool Use Examples @@ -302,9 +315,7 @@ Description: Load documentation about creating MCP servers. This tool should be ------- SEARCH import React from 'react'; - ======= - import React, { useState } from 'react'; +++++++ REPLACE @@ -315,15 +326,12 @@ function handleSubmit() { } ======= - +++++++ REPLACE ------- SEARCH return (
- ======= - function handleSubmit() { saveData(); setLoading(false); @@ -361,7 +369,7 @@ return ( create_issue { - "owner": "octocat", + "owner": "octocat2", "repo": "hello-world", "title": "Found a bug", "body": "I'm having a problem with this.", diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-focus-chain.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-focus-chain.snap index 6f7ec9ae..d9e9cfa7 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-focus-chain.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-focus-chain.snap @@ -27,8 +27,8 @@ Always adhere to this format for the tool use to ensure proper parsing and execu ## execute_command Description: Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. For command chaining, use the appropriate chaining syntax for the user's shell. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory: /test/project Parameters: -- command: (required) The CLI command to execute... -- requires_approval: (required) A boolean indicating whether... +- command: (required) The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- requires_approval: (required) A boolean indicating whether this command requires explicit user approval before execution in case the user has auto-approve mode enabled. Set to 'true' for potentially impactful operations like installing/uninstalling packages, deleting/overwriting files, system configuration changes, network operations, or any commands that could have unintended side effects. Set to 'false' for safe operations like reading files/directories, running development servers, building projects, and other non-destructive operations. Usage: Your command here @@ -64,7 +64,6 @@ Parameters: ------- SEARCH [exact content to find] ======= - [new content to replace with] +++++++ REPLACE ``` @@ -130,10 +129,25 @@ Description: Request to interact with a Puppeteer-controlled browser. Every acti - The browser window has a resolution of **1280x720** pixels. When performing any click actions, ensure the coordinates are within this resolution range. - Before clicking on any elements such as icons, links, or buttons, you must consult the provided screenshot of the page to determine the coordinates of the element. The click should be targeted at the **center of the element**, not on its edges. Parameters: -- action: (required) The action to perform. The available actions are: * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**. - Use with the `url` parameter to provide the URL. - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.) * click: Click at a specific x,y coordinate. - Use with the `coordinate` parameter to specify the location. - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot. * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text. - Use with the `text` parameter to provide the string to type. * scroll_down: Scroll down the page by one page height. * scroll_up: Scroll up the page by one page height. * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**. - Example: `close` -- url: (optional) Use this for providing the URL for the `launch` action. * Example: https://example.com -- coordinate: (optional) The X and Y coordinates for the `click` action. Coordinates should be within the **1280x720** resolution. * Example: 450,300 -- text: (optional) Use this for providing the text for the `type` action. * Example: Hello, world! +- action: (required) The action to perform. The available actions are: + * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**. + - Use with the `url` parameter to provide the URL. + - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.) + * click: Click at a specific x,y coordinate. + - Use with the `coordinate` parameter to specify the location. + - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot. + * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text. + - Use with the `text` parameter to provide the string to type. + * scroll_down: Scroll down the page by one page height. + * scroll_up: Scroll up the page by one page height. + * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**. + - Example: `close` +- url: (optional) Use this for providing the URL for the `launch` action. + * Example: https://example.com +- coordinate: (optional) The X and Y coordinates for the `click` action. Coordinates should be within the **1280x720** resolution. + * Example: 450,300 +- text: (optional) Use this for providing the text for the `type` action. + * Example: Hello, world! Usage: Action to perform (e.g., launch, click, type, scroll_down, scroll_up, close) @@ -152,28 +166,30 @@ Usage: server name here tool name here -{ + +{ "param1": "value1", "param2": "value2" -} +} + ## access_mcp_resource -Description: The name of the MCP server providing the resource. +Description: Request to access a resource provided by a connected MCP server. Resources represent data sources that can be used as context, such as files, API responses, or system information. Parameters: -- server_name: (required) server name here -- uri: (required) resource URI here +- server_name: (required) The name of the MCP server providing the resource +- uri: (required) The URI identifying the specific resource to access Usage: - - +server name here +resource URI here ## 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. Parameters: - question: (required) The question to ask the user. This should be a clear, specific question that addresses the information you need. -- options: (optional) An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer. +- options: (optional) An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer. You may not always need to provide options, but it may be helpful in many cases where it can save the user from having to type out a response manually. IMPORTANT: NEVER include an option to toggle to Act mode, as this would be something you need to direct the user to do manually themselves if needed. Usage: Your question here @@ -193,7 +209,7 @@ Usage: ## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. +Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. Parameters: - context: (required) The context to preload the new task with. If applicable based on the current task, this should include: @@ -221,6 +237,10 @@ Usage: ## load_mcp_documentation Description: Load documentation about creating MCP servers. This tool should be used when the user requests to create or install an MCP server (the user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. You have the ability to create an MCP server and add it to a configuration file that will then expose the tools and resources for you to use with `use_mcp_tool` and `access_mcp_resource`). The documentation provides detailed information about the MCP server creation process, including setup instructions, best practices, and examples. +Parameters: None +Usage: + + # Tool Use Examples @@ -291,9 +311,7 @@ Description: Load documentation about creating MCP servers. This tool should be ------- SEARCH import React from 'react'; - ======= - import React, { useState } from 'react'; +++++++ REPLACE @@ -304,15 +322,12 @@ function handleSubmit() { } ======= - +++++++ REPLACE ------- SEARCH return (
- ======= - function handleSubmit() { saveData(); setLoading(false); @@ -344,7 +359,7 @@ return ( create_issue { - "owner": "octocat", + "owner": "octocat2", "repo": "hello-world", "title": "Found a bug", "body": "I'm having a problem with this.", diff --git a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-mcp.snap b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-mcp.snap index 2d4e2a35..9cc9a5e8 100644 --- a/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-mcp.snap +++ b/src/core/prompts/system-prompt/__tests__/__snapshots__/openai_gpt_3-no-mcp.snap @@ -30,8 +30,8 @@ Always adhere to this format for the tool use to ensure proper parsing and execu ## execute_command Description: Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. For command chaining, use the appropriate chaining syntax for the user's shell. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory: /test/project Parameters: -- command: (required) The CLI command to execute... -- requires_approval: (required) A boolean indicating whether... +- command: (required) The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- requires_approval: (required) A boolean indicating whether this command requires explicit user approval before execution in case the user has auto-approve mode enabled. Set to 'true' for potentially impactful operations like installing/uninstalling packages, deleting/overwriting files, system configuration changes, network operations, or any commands that could have unintended side effects. Set to 'false' for safe operations like reading files/directories, running development servers, building projects, and other non-destructive operations. Usage: Your command here @@ -71,7 +71,6 @@ Parameters: ------- SEARCH [exact content to find] ======= - [new content to replace with] +++++++ REPLACE ``` @@ -105,11 +104,13 @@ Parameters: - path: (required) The path of the directory to search in (relative to the current working directory /test/project). This directory will be recursively searched. - regex: (required) The regular expression pattern to search for. Uses Rust regex syntax. - file_pattern: (optional) Glob pattern to filter files (e.g., '*.ts' for TypeScript files). If not provided, it will search all files (*). +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here Your regex pattern here file pattern here (optional) +Checklist here (optional) ## list_files @@ -117,19 +118,23 @@ Description: Request to list files and directories within the specified director Parameters: - path: (required) The path of the directory to list contents for (relative to the current working directory /test/project) - recursive: (optional) Whether to list files recursively. Use true for recursive listing, false or omit for top-level only. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here true or false (optional) +Checklist here (optional) ## list_code_definition_names Description: Request to list definition names (classes, functions, methods, etc.) used in source code files at the top level of the specified directory. This tool provides insights into the codebase structure and important constructs, encapsulating high-level concepts and relationships that are crucial for understanding the overall architecture. Parameters: - path: (required) The path of the directory (relative to the current working directory /test/project) to list top level source code definitions for. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Directory path here +Checklist here (optional) ## browser_action @@ -139,10 +144,25 @@ Description: Request to interact with a Puppeteer-controlled browser. Every acti - The browser window has a resolution of **1280x720** pixels. When performing any click actions, ensure the coordinates are within this resolution range. - Before clicking on any elements such as icons, links, or buttons, you must consult the provided screenshot of the page to determine the coordinates of the element. The click should be targeted at the **center of the element**, not on its edges. Parameters: -- action: (required) The action to perform. The available actions are: * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**. - Use with the `url` parameter to provide the URL. - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.) * click: Click at a specific x,y coordinate. - Use with the `coordinate` parameter to specify the location. - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot. * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text. - Use with the `text` parameter to provide the string to type. * scroll_down: Scroll down the page by one page height. * scroll_up: Scroll up the page by one page height. * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**. - Example: `close` -- url: (optional) Use this for providing the URL for the `launch` action. * Example: https://example.com -- coordinate: (optional) The X and Y coordinates for the `click` action. Coordinates should be within the **1280x720** resolution. * Example: 450,300 -- text: (optional) Use this for providing the text for the `type` action. * Example: Hello, world! +- action: (required) The action to perform. The available actions are: + * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**. + - Use with the `url` parameter to provide the URL. + - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.) + * click: Click at a specific x,y coordinate. + - Use with the `coordinate` parameter to specify the location. + - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot. + * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text. + - Use with the `text` parameter to provide the string to type. + * scroll_down: Scroll down the page by one page height. + * scroll_up: Scroll up the page by one page height. + * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**. + - Example: `close` +- url: (optional) Use this for providing the URL for the `launch` action. + * Example: https://example.com +- coordinate: (optional) The X and Y coordinates for the `click` action. Coordinates should be within the **1280x720** resolution. + * Example: 450,300 +- text: (optional) Use this for providing the text for the `type` action. + * Example: Hello, world! Usage: Action to perform (e.g., launch, click, type, scroll_down, scroll_up, close) @@ -157,28 +177,30 @@ Parameters: - server_name: (required) The name of the MCP server providing the tool - tool_name: (required) The name of the tool to execute - arguments: (required) A JSON object containing the tool's input parameters, following the tool's input schema -- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: server name here tool name here -{ + +{ "param1": "value1", "param2": "value2" -} +} + Checklist here (optional) ## access_mcp_resource -Description: The name of the MCP server providing the resource. +Description: Request to access a resource provided by a connected MCP server. Resources represent data sources that can be used as context, such as files, API responses, or system information. Parameters: -- server_name: (required) server name here -- uri: (required) resource URI here +- server_name: (required) The name of the MCP server providing the resource +- uri: (required) The URI identifying the specific resource to access - task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: - - +server name here +resource URI here Checklist here (optional) @@ -186,11 +208,13 @@ Usage: 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. Parameters: - question: (required) The question to ask the user. This should be a clear, specific question that addresses the information you need. -- options: (optional) An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer. +- options: (optional) An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer. You may not always need to provide options, but it may be helpful in many cases where it can save the user from having to type out a response manually. IMPORTANT: NEVER include an option to toggle to Act mode, as this would be something you need to direct the user to do manually themselves if needed. +- task_progress: (optional) A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details) Usage: Your question here Array of options here (optional), e.g. ["Option 1", "Option 2", "Option 3"] +Checklist here (optional) ## attempt_completion @@ -209,7 +233,7 @@ Usage: ## new_task -Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. +Description: Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point. Parameters: - context: (required) The context to preload the new task with. If applicable based on the current task, this should include: @@ -234,11 +258,15 @@ Usage: Your response here true or false (optional, but you MUST set to true if in you need to read files or use other exploration tools) -Checklist here (optional) +Checklist here (If you have presented the user with concrete steps or requirements, you can optionally include a todo list outlining these steps.) ## load_mcp_documentation Description: Load documentation about creating MCP servers. This tool should be used when the user requests to create or install an MCP server (the user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. You have the ability to create an MCP server and add it to a configuration file that will then expose the tools and resources for you to use with `use_mcp_tool` and `access_mcp_resource`). The documentation provides detailed information about the MCP server creation process, including setup instructions, best practices, and examples. +Parameters: None +Usage: + + # Tool Use Examples @@ -321,9 +349,7 @@ Description: Load documentation about creating MCP servers. This tool should be ------- SEARCH import React from 'react'; - ======= - import React, { useState } from 'react'; +++++++ REPLACE @@ -334,15 +360,12 @@ function handleSubmit() { } ======= - +++++++ REPLACE ------- SEARCH return (
- ======= - function handleSubmit() { saveData(); setLoading(false); @@ -380,7 +403,7 @@ return ( create_issue { - "owner": "octocat", + "owner": "octocat2", "repo": "hello-world", "title": "Found a bug", "body": "I'm having a problem with this.", diff --git a/src/core/prompts/system-prompt/components/tool_use/examples.ts b/src/core/prompts/system-prompt/components/tool_use/examples.ts index 4514b652..29d7a6d4 100644 --- a/src/core/prompts/system-prompt/components/tool_use/examples.ts +++ b/src/core/prompts/system-prompt/components/tool_use/examples.ts @@ -143,7 +143,7 @@ return ( create_issue { - "owner": "octocat", + "owner": "octocat2", "repo": "hello-world", "title": "Found a bug", "body": "I'm having a problem with this.", diff --git a/src/core/prompts/system-prompt/registry/PromptBuilder.ts b/src/core/prompts/system-prompt/registry/PromptBuilder.ts index 4138bbf7..f217f002 100644 --- a/src/core/prompts/system-prompt/registry/PromptBuilder.ts +++ b/src/core/prompts/system-prompt/registry/PromptBuilder.ts @@ -94,8 +94,23 @@ export class PromptBuilder { .trim() // Remove leading/trailing whitespace .replace(/====+\s*$/, "") // Remove trailing ==== after trim .replace(/\n====+\s*\n+\s*====+\n/g, "\n====\n") // Remove empty sections between separators - .replace(/====\n([^\n])/g, "====\n\n$1") // Ensure proper section separation - .replace(/([^\n])\n====/g, "$1\n\n====") + .replace(/====+\n(?!\n)([^\n])/g, (match, nextChar, offset, string) => { + // Add extra newline after ====+ if not already followed by a newline + // Exception: preserve single newlines when ====+ appears to be part of diff-like content + // Look for patterns like "SEARCH\n=======\n" or ";\n=======\n" (diff markers) + const beforeContext = string.substring(Math.max(0, offset - 50), offset) + const afterContext = string.substring(offset, Math.min(string.length, offset + 50)) + const isDiffLike = /SEARCH|REPLACE|\+\+\+\+\+\+\+|-------/.test(beforeContext + afterContext) + return isDiffLike ? match : match.replace(/\n/, "\n\n") + }) + .replace(/([^\n])\n(?!\n)====+/g, (match, prevChar, offset, string) => { + // Add extra newline before ====+ if not already preceded by a newline + // Exception: preserve single newlines when ====+ appears to be part of diff-like content + const beforeContext = string.substring(Math.max(0, offset - 50), offset) + const afterContext = string.substring(offset, Math.min(string.length, offset + 50)) + const isDiffLike = /SEARCH|REPLACE|\+\+\+\+\+\+\+|-------/.test(beforeContext + afterContext) + return isDiffLike ? match : prevChar + "\n\n" + match.substring(1).replace(/\n/, "") + }) } getBuildMetadata(): { diff --git a/src/core/prompts/system-prompt/tools/access_mcp_resource.ts b/src/core/prompts/system-prompt/tools/access_mcp_resource.ts index 87afee1a..4959cfba 100644 --- a/src/core/prompts/system-prompt/tools/access_mcp_resource.ts +++ b/src/core/prompts/system-prompt/tools/access_mcp_resource.ts @@ -1,6 +1,7 @@ import { ModelFamily } from "@/shared/prompts" import { ClineDefaultTool } from "@/shared/tools" import type { ClineToolSpec } from "../spec" +import { TASK_PROGRESS_PARAMETER } from "../types" /** * ## access_mcp_resource @@ -23,27 +24,23 @@ const generic: ClineToolSpec = { variant: ModelFamily.GENERIC, id: ClineDefaultTool.MCP_ACCESS, name: "access_mcp_resource", - description: "The name of the MCP server providing the resource.", + description: + "Request to access a resource provided by a connected MCP server. Resources represent data sources that can be used as context, such as files, API responses, or system information.", contextRequirements: (context) => context.mcpHub !== undefined && context.mcpHub !== null, parameters: [ { name: "server_name", required: true, - instruction: "server name here", + instruction: "The name of the MCP server providing the resource", + usage: "server name here", }, { name: "uri", required: true, - instruction: "resource URI here", - }, - { - name: "task_progress", - required: false, - instruction: - "A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details)", - usage: "Checklist here (optional)", - dependencies: [ClineDefaultTool.TODO], + instruction: "The URI identifying the specific resource to access", + usage: "resource URI here", }, + TASK_PROGRESS_PARAMETER, ], } diff --git a/src/core/prompts/system-prompt/tools/ask_followup_question.ts b/src/core/prompts/system-prompt/tools/ask_followup_question.ts index f85f05c7..73882749 100644 --- a/src/core/prompts/system-prompt/tools/ask_followup_question.ts +++ b/src/core/prompts/system-prompt/tools/ask_followup_question.ts @@ -1,6 +1,7 @@ import { ModelFamily } from "@/shared/prompts" import { ClineDefaultTool } from "@/shared/tools" import type { ClineToolSpec } from "../spec" +import { TASK_PROGRESS_PARAMETER } from "../types" const generic: ClineToolSpec = { variant: ModelFamily.GENERIC, @@ -20,9 +21,10 @@ const generic: ClineToolSpec = { name: "options", required: false, instruction: - "An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer.", + "An array of 2-5 options for the user to choose from. Each option should be a string describing a possible answer. You may not always need to provide options, but it may be helpful in many cases where it can save the user from having to type out a response manually. IMPORTANT: NEVER include an option to toggle to Act mode, as this would be something you need to direct the user to do manually themselves if needed.", usage: 'Array of options here (optional), e.g. ["Option 1", "Option 2", "Option 3"]', }, + TASK_PROGRESS_PARAMETER, ], } diff --git a/src/core/prompts/system-prompt/tools/attempt_completion.ts b/src/core/prompts/system-prompt/tools/attempt_completion.ts index 8b3c8b7e..d4efeaf5 100644 --- a/src/core/prompts/system-prompt/tools/attempt_completion.ts +++ b/src/core/prompts/system-prompt/tools/attempt_completion.ts @@ -24,6 +24,7 @@ IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user th "A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions", usage: "Your command here (optional)", }, + // Different than the vanilla ASK_PROGRESS_PARAMETER { name: "task_progress", required: false, diff --git a/src/core/prompts/system-prompt/tools/browser_action.ts b/src/core/prompts/system-prompt/tools/browser_action.ts index fd5f3da8..acc8362a 100644 --- a/src/core/prompts/system-prompt/tools/browser_action.ts +++ b/src/core/prompts/system-prompt/tools/browser_action.ts @@ -1,4 +1,3 @@ -import { z } from "zod" import { ModelFamily } from "@/shared/prompts" import { ClineDefaultTool } from "@/shared/tools" import type { ClineToolSpec } from "../spec" @@ -19,46 +18,43 @@ const generic: ClineToolSpec = { { name: "action", required: true, - instruction: - "The action to perform. The available actions are: * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**. - Use with the `url` parameter to provide the URL. - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.) * click: Click at a specific x,y coordinate. - Use with the `coordinate` parameter to specify the location. - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot. * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text. - Use with the `text` parameter to provide the string to type. * scroll_down: Scroll down the page by one page height. * scroll_up: Scroll up the page by one page height. * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**. - Example: `close`", + instruction: `The action to perform. The available actions are: + * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**. + - Use with the \`url\` parameter to provide the URL. + - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.) + * click: Click at a specific x,y coordinate. + - Use with the \`coordinate\` parameter to specify the location. + - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot. + * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text. + - Use with the \`text\` parameter to provide the string to type. + * scroll_down: Scroll down the page by one page height. + * scroll_up: Scroll up the page by one page height. + * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**. + - Example: \`close\``, usage: "Action to perform (e.g., launch, click, type, scroll_down, scroll_up, close)", }, { name: "url", required: false, - instruction: "Use this for providing the URL for the `launch` action. * Example: https://example.com", + instruction: `Use this for providing the URL for the \`launch\` action. + * Example: https://example.com`, usage: "URL to launch the browser at (optional)", }, { name: "coordinate", required: false, - instruction: `The X and Y coordinates for the \`click\` action. Coordinates should be within the **{{BROWSER_VIEWPORT_WIDTH}}x{{BROWSER_VIEWPORT_HEIGHT}}** resolution. * Example: 450,300`, + instruction: `The X and Y coordinates for the \`click\` action. Coordinates should be within the **{{BROWSER_VIEWPORT_WIDTH}}x{{BROWSER_VIEWPORT_HEIGHT}}** resolution. + * Example: 450,300`, usage: "x,y coordinates (optional)", }, { name: "text", required: false, - instruction: "Use this for providing the text for the `type` action. * Example: Hello, world!", + instruction: `Use this for providing the text for the \`type\` action. + * Example: Hello, world!`, usage: "Text to type (optional)", }, ], } -export const browser_action_zod_schema = z.object({ - action: z - .enum(["launch", "click", "type", "scroll_down", "scroll_up", "close"]) - .describe( - "The action to perform. The available actions are: * launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**. - Use with the `url` parameter to provide the URL. - Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.) * click: Click at a specific x,y coordinate. - Use with the `coordinate` parameter to specify the location. - Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot. * type: Type a string of text on the keyboard. You might use this after clicking on a text field to input text. - Use with the `text` parameter to provide the string to type. * scroll_down: Scroll down the page by one page height. * scroll_up: Scroll up the page by one page height. * close: Close the Puppeteer-controlled browser instance. This **must always be the final browser action**.", - ), - url: z.string().url().optional().describe("Use this for providing the URL for the `launch` action."), - coordinate: z - .string() - .regex(/^\d+,\d+$/) - .optional() - .describe( - "The X and Y coordinates for the `click` action. Coordinates should be within the **{{BROWSER_VIEWPORT_WIDTH}}x{{BROWSER_VIEWPORT_HEIGHT}}** resolution. * Example: 450,300", - ), - text: z.string().max(1000).optional().describe("Use this for providing the text for the `type` action."), -}) - export const browser_action_variants = [generic] diff --git a/src/core/prompts/system-prompt/tools/execute_command.ts b/src/core/prompts/system-prompt/tools/execute_command.ts index 105cd897..23f3325f 100644 --- a/src/core/prompts/system-prompt/tools/execute_command.ts +++ b/src/core/prompts/system-prompt/tools/execute_command.ts @@ -1,6 +1,7 @@ import { ModelFamily } from "@/shared/prompts" import { ClineDefaultTool } from "@/shared/tools" import type { ClineToolSpec } from "../spec" +import { TASK_PROGRESS_PARAMETER } from "../types" const generic: ClineToolSpec = { variant: ModelFamily.GENERIC, @@ -11,13 +12,14 @@ const generic: ClineToolSpec = { { name: "command", required: true, - instruction: "The CLI command to execute...", + instruction: `The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions.`, usage: "Your command here", }, { name: "requires_approval", required: true, - instruction: "A boolean indicating whether...", + instruction: + "A boolean indicating whether this command requires explicit user approval before execution in case the user has auto-approve mode enabled. Set to 'true' for potentially impactful operations like installing/uninstalling packages, deleting/overwriting files, system configuration changes, network operations, or any commands that could have unintended side effects. Set to 'false' for safe operations like reading files/directories, running development servers, building projects, and other non-destructive operations.", usage: "true or false", }, ], @@ -41,6 +43,7 @@ const gpt = { required: false, instruction: "Whether the command is dangerous. If true, user will be asked to confirm.", }, + TASK_PROGRESS_PARAMETER, ], } diff --git a/src/core/prompts/system-prompt/tools/list_code_definition_names.ts b/src/core/prompts/system-prompt/tools/list_code_definition_names.ts index 83e4fe6d..baa74505 100644 --- a/src/core/prompts/system-prompt/tools/list_code_definition_names.ts +++ b/src/core/prompts/system-prompt/tools/list_code_definition_names.ts @@ -1,6 +1,7 @@ import { ModelFamily } from "@/shared/prompts" import { ClineDefaultTool } from "@/shared/tools" import type { ClineToolSpec } from "../spec" +import { TASK_PROGRESS_PARAMETER } from "../types" const id = ClineDefaultTool.LIST_CODE_DEF @@ -17,6 +18,7 @@ const generic: ClineToolSpec = { instruction: `The path of the directory (relative to the current working directory {{CWD}}) to list top level source code definitions for.`, usage: "Directory path here", }, + TASK_PROGRESS_PARAMETER, ], } diff --git a/src/core/prompts/system-prompt/tools/list_files.ts b/src/core/prompts/system-prompt/tools/list_files.ts index 62b583e3..b1a7a5be 100644 --- a/src/core/prompts/system-prompt/tools/list_files.ts +++ b/src/core/prompts/system-prompt/tools/list_files.ts @@ -1,6 +1,7 @@ import { ModelFamily } from "@/shared/prompts" import { ClineDefaultTool } from "@/shared/tools" import type { ClineToolSpec } from "../spec" +import { TASK_PROGRESS_PARAMETER } from "../types" const id = ClineDefaultTool.LIST_FILES @@ -23,6 +24,7 @@ const generic: ClineToolSpec = { instruction: "Whether to list files recursively. Use true for recursive listing, false or omit for top-level only.", usage: "true or false (optional)", }, + TASK_PROGRESS_PARAMETER, ], } diff --git a/src/core/prompts/system-prompt/tools/load_mcp_documentation.ts b/src/core/prompts/system-prompt/tools/load_mcp_documentation.ts index a97e4fb8..2cc62929 100644 --- a/src/core/prompts/system-prompt/tools/load_mcp_documentation.ts +++ b/src/core/prompts/system-prompt/tools/load_mcp_documentation.ts @@ -17,7 +17,11 @@ const generic: ClineToolSpec = { id, variant: ModelFamily.GENERIC, name: "load_mcp_documentation", - description: `Load documentation about creating MCP servers. This tool should be used when the user requests to create or install an MCP server (the user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. You have the ability to create an MCP server and add it to a configuration file that will then expose the tools and resources for you to use with \`use_mcp_tool\` and \`access_mcp_resource\`). The documentation provides detailed information about the MCP server creation process, including setup instructions, best practices, and examples.`, + description: `Load documentation about creating MCP servers. This tool should be used when the user requests to create or install an MCP server (the user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. You have the ability to create an MCP server and add it to a configuration file that will then expose the tools and resources for you to use with \`use_mcp_tool\` and \`access_mcp_resource\`). The documentation provides detailed information about the MCP server creation process, including setup instructions, best practices, and examples. +Parameters: None +Usage: + +`, contextRequirements: (context) => context.mcpHub !== undefined && context.mcpHub !== null, } diff --git a/src/core/prompts/system-prompt/tools/new_task.ts b/src/core/prompts/system-prompt/tools/new_task.ts index 8ae0fef4..5b0804b5 100644 --- a/src/core/prompts/system-prompt/tools/new_task.ts +++ b/src/core/prompts/system-prompt/tools/new_task.ts @@ -25,7 +25,7 @@ const generic: ClineToolSpec = { variant: ModelFamily.GENERIC, id, name: "new_task", - description: ` Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. + description: `Request to create a new task with preloaded context covering the conversation with the user up to this point and key information for continuing with the new task. With this tool, you will create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions, with a focus on the most relevant information required for the new task. Among other important areas of focus, this summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing with the new task. The user will be presented with a preview of your generated context and can choose to create a new task or keep chatting in the current conversation. The user may choose to start a new task at any point.`, parameters: [ { diff --git a/src/core/prompts/system-prompt/tools/plan_mode_respond.ts b/src/core/prompts/system-prompt/tools/plan_mode_respond.ts index 2db8607e..a8e2521f 100644 --- a/src/core/prompts/system-prompt/tools/plan_mode_respond.ts +++ b/src/core/prompts/system-prompt/tools/plan_mode_respond.ts @@ -42,12 +42,13 @@ However, if while writing your response you realize you actually need to do more "Set to true if while formulating your response that you found you need to do more exploration with tools, for example reading files. (Remember, you can explore the project with tools like read_file in PLAN MODE without the user having to toggle to ACT MODE.) Defaults to false if not specified.", usage: "true or false (optional, but you MUST set to true if in you need to read files or use other exploration tools)", }, + // Different than the vanilla TASK_PROGRESS_PARAMETER { name: "task_progress", required: false, instruction: " A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details)", - usage: "Checklist here (optional)", + usage: "Checklist here (If you have presented the user with concrete steps or requirements, you can optionally include a todo list outlining these steps.)", dependencies: [ClineDefaultTool.TODO], }, ], diff --git a/src/core/prompts/system-prompt/tools/read_file.ts b/src/core/prompts/system-prompt/tools/read_file.ts index 62787c66..930a71f9 100644 --- a/src/core/prompts/system-prompt/tools/read_file.ts +++ b/src/core/prompts/system-prompt/tools/read_file.ts @@ -1,6 +1,7 @@ import { ModelFamily } from "@/shared/prompts" import { ClineDefaultTool } from "@/shared/tools" import type { ClineToolSpec } from "../spec" +import { TASK_PROGRESS_PARAMETER } from "../types" const id = ClineDefaultTool.FILE_READ @@ -17,13 +18,7 @@ const generic: ClineToolSpec = { instruction: `The path of the file to read (relative to the current working directory {{CWD}})`, usage: "File path here", }, - { - name: "task_progress", - required: false, - instruction: `A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details)`, - usage: "Checklist here (optional)", - dependencies: [ClineDefaultTool.TODO], - }, + TASK_PROGRESS_PARAMETER, ], } diff --git a/src/core/prompts/system-prompt/tools/replace_in_file.ts b/src/core/prompts/system-prompt/tools/replace_in_file.ts index b7f53a45..396ad349 100644 --- a/src/core/prompts/system-prompt/tools/replace_in_file.ts +++ b/src/core/prompts/system-prompt/tools/replace_in_file.ts @@ -1,6 +1,7 @@ import { ModelFamily } from "@/shared/prompts" import { ClineDefaultTool } from "@/shared/tools" import type { ClineToolSpec } from "../spec" +import { TASK_PROGRESS_PARAMETER } from "../types" const id = ClineDefaultTool.FILE_EDIT @@ -46,13 +47,7 @@ const generic: ClineToolSpec = { * To delete code: Use empty REPLACE section`, usage: "Search and replace blocks here", }, - { - name: "task_progress", - required: false, - instruction: `A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details)`, - usage: "Checklist here (optional)", - dependencies: [ClineDefaultTool.TODO], - }, + TASK_PROGRESS_PARAMETER, ], } diff --git a/src/core/prompts/system-prompt/tools/search_files.ts b/src/core/prompts/system-prompt/tools/search_files.ts index 655378af..dfbec5cd 100644 --- a/src/core/prompts/system-prompt/tools/search_files.ts +++ b/src/core/prompts/system-prompt/tools/search_files.ts @@ -1,6 +1,7 @@ import { ModelFamily } from "@/shared/prompts" import { ClineDefaultTool } from "@/shared/tools" import type { ClineToolSpec } from "../spec" +import { TASK_PROGRESS_PARAMETER } from "../types" /** * ## search_files @@ -45,6 +46,7 @@ const generic: ClineToolSpec = { "Glob pattern to filter files (e.g., '*.ts' for TypeScript files). If not provided, it will search all files (*).", usage: "file pattern here (optional)", }, + TASK_PROGRESS_PARAMETER, ], } diff --git a/src/core/prompts/system-prompt/tools/use_mcp_tool.ts b/src/core/prompts/system-prompt/tools/use_mcp_tool.ts index 21e95b34..b37e65c3 100644 --- a/src/core/prompts/system-prompt/tools/use_mcp_tool.ts +++ b/src/core/prompts/system-prompt/tools/use_mcp_tool.ts @@ -1,6 +1,7 @@ import { ModelFamily } from "@/shared/prompts" import { ClineDefaultTool } from "@/shared/tools" import type { ClineToolSpec } from "../spec" +import { TASK_PROGRESS_PARAMETER } from "../types" /** ## use_mcp_tool @@ -54,20 +55,14 @@ const generic: ClineToolSpec = { name: "arguments", required: true, instruction: "A JSON object containing the tool's input parameters, following the tool's input schema", - usage: `{ + usage: ` +{ "param1": "value1", "param2": "value2" -}`, - dependencies: [ClineDefaultTool.MCP_USE], - }, - { - name: "task_progress", - required: false, - instruction: - " A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details)", - usage: "Checklist here (optional)", - dependencies: [ClineDefaultTool.TODO], +} +`, }, + TASK_PROGRESS_PARAMETER, ], } diff --git a/src/core/prompts/system-prompt/tools/web_fetch.ts b/src/core/prompts/system-prompt/tools/web_fetch.ts index 70d54d20..8a0de774 100644 --- a/src/core/prompts/system-prompt/tools/web_fetch.ts +++ b/src/core/prompts/system-prompt/tools/web_fetch.ts @@ -1,6 +1,7 @@ import { ModelFamily } from "@/shared/prompts" import { ClineDefaultTool } from "@/shared/tools" import type { ClineToolSpec } from "../spec" +import { TASK_PROGRESS_PARAMETER } from "../types" const nextGen: ClineToolSpec = { variant: ModelFamily.NEXT_GEN, @@ -21,6 +22,7 @@ const nextGen: ClineToolSpec = { instruction: "The URL to fetch content from", usage: "https://example.com/docs", }, + TASK_PROGRESS_PARAMETER, ], } diff --git a/src/core/prompts/system-prompt/tools/write_to_file.ts b/src/core/prompts/system-prompt/tools/write_to_file.ts index 7e3efe86..8ab81ab1 100644 --- a/src/core/prompts/system-prompt/tools/write_to_file.ts +++ b/src/core/prompts/system-prompt/tools/write_to_file.ts @@ -1,6 +1,7 @@ import { ModelFamily } from "@/shared/prompts" import { ClineDefaultTool } from "@/shared/tools" import type { ClineToolSpec } from "../spec" +import { TASK_PROGRESS_PARAMETER } from "../types" /** * ## write_to_file @@ -43,14 +44,7 @@ const generic: ClineToolSpec = { "The content to write to the file. ALWAYS provide the COMPLETE intended content of the file, without any truncation or omissions. You MUST include ALL parts of the file, even if they haven't been modified.", usage: "Your file content here", }, - { - name: "task_progress", - required: false, - instruction: - "A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details)", - usage: "Checklist here (optional)", - dependencies: [ClineDefaultTool.TODO], - }, + TASK_PROGRESS_PARAMETER, ], } diff --git a/src/core/prompts/system-prompt/types.ts b/src/core/prompts/system-prompt/types.ts index 4657d159..9c3218e0 100644 --- a/src/core/prompts/system-prompt/types.ts +++ b/src/core/prompts/system-prompt/types.ts @@ -239,3 +239,14 @@ export interface VariantSchema { readonly optional: readonly string[] readonly validation: Record boolean> } + +/** + * Common parameter shared between tools for tracking task progress + */ +export const TASK_PROGRESS_PARAMETER = { + name: "task_progress", + required: false, + instruction: `A checklist showing task progress after this tool use is completed. (See 'Updating Task Progress' section for more details)`, + usage: "Checklist here (optional)", + dependencies: [ClineDefaultTool.TODO], +}